| 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;
|
| +
|
| +// Specialization of the template member function for ConstantInteger32
|
| +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;
|
| + // 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
|
|
|