[llvm] [PassManager] Support MachineFunctionProperties (PR #83668)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 29 03:52:31 PDT 2024
================
@@ -266,20 +228,39 @@ class ModuleToMachineFunctionPassAdaptor
static bool isRequired() { return true; }
private:
- std::unique_ptr<MachinePassConcept> Pass;
+ std::unique_ptr<PassConceptT> Pass;
};
template <typename MachineFunctionPassT>
ModuleToMachineFunctionPassAdaptor
createModuleToMachineFunctionPassAdaptor(MachineFunctionPassT &&Pass) {
- using PassModelT = detail::MachinePassModel<MachineFunctionPassT>;
+ using PassModelT = detail::PassModel<MachineFunction, MachineFunctionPassT,
+ MachineFunctionAnalysisManager>;
// Do not use make_unique, it causes too many template instantiations,
// causing terrible compile times.
return ModuleToMachineFunctionPassAdaptor(
- std::unique_ptr<detail::MachinePassConcept>(
+ std::unique_ptr<ModuleToMachineFunctionPassAdaptor::PassConceptT>(
new PassModelT(std::forward<MachineFunctionPassT>(Pass))));
}
+template <>
+template <typename PassT>
+std::enable_if_t<!std::is_same<PassT, PassManager<MachineFunction>>::value>
+PassManager<MachineFunction>::addPass(PassT &&Pass) {
+ using PassModelT =
+ detail::PassModel<MachineFunction, PassT, MachineFunctionAnalysisManager>;
+ using MachinePassModelT = detail::MachinePassModel<PassT>;
+ // Do not use make_unique or emplace_back, they cause too many template
+ // instantiations, causing terrible compile times.
+ if constexpr (std::is_base_of_v<MachinePassInfoMixin<PassT>, PassT>) {
----------------
paperchalice wrote:
> shouldn't this always be true?
Try to use `MachinePassModelT` only, but `InvalidateAnalysisPass<T>` no longer works.
https://github.com/llvm/llvm-project/pull/83668
More information about the llvm-commits
mailing list