mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-05 18:37:17 +00:00
Add support for unreachable and undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17048 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e87597fb75
commit
a9d12c0a56
@ -174,6 +174,7 @@ namespace {
|
||||
void visitUnwindInst(UnwindInst &I) {
|
||||
assert(0 && "Lowerinvoke pass didn't work!");
|
||||
}
|
||||
void visitUnreachableInst(UnreachableInst &I);
|
||||
|
||||
void visitPHINode(PHINode &I);
|
||||
void visitBinaryOperator(Instruction &I);
|
||||
@ -521,6 +522,9 @@ void CWriter::printConstant(Constant *CPV) {
|
||||
<< *CE << "\n";
|
||||
abort();
|
||||
}
|
||||
} else if (isa<UndefValue>(CPV) && CPV->getType()->isFirstClassType()) {
|
||||
Out << "0";
|
||||
return;
|
||||
}
|
||||
|
||||
switch (CPV->getType()->getTypeID()) {
|
||||
@ -606,7 +610,7 @@ void CWriter::printConstant(Constant *CPV) {
|
||||
}
|
||||
|
||||
case Type::ArrayTyID:
|
||||
if (isa<ConstantAggregateZero>(CPV)) {
|
||||
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
|
||||
const ArrayType *AT = cast<ArrayType>(CPV->getType());
|
||||
Out << "{";
|
||||
if (AT->getNumElements()) {
|
||||
@ -625,7 +629,7 @@ void CWriter::printConstant(Constant *CPV) {
|
||||
break;
|
||||
|
||||
case Type::StructTyID:
|
||||
if (isa<ConstantAggregateZero>(CPV)) {
|
||||
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
|
||||
const StructType *ST = cast<StructType>(CPV->getType());
|
||||
Out << "{";
|
||||
if (ST->getNumElements()) {
|
||||
@ -1205,6 +1209,10 @@ void CWriter::visitSwitchInst(SwitchInst &SI) {
|
||||
Out << " }\n";
|
||||
}
|
||||
|
||||
void CWriter::visitUnreachableInst(UnreachableInst &I) {
|
||||
Out << " /*UNREACHABLE*/\n";
|
||||
}
|
||||
|
||||
bool CWriter::isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) {
|
||||
/// FIXME: This should be reenabled, but loop reordering safe!!
|
||||
return true;
|
||||
|
@ -174,6 +174,7 @@ namespace {
|
||||
void visitUnwindInst(UnwindInst &I) {
|
||||
assert(0 && "Lowerinvoke pass didn't work!");
|
||||
}
|
||||
void visitUnreachableInst(UnreachableInst &I);
|
||||
|
||||
void visitPHINode(PHINode &I);
|
||||
void visitBinaryOperator(Instruction &I);
|
||||
@ -521,6 +522,9 @@ void CWriter::printConstant(Constant *CPV) {
|
||||
<< *CE << "\n";
|
||||
abort();
|
||||
}
|
||||
} else if (isa<UndefValue>(CPV) && CPV->getType()->isFirstClassType()) {
|
||||
Out << "0";
|
||||
return;
|
||||
}
|
||||
|
||||
switch (CPV->getType()->getTypeID()) {
|
||||
@ -606,7 +610,7 @@ void CWriter::printConstant(Constant *CPV) {
|
||||
}
|
||||
|
||||
case Type::ArrayTyID:
|
||||
if (isa<ConstantAggregateZero>(CPV)) {
|
||||
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
|
||||
const ArrayType *AT = cast<ArrayType>(CPV->getType());
|
||||
Out << "{";
|
||||
if (AT->getNumElements()) {
|
||||
@ -625,7 +629,7 @@ void CWriter::printConstant(Constant *CPV) {
|
||||
break;
|
||||
|
||||
case Type::StructTyID:
|
||||
if (isa<ConstantAggregateZero>(CPV)) {
|
||||
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
|
||||
const StructType *ST = cast<StructType>(CPV->getType());
|
||||
Out << "{";
|
||||
if (ST->getNumElements()) {
|
||||
@ -1205,6 +1209,10 @@ void CWriter::visitSwitchInst(SwitchInst &SI) {
|
||||
Out << " }\n";
|
||||
}
|
||||
|
||||
void CWriter::visitUnreachableInst(UnreachableInst &I) {
|
||||
Out << " /*UNREACHABLE*/\n";
|
||||
}
|
||||
|
||||
bool CWriter::isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) {
|
||||
/// FIXME: This should be reenabled, but loop reordering safe!!
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user