From 6e264f078a4153beb8a6d9588078ce7b892a6986 Mon Sep 17 00:00:00 2001 From: John Criswell Date: Thu, 31 Jul 2003 15:11:08 +0000 Subject: [PATCH] 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. llvm-svn: 7449 --- llvm/lib/CWriter/Writer.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/llvm/lib/CWriter/Writer.cpp b/llvm/lib/CWriter/Writer.cpp index 88cf718dae55..ad242c77c46e 100644 --- a/llvm/lib/CWriter/Writer.cpp +++ b/llvm/lib/CWriter/Writer.cpp @@ -570,7 +570,9 @@ void CWriter::printModule(Module *M) { // get declaration for alloca Out << "/* Provide Declarations */\n"; Out << "#include \n"; +#ifdef HAVE_JUMP Out << "#include \n"; +#endif generateCompilerSpecificCode(Out); // Provide a definition for `bool' if not compiling with a C++ compiler. @@ -1123,16 +1125,32 @@ void CWriter::visitCallInst(CallInst &I) { 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; } }