[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment
[llvm-core.git] / include / llvm / CodeGen / PBQPRAConstraint.h
blob876ab97a669fd6e15a85559c08a570c7a2a1be1b
1 //===- llvm/CodeGen/PBQPRAConstraint.h --------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the PBQPBuilder interface, for classes which build PBQP
10 // instances to represent register allocation problems, and the RegAllocPBQP
11 // interface.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_PBQPRACONSTRAINT_H
16 #define LLVM_CODEGEN_PBQPRACONSTRAINT_H
18 #include <algorithm>
19 #include <memory>
20 #include <vector>
22 namespace llvm {
24 namespace PBQP {
25 namespace RegAlloc {
27 // Forward declare PBQP graph class.
28 class PBQPRAGraph;
30 } // end namespace RegAlloc
31 } // end namespace PBQP
33 using PBQPRAGraph = PBQP::RegAlloc::PBQPRAGraph;
35 /// Abstract base for classes implementing PBQP register allocation
36 /// constraints (e.g. Spill-costs, interference, coalescing).
37 class PBQPRAConstraint {
38 public:
39 virtual ~PBQPRAConstraint() = 0;
40 virtual void apply(PBQPRAGraph &G) = 0;
42 private:
43 virtual void anchor();
46 /// PBQP register allocation constraint composer.
47 ///
48 /// Constraints added to this list will be applied, in the order that they are
49 /// added, to the PBQP graph.
50 class PBQPRAConstraintList : public PBQPRAConstraint {
51 public:
52 void apply(PBQPRAGraph &G) override {
53 for (auto &C : Constraints)
54 C->apply(G);
57 void addConstraint(std::unique_ptr<PBQPRAConstraint> C) {
58 if (C)
59 Constraints.push_back(std::move(C));
62 private:
63 std::vector<std::unique_ptr<PBQPRAConstraint>> Constraints;
65 void anchor() override;
68 } // end namespace llvm
70 #endif // LLVM_CODEGEN_PBQPRACONSTRAINT_H