@@ -2168,7 +2168,8 @@ Error AMDGPUCodeGenPassBuilder::addRegAssignmentOptimized(
2168
2168
2169
2169
addPass (GCNPreRALongBranchRegPass ());
2170
2170
2171
- addPass (RAGreedyPass ({onlyAllocateSGPRs, " sgpr" }));
2171
+ addRegAllocPassOrOpt (
2172
+ addPass, []() { return RAGreedyPass ({onlyAllocateSGPRs, " sgpr" }); });
2172
2173
2173
2174
// Commit allocated register changes. This is mostly necessary because too
2174
2175
// many things rely on the use lists of the physical registers, such as the
@@ -2188,21 +2189,20 @@ Error AMDGPUCodeGenPassBuilder::addRegAssignmentOptimized(
2188
2189
addPass (SIPreAllocateWWMRegsPass ());
2189
2190
2190
2191
// For allocating other wwm register operands.
2191
- // addRegAlloc<RAGreedyPass>(addPass, RegAllocPhase::WWM);
2192
- addPass ( RAGreedyPass ({onlyAllocateWWMRegs, " wwm" }));
2192
+ addRegAllocPassOrOpt (
2193
+ addPass, []() { return RAGreedyPass ({onlyAllocateWWMRegs, " wwm" }); } );
2193
2194
addPass (SILowerWWMCopiesPass ());
2194
2195
addPass (VirtRegRewriterPass (false ));
2195
2196
addPass (AMDGPUReserveWWMRegsPass ());
2196
2197
2197
2198
// For allocating per-thread VGPRs.
2198
- // addRegAlloc<RAGreedyPass>(addPass, RegAllocPhase::VGPR);
2199
- addPass (RAGreedyPass ({onlyAllocateVGPRs, " vgpr" }));
2200
-
2199
+ addRegAllocPassOrOpt (
2200
+ addPass, []() { return RAGreedyPass ({onlyAllocateVGPRs, " vgpr" }); });
2201
2201
2202
2202
addPreRewrite (addPass);
2203
2203
addPass (VirtRegRewriterPass (true ));
2204
2204
2205
- // TODO: addPass(AMDGPUMarkLastScratchLoadPass());
2205
+ addPass (AMDGPUMarkLastScratchLoadPass ());
2206
2206
return Error::success ();
2207
2207
}
2208
2208
@@ -2252,47 +2252,6 @@ void AMDGPUCodeGenPassBuilder::addPreEmitPass(AddMachinePass &addPass) const {
2252
2252
2253
2253
addPass (BranchRelaxationPass ());
2254
2254
}
2255
- Error AMDGPUCodeGenPassBuilder::addRegAssignmentOptimized (
2256
- AddMachinePass &addPass) const {
2257
- addPass (GCNPreRALongBranchRegPass ());
2258
-
2259
- addRegAllocPassOrOpt (
2260
- addPass, []() { return RAGreedyPass ({onlyAllocateSGPRs, " sgpr" }); });
2261
-
2262
- // Commit allocated register changes. This is mostly necessary because too
2263
- // many things rely on the use lists of the physical registers, such as the
2264
- // verifier. This is only necessary with allocators which use LiveIntervals,
2265
- // since FastRegAlloc does the replacements itself.
2266
- // TODO: addPass(VirtRegRewriterPass(false));
2267
-
2268
- // At this point, the sgpr-regalloc has been done and it is good to have the
2269
- // stack slot coloring to try to optimize the SGPR spill stack indices before
2270
- // attempting the custom SGPR spill lowering.
2271
- addPass (StackSlotColoringPass ());
2272
-
2273
- // Equivalent of PEI for SGPRs.
2274
- addPass (SILowerSGPRSpillsPass ());
2275
-
2276
- // To Allocate wwm registers used in whole quad mode operations (for shaders).
2277
- addPass (SIPreAllocateWWMRegsPass ());
2278
-
2279
- // For allocating other wwm register operands.
2280
- addRegAllocPassOrOpt (
2281
- addPass, []() { return RAGreedyPass ({onlyAllocateWWMRegs, " wwm" }); });
2282
- addPass (SILowerWWMCopiesPass ());
2283
- addPass (VirtRegRewriterPass (false ));
2284
- addPass (AMDGPUReserveWWMRegsPass ());
2285
-
2286
- // For allocating per-thread VGPRs.
2287
- addRegAllocPassOrOpt (
2288
- addPass, []() { return RAGreedyPass ({onlyAllocateVGPRs, " vgpr" }); });
2289
-
2290
- // TODO: addPreRewrite();
2291
- addPass (VirtRegRewriterPass (false ));
2292
-
2293
- // TODO: addPass(AMDGPUMarkLastScratchLoadPass());
2294
- return Error::success ();
2295
- }
2296
2255
2297
2256
bool AMDGPUCodeGenPassBuilder::isPassEnabled (const cl::opt<bool > &Opt,
2298
2257
CodeGenOptLevel Level) const {
0 commit comments