| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===// | 1 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===// |
| 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 /// \file | 10 /// \file |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 Type Ty = T::Ty; | 736 Type Ty = T::Ty; |
| 737 SizeT Align = typeAlignInBytes(Ty); | 737 SizeT Align = typeAlignInBytes(Ty); |
| 738 ConstantList Pool = Ctx->getConstantPool(Ty); | 738 ConstantList Pool = Ctx->getConstantPool(Ty); |
| 739 | 739 |
| 740 Str << "\t.section\t.rodata.cst" << Align << ",\"aM\",@progbits," << Align | 740 Str << "\t.section\t.rodata.cst" << Align << ",\"aM\",@progbits," << Align |
| 741 << "\n"; | 741 << "\n"; |
| 742 Str << "\t.align\t" << Align << "\n"; | 742 Str << "\t.align\t" << Align << "\n"; |
| 743 | 743 |
| 744 // If reorder-pooled-constants option is set to true, we need to shuffle the | 744 // If reorder-pooled-constants option is set to true, we need to shuffle the |
| 745 // constant pool before emitting it. | 745 // constant pool before emitting it. |
| 746 if (Ctx->getFlags().shouldReorderPooledConstants()) | 746 if (Ctx->getFlags().shouldReorderPooledConstants()) { |
| 747 RandomShuffle(Pool.begin(), Pool.end(), [Ctx](uint64_t N) { | 747 // Use the constant's kind value as the salt for creating random number |
| 748 return (uint32_t)Ctx->getRNG().next(N); | 748 // generator. |
| 749 }); | 749 Operand::OperandKind K = (*Pool.begin())->getKind(); |
| 750 RandomNumberGenerator RNG(Ctx->getFlags().getRandomSeed(), |
| 751 RPE_PooledConstantReordering, K); |
| 752 RandomShuffle(Pool.begin(), Pool.end(), |
| 753 [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); }); |
| 754 } |
| 750 | 755 |
| 751 for (Constant *C : Pool) { | 756 for (Constant *C : Pool) { |
| 752 if (!C->getShouldBePooled()) | 757 if (!C->getShouldBePooled()) |
| 753 continue; | 758 continue; |
| 754 typename T::IceType *Const = llvm::cast<typename T::IceType>(C); | 759 typename T::IceType *Const = llvm::cast<typename T::IceType>(C); |
| 755 typename T::IceType::PrimType Value = Const->getValue(); | 760 typename T::IceType::PrimType Value = Const->getValue(); |
| 756 // Use memcpy() to copy bits from Value into RawValue in a way | 761 // Use memcpy() to copy bits from Value into RawValue in a way |
| 757 // that avoids breaking strict-aliasing rules. | 762 // that avoids breaking strict-aliasing rules. |
| 758 typename T::PrimitiveIntType RawValue; | 763 typename T::PrimitiveIntType RawValue; |
| 759 memcpy(&RawValue, &Value, sizeof(Value)); | 764 memcpy(&RawValue, &Value, sizeof(Value)); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 // entries in case the high-level table has extra entries. | 956 // entries in case the high-level table has extra entries. |
| 952 #define X(tag, sizeLog2, align, elts, elty, str) \ | 957 #define X(tag, sizeLog2, align, elts, elty, str) \ |
| 953 static_assert(_table1_##tag == _table2_##tag, \ | 958 static_assert(_table1_##tag == _table2_##tag, \ |
| 954 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE"); | 959 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE"); |
| 955 ICETYPE_TABLE | 960 ICETYPE_TABLE |
| 956 #undef X | 961 #undef X |
| 957 } // end of namespace dummy3 | 962 } // end of namespace dummy3 |
| 958 } // end of anonymous namespace | 963 } // end of anonymous namespace |
| 959 | 964 |
| 960 } // end of namespace Ice | 965 } // end of namespace Ice |
| OLD | NEW |