Home | History | Annotate | Line # | Download | only in XCore
      1 //===-- XCoreFrameLowering.h - Frame info for XCore Target ------*- C++ -*-===//
      2 //
      3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
      4 // See https://llvm.org/LICENSE.txt for license information.
      5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
      6 //
      7 //===----------------------------------------------------------------------===//
      8 //
      9 // This file contains XCore frame information that doesn't fit anywhere else
     10 // cleanly...
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_LIB_TARGET_XCORE_XCOREFRAMELOWERING_H
     15 #define LLVM_LIB_TARGET_XCORE_XCOREFRAMELOWERING_H
     16 
     17 #include "llvm/CodeGen/TargetFrameLowering.h"
     18 #include "llvm/Target/TargetMachine.h"
     19 
     20 namespace llvm {
     21   class XCoreSubtarget;
     22 
     23   class XCoreFrameLowering: public TargetFrameLowering {
     24   public:
     25     XCoreFrameLowering(const XCoreSubtarget &STI);
     26 
     27     /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
     28     /// the function.
     29     void emitPrologue(MachineFunction &MF,
     30                       MachineBasicBlock &MBB) const override;
     31     void emitEpilogue(MachineFunction &MF,
     32                       MachineBasicBlock &MBB) const override;
     33 
     34     bool
     35     spillCalleeSavedRegisters(MachineBasicBlock &MBB,
     36                               MachineBasicBlock::iterator MI,
     37                               ArrayRef<CalleeSavedInfo> CSI,
     38                               const TargetRegisterInfo *TRI) const override;
     39     bool
     40     restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
     41                                 MachineBasicBlock::iterator MI,
     42                                 MutableArrayRef<CalleeSavedInfo> CSI,
     43                                 const TargetRegisterInfo *TRI) const override;
     44 
     45     MachineBasicBlock::iterator
     46     eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
     47                                   MachineBasicBlock::iterator I) const override;
     48 
     49     bool hasFP(const MachineFunction &MF) const override;
     50 
     51     void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
     52                               RegScavenger *RS = nullptr) const override;
     53 
     54     void processFunctionBeforeFrameFinalized(MachineFunction &MF,
     55                                      RegScavenger *RS = nullptr) const override;
     56 
     57     //! Stack slot size (4 bytes)
     58     static int stackSlotSize() {
     59       return 4;
     60     }
     61   };
     62 }
     63 
     64 #endif
     65