mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Add support for the new ConstantAggregateZero class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11473 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dd2c82a427
commit
cfb0fd2ce8
@ -475,10 +475,38 @@ void CWriter::printConstant(Constant *CPV) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case Type::ArrayTyID:
|
case Type::ArrayTyID:
|
||||||
|
if (isa<ConstantAggregateZero>(CPV)) {
|
||||||
|
const ArrayType *AT = cast<ArrayType>(CPV->getType());
|
||||||
|
Out << "{";
|
||||||
|
if (AT->getNumElements()) {
|
||||||
|
Out << " ";
|
||||||
|
Constant *CZ = Constant::getNullValue(AT->getElementType());
|
||||||
|
printConstant(CZ);
|
||||||
|
for (unsigned i = 1, e = AT->getNumElements(); i != e; ++i) {
|
||||||
|
Out << ", ";
|
||||||
|
printConstant(CZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Out << " }";
|
||||||
|
} else {
|
||||||
printConstantArray(cast<ConstantArray>(CPV));
|
printConstantArray(cast<ConstantArray>(CPV));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type::StructTyID: {
|
case Type::StructTyID:
|
||||||
|
if (isa<ConstantAggregateZero>(CPV)) {
|
||||||
|
const StructType *ST = cast<StructType>(CPV->getType());
|
||||||
|
Out << "{";
|
||||||
|
if (ST->getNumElements()) {
|
||||||
|
Out << " ";
|
||||||
|
printConstant(Constant::getNullValue(ST->getElementType(0)));
|
||||||
|
for (unsigned i = 1, e = ST->getNumElements(); i != e; ++i) {
|
||||||
|
Out << ", ";
|
||||||
|
printConstant(Constant::getNullValue(ST->getElementType(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Out << " }";
|
||||||
|
} else {
|
||||||
Out << "{";
|
Out << "{";
|
||||||
if (CPV->getNumOperands()) {
|
if (CPV->getNumOperands()) {
|
||||||
Out << " ";
|
Out << " ";
|
||||||
@ -489,8 +517,8 @@ void CWriter::printConstant(Constant *CPV) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Out << " }";
|
Out << " }";
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Type::PointerTyID:
|
case Type::PointerTyID:
|
||||||
if (isa<ConstantPointerNull>(CPV)) {
|
if (isa<ConstantPointerNull>(CPV)) {
|
||||||
|
@ -475,10 +475,38 @@ void CWriter::printConstant(Constant *CPV) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case Type::ArrayTyID:
|
case Type::ArrayTyID:
|
||||||
|
if (isa<ConstantAggregateZero>(CPV)) {
|
||||||
|
const ArrayType *AT = cast<ArrayType>(CPV->getType());
|
||||||
|
Out << "{";
|
||||||
|
if (AT->getNumElements()) {
|
||||||
|
Out << " ";
|
||||||
|
Constant *CZ = Constant::getNullValue(AT->getElementType());
|
||||||
|
printConstant(CZ);
|
||||||
|
for (unsigned i = 1, e = AT->getNumElements(); i != e; ++i) {
|
||||||
|
Out << ", ";
|
||||||
|
printConstant(CZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Out << " }";
|
||||||
|
} else {
|
||||||
printConstantArray(cast<ConstantArray>(CPV));
|
printConstantArray(cast<ConstantArray>(CPV));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type::StructTyID: {
|
case Type::StructTyID:
|
||||||
|
if (isa<ConstantAggregateZero>(CPV)) {
|
||||||
|
const StructType *ST = cast<StructType>(CPV->getType());
|
||||||
|
Out << "{";
|
||||||
|
if (ST->getNumElements()) {
|
||||||
|
Out << " ";
|
||||||
|
printConstant(Constant::getNullValue(ST->getElementType(0)));
|
||||||
|
for (unsigned i = 1, e = ST->getNumElements(); i != e; ++i) {
|
||||||
|
Out << ", ";
|
||||||
|
printConstant(Constant::getNullValue(ST->getElementType(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Out << " }";
|
||||||
|
} else {
|
||||||
Out << "{";
|
Out << "{";
|
||||||
if (CPV->getNumOperands()) {
|
if (CPV->getNumOperands()) {
|
||||||
Out << " ";
|
Out << " ";
|
||||||
@ -489,8 +517,8 @@ void CWriter::printConstant(Constant *CPV) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Out << " }";
|
Out << " }";
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Type::PointerTyID:
|
case Type::PointerTyID:
|
||||||
if (isa<ConstantPointerNull>(CPV)) {
|
if (isa<ConstantPointerNull>(CPV)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user