Chromium Code Reviews| Index: src/IceTargetLowering.cpp |
| diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp |
| index 0034de5f7ca3e2340eb15e52f23530dfafc8ca56..5874e79bceb7c4407c3eeff421c04de0ac5c0e6c 100644 |
| --- a/src/IceTargetLowering.cpp |
| +++ b/src/IceTargetLowering.cpp |
| @@ -22,8 +22,20 @@ |
| #include "IceTargetLowering.h" |
| #include "IceTargetLoweringX8632.h" |
| +#include "llvm/Support/CommandLine.h" |
| + |
| namespace Ice { |
| +namespace { |
| +namespace cl = llvm::cl; |
| +cl::opt<bool> DoNopInsertion("insert-nops", cl::desc("Randomly insert NOPs"), |
| + cl::init(false)); |
| +cl::opt<int> NopProbability("nop-probability", |
| + cl::desc("Nop insertion probability"), |
|
jvoung (off chromium)
2014/08/14 15:17:17
A default of "10" should be a strong hint at the u
wala
2014/08/14 23:29:50
Done.
|
| + cl::init(10)); |
| +} // end anonymous namespace |
|
Jim Stichnoth
2014/08/14 01:20:10
end of anonymous namespace
wala
2014/08/14 23:29:50
Done.
|
| + |
| + |
| void LoweringContext::init(CfgNode *N) { |
| Node = N; |
| Begin = getNode()->getInsts().begin(); |
| @@ -90,6 +102,16 @@ void TargetLowering::doAddressOpt() { |
| Context.advanceNext(); |
| } |
| +bool TargetLowering::shouldDoNopInsertion() const { |
| + return DoNopInsertion; |
| +} |
| + |
| +void TargetLowering::doNopInsertion() { |
| + randomlyInsertNop(NopProbability / 100.0); |
| + Context.advanceCur(); |
| + Context.advanceNext(); |
| +} |
| + |
| // Lowers a single instruction according to the information in |
| // Context, by checking the Context.Cur instruction kind and calling |
| // the appropriate lowering method. The lowering method should insert |