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"
22 class X86TargetMachine
;
24 class X86FrameLowering
: public TargetFrameLowering
{
25 const X86TargetMachine
&TM
;
26 const X86Subtarget
&STI
;
28 explicit X86FrameLowering(const X86TargetMachine
&tm
, const X86Subtarget
&sti
)
29 : TargetFrameLowering(StackGrowsDown
,
30 sti
.getStackAlignment(),
31 (sti
.is64Bit() ? -8 : -4)),
35 void emitCalleeSavedFrameMoves(MachineFunction
&MF
, MCSymbol
*Label
,
36 unsigned FramePtr
) const;
38 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
40 void emitPrologue(MachineFunction
&MF
) const;
41 void emitEpilogue(MachineFunction
&MF
, MachineBasicBlock
&MBB
) const;
43 void processFunctionBeforeCalleeSavedScan(MachineFunction
&MF
,
44 RegScavenger
*RS
= NULL
) const;
46 bool spillCalleeSavedRegisters(MachineBasicBlock
&MBB
,
47 MachineBasicBlock::iterator MI
,
48 const std::vector
<CalleeSavedInfo
> &CSI
,
49 const TargetRegisterInfo
*TRI
) const;
51 bool restoreCalleeSavedRegisters(MachineBasicBlock
&MBB
,
52 MachineBasicBlock::iterator MI
,
53 const std::vector
<CalleeSavedInfo
> &CSI
,
54 const TargetRegisterInfo
*TRI
) const;
56 bool hasFP(const MachineFunction
&MF
) const;
57 bool hasReservedCallFrame(const MachineFunction
&MF
) const;
59 void getInitialFrameState(std::vector
<MachineMove
> &Moves
) const;
60 int getFrameIndexOffset(const MachineFunction
&MF
, int FI
) const;
63 } // End llvm namespace