| 1 | //==- RegAllocGreedyPass.h --- greedy register allocator pass ------*-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 | #ifndef LLVM_CODEGEN_REGALLOC_GREEDY_PASS_H |
| 9 | #define LLVM_CODEGEN_REGALLOC_GREEDY_PASS_H |
| 10 | |
| 11 | #include "llvm/CodeGen/MachineFunctionPass.h" |
| 12 | #include "llvm/CodeGen/RegAllocCommon.h" |
| 13 | #include "llvm/CodeGen/RegAllocFast.h" |
| 14 | #include "llvm/IR/PassManager.h" |
| 15 | |
| 16 | using namespace llvm; |
| 17 | |
| 18 | class RAGreedyPass : public PassInfoMixin<RAGreedyPass> { |
| 19 | public: |
| 20 | struct Options { |
| 21 | RegAllocFilterFunc Filter; |
| 22 | StringRef FilterName; |
| 23 | Options(RegAllocFilterFunc F = nullptr, StringRef FN = "all") |
| 24 | : Filter(std::move(F)), FilterName(FN) {}; |
| 25 | }; |
| 26 | |
| 27 | RAGreedyPass(Options Opts = Options()) : Opts(std::move(Opts)) {} |
| 28 | PreservedAnalyses run(MachineFunction &F, MachineFunctionAnalysisManager &AM); |
| 29 | |
| 30 | MachineFunctionProperties getRequiredProperties() const { |
| 31 | return MachineFunctionProperties().setNoPHIs(); |
| 32 | } |
| 33 | |
| 34 | MachineFunctionProperties getClearedProperties() const { |
| 35 | return MachineFunctionProperties().setIsSSA(); |
| 36 | } |
| 37 | |
| 38 | void |
| 39 | printPipeline(raw_ostream &OS, |
| 40 | function_ref<StringRef(StringRef)> MapClassName2PassName) const; |
| 41 | static bool isRequired() { return true; } |
| 42 | |
| 43 | private: |
| 44 | Options Opts; |
| 45 | }; |
| 46 | |
| 47 | #endif // LLVM_CODEGEN_REGALLOC_GREEDY_PASS_H |
| 48 |