Index: src/IceTargetLowering.cpp |
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp |
index bab46f657f07e825b7aa7024d77a4c9248ce2fc0..9a4cf928c15cd6889f99ec572fd8a2615a87ea4f 100644 |
--- a/src/IceTargetLowering.cpp |
+++ b/src/IceTargetLowering.cpp |
@@ -29,6 +29,7 @@ namespace Ice { |
namespace { |
+// TODO(stichnot): Move this machinery into llvm2ice.cpp. |
namespace cl = llvm::cl; |
cl::opt<bool> DoNopInsertion("nop-insertion", cl::desc("Randomly insert NOPs"), |
cl::init(false)); |
@@ -40,6 +41,11 @@ cl::opt<int> MaxNopsPerInstruction( |
cl::opt<int> NopProbabilityAsPercentage( |
"nop-insertion-percentage", |
cl::desc("Nop insertion probability as percentage"), cl::init(10)); |
+ |
+cl::opt<bool> |
+CLRandomizeRegisterAllocation("randomize-regalloc", |
+ cl::desc("Randomize register allocation"), |
+ cl::init(false)); |
} // end of anonymous namespace |
void LoweringContext::init(CfgNode *N) { |
@@ -95,6 +101,11 @@ TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) { |
return NULL; |
} |
+TargetLowering::TargetLowering(Cfg *Func) |
+ : Func(Func), Ctx(Func->getContext()), HasComputedFrame(false), |
+ StackAdjustment(0), |
+ RandomizeRegisterAllocation(CLRandomizeRegisterAllocation) {} |
JF
2014/12/17 18:56:18
Missing CallsReturnsTwice and Context.
Jim Stichnoth
2014/12/18 18:52:03
Done for CallsReturnsTwice. For Context, its ctor
Jim Stichnoth
2014/12/18 18:59:34
I don't know what happened before, but it's done n
|
+ |
Assembler *TargetLowering::createAssembler(TargetArch Target, Cfg *Func) { |
// These statements can be #ifdef'd to specialize the assembler |
// to a subset of the available targets. TODO: use CRTP. |
@@ -236,7 +247,7 @@ void TargetLowering::regAlloc(RegAllocKind Kind) { |
RegExclude |= RegSet_FramePointer; |
LinearScan.init(Kind); |
llvm::SmallBitVector RegMask = getRegisterSet(RegInclude, RegExclude); |
- LinearScan.scan(RegMask); |
+ LinearScan.scan(RegMask, RandomizeRegisterAllocation); |
} |
TargetGlobalInitLowering * |