1 //===-- X86TargetFrameLowering.h - Define frame lowering for X86 -*- C++ -*-==//
\r
3 // The LLVM Compiler Infrastructure
\r
5 // This file is distributed under the University of Illinois Open Source
\r
6 // License. See LICENSE.TXT for details.
\r
8 //===----------------------------------------------------------------------===//
\r
10 // This class implements X86-specific bits of TargetFrameLowering class.
\r
12 //===----------------------------------------------------------------------===//
\r
14 #ifndef LLVM_LIB_TARGET_X86_X86FRAMELOWERING_H
\r
15 #define LLVM_LIB_TARGET_X86_X86FRAMELOWERING_H
\r
17 #include "llvm/Target/TargetFrameLowering.h"
\r
22 class X86TargetMachine;
\r
25 class X86FrameLowering : public TargetFrameLowering {
\r
27 explicit X86FrameLowering(StackDirection D, unsigned StackAl, int LAO)
\r
28 : TargetFrameLowering(StackGrowsDown, StackAl, LAO) {}
\r
30 /// Emit a call to the target's stack probe function. This is required for all
\r
31 /// large stack allocations on Windows. The caller is required to materialize
\r
32 /// the number of bytes to probe in RAX/EAX.
\r
33 static void emitStackProbeCall(MachineFunction &MF, MachineBasicBlock &MBB,
\r
34 MachineBasicBlock::iterator MBBI, DebugLoc DL);
\r
36 void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
\r
37 MachineBasicBlock::iterator MBBI,
\r
40 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
\r
42 void emitPrologue(MachineFunction &MF) const override;
\r
43 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
\r
45 void adjustForSegmentedStacks(MachineFunction &MF) const override;
\r
47 void adjustForHiPEPrologue(MachineFunction &MF) const override;
\r
49 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
\r
50 RegScavenger *RS = nullptr) const override;
\r
53 assignCalleeSavedSpillSlots(MachineFunction &MF,
\r
54 const TargetRegisterInfo *TRI,
\r
55 std::vector<CalleeSavedInfo> &CSI) const override;
\r
57 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
\r
58 MachineBasicBlock::iterator MI,
\r
59 const std::vector<CalleeSavedInfo> &CSI,
\r
60 const TargetRegisterInfo *TRI) const override;
\r
62 bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
\r
63 MachineBasicBlock::iterator MI,
\r
64 const std::vector<CalleeSavedInfo> &CSI,
\r
65 const TargetRegisterInfo *TRI) const override;
\r
67 bool hasFP(const MachineFunction &MF) const override;
\r
68 bool hasReservedCallFrame(const MachineFunction &MF) const override;
\r
69 bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
\r
70 bool needsFrameIndexResolution(const MachineFunction &MF) const override;
\r
72 int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
\r
73 int getFrameIndexReference(const MachineFunction &MF, int FI,
\r
74 unsigned &FrameReg) const override;
\r
76 int getFrameIndexOffsetFromSP(const MachineFunction &MF, int FI) const;
\r
77 int getFrameIndexReferenceFromSP(const MachineFunction &MF, int FI,
\r
78 unsigned &FrameReg) const override;
\r
80 void eliminateCallFramePseudoInstr(MachineFunction &MF,
\r
81 MachineBasicBlock &MBB,
\r
82 MachineBasicBlock::iterator MI) const override;
\r
85 /// convertArgMovsToPushes - This method tries to convert a call sequence
\r
86 /// that uses sub and mov instructions to put the argument onto the stack
\r
87 /// into a series of pushes.
\r
88 /// Returns true if the transformation succeeded, false if not.
\r
89 bool convertArgMovsToPushes(MachineFunction &MF,
\r
90 MachineBasicBlock &MBB,
\r
91 MachineBasicBlock::iterator I,
\r
92 uint64_t Amount) const;
\r
95 } // End llvm namespace
\r