summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-10-16 18:14:10 +0000
committerChris Lattner <sabre@nondot.org>2004-10-16 18:14:10 +0000
commitea9a85abe4b4b8aaf03ac0707aa56d098228f013 (patch)
tree853532557b5eb1b928a21dbdf3a65f98170403d3 /llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp
parenta3f3c8a1adb8c98ea38b942846a31ac7ed341273 (diff)
downloadbcm5719-llvm-ea9a85abe4b4b8aaf03ac0707aa56d098228f013.tar.gz
bcm5719-llvm-ea9a85abe4b4b8aaf03ac0707aa56d098228f013.zip
Add support for undef and unreachable
llvm-svn: 17051
Diffstat (limited to 'llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp')
-rw-r--r--llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp b/llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp
index 6eade42825a..fd1fdc329e1 100644
--- a/llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp
+++ b/llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp
@@ -55,6 +55,15 @@ namespace {
void visitCallInst(CallInst &I);
void visitPHINode(PHINode &PN);
+ void visitBasicBlock(BasicBlock &BB) {
+ if (isa<UnreachableInst>(BB.getTerminator())) {
+ BB.getInstList().pop_back();
+ const Type *RetTy = BB.getParent()->getReturnType();
+ Value *RetVal = RetTy == Type::VoidTy ? 0 : UndefValue::get(RetTy);
+ new ReturnInst(RetVal, &BB);
+ }
+ }
+
// Helper functions for visiting operands of every instruction
//
// visitOperands() works on every operand in [firstOp, lastOp-1].
OpenPOWER on IntegriCloud