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