Subzero: Randomly insert nops.
Adds command line options -nop-insertion, -nop-insertion-probability=X, and -max-nops-per-instruction=X.
BUG=none
R=jvoung@chromium.org, stichnot@chromium.org
Review URL: https://codereview.chromium.org/463563006
diff --git a/src/IceTargetLowering.h b/src/IceTargetLowering.h
index 39e08de..6bf1424 100644
--- a/src/IceTargetLowering.h
+++ b/src/IceTargetLowering.h
@@ -121,6 +121,8 @@
// Tries to do address mode optimization on a single instruction.
void doAddressOpt();
+ // Randomly insert NOPs.
+ void doNopInsertion();
// Lowers a single instruction.
void lower();
@@ -136,6 +138,7 @@
virtual SizeT getFrameOrStackReg() const = 0;
virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0;
bool hasComputedFrame() const { return HasComputedFrame; }
+ bool shouldDoNopInsertion() const;
int32_t getStackAdjustment() const { return StackAdjustment; }
void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; }
void resetStackAdjustment() { StackAdjustment = 0; }
@@ -193,6 +196,7 @@
virtual void doAddressOptLoad() {}
virtual void doAddressOptStore() {}
+ virtual void randomlyInsertNop(float Probability) = 0;
// This gives the target an opportunity to post-process the lowered
// expansion before returning. The primary intention is to do some
// Register Manager activity as necessary, specifically to eagerly