[llvm-commits] [llvm] r43720 - /llvm/trunk/lib/CodeGen/AsmPrinter.cpp

Duncan Sands baldrick at free.fr
Mon Nov 5 10:03:02 PST 2007


Author: baldrick
Date: Mon Nov  5 12:03:02 2007
New Revision: 43720

URL: http://llvm.org/viewvc/llvm-project?rev=43720&view=rev
Log:
Don't output ABI size padding twice.  By using the store
size for the field we get ABI padding automatically, so
no need to put it in again when we emit the field.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=43720&r1=43719&r2=43720&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Mon Nov  5 12:03:02 2007
@@ -831,15 +831,16 @@
 
       // Check if padding is needed and insert one or more 0s.
       uint64_t fieldSize = TD->getTypeStoreSize(field->getType());
-      uint64_t padSize = ((i == e-1? cvsLayout->getSizeInBytes()
-                           : cvsLayout->getElementOffset(i+1))
+      uint64_t padSize = ((i == e-1 ? Size : cvsLayout->getElementOffset(i+1))
                           - cvsLayout->getElementOffset(i)) - fieldSize;
       sizeSoFar += fieldSize + padSize;
 
-      // Now print the actual field value
-      EmitGlobalConstant(field, CVS->getType()->isPacked());
+      // Now print the actual field value without ABI size padding.
+      EmitGlobalConstant(field, true);
 
-      // Insert the field padding unless it's zero bytes...
+      // Insert padding - this may include padding to increase the size of the
+      // current field up to the ABI size (if the struct is not packed) as well
+      // as padding to ensure that the next field starts at the right offset.
       EmitZeros(padSize);
     }
     assert(sizeSoFar == cvsLayout->getSizeInBytes() &&





More information about the llvm-commits mailing list