• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- LanaiFrameLowering.h - Define frame lowering for Lanai --*- C++-*--===//
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 // This class implements Lanai-specific bits of TargetFrameLowering class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_LANAI_LANAIFRAMELOWERING_H
15 #define LLVM_LIB_TARGET_LANAI_LANAIFRAMELOWERING_H
16 
17 #include "Lanai.h"
18 #include "llvm/Target/TargetFrameLowering.h"
19 
20 namespace llvm {
21 
22 class BitVector;
23 class LanaiSubtarget;
24 
25 class LanaiFrameLowering : public TargetFrameLowering {
26 private:
27   void determineFrameLayout(MachineFunction &MF) const;
28   void replaceAdjDynAllocPseudo(MachineFunction &MF) const;
29 
30 protected:
31   const LanaiSubtarget &STI;
32 
33 public:
LanaiFrameLowering(const LanaiSubtarget & Subtarget)34   explicit LanaiFrameLowering(const LanaiSubtarget &Subtarget)
35       : TargetFrameLowering(StackGrowsDown,
36                             /*StackAlignment=*/8,
37                             /*LocalAreaOffset=*/0),
38         STI(Subtarget) {}
39 
40   // emitProlog/emitEpilog - These methods insert prolog and epilog code into
41   // the function.
42   void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
43   void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
44 
45   MachineBasicBlock::iterator
46   eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
47                                 MachineBasicBlock::iterator I) const override;
48 
hasFP(const MachineFunction & MF)49   bool hasFP(const MachineFunction &MF) const override { return true; }
50 
51   void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
52                             RegScavenger *RS = nullptr) const override;
53 };
54 
55 } // namespace llvm
56 
57 #endif // LLVM_LIB_TARGET_LANAI_LANAIFRAMELOWERING_H
58