[llvm] [CodeGen][NewPM] Handle `--regalloc-npm` option (PR #94748)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 7 05:54:25 PDT 2024
================
@@ -749,6 +752,30 @@ void AMDGPUTargetMachine::registerPassBuilderCallbacks(
return onlyAllocateVGPRs;
return nullptr;
});
+
+ PB.setDefaultRegAllocBuilder(
+ [TM = this](StringMap<MachineFunctionPassManager> &RegAllocMap) {
+ auto Opts = getCGPassBuilderOption();
+ if (Opts.OptimizeRegAlloc.value_or(TM->getOptLevel() !=
+ CodeGenOptLevel::None)) {
+ // TODO: Add greedy register allocator.
+ } else {
+ RegAllocFastPassOptions Opts;
+ Opts.Filter = onlyAllocateSGPRs;
+ Opts.FilterName = "sgpr";
+ Opts.ClearVRegs = false;
----------------
arsenm wrote:
Use initializer list?
https://github.com/llvm/llvm-project/pull/94748
More information about the llvm-commits
mailing list