1 //===-- X86TargetFrameLowering.h - Define frame lowering for X86 -*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This class implements X86-specific bits of TargetFrameLowering class.
12 //===----------------------------------------------------------------------===//
14 #ifndef X86_FRAMELOWERING_H
15 #define X86_FRAMELOWERING_H
17 #include "X86Subtarget.h"
18 #include "llvm/Target/TargetFrameLowering.h"
23 class X86TargetMachine;
25 class X86FrameLowering : public TargetFrameLowering {
27 explicit X86FrameLowering(const X86Subtarget &sti)
28 : TargetFrameLowering(StackGrowsDown, sti.getStackAlignment(),
29 (sti.is64Bit() ? -8 : -4)) {}
31 void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
32 MachineBasicBlock::iterator MBBI, DebugLoc DL,
33 unsigned FramePtr) const;
35 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
37 void emitPrologue(MachineFunction &MF) const override;
38 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
40 void adjustForSegmentedStacks(MachineFunction &MF) const override;
42 void adjustForHiPEPrologue(MachineFunction &MF) const override;
44 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
45 RegScavenger *RS = nullptr) const override;
47 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
48 MachineBasicBlock::iterator MI,
49 const std::vector<CalleeSavedInfo> &CSI,
50 const TargetRegisterInfo *TRI) const override;
52 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
53 MachineBasicBlock::iterator MI,
54 const std::vector<CalleeSavedInfo> &CSI,
55 const TargetRegisterInfo *TRI) const override;
57 bool hasFP(const MachineFunction &MF) const override;
58 bool hasReservedCallFrame(const MachineFunction &MF) const override;
60 int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
61 int getFrameIndexReference(const MachineFunction &MF, int FI,
62 unsigned &FrameReg) const override;
64 void eliminateCallFramePseudoInstr(MachineFunction &MF,
65 MachineBasicBlock &MBB,
66 MachineBasicBlock::iterator MI) const override;
69 } // End llvm namespace