[llvm] [CodeGen][NewPM] Handle `--regalloc-npm` option (PR #94748)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 11 06:19:21 PDT 2024
================
@@ -582,12 +583,28 @@ class PassBuilder {
/// Register callbacks to parse target specific filter field if regalloc pass
/// needs it. E.g. AMDGPU requires regalloc passes can handle sgpr and vgpr
- /// separately.
+ /// separately. Currently "all" and "none" are preserved filter name.
void registerRegClassFilterParsingCallback(
const std::function<RegClassFilterFunc(StringRef)> &C) {
RegClassFilterParsingCallbacks.push_back(C);
}
+ /// Parse command line option `--regalloc-npm`
+ /// Should only be called by CodeGenPassBuilder.
+ Error parseRegAllocOpt(StringRef Text);
+
+ /// Target hook to set default regalloc.
+ void setDefaultRegAllocBuilder(
+ const std::function<void(StringMap<MachineFunctionPassManager> &)> &C) {
+ DefaultRegAllocBuilder = C;
+ }
+
+ /// Used by CodeGenPassBuilder to add correct regalloc pass.
+ /// Should only be called by CodeGenPassBuilder.
+ StringMap<MachineFunctionPassManager> &getRegAllocMap() {
----------------
paperchalice wrote:
The requirements for register allocation passes from backends are somewhat complex. Some targets (DirectX, NVPTX etc) shall not contain them. AMDGPU needs register allocators with correct parameters if pass supports it, here is the register filter. Callbacks may not suitable for this situation, callbacks may add some unexpected passes. WDYT?
https://github.com/llvm/llvm-project/pull/94748
More information about the llvm-commits
mailing list