summaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-10-16 18:08:06 +0000
committerChris Lattner <sabre@nondot.org>2004-10-16 18:08:06 +0000
commitb976e668165e1875a8f1eb7af800e33bb1e4393d (patch)
treefea6726be7a279c0937865e0ca36976d7f9f3052 /lib/VMCore
parentb9f18592a62b5f60d20ee6d498df0086b1813b21 (diff)
downloadexternal_llvm-b976e668165e1875a8f1eb7af800e33bb1e4393d.zip
external_llvm-b976e668165e1875a8f1eb7af800e33bb1e4393d.tar.gz
external_llvm-b976e668165e1875a8f1eb7af800e33bb1e4393d.tar.bz2
Add support for undef and unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp3
-rw-r--r--lib/VMCore/Instruction.cpp1
-rw-r--r--lib/VMCore/Instructions.cpp9
-rw-r--r--lib/VMCore/Linker.cpp2
4 files changed, 14 insertions, 1 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 236e243..2e973fe 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -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() << " (";
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index 4ea5775..17970ac 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -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";
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 38e9255..029ee6a 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -249,6 +249,14 @@ void UnwindInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) {
}
//===----------------------------------------------------------------------===//
+// 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();}
diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp
index 70bd22c..fbf0978 100644
--- a/lib/VMCore/Linker.cpp
+++ b/lib/VMCore/Linker.cpp
@@ -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));