[llvm-commits] [llvm] r149222 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Sun Jan 29 21:49:44 PST 2012
Author: lattner
Date: Sun Jan 29 23:49:43 2012
New Revision: 149222
URL: http://llvm.org/viewvc/llvm-project?rev=149222&view=rev
Log:
don't lose tail padding on ConstantDataAggregate vec3's.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=149222&r1=149221&r2=149222&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sun Jan 29 23:49:43 2012
@@ -1629,15 +1629,10 @@
AP.OutStreamer.EmitIntValue(CDS->getElementAsInteger(i),
ElementByteSize, AddrSpace);
}
- return;
- }
-
- // FP Constants are printed as integer constants to avoid losing
- // precision.
- assert(CDS->getElementType()->isFloatTy() ||
- CDS->getElementType()->isDoubleTy());
-
- if (ElementByteSize == 4) {
+ } else if (ElementByteSize == 4) {
+ // FP Constants are printed as integer constants to avoid losing
+ // precision.
+ assert(CDS->getElementType()->isFloatTy());
for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
union {
float F;
@@ -1649,20 +1644,28 @@
AP.OutStreamer.GetCommentOS() << "float " << F << '\n';
AP.OutStreamer.EmitIntValue(I, 4, AddrSpace);
}
- return;
+ } else {
+ assert(CDS->getElementType()->isDoubleTy());
+ for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
+ union {
+ double F;
+ uint64_t I;
+ };
+
+ F = CDS->getElementAsDouble(i);
+ if (AP.isVerbose())
+ AP.OutStreamer.GetCommentOS() << "double " << F << '\n';
+ AP.OutStreamer.EmitIntValue(I, 8, AddrSpace);
+ }
}
- for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
- union {
- double F;
- uint64_t I;
- };
-
- F = CDS->getElementAsDouble(i);
- if (AP.isVerbose())
- AP.OutStreamer.GetCommentOS() << "double " << F << '\n';
- AP.OutStreamer.EmitIntValue(I, 8, AddrSpace);
- }
+ const TargetData &TD = *AP.TM.getTargetData();
+ unsigned Size = TD.getTypeAllocSize(CDS->getType());
+ unsigned EmittedSize = TD.getTypeAllocSize(CDS->getType()->getElementType()) *
+ CDS->getNumElements();
+ if (unsigned Padding = Size - EmittedSize)
+ AP.OutStreamer.EmitZeros(Padding, AddrSpace);
+
}
static void EmitGlobalConstantArray(const ConstantArray *CA, unsigned AddrSpace,
More information about the llvm-commits
mailing list