1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

fix asmwriting of ConstantDataArray to use the right element count,

simplify ConstantArray handling, since they can never be empty.

llvm-svn: 149341
This commit is contained in:
Chris Lattner 2012-01-31 03:15:40 +00:00
parent 054e412291
commit 1d52d79d31

View File

@ -837,19 +837,17 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
Out << '"';
} else { // Cannot output in string format...
Out << '[';
if (CA->getNumOperands()) {
TypePrinter.print(ETy, Out);
Out << ' ';
WriteAsOperandInternal(Out, CA->getOperand(0),
&TypePrinter, Machine,
Context);
for (unsigned i = 1, e = CA->getNumOperands(); i != e; ++i) {
Out << ", ";
TypePrinter.print(ETy, Out);
Out << ' ';
WriteAsOperandInternal(Out, CA->getOperand(0),
&TypePrinter, Machine,
WriteAsOperandInternal(Out, CA->getOperand(i), &TypePrinter, Machine,
Context);
for (unsigned i = 1, e = CA->getNumOperands(); i != e; ++i) {
Out << ", ";
TypePrinter.print(ETy, Out);
Out << ' ';
WriteAsOperandInternal(Out, CA->getOperand(i), &TypePrinter, Machine,
Context);
}
}
Out << ']';
}
@ -868,21 +866,19 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
Type *ETy = CA->getType()->getElementType();
Out << '[';
if (CA->getNumOperands()) {
TypePrinter.print(ETy, Out);
Out << ' ';
WriteAsOperandInternal(Out, CA->getElementAsConstant(0),
&TypePrinter, Machine,
Context);
for (unsigned i = 1, e = CA->getNumElements(); i != e; ++i) {
Out << ", ";
TypePrinter.print(ETy, Out);
Out << ' ';
WriteAsOperandInternal(Out, CA->getElementAsConstant(0),
&TypePrinter, Machine,
Context);
for (unsigned i = 1, e = CA->getNumOperands(); i != e; ++i) {
Out << ", ";
TypePrinter.print(ETy, Out);
Out << ' ';
WriteAsOperandInternal(Out, CA->getElementAsConstant(i), &TypePrinter,
Machine, Context);
}
Out << ']';
WriteAsOperandInternal(Out, CA->getElementAsConstant(i), &TypePrinter,
Machine, Context);
}
Out << ']';
return;
}