Chromium Code Reviews| Index: src/IceOperand.cpp |
| diff --git a/src/IceOperand.cpp b/src/IceOperand.cpp |
| index 2d2c8cf2c3276fbf3ce89d28d116a74cdca3f54b..5fab998fd5cd213b875be8d4b0b6751bcc36c629 100644 |
| --- a/src/IceOperand.cpp |
| +++ b/src/IceOperand.cpp |
| @@ -491,4 +491,26 @@ Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
| return Str; |
| } |
| +// =========== Immediate Randomization and Pooling routines ============== |
| +// Immediates randomization and pooling threshold, we should not |
| +// randomize or pool small constants e.g. 2,4 etc. |
| +static const uint32_t X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD = 0x1; |
|
Jim Stichnoth
2015/06/19 16:51:03
Do you really mean to set such a low threshold?
I
qining
2015/06/19 20:22:25
Done. Chang back to 0xffff. Do we need to add a co
Jim Stichnoth
2015/06/19 23:12:15
I think a command line option would be most excell
qining
2015/06/20 00:22:28
Done.
|
| + |
| +// Specialization of the template member function for ConstantInteger32 |
|
Jim Stichnoth
2015/06/19 16:51:03
It seems that you're trying to specialize for i32
qining
2015/06/19 20:22:25
Done. I've labeled that with a TODO tag. But actua
|
| +template <> |
| +bool ConstantInteger32::shouldBeRandomizedOrPooled(const GlobalContext *Ctx) { |
| + if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_None) |
| + return false; |
| + if (getType() != IceType_i32 && getType() != IceType_i16 && |
| + getType() != IceType_i8) |
| + return false; |
| + // if(getType() != IceType_i32) return false; |
|
Jim Stichnoth
2015/06/19 16:51:03
remove commented code
|
| + // The Following checks if the signed representation of Value is between |
| + // -THRESHOLD/2 and +THRESHOLD/2 |
| + bool largerThanThreshold = |
| + X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD / 2 + Value >= |
| + X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD; |
| + return largerThanThreshold; |
| +} |
| + |
| } // end of namespace Ice |