mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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:
@@ -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];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user