diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-10-16 18:14:10 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-10-16 18:14:10 +0000 |
| commit | ea9a85abe4b4b8aaf03ac0707aa56d098228f013 (patch) | |
| tree | 853532557b5eb1b928a21dbdf3a65f98170403d3 /llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp | |
| parent | a3f3c8a1adb8c98ea38b942846a31ac7ed341273 (diff) | |
| download | bcm5719-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.cpp | 9 |
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]. |

