[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp MachOWriter.cpp

Chris Lattner sabre at nondot.org
Sat Feb 10 11:55:48 PST 2007



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.146 -> 1.147
MachOWriter.cpp updated: 1.24 -> 1.25
---
Log message:

Privatize StructLayout::MemberOffsets, adding an accessor


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

 AsmPrinter.cpp  |    4 ++--
 MachOWriter.cpp |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.146 llvm/lib/CodeGen/AsmPrinter.cpp:1.147
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.146	Mon Feb  5 19:56:31 2007
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Sat Feb 10 13:55:17 2007
@@ -739,8 +739,8 @@
       // Check if padding is needed and insert one or more 0s.
       uint64_t fieldSize = TD->getTypeSize(field->getType());
       uint64_t padSize = ((i == e-1? cvsLayout->StructSize
-                           : cvsLayout->MemberOffsets[i+1])
-                          - cvsLayout->MemberOffsets[i]) - fieldSize;
+                           : cvsLayout->getElementOffset(i+1))
+                          - cvsLayout->getElementOffset(i)) - fieldSize;
       sizeSoFar += fieldSize + padSize;
 
       // Now print the actual field value


Index: llvm/lib/CodeGen/MachOWriter.cpp
diff -u llvm/lib/CodeGen/MachOWriter.cpp:1.24 llvm/lib/CodeGen/MachOWriter.cpp:1.25
--- llvm/lib/CodeGen/MachOWriter.cpp:1.24	Wed Feb  7 19:35:27 2007
+++ llvm/lib/CodeGen/MachOWriter.cpp	Sat Feb 10 13:55:17 2007
@@ -878,7 +878,8 @@
       const StructLayout *SL =
         TD->getStructLayout(cast<StructType>(CPS->getType()));
       for (unsigned i = 0, e = CPS->getNumOperands(); i != e; ++i)
-        WorkList.push_back(CPair(CPS->getOperand(i), PA+SL->MemberOffsets[i]));
+        WorkList.push_back(CPair(CPS->getOperand(i),
+                                 PA+SL->getElementOffset(i)));
     } else {
       cerr << "Bad Type: " << *PC->getType() << "\n";
       assert(0 && "Unknown constant type to initialize memory with!");






More information about the llvm-commits mailing list