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/MC/MCDwarf.h"
19 #include "llvm/Target/TargetFrameLowering.h"
24 class X86TargetMachine;
26 class X86FrameLowering : public TargetFrameLowering {
27 const X86TargetMachine &TM;
28 const X86Subtarget &STI;
30 explicit X86FrameLowering(const X86TargetMachine &tm, const X86Subtarget &sti)
31 : TargetFrameLowering(StackGrowsDown,
32 sti.getStackAlignment(),
33 (sti.is64Bit() ? -8 : -4)),
37 void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
38 MachineBasicBlock::iterator MBBI, DebugLoc DL,
39 unsigned FramePtr) const;
41 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
43 void emitPrologue(MachineFunction &MF) const override;
44 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
46 void adjustForSegmentedStacks(MachineFunction &MF) const override;
48 void adjustForHiPEPrologue(MachineFunction &MF) const override;
50 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
51 RegScavenger *RS = NULL) const override;
53 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
54 MachineBasicBlock::iterator MI,
55 const std::vector<CalleeSavedInfo> &CSI,
56 const TargetRegisterInfo *TRI) const override;
58 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
59 MachineBasicBlock::iterator MI,
60 const std::vector<CalleeSavedInfo> &CSI,
61 const TargetRegisterInfo *TRI) const override;
63 bool hasFP(const MachineFunction &MF) const override;
64 bool hasReservedCallFrame(const MachineFunction &MF) const override;
66 int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
67 int getFrameIndexReference(const MachineFunction &MF, int FI,
68 unsigned &FrameReg) const override;
70 void eliminateCallFramePseudoInstr(MachineFunction &MF,
71 MachineBasicBlock &MBB,
72 MachineBasicBlock::iterator MI) const override;
75 } // End llvm namespace