diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-06-22 18:55:03 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-06-22 18:55:03 +0000 |
commit | 6208a2fd66f305905cee09bd9dabf3f16dba91d7 (patch) | |
tree | ca285ec1e6fbc534eda58be337c6413b99636077 /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | bb9a5e6df1ff42c595f09facaf9db6430b1a5a70 (diff) | |
download | bcm5719-llvm-6208a2fd66f305905cee09bd9dabf3f16dba91d7.tar.gz bcm5719-llvm-6208a2fd66f305905cee09bd9dabf3f16dba91d7.zip |
Emit trailing padding on constant vectors when TargetData says that the vector
is larger than the sum of the elements (including per-element padding).
llvm-svn: 133631
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 946018cd1a4..edfb30725c5 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1516,6 +1516,13 @@ static void EmitGlobalConstantVector(const ConstantVector *CV, unsigned AddrSpace, AsmPrinter &AP) { for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i) EmitGlobalConstantImpl(CV->getOperand(i), AddrSpace, AP); + + const TargetData &TD = *AP.TM.getTargetData(); + unsigned Size = TD.getTypeAllocSize(CV->getType()); + unsigned EmittedSize = TD.getTypeAllocSize(CV->getType()->getElementType()) * + CV->getType()->getNumElements(); + if (unsigned Padding = Size - EmittedSize) + AP.OutStreamer.EmitZeros(Padding, AddrSpace); } static void EmitGlobalConstantStruct(const ConstantStruct *CS, |