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

John Criswell criswell at cs.uiuc.edu
Thu Jul 31 10:12:03 PDT 2003


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.111 -> 1.112

---
Log message:

Modified the code so that it generates (0) for setjmp() and abort() for
longjmp() (and does not include setjmp.h).
This is to fix some problems on Sparc while non-local jumps are still
unimplemented.


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.111 llvm/lib/CWriter/Writer.cpp:1.112
--- llvm/lib/CWriter/Writer.cpp:1.111	Fri Jul 25 15:21:06 2003
+++ llvm/lib/CWriter/Writer.cpp	Thu Jul 31 10:11:08 2003
@@ -570,7 +570,9 @@
   // get declaration for alloca
   Out << "/* Provide Declarations */\n";
   Out << "#include <stdarg.h>\n";
+#ifdef HAVE_JUMP
   Out << "#include <setjmp.h>\n";
+#endif
   generateCompilerSpecificCode(Out);
   
   // Provide a definition for `bool' if not compiling with a C++ compiler.
@@ -1123,16 +1125,32 @@
         return;
         
       case LLVMIntrinsic::setjmp:
+#ifdef HAVE_JUMP
         Out << "setjmp(*(jmp_buf*)";
         writeOperand(I.getOperand(1));
         Out << ")";
+#else
+        //
+        // For right now, we don't really support non-local jumps.  So
+        // make setjmp() always evaluate to zero for now.
+        //
+        Out << "(0)";
+#endif
         return;
       case LLVMIntrinsic::longjmp:
+#ifdef HAVE_JUMP
         Out << "longjmp(*(jmp_buf*)";
         writeOperand(I.getOperand(1));
         Out << ", ";
         writeOperand(I.getOperand(2));
         Out << ")";
+#else
+        //
+        // For right now, we don't really support non-local jumps.  So
+        // make longjmp() abort the program.
+        //
+        Out << "abort()";
+#endif
         return;
       }
     }





More information about the llvm-commits mailing list