diff options
author | Derek Schuff <dschuff@google.com> | 2016-10-21 16:38:07 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2016-10-21 16:38:07 +0000 |
commit | 6f69783f1fa51cd748d0439b17da3e3ee23cc3f8 (patch) | |
tree | d9ad8bff62eca303a04816379f4e4e34b5464a33 /llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td | |
parent | 9daf8110c82f5245e5e263e8a03ce745e6da5f40 (diff) | |
download | bcm5719-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/lib/Target/WebAssembly/WebAssemblyInstrCall.td')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td index 4bbe2d7443e..47459f85a16 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td @@ -29,9 +29,14 @@ multiclass CALL<WebAssemblyRegClass vt, string prefix> { def CALL_#vt : I<(outs vt:$dst), (ins i32imm:$callee, variable_ops), [(set vt:$dst, (WebAssemblycall1 (i32 imm:$callee)))], !strconcat(prefix, "call\t$dst, $callee")>; - def CALL_INDIRECT_#vt : I<(outs vt:$dst), (ins I32:$callee, variable_ops), - [(set vt:$dst, (WebAssemblycall1 I32:$callee))], - !strconcat(prefix, "call_indirect\t$dst, $callee")>; + let isCodeGenOnly = 1 in { + def PCALL_INDIRECT_#vt : I<(outs vt:$dst), (ins I32:$callee, variable_ops), + [(set vt:$dst, (WebAssemblycall1 I32:$callee))], + "PSEUDO CALL INDIRECT\t$callee">; + } // isCodeGenOnly = 1 + def CALL_INDIRECT_#vt : I<(outs vt:$dst), (ins variable_ops), + [], + !strconcat(prefix, "call_indirect\t$dst")>; } multiclass SIMD_CALL<ValueType vt, string prefix> { @@ -39,12 +44,17 @@ multiclass SIMD_CALL<ValueType vt, string prefix> { [(set (vt V128:$dst), (WebAssemblycall1 (i32 imm:$callee)))], !strconcat(prefix, "call\t$dst, $callee")>; + let isCodeGenOnly = 1 in { + def PCALL_INDIRECT_#vt : SIMD_I<(outs V128:$dst), + (ins I32:$callee, variable_ops), + [(set (vt V128:$dst), + (WebAssemblycall1 I32:$callee))], + "PSEUDO CALL INDIRECT\t$callee">; + } // isCodeGenOnly = 1 def CALL_INDIRECT_#vt : SIMD_I<(outs V128:$dst), - (ins I32:$callee, variable_ops), - [(set (vt V128:$dst), - (WebAssemblycall1 I32:$callee))], - !strconcat(prefix, - "call_indirect\t$dst, $callee")>; + (ins variable_ops), + [], + !strconcat(prefix, "call_indirect\t$dst")>; } let Uses = [SP32, SP64], isCall = 1 in { @@ -60,9 +70,14 @@ let Uses = [SP32, SP64], isCall = 1 in { def CALL_VOID : I<(outs), (ins i32imm:$callee, variable_ops), [(WebAssemblycall0 (i32 imm:$callee))], "call \t$callee">; - def CALL_INDIRECT_VOID : I<(outs), (ins I32:$callee, variable_ops), - [(WebAssemblycall0 I32:$callee)], - "call_indirect\t$callee">; + let isCodeGenOnly = 1 in { + def PCALL_INDIRECT_VOID : I<(outs), (ins I32:$callee, variable_ops), + [(WebAssemblycall0 I32:$callee)], + "PSEUDO CALL INDIRECT\t$callee">; + } // isCodeGenOnly = 1 + def CALL_INDIRECT_VOID : I<(outs), (ins variable_ops), + [], + "call_indirect\t">; } // Uses = [SP32,SP64], isCall = 1 } // Defs = [ARGUMENTS] |