1*10e730a2SDan Gohman //===-- WebAssemblyFrameLowering.cpp - WebAssembly Frame Lowering ----------==// 2*10e730a2SDan Gohman // 3*10e730a2SDan Gohman // The LLVM Compiler Infrastructure 4*10e730a2SDan Gohman // 5*10e730a2SDan Gohman // This file is distributed under the University of Illinois Open Source 6*10e730a2SDan Gohman // License. See LICENSE.TXT for details. 7*10e730a2SDan Gohman // 8*10e730a2SDan Gohman //===----------------------------------------------------------------------===// 9*10e730a2SDan Gohman /// 10*10e730a2SDan Gohman /// \file 11*10e730a2SDan Gohman /// \brief This file contains the WebAssembly implementation of 12*10e730a2SDan Gohman /// TargetFrameLowering class. 13*10e730a2SDan Gohman /// 14*10e730a2SDan Gohman /// On WebAssembly, there aren't a lot of things to do here. There are no 15*10e730a2SDan Gohman /// callee-saved registers to save, and no spill slots. 16*10e730a2SDan Gohman /// 17*10e730a2SDan Gohman /// The stack grows downward. 18*10e730a2SDan Gohman /// 19*10e730a2SDan Gohman //===----------------------------------------------------------------------===// 20*10e730a2SDan Gohman 21*10e730a2SDan Gohman #include "WebAssemblyFrameLowering.h" 22*10e730a2SDan Gohman #include "MCTargetDesc/WebAssemblyMCTargetDesc.h" 23*10e730a2SDan Gohman #include "WebAssemblyInstrInfo.h" 24*10e730a2SDan Gohman #include "WebAssemblyMachineFunctionInfo.h" 25*10e730a2SDan Gohman #include "WebAssemblySubtarget.h" 26*10e730a2SDan Gohman #include "WebAssemblyTargetMachine.h" 27*10e730a2SDan Gohman #include "llvm/CodeGen/MachineFrameInfo.h" 28*10e730a2SDan Gohman #include "llvm/CodeGen/MachineFunction.h" 29*10e730a2SDan Gohman #include "llvm/CodeGen/MachineInstrBuilder.h" 30*10e730a2SDan Gohman #include "llvm/CodeGen/MachineModuleInfo.h" 31*10e730a2SDan Gohman #include "llvm/CodeGen/MachineRegisterInfo.h" 32*10e730a2SDan Gohman #include "llvm/Support/Debug.h" 33*10e730a2SDan Gohman using namespace llvm; 34*10e730a2SDan Gohman 35*10e730a2SDan Gohman #define DEBUG_TYPE "frame-info" 36*10e730a2SDan Gohman 37*10e730a2SDan Gohman // TODO: Implement a red zone? 38*10e730a2SDan Gohman 39*10e730a2SDan Gohman /// Return true if the specified function should have a dedicated frame pointer 40*10e730a2SDan Gohman /// register. 41*10e730a2SDan Gohman bool WebAssemblyFrameLowering::hasFP(const MachineFunction &MF) const { 42*10e730a2SDan Gohman llvm_unreachable("TODO: implement hasFP"); 43*10e730a2SDan Gohman } 44*10e730a2SDan Gohman 45*10e730a2SDan Gohman /// Under normal circumstances, when a frame pointer is not required, we reserve 46*10e730a2SDan Gohman /// argument space for call sites in the function immediately on entry to the 47*10e730a2SDan Gohman /// current function. This eliminates the need for add/sub sp brackets around 48*10e730a2SDan Gohman /// call sites. Returns true if the call frame is included as part of the stack 49*10e730a2SDan Gohman /// frame. 50*10e730a2SDan Gohman bool WebAssemblyFrameLowering::hasReservedCallFrame( 51*10e730a2SDan Gohman const MachineFunction &MF) const { 52*10e730a2SDan Gohman return !MF.getFrameInfo()->hasVarSizedObjects(); 53*10e730a2SDan Gohman } 54*10e730a2SDan Gohman 55*10e730a2SDan Gohman void WebAssemblyFrameLowering::eliminateCallFramePseudoInstr( 56*10e730a2SDan Gohman MachineFunction &MF, MachineBasicBlock &MBB, 57*10e730a2SDan Gohman MachineBasicBlock::iterator I) const { 58*10e730a2SDan Gohman llvm_unreachable("TODO: implement eliminateCallFramePseudoInstr"); 59*10e730a2SDan Gohman } 60*10e730a2SDan Gohman 61*10e730a2SDan Gohman void WebAssemblyFrameLowering::emitPrologue(MachineFunction &MF, 62*10e730a2SDan Gohman MachineBasicBlock &MBB) const { 63*10e730a2SDan Gohman llvm_unreachable("TODO: implement emitPrologue"); 64*10e730a2SDan Gohman } 65*10e730a2SDan Gohman 66*10e730a2SDan Gohman void WebAssemblyFrameLowering::emitEpilogue(MachineFunction &MF, 67*10e730a2SDan Gohman MachineBasicBlock &MBB) const { 68*10e730a2SDan Gohman llvm_unreachable("TODO: implement emitEpilogue"); 69*10e730a2SDan Gohman } 70*10e730a2SDan Gohman 71*10e730a2SDan Gohman void WebAssemblyFrameLowering::processFunctionBeforeCalleeSavedScan( 72*10e730a2SDan Gohman MachineFunction &MF, RegScavenger *RS) const { 73*10e730a2SDan Gohman llvm_unreachable("TODO: implement processFunctionBeforeCalleeSavedScan"); 74*10e730a2SDan Gohman } 75