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/WebAssemblyTargetMachine.cpp | |
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/WebAssemblyTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index fe987f9e99d..e8fbe941345 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -229,6 +229,11 @@ void WebAssemblyPassConfig::addPreEmitPass() { // colored, and numbered with the rest of the registers. addPass(createWebAssemblyReplacePhysRegs()); + // Rewrite pseudo call_indirect instructions as real instructions. + // This needs to run before register stackification, because we change the + // order of the arguments. + addPass(createWebAssemblyCallIndirectFixup()); + if (getOptLevel() != CodeGenOpt::None) { // LiveIntervals isn't commonly run this late. Re-establish preconditions. addPass(createWebAssemblyPrepareForLiveIntervals()); |