aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2016-10-25 00:17:11 +0000
committerDan Gohman <dan433584@gmail.com>2016-10-25 00:17:11 +0000
commit48abaa9c7409e58d1c4dd7b67cb3ac6e788bd314 (patch)
treed9740adeafc3a7c86fa7d932849f90c130152f2e /llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp
parent5c61c703877df673b89cb98a74edeb956b94506c (diff)
downloadllvm-48abaa9c7409e58d1c4dd7b67cb3ac6e788bd314.zip
llvm-48abaa9c7409e58d1c4dd7b67cb3ac6e788bd314.tar.gz
llvm-48abaa9c7409e58d1c4dd7b67cb3ac6e788bd314.tar.bz2
[WebAssembly] Reorder load/store operands to match binary encoding.
The p2align operand of a load/store is encoded before the offset operand; reorder the MachineInstr operands accordingly. llvm-svn: 285044
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp
index 6523ea5..a1c9658 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp
@@ -96,9 +96,9 @@ static void writeSPToMemory(unsigned SrcReg, MachineFunction &MF,
MachinePointerInfo(MF.getPSVManager().getExternalSymbolCallEntry(ES)),
MachineMemOperand::MOStore, 4, 4);
BuildMI(MBB, InsertStore, DL, TII->get(WebAssembly::STORE_I32))
+ .addImm(2) // p2align
.addExternalSymbol(SPSymbol)
.addReg(Zero)
- .addImm(2) // p2align
.addReg(SrcReg)
.addMemOperand(MMO);
}
@@ -148,9 +148,9 @@ void WebAssemblyFrameLowering::emitPrologue(MachineFunction &MF,
// Load the SP value.
BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::LOAD_I32),
StackSize ? SPReg : (unsigned)WebAssembly::SP32)
+ .addImm(2) // p2align
.addExternalSymbol(SPSymbol)
.addReg(Zero) // addr
- .addImm(2) // p2align
.addMemOperand(LoadMMO);
if (StackSize) {