[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Instruction.cpp Instructions.cpp Linker.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Oct 16 11:08:17 PDT 2004
Changes in directory llvm/lib/VMCore:
AsmWriter.cpp updated: 1.162 -> 1.163
Instruction.cpp updated: 1.39 -> 1.40
Instructions.cpp updated: 1.4 -> 1.5
Linker.cpp updated: 1.86 -> 1.87
---
Log message:
Add support for undef and unreachable
---
Diffs of the changes: (+14 -1)
Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.162 llvm/lib/VMCore/AsmWriter.cpp:1.163
--- llvm/lib/VMCore/AsmWriter.cpp:1.162 Tue Sep 14 00:43:23 2004
+++ llvm/lib/VMCore/AsmWriter.cpp Sat Oct 16 13:08:06 2004
@@ -518,6 +518,9 @@
} 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() << " (";
Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.39 llvm/lib/VMCore/Instruction.cpp:1.40
--- llvm/lib/VMCore/Instruction.cpp:1.39 Mon Oct 11 17:21:39 2004
+++ llvm/lib/VMCore/Instruction.cpp Sat Oct 16 13:08:06 2004
@@ -88,6 +88,7 @@
case Switch: return "switch";
case Invoke: return "invoke";
case Unwind: return "unwind";
+ case Unreachable: return "unreachable";
// Standard binary operators...
case Add: return "add";
Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.4 llvm/lib/VMCore/Instructions.cpp:1.5
--- llvm/lib/VMCore/Instructions.cpp:1.4 Fri Oct 15 18:52:53 2004
+++ llvm/lib/VMCore/Instructions.cpp Sat Oct 16 13:08:06 2004
@@ -249,6 +249,14 @@
}
//===----------------------------------------------------------------------===//
+// UnreachableInst Implementation
+//===----------------------------------------------------------------------===//
+
+void UnreachableInst::setSuccessor(unsigned idx, BasicBlock *NewSucc) {
+ assert(0 && "UnreachableInst has no successors!");
+}
+
+//===----------------------------------------------------------------------===//
// BranchInst Implementation
//===----------------------------------------------------------------------===//
@@ -832,3 +840,4 @@
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();}
Index: llvm/lib/VMCore/Linker.cpp
diff -u llvm/lib/VMCore/Linker.cpp:1.86 llvm/lib/VMCore/Linker.cpp:1.87
--- llvm/lib/VMCore/Linker.cpp:1.86 Mon Oct 4 21:28:11 2004
+++ llvm/lib/VMCore/Linker.cpp Sat Oct 16 13:08:06 2004
@@ -310,7 +310,7 @@
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));
More information about the llvm-commits
mailing list