diff options
author | paperchalice <liujunchang97@outlook.com> | 2024-03-30 09:54:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-30 09:54:58 +0800 |
commit | 5538853f9abb559ff4bb7ff598535041d91d97d7 (patch) | |
tree | c2cb1f7871b1d090fee7f8f47aebb804af8cbb65 /llvm/lib/Passes/PassBuilder.cpp | |
parent | a8b0ecd2605ff23f495a8af64e06c35f86834e54 (diff) | |
download | llvm-5538853f9abb559ff4bb7ff598535041d91d97d7.zip llvm-5538853f9abb559ff4bb7ff598535041d91d97d7.tar.gz llvm-5538853f9abb559ff4bb7ff598535041d91d97d7.tar.bz2 |
[PassManager] Support MachineFunctionProperties (#83668)
This pull request adds `MachineFunctionProperties` support. If a pass
wants to modify machine function properties, it must derive from
`MachinePassInfoMixin` and define some static methods like in legacy
pass manager. A test pass `RequireAllMachineFunctionPropertiesPass` is
also added here, which could be a example.
Diffstat (limited to 'llvm/lib/Passes/PassBuilder.cpp')
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index f60f4eb..57975e3 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -365,6 +365,33 @@ public: static StringRef name() { return "TriggerVerifierErrorPass"; } }; +// A pass requires all MachineFunctionProperties. +// DO NOT USE THIS EXCEPT FOR TESTING! +class RequireAllMachineFunctionPropertiesPass + : public MachinePassInfoMixin<RequireAllMachineFunctionPropertiesPass> { +public: + PreservedAnalyses run(MachineFunction &, MachineFunctionAnalysisManager &) { + return PreservedAnalyses::none(); + } + + static MachineFunctionProperties getRequiredProperties() { + MachineFunctionProperties MFProps; + MFProps.set(MachineFunctionProperties::Property::FailedISel); + MFProps.set(MachineFunctionProperties::Property::FailsVerification); + MFProps.set(MachineFunctionProperties::Property::IsSSA); + MFProps.set(MachineFunctionProperties::Property::Legalized); + MFProps.set(MachineFunctionProperties::Property::NoPHIs); + MFProps.set(MachineFunctionProperties::Property::NoVRegs); + MFProps.set(MachineFunctionProperties::Property::RegBankSelected); + MFProps.set(MachineFunctionProperties::Property::Selected); + MFProps.set(MachineFunctionProperties::Property::TiedOpsRewritten); + MFProps.set(MachineFunctionProperties::Property::TracksDebugUserValues); + MFProps.set(MachineFunctionProperties::Property::TracksLiveness); + return MFProps; + } + static StringRef name() { return "RequireAllMachineFunctionPropertiesPass"; } +}; + } // namespace PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO, |