[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Aug 24 08:07:01 PDT 2003


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.117 -> 1.118

---
Log message:

Implement support for the unwind intrinsic in the CBE


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.117 llvm/lib/CWriter/Writer.cpp:1.118
--- llvm/lib/CWriter/Writer.cpp:1.117	Mon Aug 18 11:06:07 2003
+++ llvm/lib/CWriter/Writer.cpp	Sun Aug 24 08:06:10 2003
@@ -1137,6 +1137,19 @@
         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:





More information about the llvm-commits mailing list