Index: src/IceOperand.cpp |
diff --git a/src/IceOperand.cpp b/src/IceOperand.cpp |
index 2d2c8cf2c3276fbf3ce89d28d116a74cdca3f54b..7231f4b688e3547b5cd6f4678ab5f7ca96adf6b0 100644 |
--- a/src/IceOperand.cpp |
+++ b/src/IceOperand.cpp |
@@ -491,4 +491,21 @@ Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
return Str; |
} |
+// =========== Immediate Radomization and Pooling routines ============== |
Jim Stichnoth
2015/06/12 23:48:17
Randomization
qining
2015/06/17 04:28:53
Done.
|
+// Immediate randomization and pooling threshold, we should not |
+// randomize or pool small constants e.g. 2,4 etc. |
+const uint32_t X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD = 0xffff; |
+ |
+// Specialization of the template member function for ConstantInteger32 |
+template <> |
+bool ConstantInteger32::shouldBeRandomizedOrPooled(const GlobalContext *Ctx) { |
+ if (Ctx->getFlags().shouldNotRandomizeOrPoolImmediates() == true) |
+ return false; |
+ bool typeCorrect = getType() == IceType_i32; |
Jim Stichnoth
2015/06/12 23:48:17
Can you just do this?
if (getType() != IceType_i
qining
2015/06/17 04:28:53
Done. I've also add IceType_i8, IceType_i16 as val
|
+ bool largerThanThreshold = |
+ X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD / 2 + Value >= |
Jim Stichnoth
2015/06/12 23:48:17
Could you add a comment explaining that this check
qining
2015/06/17 04:28:53
Done.
|
+ X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD; |
+ return typeCorrect && largerThanThreshold; |
+} |
+ |
} // end of namespace Ice |