@@ -2164,97 +2164,6 @@ static const char NPMRegAllocOptNotSupportedMessage[] =
2164
2164
" -wwm-regalloc-npm, "
2165
2165
" and -vgpr-regalloc-npm" ;
2166
2166
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
-
2258
2167
template <typename RegAllocPassT>
2259
2168
typename RegAllocPassT::Options
2260
2169
AMDGPUCodeGenPassBuilder::getRAOptionsForPhase (RegAllocPhase Phase) const {
@@ -2275,18 +2184,6 @@ AMDGPUCodeGenPassBuilder::getRAOptionsForPhase(RegAllocPhase Phase) const {
2275
2184
case RegAllocPhase::VGPR:
2276
2185
return RA_OPTIONS (onlyAllocateVGPRs, " vgpr" , true );
2277
2186
}
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
- // }
2290
2187
2291
2188
#undef RA_OPTIONS
2292
2189
}
@@ -2317,10 +2214,11 @@ void AMDGPUCodeGenPassBuilder::addRegAlloc(AddMachinePass &addPass,
2317
2214
addPass (RegAllocFastPass (getRAOptionsForPhase<RegAllocFastPass>(Phase)));
2318
2215
return ;
2319
2216
case RegAllocType::Unset:
2217
+ case RegAllocType::Default:
2320
2218
addPass (RegAllocPassT (getRAOptionsForPhase<RegAllocPassT>(Phase)));
2321
2219
return ;
2322
2220
default :
2323
- report_fatal_error (" Unsupported regalloc type" , false );
2221
+ report_fatal_error (" Unsupported regalloc type for AMDGPU " , false );
2324
2222
}
2325
2223
}
2326
2224
0 commit comments