summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-30 05:49:43 +0000
committerChris Lattner <sabre@nondot.org>2012-01-30 05:49:43 +0000
commit6e64c381daa30a63608bfa3443e67c39e6df2d64 (patch)
tree0a847707dea8d7195433e15e778e569718dbb756 /lib/CodeGen/AsmPrinter/AsmPrinter.cpp
parent0cd0d8149278782aaa93c190f81e04f10a4efb5e (diff)
downloadllvm-6e64c381daa30a63608bfa3443e67c39e6df2d64.tar.gz
llvm-6e64c381daa30a63608bfa3443e67c39e6df2d64.tar.bz2
llvm-6e64c381daa30a63608bfa3443e67c39e6df2d64.tar.xz
don't lose tail padding on ConstantDataAggregate vec3's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149222 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp45
1 files changed, 24 insertions, 21 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 3863867486..f0733a35b6 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1629,15 +1629,10 @@ static void EmitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
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 @@ static void EmitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
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,