10b57cec5SDimitry Andric //==- MSP430FrameLowering.h - Define frame lowering for MSP430 --*- C++ -*--==// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_MSP430_MSP430FRAMELOWERING_H 140b57cec5SDimitry Andric #define LLVM_LIB_TARGET_MSP430_MSP430FRAMELOWERING_H 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric #include "MSP430.h" 170b57cec5SDimitry Andric #include "llvm/CodeGen/TargetFrameLowering.h" 180b57cec5SDimitry Andric 190b57cec5SDimitry Andric namespace llvm { 20*06c3fb27SDimitry Andric 21*06c3fb27SDimitry Andric class MSP430Subtarget; 22*06c3fb27SDimitry Andric class MSP430InstrInfo; 23*06c3fb27SDimitry Andric class MSP430RegisterInfo; 24*06c3fb27SDimitry Andric 250b57cec5SDimitry Andric class MSP430FrameLowering : public TargetFrameLowering { 260b57cec5SDimitry Andric protected: 270b57cec5SDimitry Andric 280b57cec5SDimitry Andric public: 29*06c3fb27SDimitry Andric MSP430FrameLowering(const MSP430Subtarget &STI); 30*06c3fb27SDimitry Andric 31*06c3fb27SDimitry Andric const MSP430Subtarget &STI; 32*06c3fb27SDimitry Andric const MSP430InstrInfo &TII; 33*06c3fb27SDimitry Andric const MSP430RegisterInfo *TRI; 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric /// emitProlog/emitEpilog - These methods insert prolog and epilog code into 360b57cec5SDimitry Andric /// the function. 370b57cec5SDimitry Andric void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; 380b57cec5SDimitry Andric void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; 390b57cec5SDimitry Andric 400b57cec5SDimitry Andric MachineBasicBlock::iterator 410b57cec5SDimitry Andric eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, 420b57cec5SDimitry Andric MachineBasicBlock::iterator I) const override; 430b57cec5SDimitry Andric 440b57cec5SDimitry Andric bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, 450b57cec5SDimitry Andric MachineBasicBlock::iterator MI, 465ffd83dbSDimitry Andric ArrayRef<CalleeSavedInfo> CSI, 470b57cec5SDimitry Andric const TargetRegisterInfo *TRI) const override; 485ffd83dbSDimitry Andric bool 495ffd83dbSDimitry Andric restoreCalleeSavedRegisters(MachineBasicBlock &MBB, 500b57cec5SDimitry Andric MachineBasicBlock::iterator MI, 515ffd83dbSDimitry Andric MutableArrayRef<CalleeSavedInfo> CSI, 520b57cec5SDimitry Andric const TargetRegisterInfo *TRI) const override; 530b57cec5SDimitry Andric 540b57cec5SDimitry Andric bool hasFP(const MachineFunction &MF) const override; 550b57cec5SDimitry Andric bool hasReservedCallFrame(const MachineFunction &MF) const override; 560b57cec5SDimitry Andric void processFunctionBeforeFrameFinalized(MachineFunction &MF, 570b57cec5SDimitry Andric RegScavenger *RS = nullptr) const override; 58*06c3fb27SDimitry Andric 59*06c3fb27SDimitry Andric /// Wraps up getting a CFI index and building a MachineInstr for it. 60*06c3fb27SDimitry Andric void BuildCFI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, 61*06c3fb27SDimitry Andric const DebugLoc &DL, const MCCFIInstruction &CFIInst, 62*06c3fb27SDimitry Andric MachineInstr::MIFlag Flag = MachineInstr::NoFlags) const; 63*06c3fb27SDimitry Andric 64*06c3fb27SDimitry Andric void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB, 65*06c3fb27SDimitry Andric MachineBasicBlock::iterator MBBI, 66*06c3fb27SDimitry Andric const DebugLoc &DL, bool IsPrologue) const; 670b57cec5SDimitry Andric }; 680b57cec5SDimitry Andric 690b57cec5SDimitry Andric } // End llvm namespace 700b57cec5SDimitry Andric 710b57cec5SDimitry Andric #endif 72