Add Rust definitions for new LLVM EH instructions

Issue #236
This commit is contained in:
Brian Anderson 2011-09-07 11:58:49 -07:00
parent 4bced5e5f2
commit 5e4637b61f
3 changed files with 29 additions and 0 deletions

View File

@ -572,6 +572,9 @@ native "cdecl" mod llvm = "rustllvm" {
fn LLVMBuildInvoke(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
NumArgs: uint, Then: BasicBlockRef,
Catch: BasicBlockRef, Name: sbuf) -> ValueRef;
fn LLVMBuildLandingPad(B: BuilderRef, Ty: TypeRef, PersFn: ValueRef,
NumClauses: uint, Name: sbuf) -> ValueRef;
fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
/* Add a case to the switch instruction */
@ -580,6 +583,12 @@ native "cdecl" mod llvm = "rustllvm" {
/* Add a destination to the indirectbr instruction */
fn LLVMAddDestination(IndirectBr: ValueRef, Dest: BasicBlockRef);
/* Add a clause to the landing pad instruction */
fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
/* Set the cleanup on a landing pad instruction */
fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
/* Arithmetic */
fn LLVMBuildAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef, Name: sbuf)
-> ValueRef;

View File

@ -545,6 +545,22 @@ fn Trap(cx: &@block_ctxt) -> ValueRef {
});
}
fn LandingPad(cx: &@block_ctxt, Ty: TypeRef, PersFn: ValueRef,
NumClauses: uint) -> ValueRef {
ret str::as_buf("",
{|buf|
llvm::LLVMBuildLandingPad(B(cx),
Ty,
PersFn,
NumClauses,
buf)
});
}
fn SetCleanup(_cx: &@block_ctxt, LandingPad: ValueRef) {
llvm::LLVMSetCleanup(LandingPad, lib::llvm::True);
}
//
// Local Variables:
// mode: rust

View File

@ -25,6 +25,7 @@ LLVMAddAttribute
LLVMAddBasicAliasAnalysisPass
LLVMAddCFGSimplificationPass
LLVMAddCase
LLVMAddClause
LLVMAddConstantMergePass
LLVMAddConstantPropagationPass
LLVMAddCorrelatedValuePropagationPass
@ -122,6 +123,7 @@ LLVMBuildIntToPtr
LLVMBuildInvoke
LLVMBuildIsNotNull
LLVMBuildIsNull
LLVMBuildLandingPad
LLVMBuildLShr
LLVMBuildLoad
LLVMBuildMalloc
@ -141,6 +143,7 @@ LLVMBuildPhi
LLVMBuildPointerCast
LLVMBuildPtrDiff
LLVMBuildPtrToInt
LLVMBuildResume
LLVMBuildRet
LLVMBuildRetVoid
LLVMBuildSDiv
@ -548,6 +551,7 @@ LLVMRunPassManager
LLVMRunStaticConstructors
LLVMRunStaticDestructors
LLVMSetAlignment
LLVMSetCleanup
LLVMSetCurrentDebugLocation
LLVMSetDataLayout
LLVMSetFunctionCallConv