Index: src/IceTargetLoweringX8632.cpp |
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp |
index 35792aaac0aebc38cafca62a0744a7e8c9fe4572..d36ad1695191b49e77d7ad516c33d80eacfbf890 100644 |
--- a/src/IceTargetLoweringX8632.cpp |
+++ b/src/IceTargetLoweringX8632.cpp |
@@ -134,6 +134,8 @@ const uint32_t X86_RET_IP_SIZE_BYTES = 4; |
const uint32_t X86_LOG2_OF_MIN_STACK_SLOT_SIZE = 2; |
// The base 2 logarithm of the width in bytes of the largest stack slot |
const uint32_t X86_LOG2_OF_MAX_STACK_SLOT_SIZE = 4; |
+// The number of different NOP instructions |
+const uint32_t X86_NUM_NOP_VARIANTS = 5; |
// Value and Alignment are in bytes. Return Value adjusted to the next |
// highest multiple of Alignment. |
@@ -391,6 +393,11 @@ void TargetX8632::translateO2() { |
return; |
T_genFrame.printElapsedUs(Context, "genFrame()"); |
Func->dump("After stack frame mapping"); |
+ |
+ // Nop insertion |
+ if (shouldDoNopInsertion()) { |
+ Func->doNopInsertion(); |
+ } |
} |
void TargetX8632::translateOm1() { |
@@ -429,6 +436,11 @@ void TargetX8632::translateOm1() { |
return; |
T_genFrame.printElapsedUs(Context, "genFrame()"); |
Func->dump("After stack frame mapping"); |
+ |
+ // Nop insertion |
+ if (shouldDoNopInsertion()) { |
+ Func->doNopInsertion(); |
+ } |
} |
IceString TargetX8632::RegNames[] = { |
@@ -3670,6 +3682,13 @@ void TargetX8632::doAddressOptLoad() { |
} |
} |
+void TargetX8632::randomlyInsertNop(float Probability) { |
+ RandomNumberGeneratorWrapper RNG(Ctx->getRNG()); |
+ if (RNG.getTrueWithProbability(Probability)) { |
+ _nop(RNG.next(X86_NUM_NOP_VARIANTS)); |
+ } |
+} |
+ |
void TargetX8632::lowerPhi(const InstPhi * /*Inst*/) { |
Func->setError("Phi found in regular instruction list"); |
} |