Skip to content

Commit

Permalink
The HAVE_JUMP code is dead, these intrinsics should _never_ be expanded
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7642 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lattner committed Aug 6, 2003
1 parent 8043127 commit 326e40a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 46 deletions.
29 changes: 6 additions & 23 deletions lib/Target/CBackend/CBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,32 +1123,15 @@ 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
// This instrinsic should never exist in the program, but until we get
// setjmp/longjmp transformations going on, we should codegen it to
// something reasonable. This will allow code that never calls longjmp
// to work.
Out << "0";
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.
//
// Treat longjmp the same as setjmp
Out << "abort()";
#endif
return;
}
}
Expand Down
29 changes: 6 additions & 23 deletions lib/Target/CBackend/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,32 +1123,15 @@ 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
// This instrinsic should never exist in the program, but until we get
// setjmp/longjmp transformations going on, we should codegen it to
// something reasonable. This will allow code that never calls longjmp
// to work.
Out << "0";
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.
//
// Treat longjmp the same as setjmp
Out << "abort()";
#endif
return;
}
}
Expand Down

0 comments on commit 326e40a

Please sign in to comment.