1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/CodeGen/WebAssembly/externref-globalset.ll
Paulo Matos e8be0ee828 [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR
Reland of 31859f896.

This change implements new DAG notes GLOBAL_GET/GLOBAL_SET, and
lowering methods for load and stores of reference types from IR
globals. Once the lowering creates the new nodes, tablegen pattern
matches those and converts them to Wasm global.get/set.

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D104797
2021-07-22 22:07:24 +02:00

21 lines
708 B
LLVM

; 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_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
ret void
}
; CHECK-LABEL: set_externref_global:
; CHECK-NEXT: functype set_externref_global (externref) -> ()
; CHECK-NEXT: local.get 0
; CHECK-NEXT: global.set externref_global
; CHECK-NEXT: end_function
; CHECK: .globl externref_global