summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly/byval.ll
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-06-16 23:59:10 +0000
committerSam Clegg <sbc@chromium.org>2017-06-16 23:59:10 +0000
commit9d24fb7ff318d7a88f0fa3e63eb0df4acafd9805 (patch)
tree831fda1fcb2d777624a62553479acb958f043e43 /llvm/test/CodeGen/WebAssembly/byval.ll
parent4f1fca270acd736cbde43773d1fd83b3b3d2164f (diff)
downloadbcm5719-llvm-9d24fb7ff318d7a88f0fa3e63eb0df4acafd9805.tar.gz
bcm5719-llvm-9d24fb7ff318d7a88f0fa3e63eb0df4acafd9805.zip
[WebAssembly] Use __stack_pointer global when writing wasm binary
This ensures that symbolic relocations are generated for stack pointer manipulations. These relocations are of type R_WEBASSEMBLY_GLOBAL_INDEX_LEB. This change also adds support for reading relocations of this type in WasmObjectFile.cpp. Since its a globally imported symbol this does mean that the get_global/set_global instruction won't be valid until the objects are linked that global used in no longer an imported global. Differential Revision: https://reviews.llvm.org/D34172 llvm-svn: 305616
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly/byval.ll')
-rw-r--r--llvm/test/CodeGen/WebAssembly/byval.ll14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/byval.ll b/llvm/test/CodeGen/WebAssembly/byval.ll
index 907320d7977..84c5ad02101 100644
--- a/llvm/test/CodeGen/WebAssembly/byval.ll
+++ b/llvm/test/CodeGen/WebAssembly/byval.ll
@@ -24,12 +24,12 @@ declare void @ext_byval_func_empty(%EmptyStruct* byval)
define void @byval_arg(%SmallStruct* %ptr) {
; CHECK: .param i32
; Subtract 16 from SP (SP is 16-byte aligned)
- ; CHECK-NEXT: get_global $push[[L2:.+]]=, 0
+ ; CHECK-NEXT: get_global $push[[L2:.+]]=, __stack_pointer
; CHECK-NEXT: i32.const $push[[L3:.+]]=, 16
; CHECK-NEXT: i32.sub $push[[L11:.+]]=, $pop[[L2]], $pop[[L3]]
; Ensure SP is stored back before the call
; CHECK-NEXT: tee_local $push[[L10:.+]]=, $[[SP:.+]]=, $pop[[L11]]{{$}}
- ; CHECK-NEXT: set_global 0, $pop[[L10]]{{$}}
+ ; CHECK-NEXT: set_global __stack_pointer, $pop[[L10]]{{$}}
; Copy the SmallStruct argument to the stack (SP+12, original SP-4)
; CHECK-NEXT: i32.load $push[[L0:.+]]=, 0($0)
; CHECK-NEXT: i32.store 12($[[SP]]), $pop[[L0]]
@@ -41,7 +41,7 @@ define void @byval_arg(%SmallStruct* %ptr) {
; Restore the stack
; CHECK-NEXT: i32.const $push[[L6:.+]]=, 16
; CHECK-NEXT: i32.add $push[[L8:.+]]=, $[[SP]], $pop[[L6]]
- ; CHECK-NEXT: set_global 0, $pop[[L8]]
+ ; CHECK-NEXT: set_global __stack_pointer, $pop[[L8]]
; CHECK-NEXT: return
ret void
}
@@ -53,7 +53,7 @@ define void @byval_arg_align8(%SmallStruct* %ptr) {
; CHECK: i32.const $push[[L1:.+]]=, 16
; CHECK-NEXT: i32.sub $push[[L11:.+]]=, {{.+}}, $pop[[L1]]
; CHECK-NEXT: tee_local $push[[L10:.+]]=, $[[SP:.+]]=, $pop[[L11]]{{$}}
- ; CHECK-NEXT: set_global 0, $pop[[L10]]{{$}}
+ ; CHECK-NEXT: set_global __stack_pointer, $pop[[L10]]{{$}}
; Copy the SmallStruct argument to the stack (SP+8, original SP-8)
; CHECK-NEXT: i32.load $push[[L0:.+]]=, 0($0){{$}}
; CHECK-NEXT: i32.store 8($[[SP]]), $pop[[L0]]{{$}}
@@ -72,7 +72,7 @@ define void @byval_arg_double(%AlignedStruct* %ptr) {
; CHECK: i32.const $push[[L1:.+]]=, 16
; CHECK-NEXT: i32.sub $push[[L14:.+]]=, {{.+}}, $pop[[L1]]
; CHECK-NEXT: tee_local $push[[L13:.+]]=, $[[SP:.+]]=, $pop[[L14]]
- ; CHECK-NEXT: set_global 0, $pop[[L13]]
+ ; CHECK-NEXT: set_global __stack_pointer, $pop[[L13]]
; Copy the AlignedStruct argument to the stack (SP+0, original SP-16)
; Just check the last load/store pair of the memcpy
; CHECK: i64.load $push[[L4:.+]]=, 0($0)
@@ -110,11 +110,11 @@ define void @byval_empty_callee(%EmptyStruct* byval %ptr) {
; Call memcpy for "big" byvals.
; CHECK-LABEL: big_byval:
-; CHECK: get_global $push[[L2:.+]]=, 0{{$}}
+; CHECK: get_global $push[[L2:.+]]=, __stack_pointer{{$}}
; CHECK-NEXT: i32.const $push[[L3:.+]]=, 131072
; CHECK-NEXT: i32.sub $push[[L11:.+]]=, $pop[[L2]], $pop[[L3]]
; CHECK-NEXT: tee_local $push[[L10:.+]]=, $[[SP:.+]]=, $pop[[L11]]{{$}}
-; CHECK-NEXT: set_global 0, $pop[[L10]]{{$}}
+; CHECK-NEXT: set_global __stack_pointer, $pop[[L10]]{{$}}
; CHECK-NEXT: i32.const $push[[L0:.+]]=, 131072
; CHECK-NEXT: i32.call $push[[L11:.+]]=, memcpy@FUNCTION, $[[SP]], ${{.+}}, $pop{{.+}}
; CHECK-NEXT: tee_local $push[[L9:.+]]=, $[[SP:.+]]=, $pop[[L11]]{{$}}
OpenPOWER on IntegriCloud