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 35 #define DEBUG_TYPE "wasm-frame-info" 36 37 // TODO: Implement a red zone? 38 39 /// Return true if the specified function should have a dedicated frame pointer 40 /// register. 41 bool WebAssemblyFrameLowering::hasFP(const MachineFunction &MF) const { 42 llvm_unreachable("TODO: implement hasFP"); 43 } 44 45 /// Under normal circumstances, when a frame pointer is not required, we reserve 46 /// argument space for call sites in the function immediately on entry to the 47 /// current function. This eliminates the need for add/sub sp brackets around 48 /// call sites. Returns true if the call frame is included as part of the stack 49 /// frame. 50 bool WebAssemblyFrameLowering::hasReservedCallFrame( 51 const MachineFunction &MF) const { 52 return !MF.getFrameInfo()->hasVarSizedObjects(); 53 } 54 55 void WebAssemblyFrameLowering::eliminateCallFramePseudoInstr( 56 MachineFunction &MF, MachineBasicBlock &MBB, 57 MachineBasicBlock::iterator I) const { 58 llvm_unreachable("TODO: implement eliminateCallFramePseudoInstr"); 59 } 60 61 void WebAssemblyFrameLowering::emitPrologue(MachineFunction &MF, 62 MachineBasicBlock &MBB) const { 63 llvm_unreachable("TODO: implement emitPrologue"); 64 } 65 66 void WebAssemblyFrameLowering::emitEpilogue(MachineFunction &MF, 67 MachineBasicBlock &MBB) const { 68 llvm_unreachable("TODO: implement emitEpilogue"); 69 } 70 71 void WebAssemblyFrameLowering::determineCalleeSaves(MachineFunction &MF, 72 BitVector &SavedRegs, 73 RegScavenger *RS) const { 74 llvm_unreachable("TODO: implement determineCalleeSaves"); 75 } 76