summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly/reg-stackify.ll
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2016-10-21 16:38:07 +0000
committerDerek Schuff <dschuff@google.com>2016-10-21 16:38:07 +0000
commit6f69783f1fa51cd748d0439b17da3e3ee23cc3f8 (patch)
treed9ad8bff62eca303a04816379f4e4e34b5464a33 /llvm/test/CodeGen/WebAssembly/reg-stackify.ll
parent9daf8110c82f5245e5e263e8a03ce745e6da5f40 (diff)
downloadbcm5719-llvm-6f69783f1fa51cd748d0439b17da3e3ee23cc3f8.tar.gz
bcm5719-llvm-6f69783f1fa51cd748d0439b17da3e3ee23cc3f8.zip
[WebAssembly] Fix for 0xc call_indirect changes
Summary: Need to reorder the operands to have the callee as the last argument. Adds a pseudo-instruction, and a pass to lower it into a real call_indirect. This is the first of two options for how to fix the problem. Reviewers: dschuff, sunfish Subscribers: jfb, beanz, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D25708 llvm-svn: 284840
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly/reg-stackify.ll')
-rw-r--r--llvm/test/CodeGen/WebAssembly/reg-stackify.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/reg-stackify.ll b/llvm/test/CodeGen/WebAssembly/reg-stackify.ll
index bf1fdd89ab5..00469132c95 100644
--- a/llvm/test/CodeGen/WebAssembly/reg-stackify.ll
+++ b/llvm/test/CodeGen/WebAssembly/reg-stackify.ll
@@ -459,6 +459,25 @@ define i32 @stackpointer_dependency(i8* readnone) {
ret i32 %3
}
+; Stackify a call_indirect with respect to its ordering
+
+; CHECK-LABEL: call_indirect_stackify:
+; CHECK: i32.load $push[[L4:.+]]=, 0($0)
+; CHECK-NEXT: tee_local $push[[L3:.+]]=, $0=, $pop[[L4]]
+; CHECK-NEXT: i32.load $push[[L0:.+]]=, 0($0)
+; CHECK-NEXT: i32.load $push[[L1:.+]]=, 0($pop[[L0]])
+; CHECK-NEXT: i32.call_indirect $push{{.+}}=, $pop[[L3]], $1, $pop[[L1]]
+%class.call_indirect = type { i32 (...)** }
+define i32 @call_indirect_stackify(%class.call_indirect** %objptr, i32 %arg) {
+ %obj = load %class.call_indirect*, %class.call_indirect** %objptr
+ %addr = bitcast %class.call_indirect* %obj to i32(%class.call_indirect*, i32)***
+ %vtable = load i32(%class.call_indirect*, i32)**, i32(%class.call_indirect*, i32)*** %addr
+ %vfn = getelementptr inbounds i32(%class.call_indirect*, i32)*, i32(%class.call_indirect*, i32)** %vtable, i32 0
+ %f = load i32(%class.call_indirect*, i32)*, i32(%class.call_indirect*, i32)** %vfn
+ %ret = call i32 %f(%class.call_indirect* %obj, i32 %arg)
+ ret i32 %ret
+}
+
!llvm.module.flags = !{!0}
!llvm.dbg.cu = !{!1}
OpenPOWER on IntegriCloud