brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 2c4d529 Raw
95 lines · plain
1; RUN: llc < %s -enable-emscripten-cxx-exceptions | FileCheck %s --check-prefix=EH2; RUN: llc < %s -enable-emscripten-sjlj | FileCheck %s --check-prefix=SJLJ3; RUN: llc < %s | FileCheck %s --check-prefix=NONE4 5target triple = "wasm32-unknown-unknown"6 7; EH: .functype  invoke_vi (i32, i32) -> ()8; EH: .import_module  invoke_vi, env9; EH: .import_name  invoke_vi, invoke_vi10; EH-NOT: .functype  __invoke_void_i3211; EH-NOT: .import_module  __invoke_void_i3212; EH-NOT: .import_name  __invoke_void_i3213 14; SJLJ: .functype  emscripten_longjmp (i32, i32) -> ()15; SJLJ-NOT: .functype  emscripten_longjmp_jmpbuf16 17%struct.__jmp_buf_tag = type { [6 x i32], i32, [32 x i32] }18 19define void @exception() personality ptr @__gxx_personality_v0 {20; EH-LABEL:   type exception,@function21; NONE-LABEL: type exception,@function22entry:23  invoke void @foo(i32 3)24          to label %invoke.cont unwind label %lpad25; EH:     call invoke_vi26; EH-NOT: call __invoke_void_i3227; NONE:   call foo28 29invoke.cont:30  invoke void @bar()31          to label %try.cont unwind label %lpad32; EH:     call invoke_v33; EH-NOT: call __invoke_void34; NONE:   call bar35 36lpad:                                             ; preds = %entry37  %0 = landingpad { ptr, i32 }38          catch ptr null39  %1 = extractvalue { ptr, i32 } %0, 040  %2 = extractvalue { ptr, i32 } %0, 141  %3 = call ptr @__cxa_begin_catch(ptr %1) #242  call void @__cxa_end_catch()43  br label %try.cont44 45try.cont:                                         ; preds = %entry, %lpad46  ret void47}48 49define void @setjmp_longjmp() {50; SJLJ-LABEL: type setjmp_longjmp,@function51; NONE-LABEL: type setjmp_longjmp,@function52entry:53  %buf = alloca [1 x %struct.__jmp_buf_tag], align 1654  %call = call i32 @setjmp(ptr %buf) #055  call void @longjmp(ptr %buf, i32 1) #156  unreachable57; SJLJ: call __wasm_setjmp58; SJLJ: i32.const emscripten_longjmp59; SJLJ-NOT: i32.const emscripten_longjmp_jmpbuf60; SJLJ: call invoke_vii61; SJLJ-NOT: call "__invoke_void_ptr_i32"62; SJLJ: call __wasm_setjmp_test63 64; NONE: call setjmp65; NONE: call longjmp66}67 68; Tests whether a user function with 'invoke_' prefix can be used69declare void @invoke_ignoreme()70define void @test_invoke_ignoreme() {71; EH-LABEL:   type test_invoke_ignoreme,@function72; SJLJ-LABEL: type test_invoke_ignoreme,@function73entry:74  call void @invoke_ignoreme()75; EH:   call invoke_ignoreme76; SJLJ: call invoke_ignoreme77  ret void78}79 80declare void @foo(i32)81declare void @bar()82declare i32 @__gxx_personality_v0(...)83declare ptr @__cxa_begin_catch(ptr)84declare void @__cxa_end_catch()85; Function Attrs: returns_twice86declare i32 @setjmp(ptr) #087; Function Attrs: noreturn88declare void @longjmp(ptr, i32) #189declare ptr @malloc(i32)90declare void @free(ptr)91 92attributes #0 = { returns_twice }93attributes #1 = { noreturn }94attributes #2 = { nounwind }95