summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CWriter/Writer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-24 13:06:10 +0000
committerChris Lattner <sabre@nondot.org>2003-08-24 13:06:10 +0000
commit35829a154dd093e367b620c60aeb7075557a1b7d (patch)
tree5fe94983157bf6cb65222932b2e7216c00e1d8ff /llvm/lib/CWriter/Writer.cpp
parent88b2fba6ee55b8b8eaa710a39bdf667ef3275c7e (diff)
downloadbcm5719-llvm-35829a154dd093e367b620c60aeb7075557a1b7d.tar.gz
bcm5719-llvm-35829a154dd093e367b620c60aeb7075557a1b7d.zip
Implement support for the unwind intrinsic in the CBE
llvm-svn: 8116
Diffstat (limited to 'llvm/lib/CWriter/Writer.cpp')
-rw-r--r--llvm/lib/CWriter/Writer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CWriter/Writer.cpp b/llvm/lib/CWriter/Writer.cpp
index 4bc354bdee1..7f2b14d3277 100644
--- a/llvm/lib/CWriter/Writer.cpp
+++ b/llvm/lib/CWriter/Writer.cpp
@@ -1137,6 +1137,19 @@ void CWriter::visitCallInst(CallInst &I) {
writeOperand(I.getOperand(2));
Out << ")";
return;
+
+ case LLVMIntrinsic::unwind:
+ // The unwind intrinsic calls a control flow transfer out of the current
+ // function, unwinding the stack until a caller who used the invoke
+ // instruction is found. In this context, we code generated the invoke
+ // instruction to add an entry to the top of the jmpbuf_list. Thus,
+ // here we just have to longjmp to the specified handler.
+ Out << "if (__llvm_jmpbuf_list == 0) { /* llvm.unwind */\n"
+ << " printf(\"throw found with no handler!\\n\"); abort();\n"
+ << " }\n"
+ << " longjmp(__llvm_jmpbuf_list->buf, 1)";
+ return;
+
case LLVMIntrinsic::setjmp:
case LLVMIntrinsic::sigsetjmp:
OpenPOWER on IntegriCloud