Move getInitialFrameState from TargetFrameInfo to MCAsmInfo (suggestions for

better location welcome).

llvm-svn: 135438
This commit is contained in:
Evan Cheng 2011-07-18 22:29:13 +00:00
parent 11de9a966a
commit 67c033e6b8
44 changed files with 114 additions and 134 deletions

View File

@ -34,7 +34,7 @@
#include "llvm/Pass.h"
#include "llvm/GlobalValue.h"
#include "llvm/Metadata.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/DebugLoc.h"

View File

@ -16,8 +16,10 @@
#ifndef LLVM_TARGET_ASM_INFO_H
#define LLVM_TARGET_ASM_INFO_H
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/MCDirectives.h"
#include <cassert>
#include <vector>
namespace llvm {
class MCExpr;
@ -304,6 +306,10 @@ namespace llvm {
const char *const *AsmTransCBE; // Defaults to empty
//===--- Prologue State ----------------------------------------------===//
std::vector<MachineMove> InitialFrameState;
public:
explicit MCAsmInfo();
virtual ~MCAsmInfo();
@ -512,6 +518,14 @@ namespace llvm {
const char *const *getAsmCBE() const {
return AsmTransCBE;
}
void addInitialFrameState(MCSymbol *label, const MachineLocation &D,
const MachineLocation &S) {
InitialFrameState.push_back(MachineMove(label, D, S));
}
const std::vector<MachineMove> &getInitialFrameState() const {
return InitialFrameState;
}
};
}

View File

@ -16,15 +16,13 @@
#define LLVM_MC_MCDWARF_H
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/MachineLocation.h" // FIXME
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Dwarf.h"
#include <vector>
namespace llvm {
class TargetAsmInfo;
class MachineMove;
class MCContext;
class MCExpr;
class MCSection;

View File

@ -1,4 +1,4 @@
//===-- llvm/CodeGen/MachineLocation.h --------------------------*- C++ -*-===//
//===-- llvm/MC/MachineLocation.h -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -18,8 +18,8 @@
//===----------------------------------------------------------------------===//
#ifndef LLVM_CODEGEN_MACHINELOCATION_H
#define LLVM_CODEGEN_MACHINELOCATION_H
#ifndef LLVM_MC_MACHINELOCATION_H
#define LLVM_MC_MACHINELOCATION_H
namespace llvm {
class MCSymbol;
@ -36,11 +36,11 @@ public:
VirtualFP = ~0U
};
MachineLocation()
: IsRegister(false), Register(0), Offset(0) {}
: IsRegister(false), Register(0), Offset(0) {}
explicit MachineLocation(unsigned R)
: IsRegister(true), Register(R), Offset(0) {}
: IsRegister(true), Register(R), Offset(0) {}
MachineLocation(unsigned R, int O)
: IsRegister(false), Register(R), Offset(O) {}
: IsRegister(false), Register(R), Offset(O) {}
bool operator==(const MachineLocation &Other) const {
return IsRegister == Other.IsRegister && Register == Other.Register &&

View File

@ -14,7 +14,6 @@
#ifndef LLVM_TARGET_TARGETASMINFO_H
#define LLVM_TARGET_TARGETASMINFO_H
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetRegisterInfo.h"
@ -22,13 +21,10 @@
namespace llvm {
template <typename T> class ArrayRef;
class MCSection;
class MCContext;
class MachineFunction;
class TargetMachine;
class TargetLoweringObjectFile;
class TargetAsmInfo {
std::vector<MachineMove> InitialFrameState;
const TargetFrameLowering *TFI;
const TargetLoweringObjectFile *TLOF;
@ -72,10 +68,6 @@ public:
bool IsEH) const {
return TFI->getCompactUnwindEncoding(Instrs, DataAlignmentFactor, IsEH);
}
const std::vector<MachineMove> &getInitialFrameState() const {
return InitialFrameState;
}
};
}

View File

@ -161,11 +161,6 @@ public:
return hasReservedCallFrame(MF) || hasFP(MF);
}
/// getInitialFrameState - Returns a list of machine moves that are assumed
/// on entry to all functions. Note that LabelID is ignored (assumed to be
/// the beginning of the function.)
virtual void getInitialFrameState(std::vector<MachineMove> &Moves) const;
/// getFrameIndexOffset - Returns the displacement from the frame register to
/// the stack frame of the specified index.
virtual int getFrameIndexOffset(const MachineFunction &MF, int FI) const;

View File

@ -17,7 +17,6 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"

View File

@ -13,7 +13,7 @@
#define DEBUG_TYPE "asm-printer"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"

View File

@ -17,7 +17,7 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"

View File

@ -15,7 +15,7 @@
#define CODEGEN_ASMPRINTER_DWARFDEBUG_H__
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/Analysis/DebugInfo.h"
#include "DIE.h"
#include "llvm/ADT/DenseMap.h"

View File

@ -17,7 +17,6 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"

View File

@ -17,7 +17,6 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"

View File

@ -18,12 +18,12 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/CodeGen/JITCodeEmitter.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/ExecutionEngine/JITMemoryManager.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetFrameLowering.h"
@ -45,7 +45,7 @@ unsigned char* JITDwarfEmitter::EmitDwarfTable(MachineFunction& F,
TD = TM.getTargetData();
stackGrowthDirection = TM.getFrameLowering()->getStackGrowthDirection();
RI = TM.getRegisterInfo();
TFI = TM.getFrameLowering();
MAI = TM.getMCAsmInfo();
JCE = &jce;
unsigned char* ExceptionTable = EmitExceptionTable(&F, StartFunction,
@ -523,9 +523,7 @@ JITDwarfEmitter::EmitCommonEHFrame(const Function* Personality) const {
JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
}
std::vector<MachineMove> Moves;
TFI->getInitialFrameState(Moves);
EmitFrameMoves(0, Moves);
EmitFrameMoves(0, MAI->getInitialFrameState());
JCE->emitAlignmentWithFill(PointerSize, dwarf::DW_CFA_nop);

View File

@ -22,8 +22,8 @@ class JITCodeEmitter;
class MachineFunction;
class MachineModuleInfo;
class MachineMove;
class MCAsmInfo;
class TargetData;
class TargetFrameLowering;
class TargetMachine;
class TargetRegisterInfo;
@ -31,7 +31,7 @@ class JITDwarfEmitter {
const TargetData* TD;
JITCodeEmitter* JCE;
const TargetRegisterInfo* RI;
const TargetFrameLowering *TFI;
const MCAsmInfo *MAI;
MachineModuleInfo* MMI;
JIT& Jit;
bool stackGrowthDirection;

View File

@ -865,7 +865,8 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(MCStreamer &streamer,
// Initial Instructions
const std::vector<MachineMove> &Moves = TAI.getInitialFrameState();
const MCAsmInfo &MAI = context.getAsmInfo();
const std::vector<MachineMove> &Moves = MAI.getInitialFrameState();
std::vector<MCCFIInstruction> Instructions;
for (int i = 0, n = Moves.size(); i != n; ++i) {

View File

@ -27,7 +27,6 @@
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/Support/Debug.h"

View File

@ -27,7 +27,6 @@
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetMachine.h"

View File

@ -21,7 +21,6 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"

View File

@ -20,7 +20,6 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetMachine.h"

View File

@ -13,6 +13,7 @@
#include "SPUMCTargetDesc.h"
#include "SPUMCAsmInfo.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
@ -62,6 +63,17 @@ extern "C" void LLVMInitializeCellSPUMCSubtargetInfo() {
createSPUMCSubtargetInfo);
}
extern "C" void LLVMInitializeCellSPUMCAsmInfo() {
RegisterMCAsmInfo<SPULinuxMCAsmInfo> X(TheCellSPUTarget);
static MCAsmInfo *createSPUMCAsmInfo(const Target &T, StringRef TT) {
MCAsmInfo *MAI = new SPULinuxMCAsmInfo(T, TT);
// Initial state of the frame pointer is R1.
MachineLocation Dst(MachineLocation::VirtualFP);
MachineLocation Src(SPU::R1, 0);
MAI->addInitialFrameState(0, Dst, Src);
return MAI;
}
extern "C" void LLVMInitializeCellSPUMCAsmInfo() {
RegisterMCAsmInfoFn X(TheCellSPUTarget, createSPUMCAsmInfo);
}

View File

@ -249,14 +249,6 @@ void SPUFrameLowering::emitEpilogue(MachineFunction &MF,
}
}
void SPUFrameLowering::getInitialFrameState(std::vector<MachineMove> &Moves)
const {
// Initial state of the frame pointer is R1.
MachineLocation Dst(MachineLocation::VirtualFP);
MachineLocation Src(SPU::R1, 0);
Moves.push_back(MachineMove(0, Dst, Src));
}
void SPUFrameLowering::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS) const{
// Mark LR and SP unused, since the prolog spills them to stack and

View File

@ -43,9 +43,6 @@ namespace llvm {
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS = NULL) const;
//! Perform target-specific stack frame setup.
void getInitialFrameState(std::vector<MachineMove> &Moves) const;
//! Return a function's saved spill slots
/*!
For CellSPU, a function's saved spill slots is just the link register.

View File

@ -25,7 +25,6 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/CodeGen/ValueTypes.h"

View File

@ -25,7 +25,6 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"

View File

@ -13,6 +13,7 @@
#include "MipsMCTargetDesc.h"
#include "MipsMCAsmInfo.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
@ -62,7 +63,17 @@ extern "C" void LLVMInitializeMipsMCSubtargetInfo() {
createMipsMCSubtargetInfo);
}
extern "C" void LLVMInitializeMipsMCAsmInfo() {
RegisterMCAsmInfo<MipsMCAsmInfo> X(TheMipsTarget);
RegisterMCAsmInfo<MipsMCAsmInfo> Y(TheMipselTarget);
static MCAsmInfo *createMipsMCAsmInfo(const Target &T, StringRef TT) {
MCAsmInfo *MAI = new MipsMCAsmInfo(T, TT);
MachineLocation Dst(MachineLocation::VirtualFP);
MachineLocation Src(Mips::SP, 0);
MAI->addInitialFrameState(0, Dst, Src);
return MAI;
}
extern "C" void LLVMInitializeMipsMCAsmInfo() {
RegisterMCAsmInfoFn X(TheMipsTarget, createMipsMCAsmInfo);
RegisterMCAsmInfoFn Y(TheMipselTarget, createMipsMCAsmInfo);
}

View File

@ -300,13 +300,6 @@ void MipsFrameLowering::emitEpilogue(MachineFunction &MF,
}
}
void
MipsFrameLowering::getInitialFrameState(std::vector<MachineMove> &Moves) const {
MachineLocation Dst(MachineLocation::VirtualFP);
MachineLocation Src(Mips::SP, 0);
Moves.push_back(MachineMove(0, Dst, Src));
}
void MipsFrameLowering::
processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS) const {

View File

@ -39,8 +39,6 @@ public:
bool hasFP(const MachineFunction &MF) const;
void getInitialFrameState(std::vector<MachineMove> &Moves) const;
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS) const;
};

View File

@ -24,7 +24,6 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"

View File

@ -13,6 +13,7 @@
#include "PPCMCTargetDesc.h"
#include "PPCMCAsmInfo.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
@ -70,16 +71,25 @@ extern "C" void LLVMInitializePowerPCMCSubtargetInfo() {
createPPCMCSubtargetInfo);
}
static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
static MCAsmInfo *createPPCMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
bool isPPC64 = TheTriple.getArch() == Triple::ppc64;
MCAsmInfo *MAI;
if (TheTriple.isOSDarwin())
return new PPCMCAsmInfoDarwin(isPPC64);
return new PPCLinuxMCAsmInfo(isPPC64);
MAI = new PPCMCAsmInfoDarwin(isPPC64);
else
MAI = new PPCLinuxMCAsmInfo(isPPC64);
// Initial state of the frame pointer is R1.
MachineLocation Dst(MachineLocation::VirtualFP);
MachineLocation Src(PPC::R1, 0);
MAI->addInitialFrameState(0, Dst, Src);
return MAI;
}
extern "C" void LLVMInitializePowerPCMCAsmInfo() {
RegisterMCAsmInfoFn C(ThePPC32Target, createMCAsmInfo);
RegisterMCAsmInfoFn D(ThePPC64Target, createMCAsmInfo);
RegisterMCAsmInfoFn C(ThePPC32Target, createPPCMCAsmInfo);
RegisterMCAsmInfoFn D(ThePPC64Target, createPPCMCAsmInfo);
}

View File

@ -712,13 +712,6 @@ void PPCFrameLowering::emitEpilogue(MachineFunction &MF,
}
}
void PPCFrameLowering::getInitialFrameState(std::vector<MachineMove> &Moves) const {
// Initial state of the frame pointer is R1.
MachineLocation Dst(MachineLocation::VirtualFP);
MachineLocation Src(PPC::R1, 0);
Moves.push_back(MachineMove(0, Dst, Src));
}
static bool spillsCR(const MachineFunction &MF) {
const PPCFunctionInfo *FuncInfo = MF.getInfo<PPCFunctionInfo>();
return FuncInfo->isCRSpilled();

View File

@ -40,7 +40,6 @@ public:
bool hasFP(const MachineFunction &MF) const;
bool needsFP(const MachineFunction &MF) const;
void getInitialFrameState(std::vector<MachineMove> &Moves) const;
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS = NULL) const;

View File

@ -28,7 +28,6 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/Target/TargetFrameLowering.h"

View File

@ -17,7 +17,6 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Type.h"

View File

@ -18,5 +18,4 @@ using namespace llvm;
TargetAsmInfo::TargetAsmInfo(const TargetMachine &TM) {
TLOF = &TM.getTargetLowering()->getObjFileLowering();
TFI = TM.getFrameLowering();
TFI->getInitialFrameState(InitialFrameState);
}

View File

@ -23,14 +23,6 @@ using namespace llvm;
TargetFrameLowering::~TargetFrameLowering() {
}
/// getInitialFrameState - Returns a list of machine moves that are assumed
/// on entry to a function.
void
TargetFrameLowering::getInitialFrameState(std::vector<MachineMove> &Moves)
const {
// Default is to do nothing.
}
/// getFrameIndexOffset - Returns the displacement from the frame register to
/// the stack frame of the specified index. This is the default implementation
/// which is overridden for some targets.

View File

@ -13,6 +13,7 @@
#include "X86MCTargetDesc.h"
#include "X86MCAsmInfo.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
@ -301,18 +302,35 @@ extern "C" void LLVMInitializeX86MCRegisterInfo() {
static MCAsmInfo *createX86MCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
bool is64Bit = TheTriple.getArch() == Triple::x86_64;
MCAsmInfo *MAI;
if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO) {
if (TheTriple.getArch() == Triple::x86_64)
return new X86_64MCAsmInfoDarwin(TheTriple);
if (is64Bit)
MAI = new X86_64MCAsmInfoDarwin(TheTriple);
else
return new X86MCAsmInfoDarwin(TheTriple);
MAI = new X86MCAsmInfoDarwin(TheTriple);
} else if (TheTriple.isOSWindows()) {
MAI = new X86MCAsmInfoCOFF(TheTriple);
} else {
MAI = new X86ELFMCAsmInfo(TheTriple);
}
if (TheTriple.isOSWindows())
return new X86MCAsmInfoCOFF(TheTriple);
// Initialize initial frame state.
// Calculate amount of bytes used for return address storing
int stackGrowth = is64Bit ? -8 : -4;
return new X86ELFMCAsmInfo(TheTriple);
// Initial state of the frame pointer is esp+stackGrowth.
MachineLocation Dst(MachineLocation::VirtualFP);
MachineLocation Src(is64Bit ? X86::RSP : X86::ESP, stackGrowth);
MAI->addInitialFrameState(0, Dst, Src);
// Add return address to move list
MachineLocation CSDst(is64Bit ? X86::RSP : X86::ESP, stackGrowth);
MachineLocation CSSrc(is64Bit ? X86::RIP : X86::EIP);
MAI->addInitialFrameState(0, CSDst, CSSrc);
return MAI;
}
extern "C" void LLVMInitializeX86MCAsmInfo() {

View File

@ -844,23 +844,6 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
}
}
void
X86FrameLowering::getInitialFrameState(std::vector<MachineMove> &Moves) const {
// Calculate amount of bytes used for return address storing
int stackGrowth = (STI.is64Bit() ? -8 : -4);
const X86RegisterInfo *RI = TM.getRegisterInfo();
// Initial state of the frame pointer is esp+stackGrowth.
MachineLocation Dst(MachineLocation::VirtualFP);
MachineLocation Src(RI->getStackRegister(), stackGrowth);
Moves.push_back(MachineMove(0, Dst, Src));
// Add return address to move list
MachineLocation CSDst(RI->getStackRegister(), stackGrowth);
MachineLocation CSSrc(RI->getRARegister());
Moves.push_back(MachineMove(0, CSDst, CSSrc));
}
int X86FrameLowering::getFrameIndexOffset(const MachineFunction &MF, int FI) const {
const X86RegisterInfo *RI =
static_cast<const X86RegisterInfo*>(MF.getTarget().getRegisterInfo());

View File

@ -57,7 +57,6 @@ public:
bool hasFP(const MachineFunction &MF) const;
bool hasReservedCallFrame(const MachineFunction &MF) const;
void getInitialFrameState(std::vector<MachineMove> &Moves) const;
int getFrameIndexOffset(const MachineFunction &MF, int FI) const;
uint32_t getCompactUnwindEncoding(ArrayRef<MCCFIInstruction> Instrs,

View File

@ -27,7 +27,6 @@
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/MC/MCAsmInfo.h"

View File

@ -61,6 +61,17 @@ extern "C" void LLVMInitializeXCoreMCSubtargetInfo() {
createXCoreMCSubtargetInfo);
}
extern "C" void LLVMInitializeXCoreMCAsmInfo() {
RegisterMCAsmInfo<XCoreMCAsmInfo> X(TheXCoreTarget);
static MCAsmInfo *createXCoreMCAsmInfo(const Target &T, StringRef TT) {
MCAsmInfo *MAI = new XCoreMCAsmInfo(T, TT);
// Initial state of the frame pointer is SP.
MachineLocation Dst(MachineLocation::VirtualFP);
MachineLocation Src(XCore::SP, 0);
MAI->addInitialFrameState(0, Dst, Src);
return MAI;
}
extern "C" void LLVMInitializeXCoreMCAsmInfo() {
RegisterMCAsmInfoFn X(TheXCoreTarget, createXCoreMCAsmInfo);
}

View File

@ -270,14 +270,6 @@ void XCoreFrameLowering::emitEpilogue(MachineFunction &MF,
}
}
void XCoreFrameLowering::getInitialFrameState(std::vector<MachineMove> &Moves)
const {
// Initial state of the frame pointer is SP.
MachineLocation Dst(MachineLocation::VirtualFP);
MachineLocation Src(XCore::SP, 0);
Moves.push_back(MachineMove(0, Dst, Src));
}
bool XCoreFrameLowering::spillCalleeSavedRegisters(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI,
const std::vector<CalleeSavedInfo> &CSI,

View File

@ -42,8 +42,6 @@ namespace llvm {
bool hasFP(const MachineFunction &MF) const;
void getInitialFrameState(std::vector<MachineMove> &Moves) const;
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS = NULL) const;

View File

@ -17,7 +17,6 @@
#include "llvm/MC/MCContext.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"

View File

@ -17,7 +17,6 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"