OLD | NEW |
1 //===- subzero/src/IceOperand.cpp - High-level operand implementation -----===// | 1 //===- subzero/src/IceOperand.cpp - High-level operand implementation -----===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the Operand class and its target-independent | 10 // This file implements the Operand class and its target-independent |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 Ostream &operator<<(Ostream &Str, const RegWeight &W) { | 484 Ostream &operator<<(Ostream &Str, const RegWeight &W) { |
485 if (!ALLOW_DUMP) | 485 if (!ALLOW_DUMP) |
486 return Str; | 486 return Str; |
487 if (W.getWeight() == RegWeight::Inf) | 487 if (W.getWeight() == RegWeight::Inf) |
488 Str << "Inf"; | 488 Str << "Inf"; |
489 else | 489 else |
490 Str << W.getWeight(); | 490 Str << W.getWeight(); |
491 return Str; | 491 return Str; |
492 } | 492 } |
493 | 493 |
| 494 // =========== Immediate Randomization and Pooling routines ============== |
| 495 // Immediates randomization and pooling threshold, we should not |
| 496 // randomize or pool small constants e.g. 2,4 etc. |
| 497 static const uint32_t X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD = 0x1; |
| 498 |
| 499 // Specialization of the template member function for ConstantInteger32 |
| 500 template <> |
| 501 bool ConstantInteger32::shouldBeRandomizedOrPooled(const GlobalContext *Ctx) { |
| 502 if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_None) |
| 503 return false; |
| 504 if (getType() != IceType_i32 && getType() != IceType_i16 && |
| 505 getType() != IceType_i8) |
| 506 return false; |
| 507 // if(getType() != IceType_i32) return false; |
| 508 // The Following checks if the signed representation of Value is between |
| 509 // -THRESHOLD/2 and +THRESHOLD/2 |
| 510 bool largerThanThreshold = |
| 511 X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD / 2 + Value >= |
| 512 X86_INT_IMMEDIATE_RANDOMIZATION_THRESHOLD; |
| 513 return largerThanThreshold; |
| 514 } |
| 515 |
494 } // end of namespace Ice | 516 } // end of namespace Ice |
OLD | NEW |