@@ -2165,97 +2165,6 @@ static const char NPMRegAllocOptNotSupportedMessage[] =
21652165 " -wwm-regalloc-npm, "
21662166 " and -vgpr-regalloc-npm" ;
21672167
2168- // void AMDGPUCodeGenPassBuilder::addSGPRRegAlloc(AddMachinePass &addPass,
2169- // RegAllocType RAType, RegAllocFilterFunc FilterFunc, bool Optimized) const {
2170- // RegAllocType RAType = RegAllocTypeNPM;
2171- // if (RAType == RegAllocType::Default) {
2172- // RAType = Optimized ? RegAllocType::Greedy : RegAllocType::Fast;
2173- // }
2174-
2175- // if (RAType == RegAllocType::Greedy) {
2176- // addPass(RAGreedyPass({onlyAllocateSGPRs, "sgpr"}));
2177- // return;
2178- // }
2179-
2180- // if (RAType == RegAllocType::Fast) {
2181- // addPass(RegAllocFastPass({onlyAllocateSGPRs, "sgpr", false}));
2182- // return;
2183- // }
2184- // report_fatal_error("Unsupported SGPR regalloc type", false);
2185- // }
2186-
2187- // template<typename RegAllocPass>
2188- // void AMDGPUCodeGenPassBuilder::addRegAllocOfType(AddMachinePass &addPass,
2189- // RegAllocPass::Options Options) {
2190- // addPass(RegAllocPass(Options));
2191- // }
2192-
2193- // this is the final method
2194- // template<typename RegAllocPass>
2195- // void AMDGPUCodeGenPassBuilder::addRegAllocOfType(AddMachinePass &addPass,
2196- // RegAllocPhase Phase) {
2197- // #define RA_OPTIONS(FilterFunc, Name, ClearVirtRegs) \
2198- // [&]() { \
2199- // if constexpr (std::is_same_v<RegAllocPass, RegAllocFastPass>) { \
2200- // return RegAllocFastPass::Options{FilterFunc, Name, ClearVirtRegs}; \
2201- // } else { \
2202- // return typename RegAllocPass::Options{FilterFunc, Name}; \
2203- // } \
2204- // }()
2205-
2206- // typename RegAllocPass::Options Options;
2207- // RegAllocType RAType;
2208-
2209- // switch (Phase) {
2210- // case RegAllocPhase::SGPR:
2211- // Options = RA_OPTIONS(onlyAllocateSGPRs, "sgpr", false);
2212- // RAType = SGPRRegAllocTypeNPM;
2213- // break;
2214- // case RegAllocPhase::WWM:
2215- // Options = RA_OPTIONS(onlyAllocateWWMRegs, "wwm", false);
2216- // RAType = WWMRegAllocTypeNPM;
2217- // break;
2218- // case RegAllocPhase::VGPR:
2219- // Options = RA_OPTIONS(onlyAllocateVGPRs, "vgpr", true);
2220- // RAType = VGPRRegAllocTypeNPM;
2221- // break;
2222- // };
2223-
2224- // switch(RAType) {
2225- // case RegAllocType::Greedy:
2226- // addPass(RAGreedyPass(Options));
2227- // return;
2228- // case RegAllocType::Fast:
2229- // addPass(RegAllocFastPass(Options));
2230- // return;
2231- // case RegAllocType::Unset:
2232- // addPass(RegAllocPass(Options));
2233- // }
2234- // #undef RA_OPTIONS
2235- // }
2236-
2237- // template<typename RegAllocPass>
2238- // void AMDGPUCodeGenPassBuilder::addRegAlloc(AddMachinePass &addPass,
2239- // RegAllocPhase Phase) {
2240- // RegAllocType RAType;
2241- // switch(Phase) {
2242- // case RegAllocPhase::SGPR:
2243- // RAType = SGPRRegAllocTypeNPM;
2244- // break;
2245- // case RegAllocPhase::WWM:
2246- // RAType = WWMRegAllocTypeNPM;
2247- // break;
2248- // case RegAllocPhase::VGPR:
2249- // RAType = VGPRRegAllocTypeNPM;
2250- // break;
2251- // }
2252- // switch (RAType) {
2253- // case RegAllocType::Greedy:
2254- // addRegAllocOfType(addPass, Phase);
2255- // }
2256- // addRegAllocOfType<RegAllocPass>(addPass, Phase);
2257- // }
2258-
22592168template <typename RegAllocPassT>
22602169typename RegAllocPassT::Options
22612170AMDGPUCodeGenPassBuilder::getRAOptionsForPhase (RegAllocPhase Phase) const {
@@ -2276,18 +2185,6 @@ AMDGPUCodeGenPassBuilder::getRAOptionsForPhase(RegAllocPhase Phase) const {
22762185 case RegAllocPhase::VGPR:
22772186 return RA_OPTIONS (onlyAllocateVGPRs, " vgpr" , true );
22782187 }
2279- // static_assert(std::is_same_v<PhaseT, SGPRPhase> ||
2280- // std::is_same_v<PhaseT, WWMPhase> ||
2281- // std::is_same_v<PhaseT, VGPRPhase>,
2282- // "Unsupported phase type");
2283-
2284- // if constexpr(std::is_same_v<PhaseT, SGPRPhase>) {
2285- // return RA_OPTIONS(onlyAllocateSGPRs, "sgpr", false);
2286- // } else if constexpr(std::is_same_v<PhaseT, WWMPhase>) {
2287- // return RA_OPTIONS(onlyAllocateWWMRegs, "wwm", false);
2288- // } else if constexpr(std::is_same_v<PhaseT, VGPRPhase>) {
2289- // return RA_OPTIONS(onlyAllocateVGPRs, "vgpr", true);
2290- // }
22912188
22922189#undef RA_OPTIONS
22932190}
@@ -2318,10 +2215,11 @@ void AMDGPUCodeGenPassBuilder::addRegAlloc(AddMachinePass &addPass,
23182215 addPass (RegAllocFastPass (getRAOptionsForPhase<RegAllocFastPass>(Phase)));
23192216 return ;
23202217 case RegAllocType::Unset:
2218+ case RegAllocType::Default:
23212219 addPass (RegAllocPassT (getRAOptionsForPhase<RegAllocPassT>(Phase)));
23222220 return ;
23232221 default :
2324- report_fatal_error (" Unsupported regalloc type" , false );
2222+ report_fatal_error (" Unsupported regalloc type for AMDGPU " , false );
23252223 }
23262224}
23272225
0 commit comments