Skip to content

Commit 82b8874

Browse files
committed
Change the type of RegAlloc to StringRef
1 parent e7b347f commit 82b8874

File tree

3 files changed

+7
-30
lines changed

3 files changed

+7
-30
lines changed

llvm/include/llvm/CodeGen/CodeGenPassBuilder.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,30 +1113,13 @@ void CodeGenPassBuilder<Derived>::addTargetRegisterAllocator(
11131113
template <typename Derived>
11141114
void CodeGenPassBuilder<Derived>::addRegAllocPass(AddMachinePass &addPass,
11151115
bool Optimized) const {
1116-
if (Opt.RegAlloc == RegAllocType::Default)
1117-
// With no -regalloc= override, ask the target for a regalloc pass.
1118-
derived().addTargetRegisterAllocator(addPass, Optimized);
1119-
else if (Opt.RegAlloc == RegAllocType::Basic)
1120-
addPass(RABasicPass());
1121-
else if (Opt.RegAlloc == RegAllocType::Fast)
1122-
addPass(RAFastPass());
1123-
else if (Opt.RegAlloc == RegAllocType::Greedy)
1124-
addPass(RAGreedyPass());
1125-
else if (Opt.RegAlloc == RegAllocType::PBQP)
1126-
addPass(RAPBQPPass());
1127-
else
1128-
llvm_unreachable("unknonwn register allocator type");
1116+
// TODO: Parse Opt.RegAlloc to add register allocator.
11291117
}
11301118

11311119
template <typename Derived>
11321120
Error CodeGenPassBuilder<Derived>::addRegAssignmentFast(
11331121
AddMachinePass &addPass) const {
1134-
if (Opt.RegAlloc != RegAllocType::Default &&
1135-
Opt.RegAlloc != RegAllocType::Fast)
1136-
return make_error<StringError>(
1137-
"Must use fast (default) register allocator for unoptimized regalloc.",
1138-
inconvertibleErrorCode());
1139-
1122+
// TODO: Ensure allocator is default or fast.
11401123
addRegAllocPass(addPass, false);
11411124
return Error::success();
11421125
}

llvm/include/llvm/Target/CGPassBuilderOption.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct CGPassBuilderOption {
5252
bool RequiresCodeGenSCCOrder = false;
5353

5454
RunOutliner EnableMachineOutliner = RunOutliner::TargetDefault;
55-
RegAllocType RegAlloc = RegAllocType::Default;
55+
StringRef RegAlloc = "default";
5656
std::optional<GlobalISelAbortMode> EnableGlobalISelAbort;
5757
std::string FSProfileFile;
5858
std::string FSRemappingFile;

llvm/tools/llc/NewPMDriver.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,10 @@ extern cl::opt<bool> PrintPipelinePasses;
5151

5252
using namespace llvm;
5353

54-
static cl::opt<RegAllocType> RegAlloc(
55-
"regalloc-npm", cl::desc("Register allocator to use for new pass manager"),
56-
cl::Hidden, cl::ValueOptional, cl::init(RegAllocType::Default),
57-
cl::values(
58-
clEnumValN(RegAllocType::Default, "default",
59-
"pick register allocator based on -O option"),
60-
clEnumValN(RegAllocType::Basic, "basic", "basic register allocator"),
61-
clEnumValN(RegAllocType::Fast, "fast", "fast register allocator"),
62-
clEnumValN(RegAllocType::Greedy, "greedy", "greedy register allocator"),
63-
clEnumValN(RegAllocType::PBQP, "pbqp", "PBQP register allocator")));
54+
static cl::opt<std::string>
55+
RegAlloc("regalloc-npm",
56+
cl::desc("Register allocator to use for new pass manager"),
57+
cl::Hidden, cl::init("default"));
6458

6559
static cl::opt<bool>
6660
DebugPM("debug-pass-manager", cl::Hidden,

0 commit comments

Comments
 (0)