Skip to content

Commit 00ce5e8

Browse files
committed
add wasm eh intrinsics
1 parent 82336c1 commit 00ce5e8

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

compiler/rustc_codegen_llvm/src/context.rs

+4
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,10 @@ impl<'ll> CodegenCx<'ll, '_> {
662662
let t_f32 = self.type_f32();
663663
let t_f64 = self.type_f64();
664664
let t_metadata = self.type_metadata();
665+
let t_token = self.type_token();
666+
667+
ifn!("llvm.wasm.get.exception", fn(t_token) -> i8p);
668+
ifn!("llvm.wasm.get.ehselector", fn(t_token) -> t_i32);
665669

666670
ifn!("llvm.wasm.trunc.unsigned.i32.f32", fn(t_f32) -> t_i32);
667671
ifn!("llvm.wasm.trunc.unsigned.i32.f64", fn(t_f64) -> t_i32);

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,7 @@ extern "C" {
10711071

10721072
// Operations on other types
10731073
pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
1074+
pub fn LLVMTokenTypeInContext(C: &Context) -> &Type;
10741075
pub fn LLVMMetadataTypeInContext(C: &Context) -> &Type;
10751076

10761077
// Operations on all values

compiler/rustc_codegen_llvm/src/type_.rs

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ impl<'ll> CodegenCx<'ll, '_> {
5252
unsafe { llvm::LLVMVoidTypeInContext(self.llcx) }
5353
}
5454

55+
pub(crate) fn type_token(&self) -> &'ll Type {
56+
unsafe { llvm::LLVMTokenTypeInContext(self.llcx) }
57+
}
58+
5559
pub(crate) fn type_metadata(&self) -> &'ll Type {
5660
unsafe { llvm::LLVMMetadataTypeInContext(self.llcx) }
5761
}

0 commit comments

Comments
 (0)