reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %s -o - | obj2yaml | FileCheck %s
; RUN: llc -filetype=obj -exception-model=wasm -mattr=+exception-handling %s -o - | llvm-readobj -S | FileCheck -check-prefix=SEC %s

target triple = "wasm32-unknown-unknown"

declare void @llvm.wasm.throw(i32, i8*)

define i32 @test_throw0(i8* %p) {
  call void @llvm.wasm.throw(i32 0, i8* %p)
  ret i32 0
}

define i32 @test_throw1(i8* %p) {
  call void @llvm.wasm.throw(i32 0, i8* %p)
  ret i32 1
}

; CHECK:      Sections:
; CHECK-NEXT:   - Type:            TYPE
; CHECK-NEXT:     Signatures:
; CHECK-NEXT:       - Index:           0
; CHECK-NEXT:         ParamTypes:
; CHECK-NEXT:           - I32
; CHECK-NEXT:         ReturnTypes:
; CHECK-NEXT:           - I32
; CHECK-NEXT:       - Index:           1
; CHECK-NEXT:         ParamTypes:
; CHECK-NEXT:           - I32
; CHECK-NEXT:         ReturnTypes:      []

; CHECK:        - Type:            EVENT
; CHECK-NEXT:     Events:
; CHECK-NEXT:       - Index:           0
; CHECK-NEXT:         Attribute:       0
; CHECK-NEXT:         SigIndex:        1

; CHECK-NEXT:   - Type:            CODE
; CHECK-NEXT:     Relocations:
; CHECK-NEXT:       - Type:            R_WASM_EVENT_INDEX_LEB
; CHECK-NEXT:         Index:           1
; CHECK-NEXT:         Offset:          0x00000006
; CHECK-NEXT:       - Type:            R_WASM_EVENT_INDEX_LEB
; CHECK-NEXT:         Index:           1
; CHECK-NEXT:         Offset:          0x00000011

; CHECK:        - Type:            CUSTOM
; CHECK-NEXT:     Name:            linking
; CHECK-NEXT:     Version:         2
; CHECK-NEXT:     SymbolTable:

; CHECK:            - Index:           1
; CHECK-NEXT:         Kind:            EVENT
; CHECK-NEXT:         Name:            __cpp_exception
; CHECK-NEXT:         Flags:           [ BINDING_WEAK ]
; CHECK-NEXT:         Event:           0

; SEC:          Type: EVENT (0xD)
; SEC-NEXT:     Size: 3
; SEC-NEXT:     Offset: 97