diff options
author | Chris Lattner <sabre@nondot.org> | 2012-01-30 05:49:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-01-30 05:49:43 +0000 |
commit | 51ebe14a36e4b78d9a709eaf0ec2cd10fff39f4a (patch) | |
tree | 31db3762f801dcf5476646a1cc84ea8307b88f15 /llvm/lib/CodeGen | |
parent | c2783009b33fec3a6f68e9153dbd3f73dade03eb (diff) | |
download | bcm5719-llvm-51ebe14a36e4b78d9a709eaf0ec2cd10fff39f4a.tar.gz bcm5719-llvm-51ebe14a36e4b78d9a709eaf0ec2cd10fff39f4a.zip |
don't lose tail padding on ConstantDataAggregate vec3's.
llvm-svn: 149222
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 38638674866..f0733a35b60 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/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, |