forked from OSchip/llvm-project
[WebAssembly][NFC] Update reftype and table tests to use opaque pointers
Differential Revision: https://reviews.llvm.org/D126535
This commit is contained in:
parent
01cfc8a05a
commit
80fb782336
|
@ -1,13 +1,12 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
||||
|
||||
@externref_global = local_unnamed_addr addrspace(1) global %externref undef
|
||||
|
||||
define %externref @return_externref_global() {
|
||||
;; this generates a global.get of @externref_global
|
||||
%ref = load %externref, %externref addrspace(1)* @externref_global
|
||||
%ref = load %externref, ptr addrspace(1) @externref_global
|
||||
ret %externref %ref
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
; RUN: llc --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types < %s | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
||||
|
||||
@externref_global = local_unnamed_addr addrspace(1) global %externref undef
|
||||
|
||||
define void @set_externref_global(%externref %g) {
|
||||
;; this generates a global.set of @externref.global
|
||||
store %externref %g, %externref addrspace(1)* @externref_global
|
||||
store %externref %g, ptr addrspace(1) @externref_global
|
||||
ret void
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types 2>&1 | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)*
|
||||
%externref = type ptr addrspace(10)
|
||||
|
||||
define %externref @int_to_externref(i32 %i) {
|
||||
%ref = inttoptr i32 %i to %externref
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types 2>&1 | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)*
|
||||
%externref = type ptr addrspace(10)
|
||||
|
||||
define i32 @externref_to_int(%externref %ref) {
|
||||
%i = ptrtoint %externref %ref to i32
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
||||
|
||||
@externref_table = local_unnamed_addr addrspace(1) global [0 x %externref] undef
|
||||
|
||||
|
@ -11,8 +10,8 @@ define %externref @get_externref_from_table(i32 %i) {
|
|||
; CHECK-NEXT: local.get 0
|
||||
; CHECK-NEXT: table.get externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 %i
|
||||
%ref = load %externref, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace(1) @externref_table, i32 0, i32 %i
|
||||
%ref = load %externref, ptr addrspace(1) %p
|
||||
ret %externref %ref
|
||||
}
|
||||
|
||||
|
@ -22,8 +21,8 @@ define %externref @get_externref_from_table_const() {
|
|||
; CHECK-NEXT: i32.const 0
|
||||
; CHECK-NEXT: table.get externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 0
|
||||
%ref = load %externref, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace (1) @externref_table, i32 0, i32 0
|
||||
%ref = load %externref, ptr addrspace(1) %p
|
||||
ret %externref %ref
|
||||
}
|
||||
|
||||
|
@ -36,8 +35,8 @@ define %externref @get_externref_from_table_with_offset(i32 %i) {
|
|||
; CHECK-NEXT: table.get externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%off = add nsw i32 %i, 2
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 %off
|
||||
%ref = load %externref, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace (1) @externref_table, i32 0, i32 %off
|
||||
%ref = load %externref, ptr addrspace(1) %p
|
||||
ret %externref %ref
|
||||
}
|
||||
|
||||
|
@ -51,8 +50,8 @@ define %externref @get_externref_from_table_with_var_offset(i32 %i, i32 %j) {
|
|||
; CHECK-NEXT: table.get externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%off = add nsw i32 %i, %j
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 %off
|
||||
%ref = load %externref, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace (1) @externref_table, i32 0, i32 %off
|
||||
%ref = load %externref, ptr addrspace(1) %p
|
||||
ret %externref %ref
|
||||
}
|
||||
|
||||
|
@ -68,8 +67,8 @@ define %externref @get_externref_from_table_with_var_offset2(i32 %i) {
|
|||
; CHECK-NEXT: end_function
|
||||
%j = call i32 @get_offset()
|
||||
%off = add nsw i32 %i, %j
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 %off
|
||||
%ref = load %externref, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace (1) @externref_table, i32 0, i32 %off
|
||||
%ref = load %externref, ptr addrspace(1) %p
|
||||
ret %externref %ref
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
; RUN: llc --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types < %s | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
||||
|
||||
@externref_table = local_unnamed_addr addrspace(1) global [0 x %externref] undef
|
||||
|
||||
|
@ -14,8 +13,8 @@ define void @set_externref_table(%externref %g, i32 %i) {
|
|||
; CHECK-NEXT: end_function
|
||||
|
||||
;; this generates a table.set of @externref_table
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 %i
|
||||
store %externref %g, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace (1) @externref_table, i32 0, i32 %i
|
||||
store %externref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -26,8 +25,8 @@ define void @set_externref_table_const(%externref %g) {
|
|||
; CHECK-NEXT: local.get 0
|
||||
; CHECK-NEXT: table.set externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 0
|
||||
store %externref %g, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace (1) @externref_table, i32 0, i32 0
|
||||
store %externref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -41,8 +40,8 @@ define void @set_externref_table_with_offset(%externref %g, i32 %i) {
|
|||
; CHECK-NEXT: table.set externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%off = add nsw i32 %i, 2
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 %off
|
||||
store %externref %g, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace (1) @externref_table, i32 0, i32 %off
|
||||
store %externref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -56,8 +55,8 @@ define void @set_externref_table_with_var_offset(%externref %g, i32 %i, i32 %j)
|
|||
; CHECK-NEXT: table.set externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%off = add nsw i32 %i, %j
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 %off
|
||||
store %externref %g, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace (1) @externref_table, i32 0, i32 %off
|
||||
store %externref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -74,8 +73,8 @@ define void @set_externref_table_with_var_offset2(%externref %g, i32 %i) {
|
|||
; CHECK-NEXT: end_function
|
||||
%j = call i32 @set_offset()
|
||||
%off = add nsw i32 %i, %j
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 %off
|
||||
store %externref %g, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace (1) @externref_table, i32 0, i32 %off
|
||||
store %externref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -89,8 +88,8 @@ define void @set_externref_table_with_id_from_call(%externref %g) {
|
|||
; CHECK-NEXT: table.set externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%id = call i32 @get_table_slot()
|
||||
%p = getelementptr [0 x %externref], [0 x %externref] addrspace (1)* @externref_table, i32 0, i32 %id
|
||||
store %externref %g, %externref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %externref], ptr addrspace (1) @externref_table, i32 0, i32 %id
|
||||
store %externref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
|
||||
@externref_global = local_unnamed_addr addrspace(1) global %externref undef
|
||||
|
||||
define %extern @return_extern_undef() {
|
||||
; Returning a ref.null or an uninitialized externref would make
|
||||
; more sense if the return type would be %externref. However, in
|
||||
; this case this is an %extern value, which really is an opaque
|
||||
; type and should never really happen.
|
||||
ret %extern undef
|
||||
}
|
||||
|
||||
; CHECK-LABEL: return_extern_undef:
|
||||
; CHECK-NEXT: functype return_extern_undef () -> ()
|
||||
; CHECK-NEXT: end_function
|
||||
|
||||
; CHECK: .globl externref_global
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
; RUN: not llc --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types < %s 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)*
|
||||
%externref = type ptr addrspace(10)
|
||||
|
||||
define void @load_extern(%externref %ref) {
|
||||
%e = load %extern, %externref %ref
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
; RUN: not llc --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types < %s 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)*
|
||||
%externref = type ptr addrspace(10)
|
||||
|
||||
define void @store_extern(%externref %ref) {
|
||||
store %extern undef, %externref %ref
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
|
||||
|
||||
%funcptr = type void () addrspace(20)*
|
||||
%funcref = type i8 addrspace(20)* ;; addrspace 20 is nonintegral
|
||||
%funcref = type ptr addrspace(20) ;; addrspace 20 is nonintegral
|
||||
|
||||
; CHECK: .tabletype __funcref_call_table, funcref, 1
|
||||
|
||||
|
@ -16,23 +15,6 @@ define void @call_funcref(%funcref %ref) {
|
|||
; CHECK-NEXT: i32.const 0
|
||||
; CHECK-NEXT: ref.null_func
|
||||
; CHECK-NEXT: table.set __funcref_call_table
|
||||
; CHECK-NEXT: end_function
|
||||
%f = bitcast %funcref %ref to %funcptr
|
||||
call addrspace(20) void %f()
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @call_funcptr(%funcptr %ref) {
|
||||
; CHECK-LABEL: call_funcptr:
|
||||
; CHECK-NEXT: .functype call_funcptr (funcref) -> ()
|
||||
; CHECK-NEXT: i32.const 0
|
||||
; CHECK-NEXT: local.get 0
|
||||
; CHECK-NEXT: table.set __funcref_call_table
|
||||
; CHECK-NEXT: i32.const 0
|
||||
; CHECK-NEXT: call_indirect __funcref_call_table, () -> ()
|
||||
; CHECK-NEXT: i32.const 0
|
||||
; CHECK-NEXT: ref.null_func
|
||||
; CHECK-NEXT: table.set __funcref_call_table
|
||||
; CHECK-NEXT: end_function
|
||||
call addrspace(20) void %ref()
|
||||
ret void
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
|
||||
|
||||
%funcref = type i8 addrspace(20)* ;; addrspace 20 is nonintegral
|
||||
%funcref = type ptr addrspace(20) ;; addrspace 20 is nonintegral
|
||||
|
||||
@funcref_global = local_unnamed_addr addrspace(1) global %funcref undef
|
||||
|
||||
define %funcref @return_funcref_global() {
|
||||
;; this generates a global.get of @funcref_global
|
||||
%ref = load %funcref, %funcref addrspace(1)* @funcref_global
|
||||
%ref = load %funcref, ptr addrspace(1) @funcref_global
|
||||
ret %funcref %ref
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
|
||||
|
||||
%funcref = type i8 addrspace(20)* ;; addrspace 20 is nonintegral
|
||||
%funcref = type ptr addrspace(20) ;; addrspace 20 is nonintegral
|
||||
|
||||
@funcref_global = local_unnamed_addr addrspace(1) global %funcref undef
|
||||
|
||||
define void @set_funcref_global(%funcref %g) {
|
||||
;; this generates a global.set of @funcref_global
|
||||
store %funcref %g, %funcref addrspace(1)* @funcref_global
|
||||
store %funcref %g, ptr addrspace(1) @funcref_global
|
||||
ret void
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
|
||||
|
||||
%funcptr = type void () addrspace(20)*
|
||||
%funcref = type i8 addrspace(20)* ;; addrspace 20 is nonintegral
|
||||
%funcref = type ptr addrspace(20) ;; addrspace 20 is nonintegral
|
||||
|
||||
@funcref_table = local_unnamed_addr addrspace(1) global [0 x %funcref] undef
|
||||
|
||||
|
@ -20,10 +19,9 @@ define void @call_funcref_from_table(i32 %i) {
|
|||
; CHECK-NEXT: ref.null_func
|
||||
; CHECK-NEXT: table.set __funcref_call_table
|
||||
; CHECK-NEXT: end_function
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 %i
|
||||
%ref = load %funcref, %funcref addrspace(1)* %p
|
||||
%fn = bitcast %funcref %ref to %funcptr
|
||||
call addrspace(20) void %fn()
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 %i
|
||||
%ref = load %funcref, ptr addrspace(1) %p
|
||||
call addrspace(20) void %ref()
|
||||
ret void
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
|
||||
|
||||
%funcref = type i8 addrspace(20)* ;; addrspace 20 is nonintegral
|
||||
%funcref = type ptr addrspace(20) ;; addrspace 20 is nonintegral
|
||||
|
||||
@funcref_table = local_unnamed_addr addrspace(1) global [0 x %funcref] undef
|
||||
|
||||
|
@ -10,8 +10,8 @@ define %funcref @get_funcref_from_table(i32 %i) {
|
|||
; CHECK-NEXT: local.get 0
|
||||
; CHECK-NEXT: table.get funcref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 %i
|
||||
%ref = load %funcref, %funcref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 %i
|
||||
%ref = load %funcref, ptr addrspace(1) %p
|
||||
ret %funcref %ref
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ define %funcref @get_funcref_from_table_const() {
|
|||
; CHECK-NEXT: i32.const 0
|
||||
; CHECK-NEXT: table.get funcref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 0
|
||||
%ref = load %funcref, %funcref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 0
|
||||
%ref = load %funcref, ptr addrspace(1) %p
|
||||
ret %funcref %ref
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,8 @@ define %funcref @get_funcref_from_table_with_offset(i32 %i) {
|
|||
; CHECK-NEXT: table.get funcref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%off = add nsw i32 %i, 2
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 %off
|
||||
%ref = load %funcref, %funcref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 %off
|
||||
%ref = load %funcref, ptr addrspace(1) %p
|
||||
ret %funcref %ref
|
||||
}
|
||||
|
||||
|
@ -50,8 +50,8 @@ define %funcref @get_funcref_from_table_with_var_offset(i32 %i, i32 %j) {
|
|||
; CHECK-NEXT: table.get funcref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%off = add nsw i32 %i, %j
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 %off
|
||||
%ref = load %funcref, %funcref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 %off
|
||||
%ref = load %funcref, ptr addrspace(1) %p
|
||||
ret %funcref %ref
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,8 @@ define %funcref @get_funcref_from_table_with_var_offset2(i32 %i) {
|
|||
; CHECK-NEXT: end_function
|
||||
%j = call i32 @get_offset()
|
||||
%off = add nsw i32 %i, %j
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 %off
|
||||
%ref = load %funcref, %funcref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 %off
|
||||
%ref = load %funcref, ptr addrspace(1) %p
|
||||
ret %funcref %ref
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; RUN: llc --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types < %s | FileCheck %s
|
||||
|
||||
%funcref = type i8 addrspace(20)* ;; addrspace 20 is nonintegral
|
||||
%funcref = type ptr addrspace(20) ;; addrspace 20 is nonintegral
|
||||
|
||||
@funcref_table = local_unnamed_addr addrspace(1) global [0 x %funcref] undef
|
||||
|
||||
|
@ -13,8 +13,8 @@ define void @set_funcref_table(%funcref %g, i32 %i) {
|
|||
; CHECK-NEXT: end_function
|
||||
|
||||
;; this generates a table.set of @funcref_table
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 %i
|
||||
store %funcref %g, %funcref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 %i
|
||||
store %funcref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ define void @set_funcref_table_const(%funcref %g) {
|
|||
; CHECK-NEXT: local.get 0
|
||||
; CHECK-NEXT: table.set funcref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 0
|
||||
store %funcref %g, %funcref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 0
|
||||
store %funcref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ define void @set_funcref_table_with_offset(%funcref %g, i32 %i) {
|
|||
; CHECK-NEXT: table.set funcref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%off = add nsw i32 %i, 2
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 %off
|
||||
store %funcref %g, %funcref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 %off
|
||||
store %funcref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -55,8 +55,8 @@ define void @set_funcref_table_with_var_offset(%funcref %g, i32 %i, i32 %j) {
|
|||
; CHECK-NEXT: table.set funcref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%off = add nsw i32 %i, %j
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 %off
|
||||
store %funcref %g, %funcref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 %off
|
||||
store %funcref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -73,8 +73,8 @@ define void @set_funcref_table_with_var_offset2(%funcref %g, i32 %i) {
|
|||
; CHECK-NEXT: end_function
|
||||
%j = call i32 @set_offset()
|
||||
%off = add nsw i32 %i, %j
|
||||
%p = getelementptr [0 x %funcref], [0 x %funcref] addrspace (1)* @funcref_table, i32 0, i32 %off
|
||||
store %funcref %g, %funcref addrspace(1)* %p
|
||||
%p = getelementptr [0 x %funcref], ptr addrspace (1) @funcref_table, i32 0, i32 %off
|
||||
store %funcref %g, ptr addrspace(1) %p
|
||||
ret void
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc --mtriple=wasm32-unknown-unknown -mattr=+reference-types < %s | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
%funcref = type i8 addrspace(20)* ;; addrspace 20 is nonintegral
|
||||
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
||||
%funcref = type ptr addrspace(20) ;; addrspace 20 is nonintegral
|
||||
|
||||
declare %externref @llvm.wasm.ref.null.extern() nounwind
|
||||
declare %funcref @llvm.wasm.ref.null.func() nounwind
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
; RUN: llc --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types < %s | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
||||
|
||||
@externref_table1 = local_unnamed_addr addrspace(1) global [0 x %externref] undef
|
||||
@externref_table2 = local_unnamed_addr addrspace(1) global [0 x %externref] undef
|
||||
|
||||
declare void @llvm.wasm.table.copy(i8 addrspace(1)*, i8 addrspace(1)*, i32, i32, i32) nounwind readonly
|
||||
declare void @llvm.wasm.table.copy(ptr addrspace(1), ptr addrspace(1), i32, i32, i32) nounwind readonly
|
||||
|
||||
define void @table_copy(i32 %dst, i32 %src, i32 %len) {
|
||||
; CHECK-LABEL: table_copy:
|
||||
|
@ -16,11 +15,9 @@ define void @table_copy(i32 %dst, i32 %src, i32 %len) {
|
|||
; CHECK-NEXT: local.get 2
|
||||
; CHECK-NEXT: table.copy externref_table1, externref_table2
|
||||
; CHECK-NEXT: end_function
|
||||
%tableptr1 = getelementptr [0 x %externref], [0 x %externref] addrspace(1)* @externref_table1, i32 0, i32 0
|
||||
%tb1 = bitcast %externref addrspace(1)* %tableptr1 to i8 addrspace(1)*
|
||||
%tableptr2 = getelementptr [0 x %externref], [0 x %externref] addrspace(1)* @externref_table2, i32 0, i32 0
|
||||
%tb2 = bitcast %externref addrspace(1)* %tableptr2 to i8 addrspace(1)*
|
||||
call void @llvm.wasm.table.copy(i8 addrspace(1)* %tb1, i8 addrspace(1)* %tb2, i32 %dst, i32 %src, i32 %len)
|
||||
%tableptr1 = getelementptr [0 x %externref], ptr addrspace(1) @externref_table1, i32 0, i32 0
|
||||
%tableptr2 = getelementptr [0 x %externref], ptr addrspace(1) @externref_table2, i32 0, i32 0
|
||||
call void @llvm.wasm.table.copy(ptr addrspace(1) %tableptr1, ptr addrspace(1) %tableptr2, i32 %dst, i32 %src, i32 %len)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -37,8 +34,7 @@ define void @self_table_copy(i32 %src, i32 %off, i32 %len) {
|
|||
; CHECK-NEXT: table.copy externref_table1, externref_table1
|
||||
; CHECK-NEXT: end_function
|
||||
%dst = add nsw i32 %src, %off
|
||||
%tableptr1 = getelementptr [0 x %externref], [0 x %externref] addrspace(1)* @externref_table1, i32 0, i32 0
|
||||
%tb1 = bitcast %externref addrspace(1)* %tableptr1 to i8 addrspace(1)*
|
||||
call void @llvm.wasm.table.copy(i8 addrspace(1)* %tb1, i8 addrspace(1)* %tb1, i32 %dst, i32 %src, i32 %len)
|
||||
%tableptr1 = getelementptr [0 x %externref], ptr addrspace(1) @externref_table1, i32 0, i32 0
|
||||
call void @llvm.wasm.table.copy(ptr addrspace(1) %tableptr1, ptr addrspace(1) %tableptr1, i32 %dst, i32 %src, i32 %len)
|
||||
ret void
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
; RUN: llc --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types < %s | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
||||
|
||||
@externref_table = local_unnamed_addr addrspace(1) global [0 x %externref] undef
|
||||
|
||||
declare void @llvm.wasm.table.fill.externref(i8 addrspace(1)*, i32, %externref, i32) nounwind readonly
|
||||
declare void @llvm.wasm.table.fill.externref(ptr addrspace(1), i32, %externref, i32) nounwind readonly
|
||||
|
||||
define void @table_fill(i32 %start, i32 %len, %externref %val) {
|
||||
; CHECK-LABEL: table_fill:
|
||||
|
@ -15,8 +14,7 @@ define void @table_fill(i32 %start, i32 %len, %externref %val) {
|
|||
; CHECK-NEXT: local.get 1
|
||||
; CHECK-NEXT: table.fill externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%tableptr = getelementptr [0 x %externref], [0 x %externref] addrspace(1)* @externref_table, i32 0, i32 0
|
||||
%tb = bitcast %externref addrspace(1)* %tableptr to i8 addrspace(1)*
|
||||
call void @llvm.wasm.table.fill.externref(i8 addrspace(1)* %tb, i32 %start, %externref %val, i32 %len)
|
||||
%tableptr = getelementptr [0 x %externref], ptr addrspace(1) @externref_table, i32 0, i32 0
|
||||
call void @llvm.wasm.table.fill.externref(ptr addrspace(1) %tableptr, i32 %start, %externref %val, i32 %len)
|
||||
ret void
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
; RUN: llc --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types < %s | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
||||
|
||||
@externref_table = local_unnamed_addr addrspace(1) global [0 x %externref] undef
|
||||
|
||||
declare i32 @llvm.wasm.table.grow.externref(i8 addrspace(1)*, %externref, i32) nounwind readonly
|
||||
declare i32 @llvm.wasm.table.grow.externref(ptr addrspace(1), %externref, i32) nounwind readonly
|
||||
declare %externref @llvm.wasm.ref.null.extern() nounwind readonly
|
||||
|
||||
define i32 @table_grow(i32 %sz) {
|
||||
|
@ -16,8 +15,7 @@ define i32 @table_grow(i32 %sz) {
|
|||
; CHECK-NEXT: table.grow externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%null = call %externref @llvm.wasm.ref.null.extern()
|
||||
%tableptr = getelementptr [0 x %externref], [0 x %externref] addrspace(1)* @externref_table, i32 0, i32 0
|
||||
%tb = bitcast %externref addrspace(1)* %tableptr to i8 addrspace(1)*
|
||||
%newsz = call i32 @llvm.wasm.table.grow.externref(i8 addrspace(1)* %tb, %externref %null, i32 %sz)
|
||||
%tableptr = getelementptr [0 x %externref], ptr addrspace(1) @externref_table, i32 0, i32 0
|
||||
%newsz = call i32 @llvm.wasm.table.grow.externref(ptr addrspace(1) %tableptr, %externref %null, i32 %sz)
|
||||
ret i32 %newsz
|
||||
}
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
; RUN: llc --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types < %s | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
||||
|
||||
@externref_table = local_unnamed_addr addrspace(1) global [0 x %externref] undef
|
||||
|
||||
declare i32 @llvm.wasm.table.size(i8 addrspace(1)*) nounwind readonly
|
||||
declare i32 @llvm.wasm.table.size(ptr addrspace(1)) nounwind readonly
|
||||
|
||||
define i32 @table_size() {
|
||||
; CHECK-LABEL: table_size:
|
||||
; CHECK-NEXT: .functype table_size () -> (i32)
|
||||
; CHECK-NEXT: table.size externref_table
|
||||
; CHECK-NEXT: end_function
|
||||
%tableptr = getelementptr [0 x %externref], [0 x %externref] addrspace(1)* @externref_table, i32 0, i32 0
|
||||
%tb = bitcast %externref addrspace(1)* %tableptr to i8 addrspace(1)*
|
||||
%sz = call i32 @llvm.wasm.table.size(i8 addrspace(1)* %tb)
|
||||
%tableptr = getelementptr [0 x %externref], ptr addrspace(1) @externref_table, i32 0, i32 0
|
||||
%sz = call i32 @llvm.wasm.table.size(ptr addrspace(1) %tableptr)
|
||||
ret i32 %sz
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | FileCheck %s
|
||||
|
||||
%extern = type opaque
|
||||
%externref = type %extern addrspace(10)* ;; addrspace 10 is nonintegral
|
||||
|
||||
%func = type void ()
|
||||
%funcref = type %func addrspace(20)* ;; addrspace 20 is nonintegral
|
||||
%externref = type ptr addrspace(10) ;; addrspace 10 is nonintegral
|
||||
%funcref = type ptr addrspace(20) ;; addrspace 20 is nonintegral
|
||||
|
||||
; CHECK: .tabletype eref_table, externref
|
||||
; CHECK-NEXT: .globl eref_table
|
||||
|
|
Loading…
Reference in New Issue