aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2015-12-16 23:21:30 +0000
committerDerek Schuff <dschuff@google.com>2015-12-16 23:21:30 +0000
commit8bb5f2927a36d1ec58b5fa090095ed0abfa5d1c6 (patch)
treee483943c93115cc76b03307adac8e5b4312d3d37 /llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp
parent433049f87b711db1adedac3fc35f6f894ede79ed (diff)
downloadllvm-8bb5f2927a36d1ec58b5fa090095ed0abfa5d1c6.zip
llvm-8bb5f2927a36d1ec58b5fa090095ed0abfa5d1c6.tar.gz
llvm-8bb5f2927a36d1ec58b5fa090095ed0abfa5d1c6.tar.bz2
[WebAssembly] Implement eliminateCallFramePseudo
Summary: Implement eliminateCallFramePsuedo to handle ADJCALLSTACKUP/DOWN pseudo-instructions. Add a test calling a vararg function which causes non-0 adjustments. This revealed an issue with RegisterCoalescer wherein it eliminates a COPY from SP32 to a vreg but failes to update the live ranges of EXPR_STACK, causing a machineinstr verifier failure (so this test is commented out). Also add a dynamic alloca test, which causes a callseq_end dag node with a 0 (instead of undef) second argument to be generated. We currently fail to select that, so adjust the ADJCALLSTACKUP tablegen code to handle it. Differential Revision: http://reviews.llvm.org/D15587 llvm-svn: 255844
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp
index 3b219f4..41c8811 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp
@@ -36,8 +36,12 @@ void WebAssemblyInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I,
DebugLoc DL, unsigned DestReg,
unsigned SrcReg, bool KillSrc) const {
- const TargetRegisterClass *RC =
- MBB.getParent()->getRegInfo().getRegClass(SrcReg);
+ // This method is called by post-RA expansion, which expects only pregs to
+ // exist. However we need to handle both here.
+ auto &MRI = MBB.getParent()->getRegInfo();
+ const TargetRegisterClass *RC = TargetRegisterInfo::isVirtualRegister(DestReg) ?
+ MRI.getRegClass(DestReg) :
+ MRI.getTargetRegisterInfo()->getMinimalPhysRegClass(SrcReg);
unsigned CopyLocalOpcode;
if (RC == &WebAssembly::I32RegClass)