eliminate the std::vector from StructLayout, allocating the elements immediately

after the StructLayout object in memory.  This marginally improves locality,
speeding up -load-vn -gcse by ~0.8%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34158 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-02-10 20:15:41 +00:00
parent b0c39a3b4d
commit 9182e3f205
2 changed files with 61 additions and 46 deletions

View File

@@ -275,9 +275,10 @@ public:
/// target machine, based on the TargetData structure.
///
class StructLayout {
std::vector<uint64_t> MemberOffsets;
unsigned StructAlignment;
uint64_t StructSize;
unsigned StructAlignment;
unsigned NumElements;
uint64_t MemberOffsets[1]; // variable sized array!
public:
uint64_t getSizeInBytes() const {
@@ -294,7 +295,7 @@ public:
unsigned getElementContainingOffset(uint64_t Offset) const;
uint64_t getElementOffset(unsigned Idx) const {
assert(Idx < MemberOffsets.size() && "Invalid element idx!");
assert(Idx < NumElements && "Invalid element idx!");
return MemberOffsets[Idx];
}