Changes in directory llvm/include/llvm/Target:

TargetData.h updated: 1.51 -> 1.52
---
Log message:

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%.



---
Diffs of the changes:  (+4 -3)

 TargetData.h |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Target/TargetData.h
diff -u llvm/include/llvm/Target/TargetData.h:1.51 
llvm/include/llvm/Target/TargetData.h:1.52
--- llvm/include/llvm/Target/TargetData.h:1.51  Sat Feb 10 13:59:22 2007
+++ llvm/include/llvm/Target/TargetData.h       Sat Feb 10 14:15:41 2007
@@ -275,9 +275,10 @@
 /// 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 @@
   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];
   }
   



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to