Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 1 | //===-- WebAssemblyFrameLowering.cpp - WebAssembly Frame Lowering ----------==// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// |
| 10 | /// \file |
| 11 | /// \brief This file contains the WebAssembly implementation of |
| 12 | /// TargetFrameLowering class. |
| 13 | /// |
| 14 | /// On WebAssembly, there aren't a lot of things to do here. There are no |
| 15 | /// callee-saved registers to save, and no spill slots. |
| 16 | /// |
| 17 | /// The stack grows downward. |
| 18 | /// |
| 19 | //===----------------------------------------------------------------------===// |
| 20 | |
| 21 | #include "WebAssemblyFrameLowering.h" |
| 22 | #include "MCTargetDesc/WebAssemblyMCTargetDesc.h" |
| 23 | #include "WebAssemblyInstrInfo.h" |
| 24 | #include "WebAssemblyMachineFunctionInfo.h" |
| 25 | #include "WebAssemblySubtarget.h" |
| 26 | #include "WebAssemblyTargetMachine.h" |
| 27 | #include "llvm/CodeGen/MachineFrameInfo.h" |
| 28 | #include "llvm/CodeGen/MachineFunction.h" |
| 29 | #include "llvm/CodeGen/MachineInstrBuilder.h" |
| 30 | #include "llvm/CodeGen/MachineModuleInfo.h" |
| 31 | #include "llvm/CodeGen/MachineRegisterInfo.h" |
| 32 | #include "llvm/Support/Debug.h" |
| 33 | using namespace llvm; |
| 34 | |
JF Bastien | 03855df | 2015-07-01 23:41:25 +0000 | [diff] [blame] | 35 | #define DEBUG_TYPE "wasm-frame-info" |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 36 | |
Derek Schuff | 9769deb | 2015-12-11 23:49:46 +0000 | [diff] [blame] | 37 | // TODO: wasm64 |
Derek Schuff | 9769deb | 2015-12-11 23:49:46 +0000 | [diff] [blame] | 38 | // TODO: Emit TargetOpcode::CFI_INSTRUCTION instructions |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 39 | |
Derek Schuff | 0d41b7b | 2016-11-07 22:00:48 +0000 | [diff] [blame] | 40 | /// We need a base pointer in the case of having items on the stack that |
| 41 | /// require stricter alignment than the stack pointer itself. Because we need |
| 42 | /// to shift the stack pointer by some unknown amount to force the alignment, |
| 43 | /// we need to record the value of the stack pointer on entry to the function. |
| 44 | bool WebAssemblyFrameLowering::hasBP( |
| 45 | const MachineFunction &MF) const { |
| 46 | const auto *RegInfo = |
| 47 | MF.getSubtarget<WebAssemblySubtarget>().getRegisterInfo(); |
| 48 | return RegInfo->needsStackRealignment(MF); |
| 49 | } |
| 50 | |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 51 | /// Return true if the specified function should have a dedicated frame pointer |
| 52 | /// register. |
| 53 | bool WebAssemblyFrameLowering::hasFP(const MachineFunction &MF) const { |
Matthias Braun | 941a705 | 2016-07-28 18:40:00 +0000 | [diff] [blame] | 54 | const MachineFrameInfo &MFI = MF.getFrameInfo(); |
Derek Schuff | 0d41b7b | 2016-11-07 22:00:48 +0000 | [diff] [blame] | 55 | |
| 56 | // When we have var-sized objects, we move the stack pointer by an unknown |
| 57 | // amount, and need to emit a frame pointer to restore the stack to where we |
| 58 | // were on function entry. |
| 59 | // If we already need a base pointer, we use that to fix up the stack pointer. |
| 60 | // If there are no fixed-size objects, we would have no use of a frame |
| 61 | // pointer, and thus should not emit one. |
| 62 | bool HasFixedSizedObjects = MFI.getStackSize() > 0; |
| 63 | bool NeedsFixedReference = !hasBP(MF) || HasFixedSizedObjects; |
| 64 | |
| 65 | return MFI.isFrameAddressTaken() || |
| 66 | (MFI.hasVarSizedObjects() && NeedsFixedReference) || |
| 67 | MFI.hasStackMap() || MFI.hasPatchPoint(); |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | /// Under normal circumstances, when a frame pointer is not required, we reserve |
| 71 | /// argument space for call sites in the function immediately on entry to the |
| 72 | /// current function. This eliminates the need for add/sub sp brackets around |
| 73 | /// call sites. Returns true if the call frame is included as part of the stack |
| 74 | /// frame. |
| 75 | bool WebAssemblyFrameLowering::hasReservedCallFrame( |
| 76 | const MachineFunction &MF) const { |
Matthias Braun | 941a705 | 2016-07-28 18:40:00 +0000 | [diff] [blame] | 77 | return !MF.getFrameInfo().hasVarSizedObjects(); |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 78 | } |
| 79 | |
Derek Schuff | 4b3bb21 | 2016-02-23 18:13:07 +0000 | [diff] [blame] | 80 | |
| 81 | /// Returns true if this function needs a local user-space stack pointer. |
| 82 | /// Unlike a machine stack pointer, the wasm user stack pointer is a global |
| 83 | /// variable, so it is loaded into a register in the prolog. |
| 84 | bool WebAssemblyFrameLowering::needsSP(const MachineFunction &MF, |
| 85 | const MachineFrameInfo &MFI) const { |
| 86 | return MFI.getStackSize() || MFI.adjustsStack() || hasFP(MF); |
| 87 | } |
| 88 | |
| 89 | /// Returns true if the local user-space stack pointer needs to be written back |
| 90 | /// to memory by this function (this is not meaningful if needsSP is false). If |
| 91 | /// false, the stack red zone can be used and only a local SP is needed. |
| 92 | bool WebAssemblyFrameLowering::needsSPWriteback( |
| 93 | const MachineFunction &MF, const MachineFrameInfo &MFI) const { |
Dan Gohman | 450a807 | 2016-05-05 20:41:15 +0000 | [diff] [blame] | 94 | assert(needsSP(MF, MFI)); |
Derek Schuff | 4b3bb21 | 2016-02-23 18:13:07 +0000 | [diff] [blame] | 95 | return MFI.getStackSize() > RedZoneSize || MFI.hasCalls() || |
| 96 | MF.getFunction()->hasFnAttribute(Attribute::NoRedZone); |
| 97 | } |
| 98 | |
Derek Schuff | 27e3b8a | 2016-02-22 21:57:17 +0000 | [diff] [blame] | 99 | static void writeSPToMemory(unsigned SrcReg, MachineFunction &MF, |
| 100 | MachineBasicBlock &MBB, |
Derek Schuff | d4207ba | 2016-03-17 17:00:29 +0000 | [diff] [blame] | 101 | MachineBasicBlock::iterator &InsertAddr, |
| 102 | MachineBasicBlock::iterator &InsertStore, |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 103 | const DebugLoc &DL) { |
Dan Gohman | d08cd15 | 2016-05-17 21:14:26 +0000 | [diff] [blame] | 104 | const char *ES = "__stack_pointer"; |
| 105 | auto *SPSymbol = MF.createExternalSymbolName(ES); |
Dan Gohman | 0cfb5f8 | 2016-05-10 04:24:02 +0000 | [diff] [blame] | 106 | MachineRegisterInfo &MRI = MF.getRegInfo(); |
| 107 | const TargetRegisterClass *PtrRC = |
| 108 | MRI.getTargetRegisterInfo()->getPointerRegClass(MF); |
Dan Gohman | d530f68 | 2016-05-24 23:47:41 +0000 | [diff] [blame] | 109 | unsigned Zero = MRI.createVirtualRegister(PtrRC); |
Derek Schuff | 27e3b8a | 2016-02-22 21:57:17 +0000 | [diff] [blame] | 110 | const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo(); |
| 111 | |
Dan Gohman | d530f68 | 2016-05-24 23:47:41 +0000 | [diff] [blame] | 112 | BuildMI(MBB, InsertAddr, DL, TII->get(WebAssembly::CONST_I32), Zero) |
| 113 | .addImm(0); |
Benjamin Kramer | 9bc1b23 | 2016-08-12 18:33:50 +0000 | [diff] [blame] | 114 | MachineMemOperand *MMO = MF.getMachineMemOperand( |
| 115 | MachinePointerInfo(MF.getPSVManager().getExternalSymbolCallEntry(ES)), |
| 116 | MachineMemOperand::MOStore, 4, 4); |
Dan Gohman | 7f1bdb2 | 2016-10-06 22:08:28 +0000 | [diff] [blame] | 117 | BuildMI(MBB, InsertStore, DL, TII->get(WebAssembly::STORE_I32)) |
Dan Gohman | 48abaa9 | 2016-10-25 00:17:11 +0000 | [diff] [blame] | 118 | .addImm(2) // p2align |
Dan Gohman | d530f68 | 2016-05-24 23:47:41 +0000 | [diff] [blame] | 119 | .addExternalSymbol(SPSymbol) |
| 120 | .addReg(Zero) |
Derek Schuff | 27e3b8a | 2016-02-22 21:57:17 +0000 | [diff] [blame] | 121 | .addReg(SrcReg) |
| 122 | .addMemOperand(MMO); |
Derek Schuff | 27e3b8a | 2016-02-22 21:57:17 +0000 | [diff] [blame] | 123 | } |
| 124 | |
Hans Wennborg | e1a2e90 | 2016-03-31 18:33:38 +0000 | [diff] [blame] | 125 | MachineBasicBlock::iterator |
| 126 | WebAssemblyFrameLowering::eliminateCallFramePseudoInstr( |
Derek Schuff | 8bb5f29 | 2015-12-16 23:21:30 +0000 | [diff] [blame] | 127 | MachineFunction &MF, MachineBasicBlock &MBB, |
| 128 | MachineBasicBlock::iterator I) const { |
Derek Schuff | 0d41b7b | 2016-11-07 22:00:48 +0000 | [diff] [blame] | 129 | assert(!I->getOperand(0).getImm() && (hasFP(MF) || hasBP(MF)) && |
Derek Schuff | 27e3b8a | 2016-02-22 21:57:17 +0000 | [diff] [blame] | 130 | "Call frame pseudos should only be used for dynamic stack adjustment"); |
| 131 | const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo(); |
Derek Schuff | 4b3bb21 | 2016-02-23 18:13:07 +0000 | [diff] [blame] | 132 | if (I->getOpcode() == TII->getCallFrameDestroyOpcode() && |
Matthias Braun | 941a705 | 2016-07-28 18:40:00 +0000 | [diff] [blame] | 133 | needsSPWriteback(MF, MF.getFrameInfo())) { |
Derek Schuff | 27e3b8a | 2016-02-22 21:57:17 +0000 | [diff] [blame] | 134 | DebugLoc DL = I->getDebugLoc(); |
Derek Schuff | d4207ba | 2016-03-17 17:00:29 +0000 | [diff] [blame] | 135 | writeSPToMemory(WebAssembly::SP32, MF, MBB, I, I, DL); |
Derek Schuff | 27e3b8a | 2016-02-22 21:57:17 +0000 | [diff] [blame] | 136 | } |
Hans Wennborg | e1a2e90 | 2016-03-31 18:33:38 +0000 | [diff] [blame] | 137 | return MBB.erase(I); |
Derek Schuff | 8bb5f29 | 2015-12-16 23:21:30 +0000 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | void WebAssemblyFrameLowering::emitPrologue(MachineFunction &MF, |
| 141 | MachineBasicBlock &MBB) const { |
| 142 | // TODO: Do ".setMIFlag(MachineInstr::FrameSetup)" on emitted instructions |
Matthias Braun | 941a705 | 2016-07-28 18:40:00 +0000 | [diff] [blame] | 143 | auto &MFI = MF.getFrameInfo(); |
| 144 | assert(MFI.getCalleeSavedInfo().empty() && |
Derek Schuff | 8bb5f29 | 2015-12-16 23:21:30 +0000 | [diff] [blame] | 145 | "WebAssembly should not have callee-saved registers"); |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 146 | |
Matthias Braun | 941a705 | 2016-07-28 18:40:00 +0000 | [diff] [blame] | 147 | if (!needsSP(MF, MFI)) return; |
| 148 | uint64_t StackSize = MFI.getStackSize(); |
Derek Schuff | 8bb5f29 | 2015-12-16 23:21:30 +0000 | [diff] [blame] | 149 | |
Dan Gohman | 3196650 | 2016-01-19 14:53:19 +0000 | [diff] [blame] | 150 | const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo(); |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 151 | auto &MRI = MF.getRegInfo(); |
Derek Schuff | 8bb5f29 | 2015-12-16 23:21:30 +0000 | [diff] [blame] | 152 | |
| 153 | auto InsertPt = MBB.begin(); |
| 154 | DebugLoc DL; |
| 155 | |
Dan Gohman | 0cfb5f8 | 2016-05-10 04:24:02 +0000 | [diff] [blame] | 156 | const TargetRegisterClass *PtrRC = |
| 157 | MRI.getTargetRegisterInfo()->getPointerRegClass(MF); |
Dan Gohman | d530f68 | 2016-05-24 23:47:41 +0000 | [diff] [blame] | 158 | unsigned Zero = MRI.createVirtualRegister(PtrRC); |
Derek Schuff | 0d41b7b | 2016-11-07 22:00:48 +0000 | [diff] [blame] | 159 | unsigned SPReg = WebAssembly::SP32; |
| 160 | if (StackSize) |
| 161 | SPReg = MRI.createVirtualRegister(PtrRC); |
Dan Gohman | d08cd15 | 2016-05-17 21:14:26 +0000 | [diff] [blame] | 162 | const char *ES = "__stack_pointer"; |
| 163 | auto *SPSymbol = MF.createExternalSymbolName(ES); |
Dan Gohman | d530f68 | 2016-05-24 23:47:41 +0000 | [diff] [blame] | 164 | BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::CONST_I32), Zero) |
| 165 | .addImm(0); |
Benjamin Kramer | 9bc1b23 | 2016-08-12 18:33:50 +0000 | [diff] [blame] | 166 | MachineMemOperand *LoadMMO = MF.getMachineMemOperand( |
| 167 | MachinePointerInfo(MF.getPSVManager().getExternalSymbolCallEntry(ES)), |
| 168 | MachineMemOperand::MOLoad, 4, 4); |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 169 | // Load the SP value. |
Derek Schuff | 0d41b7b | 2016-11-07 22:00:48 +0000 | [diff] [blame] | 170 | BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::LOAD_I32), SPReg) |
Dan Gohman | 48abaa9 | 2016-10-25 00:17:11 +0000 | [diff] [blame] | 171 | .addImm(2) // p2align |
Dan Gohman | d530f68 | 2016-05-24 23:47:41 +0000 | [diff] [blame] | 172 | .addExternalSymbol(SPSymbol) |
| 173 | .addReg(Zero) // addr |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 174 | .addMemOperand(LoadMMO); |
| 175 | |
Derek Schuff | 0d41b7b | 2016-11-07 22:00:48 +0000 | [diff] [blame] | 176 | bool HasBP = hasBP(MF); |
| 177 | if (HasBP) { |
| 178 | auto FI = MF.getInfo<WebAssemblyFunctionInfo>(); |
| 179 | unsigned BasePtr = MRI.createVirtualRegister(PtrRC); |
| 180 | FI->setBasePointerVreg(BasePtr); |
| 181 | BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::COPY), BasePtr) |
| 182 | .addReg(SPReg); |
| 183 | } |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 184 | if (StackSize) { |
| 185 | // Subtract the frame size |
Dan Gohman | 0cfb5f8 | 2016-05-10 04:24:02 +0000 | [diff] [blame] | 186 | unsigned OffsetReg = MRI.createVirtualRegister(PtrRC); |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 187 | BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::CONST_I32), OffsetReg) |
| 188 | .addImm(StackSize); |
Derek Schuff | 3f06329 | 2016-02-11 20:57:09 +0000 | [diff] [blame] | 189 | BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::SUB_I32), |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 190 | WebAssembly::SP32) |
| 191 | .addReg(SPReg) |
| 192 | .addReg(OffsetReg); |
| 193 | } |
Derek Schuff | 0d41b7b | 2016-11-07 22:00:48 +0000 | [diff] [blame] | 194 | if (HasBP) { |
| 195 | unsigned BitmaskReg = MRI.createVirtualRegister(PtrRC); |
| 196 | unsigned Alignment = MFI.getMaxAlignment(); |
Dan Gohman | f295cc8 | 2016-12-02 20:13:05 +0000 | [diff] [blame^] | 197 | assert((1u << countTrailingZeros(Alignment)) == Alignment && |
Derek Schuff | 0d41b7b | 2016-11-07 22:00:48 +0000 | [diff] [blame] | 198 | "Alignment must be a power of 2"); |
| 199 | BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::CONST_I32), BitmaskReg) |
| 200 | .addImm((int)~(Alignment - 1)); |
| 201 | BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::AND_I32), |
| 202 | WebAssembly::SP32) |
| 203 | .addReg(WebAssembly::SP32) |
| 204 | .addReg(BitmaskReg); |
| 205 | } |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 206 | if (hasFP(MF)) { |
| 207 | // Unlike most conventional targets (where FP points to the saved FP), |
| 208 | // FP points to the bottom of the fixed-size locals, so we can use positive |
| 209 | // offsets in load/store instructions. |
Dan Gohman | 0cfb5f8 | 2016-05-10 04:24:02 +0000 | [diff] [blame] | 210 | BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::COPY), |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 211 | WebAssembly::FP32) |
| 212 | .addReg(WebAssembly::SP32); |
| 213 | } |
Matthias Braun | 941a705 | 2016-07-28 18:40:00 +0000 | [diff] [blame] | 214 | if (StackSize && needsSPWriteback(MF, MFI)) { |
Derek Schuff | d4207ba | 2016-03-17 17:00:29 +0000 | [diff] [blame] | 215 | writeSPToMemory(WebAssembly::SP32, MF, MBB, InsertPt, InsertPt, DL); |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 216 | } |
Derek Schuff | 8bb5f29 | 2015-12-16 23:21:30 +0000 | [diff] [blame] | 217 | } |
| 218 | |
Derek Schuff | 9769deb | 2015-12-11 23:49:46 +0000 | [diff] [blame] | 219 | void WebAssemblyFrameLowering::emitEpilogue(MachineFunction &MF, |
| 220 | MachineBasicBlock &MBB) const { |
Matthias Braun | 941a705 | 2016-07-28 18:40:00 +0000 | [diff] [blame] | 221 | auto &MFI = MF.getFrameInfo(); |
| 222 | uint64_t StackSize = MFI.getStackSize(); |
| 223 | if (!needsSP(MF, MFI) || !needsSPWriteback(MF, MFI)) return; |
Dan Gohman | 3196650 | 2016-01-19 14:53:19 +0000 | [diff] [blame] | 224 | const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo(); |
Derek Schuff | 9769deb | 2015-12-11 23:49:46 +0000 | [diff] [blame] | 225 | auto &MRI = MF.getRegInfo(); |
Derek Schuff | 9769deb | 2015-12-11 23:49:46 +0000 | [diff] [blame] | 226 | auto InsertPt = MBB.getFirstTerminator(); |
| 227 | DebugLoc DL; |
| 228 | |
Dan Gohman | 0cfb5f8 | 2016-05-10 04:24:02 +0000 | [diff] [blame] | 229 | if (InsertPt != MBB.end()) |
Derek Schuff | 9769deb | 2015-12-11 23:49:46 +0000 | [diff] [blame] | 230 | DL = InsertPt->getDebugLoc(); |
Dan Gohman | 450a807 | 2016-05-05 20:41:15 +0000 | [diff] [blame] | 231 | |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 232 | // Restore the stack pointer. If we had fixed-size locals, add the offset |
| 233 | // subtracted in the prolog. |
Derek Schuff | d4207ba | 2016-03-17 17:00:29 +0000 | [diff] [blame] | 234 | unsigned SPReg = 0; |
| 235 | MachineBasicBlock::iterator InsertAddr = InsertPt; |
Derek Schuff | 0d41b7b | 2016-11-07 22:00:48 +0000 | [diff] [blame] | 236 | if (hasBP(MF)) { |
| 237 | auto FI = MF.getInfo<WebAssemblyFunctionInfo>(); |
| 238 | SPReg = FI->getBasePointerVreg(); |
| 239 | } else if (StackSize) { |
Dan Gohman | 0cfb5f8 | 2016-05-10 04:24:02 +0000 | [diff] [blame] | 240 | const TargetRegisterClass *PtrRC = |
| 241 | MRI.getTargetRegisterInfo()->getPointerRegClass(MF); |
| 242 | unsigned OffsetReg = MRI.createVirtualRegister(PtrRC); |
Derek Schuff | d4207ba | 2016-03-17 17:00:29 +0000 | [diff] [blame] | 243 | InsertAddr = |
| 244 | BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::CONST_I32), OffsetReg) |
| 245 | .addImm(StackSize); |
| 246 | // In the epilog we don't need to write the result back to the SP32 physreg |
| 247 | // because it won't be used again. We can use a stackified register instead. |
Dan Gohman | 0cfb5f8 | 2016-05-10 04:24:02 +0000 | [diff] [blame] | 248 | SPReg = MRI.createVirtualRegister(PtrRC); |
Derek Schuff | d4207ba | 2016-03-17 17:00:29 +0000 | [diff] [blame] | 249 | BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::ADD_I32), SPReg) |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 250 | .addReg(hasFP(MF) ? WebAssembly::FP32 : WebAssembly::SP32) |
| 251 | .addReg(OffsetReg); |
Derek Schuff | d4207ba | 2016-03-17 17:00:29 +0000 | [diff] [blame] | 252 | } else { |
| 253 | SPReg = hasFP(MF) ? WebAssembly::FP32 : WebAssembly::SP32; |
Derek Schuff | 6ea637a | 2016-01-29 18:37:49 +0000 | [diff] [blame] | 254 | } |
| 255 | |
Derek Schuff | d4207ba | 2016-03-17 17:00:29 +0000 | [diff] [blame] | 256 | writeSPToMemory(SPReg, MF, MBB, InsertAddr, InsertPt, DL); |
Dan Gohman | 10e730a | 2015-06-29 23:51:55 +0000 | [diff] [blame] | 257 | } |