2011-01-10 13:39:04 +01:00
|
|
|
//=-- X86TargetFrameLowering.h - Define frame lowering for X86 ---*- C++ -*-===//
|
2010-11-15 01:06:54 +01: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 13:39:04 +01:00
|
|
|
// This class implements X86-specific bits of TargetFrameLowering class.
|
2010-11-15 01:06:54 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-01-10 13:39:04 +01:00
|
|
|
#ifndef X86_FRAMELOWERING_H
|
|
|
|
#define X86_FRAMELOWERING_H
|
2010-11-15 01:06:54 +01:00
|
|
|
|
|
|
|
#include "X86Subtarget.h"
|
2011-07-07 02:54:13 +02:00
|
|
|
#include "llvm/MC/MCDwarf.h"
|
2011-01-10 13:39:04 +01:00
|
|
|
#include "llvm/Target/TargetFrameLowering.h"
|
2010-11-15 01:06:54 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class MCSymbol;
|
2010-11-19 00:25:52 +01:00
|
|
|
class X86TargetMachine;
|
2010-11-15 01:06:54 +01:00
|
|
|
|
2011-01-10 13:39:04 +01:00
|
|
|
class X86FrameLowering : public TargetFrameLowering {
|
2010-11-19 00:25:52 +01:00
|
|
|
const X86TargetMachine &TM;
|
2010-11-15 01:06:54 +01:00
|
|
|
const X86Subtarget &STI;
|
|
|
|
public:
|
2011-01-10 13:39:04 +01:00
|
|
|
explicit X86FrameLowering(const X86TargetMachine &tm, const X86Subtarget &sti)
|
|
|
|
: TargetFrameLowering(StackGrowsDown,
|
|
|
|
sti.getStackAlignment(),
|
2011-02-05 16:11:32 +01:00
|
|
|
(sti.is64Bit() ? -8 : -4)),
|
2010-11-19 00:25:52 +01:00
|
|
|
TM(tm), STI(sti) {
|
2010-11-15 01:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void emitCalleeSavedFrameMoves(MachineFunction &MF, MCSymbol *Label,
|
|
|
|
unsigned FramePtr) const;
|
|
|
|
|
|
|
|
/// emitProlog/emitEpilog - These methods insert prolog and epilog code into
|
|
|
|
/// the function.
|
|
|
|
void emitPrologue(MachineFunction &MF) const;
|
|
|
|
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
|
2010-11-18 22:19:35 +01:00
|
|
|
|
2011-08-30 21:39:58 +02:00
|
|
|
void adjustForSegmentedStacks(MachineFunction &MF) const;
|
|
|
|
|
2010-11-28 00:05:25 +01:00
|
|
|
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
|
|
|
RegScavenger *RS = NULL) const;
|
|
|
|
|
2010-11-28 00:05:03 +01:00
|
|
|
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
const std::vector<CalleeSavedInfo> &CSI,
|
|
|
|
const TargetRegisterInfo *TRI) const;
|
|
|
|
|
2010-11-28 00:05:25 +01:00
|
|
|
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator MI,
|
|
|
|
const std::vector<CalleeSavedInfo> &CSI,
|
|
|
|
const TargetRegisterInfo *TRI) const;
|
2010-11-28 00:05:03 +01:00
|
|
|
|
2010-11-18 22:19:35 +01:00
|
|
|
bool hasFP(const MachineFunction &MF) const;
|
|
|
|
bool hasReservedCallFrame(const MachineFunction &MF) const;
|
|
|
|
|
2010-11-20 16:59:32 +01:00
|
|
|
int getFrameIndexOffset(const MachineFunction &MF, int FI) const;
|
2011-07-25 20:00:28 +02:00
|
|
|
uint32_t getCompactUnwindEncoding(MachineFunction &MF) const;
|
2010-11-15 01:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|