mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +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:
parent
b9f18592a6
commit
b976e66816
@ -310,7 +310,7 @@ static Value *RemapOperand(const Value *In,
|
||||
Operands[i] =
|
||||
cast<Constant>(RemapOperand(CPS->getOperand(i), LocalMap, GlobalMap));
|
||||
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);
|
||||
} else if (isa<GlobalValue>(CPV)) {
|
||||
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)) {
|
||||
Out << "null";
|
||||
|
||||
} else if (isa<UndefValue>(CV)) {
|
||||
Out << "undef";
|
||||
|
||||
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
||||
Out << CE->getOpcodeName() << " (";
|
||||
|
||||
|
@ -88,6 +88,7 @@ const char *Instruction::getOpcodeName(unsigned OpCode) {
|
||||
case Switch: return "switch";
|
||||
case Invoke: return "invoke";
|
||||
case Unwind: return "unwind";
|
||||
case Unreachable: return "unreachable";
|
||||
|
||||
// Standard binary operators...
|
||||
case Add: return "add";
|
||||
|
@ -248,6 +248,14 @@ void UnwindInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
||||
assert(0 && "UnwindInst has no successors!");
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// UnreachableInst Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void UnreachableInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
||||
assert(0 && "UnreachableInst has no successors!");
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// BranchInst Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -832,3 +840,4 @@ BranchInst *BranchInst::clone() const { return new BranchInst(*this); }
|
||||
SwitchInst *SwitchInst::clone() const { return new SwitchInst(*this); }
|
||||
InvokeInst *InvokeInst::clone() const { return new InvokeInst(*this); }
|
||||
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] =
|
||||
cast<Constant>(RemapOperand(CPS->getOperand(i), LocalMap, GlobalMap));
|
||||
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);
|
||||
} else if (isa<GlobalValue>(CPV)) {
|
||||
Result = cast<Constant>(RemapOperand(CPV, LocalMap, GlobalMap));
|
||||
|
Loading…
Reference in New Issue
Block a user