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"
23 class X86TargetMachine;
25 class X86FrameLowering : public TargetFrameLowering {
26 const X86TargetMachine &TM;
27 const X86Subtarget &STI;
29 explicit X86FrameLowering(const X86TargetMachine &tm, const X86Subtarget &sti)
30 : TargetFrameLowering(StackGrowsDown,
31 sti.getStackAlignment(),
32 (sti.is64Bit() ? -8 : -4)),
36 void emitCalleeSavedFrameMoves(MachineFunction &MF, MCSymbol *Label,
37 unsigned FramePtr) const;
39 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
41 void emitPrologue(MachineFunction &MF) const;
42 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
44 void adjustForSegmentedStacks(MachineFunction &MF) const;
46 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
47 RegScavenger *RS = NULL) const;
49 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
50 MachineBasicBlock::iterator MI,
51 const std::vector<CalleeSavedInfo> &CSI,
52 const TargetRegisterInfo *TRI) const;
54 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
55 MachineBasicBlock::iterator MI,
56 const std::vector<CalleeSavedInfo> &CSI,
57 const TargetRegisterInfo *TRI) const;
59 bool hasFP(const MachineFunction &MF) const;
60 bool hasReservedCallFrame(const MachineFunction &MF) const;
62 int getFrameIndexOffset(const MachineFunction &MF, int FI) const;
63 int getFrameIndexReference(const MachineFunction &MF, int FI,
64 unsigned &FrameReg) const;
65 uint32_t getCompactUnwindEncoding(MachineFunction &MF) const;
68 } // End llvm namespace