2012-02-18 20:03:15 +08:00
|
|
|
//===-- X86TargetFrameLowering.h - Define frame lowering for X86 -*- C++ -*-==//
|
2010-11-15 08:06:54 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2011-01-10 20:39:04 +08:00
|
|
|
// This class implements X86-specific bits of TargetFrameLowering class.
|
2010-11-15 08:06:54 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-01-10 20:39:04 +08:00
|
|
|
#ifndef X86_FRAMELOWERING_H
|
|
|
|
#define X86_FRAMELOWERING_H
|
2010-11-15 08:06:54 +08:00
|
|
|
|
|
|
|
#include "X86Subtarget.h"
|
2011-01-10 20:39:04 +08:00
|
|
|
#include "llvm/Target/TargetFrameLowering.h"
|
2010-11-15 08:06:54 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
2013-04-19 08:05:59 +08:00
|
|
|
|
|
|
|
class MCSymbol;
|
|
|
|
class X86TargetMachine;
|
2010-11-15 08:06:54 +08:00
|
|
|
|
2011-01-10 20:39:04 +08:00
|
|
|
class X86FrameLowering : public TargetFrameLowering {
|
2010-11-19 07:25:52 +08:00
|
|
|
const X86TargetMachine &TM;
|
2010-11-15 08:06:54 +08:00
|
|
|
const X86Subtarget &STI;
|
|
|
|
public:
|
2011-01-10 20:39:04 +08:00
|
|
|
explicit X86FrameLowering(const X86TargetMachine &tm, const X86Subtarget &sti)
|
|
|
|
: TargetFrameLowering(StackGrowsDown,
|
|
|
|
sti.getStackAlignment(),
|
2011-02-05 23:11:32 +08:00
|
|
|
(sti.is64Bit() ? -8 : -4)),
|
2010-11-19 07:25:52 +08:00
|
|
|
TM(tm), STI(sti) {
|
2010-11-15 08:06:54 +08:00
|
|
|
}
|
|
|
|
|
2014-03-07 14:08:31 +08:00
|
|
|
void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MBBI, DebugLoc DL,
|
2010-11-15 08:06:54 +08:00
|
|
|
unsigned FramePtr) const;
|
|
|
|
|
|
|
|
/// emitProlog/emitEpilog - These methods insert prolog and epilog code into
|
|
|
|
/// the function.
|
2014-03-09 15:44:38 +08:00
|
|
|
void emitPrologue(MachineFunction &MF) const override;
|
|
|
|
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
|
2010-11-19 05:19:35 +08:00
|
|
|
|
2014-03-09 15:44:38 +08:00
|
|
|
void adjustForSegmentedStacks(MachineFunction &MF) const override;
|
2011-08-31 03:39:58 +08:00
|
|
|
|
2014-03-09 15:44:38 +08:00
|
|
|
void adjustForHiPEPrologue(MachineFunction &MF) const override;
|
2013-02-19 04:55:12 +08:00
|
|
|
|
2010-11-28 07:05:25 +08:00
|
|
|
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
2014-03-09 15:44:38 +08:00
|
|
|
RegScavenger *RS = NULL) const override;
|
2010-11-28 07:05:25 +08:00
|
|
|
|
2010-11-28 07:05:03 +08:00
|
|
|
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
const std::vector<CalleeSavedInfo> &CSI,
|
2014-03-09 15:44:38 +08:00
|
|
|
const TargetRegisterInfo *TRI) const override;
|
2010-11-28 07:05:03 +08:00
|
|
|
|
2010-11-28 07:05:25 +08:00
|
|
|
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
2014-03-09 15:44:38 +08:00
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
const std::vector<CalleeSavedInfo> &CSI,
|
|
|
|
const TargetRegisterInfo *TRI) const override;
|
2010-11-28 07:05:03 +08:00
|
|
|
|
2014-03-09 15:44:38 +08:00
|
|
|
bool hasFP(const MachineFunction &MF) const override;
|
|
|
|
bool hasReservedCallFrame(const MachineFunction &MF) const override;
|
2010-11-19 05:19:35 +08:00
|
|
|
|
2014-03-09 15:44:38 +08:00
|
|
|
int getFrameIndexOffset(const MachineFunction &MF, int FI) const override;
|
2012-05-01 23:16:06 +08:00
|
|
|
int getFrameIndexReference(const MachineFunction &MF, int FI,
|
2014-03-09 15:44:38 +08:00
|
|
|
unsigned &FrameReg) const override;
|
2013-02-22 04:05:00 +08:00
|
|
|
|
|
|
|
void eliminateCallFramePseudoInstr(MachineFunction &MF,
|
2014-03-09 15:44:38 +08:00
|
|
|
MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI) const override;
|
2010-11-15 08:06:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|