|
|
|||
File indexing completed on 2026-05-10 08:43:33
0001 //===- llvm/CodeGen/PBQPRAConstraint.h --------------------------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This file defines the PBQPBuilder interface, for classes which build PBQP 0010 // instances to represent register allocation problems, and the RegAllocPBQP 0011 // interface. 0012 // 0013 //===----------------------------------------------------------------------===// 0014 0015 #ifndef LLVM_CODEGEN_PBQPRACONSTRAINT_H 0016 #define LLVM_CODEGEN_PBQPRACONSTRAINT_H 0017 0018 #include <algorithm> 0019 #include <memory> 0020 #include <vector> 0021 0022 namespace llvm { 0023 0024 namespace PBQP { 0025 namespace RegAlloc { 0026 0027 // Forward declare PBQP graph class. 0028 class PBQPRAGraph; 0029 0030 } // end namespace RegAlloc 0031 } // end namespace PBQP 0032 0033 using PBQPRAGraph = PBQP::RegAlloc::PBQPRAGraph; 0034 0035 /// Abstract base for classes implementing PBQP register allocation 0036 /// constraints (e.g. Spill-costs, interference, coalescing). 0037 class PBQPRAConstraint { 0038 public: 0039 virtual ~PBQPRAConstraint() = 0; 0040 virtual void apply(PBQPRAGraph &G) = 0; 0041 0042 private: 0043 virtual void anchor(); 0044 }; 0045 0046 /// PBQP register allocation constraint composer. 0047 /// 0048 /// Constraints added to this list will be applied, in the order that they are 0049 /// added, to the PBQP graph. 0050 class PBQPRAConstraintList : public PBQPRAConstraint { 0051 public: 0052 void apply(PBQPRAGraph &G) override { 0053 for (auto &C : Constraints) 0054 C->apply(G); 0055 } 0056 0057 void addConstraint(std::unique_ptr<PBQPRAConstraint> C) { 0058 if (C) 0059 Constraints.push_back(std::move(C)); 0060 } 0061 0062 private: 0063 std::vector<std::unique_ptr<PBQPRAConstraint>> Constraints; 0064 0065 void anchor() override; 0066 }; 0067 0068 } // end namespace llvm 0069 0070 #endif // LLVM_CODEGEN_PBQPRACONSTRAINT_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|