[WebAssembly] Fix ADJCALLSTACKDOWN/UP use/defs
authorDerek Schuff <dschuff@google.com>
Fri, 11 Dec 2015 18:55:34 +0000 (18:55 +0000)
committerDerek Schuff <dschuff@google.com>
Fri, 11 Dec 2015 18:55:34 +0000 (18:55 +0000)
commit4f331ff0d30a81ae5c41ad5a35964398996930a1
tree7ee0b7351c29c27b91c6e05dd0a74fcad69136a1
parent23c0f3b5a2197452c6a25a74fe2fc624763547a1
[WebAssembly] Fix ADJCALLSTACKDOWN/UP use/defs

Summary:
ADJCALLSTACK{DOWN,UP} (aka CALLSEQ_{START,END}) MIs are supposed to use
and def the stack pointer. Since they do not, all the nodes are being
eliminated by DeadMachineInstructionElim, so they aren't in the IR when
PrologEpilogInserter/eliminateCallFramePseudo needs them.

This change fixes that, but since RegStackify will not stackify across
them (and it runs early, before PEI), change LowerCall to only emit them
when the call frame size is > 0. That makes the current code work the
same way and makes code handled by D15344 also work the same way. We can
expand the condition beyond NumBytes > 0 in the future if needed.

Reviewers: sunfish, jfb

Subscribers: jfb, dschuff, llvm-commits

Differential Revision: http://reviews.llvm.org/D15459

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255356 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
lib/Target/WebAssembly/WebAssemblyInstrCall.td