diff options
author | Chris Lattner <sabre@nondot.org> | 2012-01-31 06:05:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-01-31 06:05:00 +0000 |
commit | 1b2f643753a2974540934ac0f1e3ffd182b0571c (patch) | |
tree | c7f571a94ad375ba815a3ee6291123e9f3c00c59 /lib/CodeGen | |
parent | ca012b8b2341a987f0022adc42424ac8ed26752a (diff) | |
download | external_llvm-1b2f643753a2974540934ac0f1e3ffd182b0571c.zip external_llvm-1b2f643753a2974540934ac0f1e3ffd182b0571c.tar.gz external_llvm-1b2f643753a2974540934ac0f1e3ffd182b0571c.tar.bz2 |
with recent changes, ConstantArray is never a "string". Remove the associated
methods and constant fold the clients to false.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 4c09366..3e7de0a 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1675,31 +1675,18 @@ static void EmitGlobalConstantDataSequential(const ConstantDataSequential *CDS, static void EmitGlobalConstantArray(const ConstantArray *CA, unsigned AddrSpace, AsmPrinter &AP) { - if (AddrSpace != 0 || !CA->isString()) { - // Not a string. Print the values in successive locations. + // See if we can aggregate some values. Make sure it can be + // represented as a series of bytes of the constant value. + int Value = isRepeatedByteSequence(CA, AP.TM); - // See if we can aggregate some values. Make sure it can be - // represented as a series of bytes of the constant value. - int Value = isRepeatedByteSequence(CA, AP.TM); - - if (Value != -1) { - uint64_t Bytes = AP.TM.getTargetData()->getTypeAllocSize(CA->getType()); - AP.OutStreamer.EmitFill(Bytes, Value, AddrSpace); - } - else { - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) - EmitGlobalConstantImpl(CA->getOperand(i), AddrSpace, AP); - } - return; + if (Value != -1) { + uint64_t Bytes = AP.TM.getTargetData()->getTypeAllocSize(CA->getType()); + AP.OutStreamer.EmitFill(Bytes, Value, AddrSpace); + } + else { + for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) + EmitGlobalConstantImpl(CA->getOperand(i), AddrSpace, AP); } - - // Otherwise, it can be emitted as .ascii. - SmallVector<char, 128> TmpVec; - TmpVec.reserve(CA->getNumOperands()); - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) - TmpVec.push_back(cast<ConstantInt>(CA->getOperand(i))->getZExtValue()); - - AP.OutStreamer.EmitBytes(StringRef(TmpVec.data(), TmpVec.size()), AddrSpace); } static void EmitGlobalConstantVector(const ConstantVector *CV, |