Add support for setjmp/longjmp primitives

Patch checked in for Bill Wendling :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6241 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2003-05-17 22:26:33 +00:00
parent 9b11f48711
commit c436b37262
5 changed files with 44 additions and 16 deletions

View File

@@ -543,6 +543,7 @@ void CWriter::printModule(Module *M) {
Out << "/* Provide Declarations */\n";
generateAllocaDecl(Out);
Out << "#include <stdarg.h>\n";
Out << "#include <setjmp.h>\n";
// Provide a definition for null if one does not already exist,
// and for `bool' if not compiling with a C++ compiler.
@@ -1022,7 +1023,6 @@ void CWriter::visitCallInst(CallInst &I) {
writeOperand(&I.getParent()->getParent()->aback());
Out << ")";
return;
case LLVMIntrinsic::va_end:
Out << "va_end((va_list)*";
writeOperand(I.getOperand(1));
@@ -1035,6 +1035,19 @@ void CWriter::visitCallInst(CallInst &I) {
writeOperand(I.getOperand(2));
Out << ")";
return;
case LLVMIntrinsic::setjmp:
Out << "setjmp((jmp_buf)";
writeOperand(I.getOperand(1));
Out << ")";
return;
case LLVMIntrinsic::longjmp:
Out << "longjmp((jmp_buf)";
writeOperand(I.getOperand(1));
Out << ", ";
writeOperand(I.getOperand(2));
Out << ")";
return;
}
}