diff options
author | Lang Hames <lhames@gmail.com> | 2009-07-14 02:05:37 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2009-07-14 02:05:37 +0000 |
commit | b325139088c50e0420ac4e69184a46efe30698d1 (patch) | |
tree | 4db9d3eba3d5208b00095becba6f47bc1f481460 /include | |
parent | 6e0584033a39c468ecadbe337b6e7851e988e838 (diff) | |
download | external_llvm-b325139088c50e0420ac4e69184a46efe30698d1.zip external_llvm-b325139088c50e0420ac4e69184a46efe30698d1.tar.gz external_llvm-b325139088c50e0420ac4e69184a46efe30698d1.tar.bz2 |
Tidy up VNInfo alignment code. Patch contributed by Ryan Flynn.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75587 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/LiveInterval.h | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h index 6977bae..35640ac 100644 --- a/include/llvm/CodeGen/LiveInterval.h +++ b/include/llvm/CodeGen/LiveInterval.h @@ -211,7 +211,25 @@ namespace llvm { /// LiveInterval - This class represents some number of live ranges for a /// register or value. This class also contains a bit of register allocator /// state. - struct LiveInterval { + class LiveInterval { + private: + + inline unsigned getVNInfoAlignment(void) { +#ifdef __GNUC__ + return (unsigned)__alignof__(VNInfo); +#else + // FIXME: ugly. + return 8u; +#endif + } + + Ranges::iterator addRangeFrom(LiveRange LR, Ranges::iterator From); + void extendIntervalEndTo(Ranges::iterator I, unsigned NewEnd); + Ranges::iterator extendIntervalStartTo(Ranges::iterator I, unsigned NewStr); + LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT + + public: + typedef SmallVector<LiveRange,4> Ranges; typedef SmallVector<VNInfo*,4> VNInfoList; @@ -220,8 +238,6 @@ namespace llvm { float weight; // weight of this interval Ranges ranges; // the ranges in which this register is live VNInfoList valnos; // value#'s - - public: struct InstrSlots { enum { @@ -330,15 +346,9 @@ namespace llvm { assert(MIIdx != ~0u && MIIdx != ~1u && "PHI def / unused flags should now be passed explicitly."); -#ifdef __GNUC__ - unsigned Alignment = (unsigned)__alignof__(VNInfo); -#else - // FIXME: ugly. - unsigned Alignment = 8; -#endif VNInfo *VNI = static_cast<VNInfo*>(VNInfoAllocator.Allocate((unsigned)sizeof(VNInfo), - Alignment)); + getVNInfoAlignment())); new (VNI) VNInfo((unsigned)valnos.size(), MIIdx, CopyMI); VNI->setIsDefAccurate(isDefAccurate); valnos.push_back(VNI); @@ -349,15 +359,9 @@ namespace llvm { /// for the Value number. VNInfo *createValueCopy(const VNInfo *orig, BumpPtrAllocator &VNInfoAllocator) { -#ifdef __GNUC__ - unsigned Alignment = (unsigned)__alignof__(VNInfo); -#else - // FIXME: ugly. - unsigned Alignment = 8; -#endif VNInfo *VNI = static_cast<VNInfo*>(VNInfoAllocator.Allocate((unsigned)sizeof(VNInfo), - Alignment)); + getVNInfoAlignment())); new (VNI) VNInfo((unsigned)valnos.size(), *orig); valnos.push_back(VNI); @@ -594,11 +598,6 @@ namespace llvm { } void dump() const; - private: - Ranges::iterator addRangeFrom(LiveRange LR, Ranges::iterator From); - void extendIntervalEndTo(Ranges::iterator I, unsigned NewEnd); - Ranges::iterator extendIntervalStartTo(Ranges::iterator I, unsigned NewStr); - LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT }; inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) { |