mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
Add support for undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17041 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -310,7 +310,7 @@ static Value *RemapOperand(const Value *In,
|
|||||||
Operands[i] =
|
Operands[i] =
|
||||||
cast<Constant>(RemapOperand(CPS->getOperand(i), LocalMap, GlobalMap));
|
cast<Constant>(RemapOperand(CPS->getOperand(i), LocalMap, GlobalMap));
|
||||||
Result = ConstantStruct::get(cast<StructType>(CPS->getType()), Operands);
|
Result = ConstantStruct::get(cast<StructType>(CPS->getType()), Operands);
|
||||||
} else if (isa<ConstantPointerNull>(CPV)) {
|
} else if (isa<ConstantPointerNull>(CPV) || isa<UndefValue>(CPV)) {
|
||||||
Result = const_cast<Constant*>(CPV);
|
Result = const_cast<Constant*>(CPV);
|
||||||
} else if (isa<GlobalValue>(CPV)) {
|
} else if (isa<GlobalValue>(CPV)) {
|
||||||
Result = cast<Constant>(RemapOperand(CPV, LocalMap, GlobalMap));
|
Result = cast<Constant>(RemapOperand(CPV, LocalMap, GlobalMap));
|
||||||
|
@@ -518,6 +518,9 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV,
|
|||||||
} else if (isa<ConstantPointerNull>(CV)) {
|
} else if (isa<ConstantPointerNull>(CV)) {
|
||||||
Out << "null";
|
Out << "null";
|
||||||
|
|
||||||
|
} else if (isa<UndefValue>(CV)) {
|
||||||
|
Out << "undef";
|
||||||
|
|
||||||
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
||||||
Out << CE->getOpcodeName() << " (";
|
Out << CE->getOpcodeName() << " (";
|
||||||
|
|
||||||
|
@@ -88,6 +88,7 @@ const char *Instruction::getOpcodeName(unsigned OpCode) {
|
|||||||
case Switch: return "switch";
|
case Switch: return "switch";
|
||||||
case Invoke: return "invoke";
|
case Invoke: return "invoke";
|
||||||
case Unwind: return "unwind";
|
case Unwind: return "unwind";
|
||||||
|
case Unreachable: return "unreachable";
|
||||||
|
|
||||||
// Standard binary operators...
|
// Standard binary operators...
|
||||||
case Add: return "add";
|
case Add: return "add";
|
||||||
|
@@ -248,6 +248,14 @@ void UnwindInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
|||||||
assert(0 && "UnwindInst has no successors!");
|
assert(0 && "UnwindInst has no successors!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
// UnreachableInst Implementation
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
void UnreachableInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
||||||
|
assert(0 && "UnreachableInst has no successors!");
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// BranchInst Implementation
|
// BranchInst Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@@ -832,3 +840,4 @@ BranchInst *BranchInst::clone() const { return new BranchInst(*this); }
|
|||||||
SwitchInst *SwitchInst::clone() const { return new SwitchInst(*this); }
|
SwitchInst *SwitchInst::clone() const { return new SwitchInst(*this); }
|
||||||
InvokeInst *InvokeInst::clone() const { return new InvokeInst(*this); }
|
InvokeInst *InvokeInst::clone() const { return new InvokeInst(*this); }
|
||||||
UnwindInst *UnwindInst::clone() const { return new UnwindInst(); }
|
UnwindInst *UnwindInst::clone() const { return new UnwindInst(); }
|
||||||
|
UnreachableInst *UnreachableInst::clone() const { return new UnreachableInst();}
|
||||||
|
@@ -310,7 +310,7 @@ static Value *RemapOperand(const Value *In,
|
|||||||
Operands[i] =
|
Operands[i] =
|
||||||
cast<Constant>(RemapOperand(CPS->getOperand(i), LocalMap, GlobalMap));
|
cast<Constant>(RemapOperand(CPS->getOperand(i), LocalMap, GlobalMap));
|
||||||
Result = ConstantStruct::get(cast<StructType>(CPS->getType()), Operands);
|
Result = ConstantStruct::get(cast<StructType>(CPS->getType()), Operands);
|
||||||
} else if (isa<ConstantPointerNull>(CPV)) {
|
} else if (isa<ConstantPointerNull>(CPV) || isa<UndefValue>(CPV)) {
|
||||||
Result = const_cast<Constant*>(CPV);
|
Result = const_cast<Constant*>(CPV);
|
||||||
} else if (isa<GlobalValue>(CPV)) {
|
} else if (isa<GlobalValue>(CPV)) {
|
||||||
Result = cast<Constant>(RemapOperand(CPV, LocalMap, GlobalMap));
|
Result = cast<Constant>(RemapOperand(CPV, LocalMap, GlobalMap));
|
||||||
|
Reference in New Issue
Block a user