Skip to content

Commit b27949b

Browse files
committed
[NewPM][CodeGen] add TargetPassConfig like API
1 parent 33d804c commit b27949b

File tree

14 files changed

+339
-283
lines changed

14 files changed

+339
-283
lines changed

llvm/include/llvm/CodeGen/MachinePassManager.h

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "llvm/ADT/SmallVector.h"
2828
#include "llvm/IR/PassManager.h"
2929
#include "llvm/Support/Error.h"
30+
#include "llvm/Target/CGPassBuilderOption.h"
3031

3132
#include <map>
3233

@@ -37,20 +38,13 @@ class MachineFunction;
3738

3839
extern template class AnalysisManager<MachineFunction>;
3940

40-
/// Like \c AnalysisKey, but only for machine passes.
41-
struct alignas(8) MachinePassKey {};
42-
4341
/// A CRTP mix-in that provides informational APIs needed for machine passes.
4442
///
4543
/// This provides some boilerplate for types that are machine passes. It
4644
/// automatically mixes in \c PassInfoMixin.
4745
template <typename DerivedT>
4846
struct MachinePassInfoMixin : public PassInfoMixin<DerivedT> {
49-
static MachinePassKey *ID() {
50-
static_assert(std::is_base_of<MachinePassInfoMixin, DerivedT>::value,
51-
"Must pass the derived type as the template argument!");
52-
return &DerivedT::Key;
53-
}
47+
// TODO: Add MachineFunctionProperties support.
5448
};
5549

5650
/// An AnalysisManager<MachineFunction> that also exposes IR analysis results.
@@ -150,10 +144,7 @@ class MachineFunctionPassManager
150144
using Base = PassManager<MachineFunction, MachineFunctionAnalysisManager>;
151145

152146
public:
153-
MachineFunctionPassManager(bool RequireCodeGenSCCOrder = false,
154-
bool VerifyMachineFunction = false)
155-
: RequireCodeGenSCCOrder(RequireCodeGenSCCOrder),
156-
VerifyMachineFunction(VerifyMachineFunction) {}
147+
MachineFunctionPassManager() : Opt(getCGPassBuilderOption()) {}
157148
MachineFunctionPassManager(MachineFunctionPassManager &&) = default;
158149
MachineFunctionPassManager &
159150
operator=(MachineFunctionPassManager &&) = default;
@@ -261,10 +252,7 @@ class MachineFunctionPassManager
261252
using PassIndex = decltype(Passes)::size_type;
262253
std::map<PassIndex, llvm::unique_function<FuncTy>> MachineModulePasses;
263254

264-
// Run codegen in the SCC order.
265-
bool RequireCodeGenSCCOrder;
266-
267-
bool VerifyMachineFunction;
255+
CGPassBuilderOption Opt;
268256
};
269257

270258
} // end namespace llvm

0 commit comments

Comments
 (0)