aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-11-05 18:03:02 +0000
committerDuncan Sands <baldrick@free.fr>2007-11-05 18:03:02 +0000
commit0c8a13b5107eb41d3c62d7b0db1bd17fa5549368 (patch)
treeda3055e0a589cd5883f64f9636caca0da412ba2f /lib/CodeGen/AsmPrinter.cpp
parentf6e53df44184d0243292ddb86f299f20f59fc1a7 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43720 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp
index eb9375cd13..e7c7448f9b 100644
--- a/lib/CodeGen/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter.cpp
@@ -831,15 +831,16 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, bool Packed) {
// 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() &&