diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2011-07-18 22:29:13 +0000 | 
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2011-07-18 22:29:13 +0000 | 
| commit | 2d28617de2b0b731c08d1af9e830f31e14ac75b4 (patch) | |
| tree | e93a2a8c00c44b718f86a24da5044756f3abccc3 /lib/Target | |
| parent | 91614aec48ae01452422faf0cf6a6770d6b2166c (diff) | |
| download | external_llvm-2d28617de2b0b731c08d1af9e830f31e14ac75b4.zip external_llvm-2d28617de2b0b731c08d1af9e830f31e14ac75b4.tar.gz external_llvm-2d28617de2b0b731c08d1af9e830f31e14ac75b4.tar.bz2  | |
Move getInitialFrameState from TargetFrameInfo to MCAsmInfo (suggestions for
better location welcome).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135438 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
29 files changed, 78 insertions, 93 deletions
diff --git a/lib/Target/ARM/ARMBaseRegisterInfo.cpp b/lib/Target/ARM/ARMBaseRegisterInfo.cpp index d41fdb9..25130f9 100644 --- a/lib/Target/ARM/ARMBaseRegisterInfo.cpp +++ b/lib/Target/ARM/ARMBaseRegisterInfo.cpp @@ -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" diff --git a/lib/Target/ARM/Thumb1RegisterInfo.cpp b/lib/Target/ARM/Thumb1RegisterInfo.cpp index 4eb0b6c..61156e2 100644 --- a/lib/Target/ARM/Thumb1RegisterInfo.cpp +++ b/lib/Target/ARM/Thumb1RegisterInfo.cpp @@ -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" diff --git a/lib/Target/Alpha/AlphaRegisterInfo.cpp b/lib/Target/Alpha/AlphaRegisterInfo.cpp index 0f87d14..8b6230f 100644 --- a/lib/Target/Alpha/AlphaRegisterInfo.cpp +++ b/lib/Target/Alpha/AlphaRegisterInfo.cpp @@ -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" diff --git a/lib/Target/Blackfin/BlackfinRegisterInfo.cpp b/lib/Target/Blackfin/BlackfinRegisterInfo.cpp index e29bc5c..0d415c5 100644 --- a/lib/Target/Blackfin/BlackfinRegisterInfo.cpp +++ b/lib/Target/Blackfin/BlackfinRegisterInfo.cpp @@ -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" diff --git a/lib/Target/CellSPU/MCTargetDesc/SPUMCTargetDesc.cpp b/lib/Target/CellSPU/MCTargetDesc/SPUMCTargetDesc.cpp index 7d9b295..3c4147b 100644 --- a/lib/Target/CellSPU/MCTargetDesc/SPUMCTargetDesc.cpp +++ b/lib/Target/CellSPU/MCTargetDesc/SPUMCTargetDesc.cpp @@ -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);  } +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() { -  RegisterMCAsmInfo<SPULinuxMCAsmInfo> X(TheCellSPUTarget); +  RegisterMCAsmInfoFn X(TheCellSPUTarget, createSPUMCAsmInfo);  } diff --git a/lib/Target/CellSPU/SPUFrameLowering.cpp b/lib/Target/CellSPU/SPUFrameLowering.cpp index a3e7e73..8e3186b 100644 --- a/lib/Target/CellSPU/SPUFrameLowering.cpp +++ b/lib/Target/CellSPU/SPUFrameLowering.cpp @@ -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 diff --git a/lib/Target/CellSPU/SPUFrameLowering.h b/lib/Target/CellSPU/SPUFrameLowering.h index 4fee72d..16789dd 100644 --- a/lib/Target/CellSPU/SPUFrameLowering.h +++ b/lib/Target/CellSPU/SPUFrameLowering.h @@ -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. diff --git a/lib/Target/CellSPU/SPURegisterInfo.cpp b/lib/Target/CellSPU/SPURegisterInfo.cpp index bb49e5f..bbac6fd 100644 --- a/lib/Target/CellSPU/SPURegisterInfo.cpp +++ b/lib/Target/CellSPU/SPURegisterInfo.cpp @@ -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" diff --git a/lib/Target/MBlaze/MBlazeRegisterInfo.cpp b/lib/Target/MBlaze/MBlazeRegisterInfo.cpp index 152e34c..c82a84c 100644 --- a/lib/Target/MBlaze/MBlazeRegisterInfo.cpp +++ b/lib/Target/MBlaze/MBlazeRegisterInfo.cpp @@ -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" diff --git a/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp b/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp index 4acb128..3a2ed8a 100644 --- a/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp +++ b/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp @@ -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);  } +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() { -  RegisterMCAsmInfo<MipsMCAsmInfo> X(TheMipsTarget); -  RegisterMCAsmInfo<MipsMCAsmInfo> Y(TheMipselTarget); +  RegisterMCAsmInfoFn X(TheMipsTarget, createMipsMCAsmInfo); +  RegisterMCAsmInfoFn Y(TheMipselTarget, createMipsMCAsmInfo);  } diff --git a/lib/Target/Mips/MipsFrameLowering.cpp b/lib/Target/Mips/MipsFrameLowering.cpp index a0f90a0..8b4e238 100644 --- a/lib/Target/Mips/MipsFrameLowering.cpp +++ b/lib/Target/Mips/MipsFrameLowering.cpp @@ -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 { diff --git a/lib/Target/Mips/MipsFrameLowering.h b/lib/Target/Mips/MipsFrameLowering.h index 78c78ee..a778fde 100644 --- a/lib/Target/Mips/MipsFrameLowering.h +++ b/lib/Target/Mips/MipsFrameLowering.h @@ -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;  }; diff --git a/lib/Target/Mips/MipsRegisterInfo.cpp b/lib/Target/Mips/MipsRegisterInfo.cpp index 0988bd5..94e84d7 100644 --- a/lib/Target/Mips/MipsRegisterInfo.cpp +++ b/lib/Target/Mips/MipsRegisterInfo.cpp @@ -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" diff --git a/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp b/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp index 3ac644d..e651330 100644 --- a/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp +++ b/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp @@ -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);    } diff --git a/lib/Target/PowerPC/PPCFrameLowering.cpp b/lib/Target/PowerPC/PPCFrameLowering.cpp index 375e000..8dd6cba 100644 --- a/lib/Target/PowerPC/PPCFrameLowering.cpp +++ b/lib/Target/PowerPC/PPCFrameLowering.cpp @@ -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(); diff --git a/lib/Target/PowerPC/PPCFrameLowering.h b/lib/Target/PowerPC/PPCFrameLowering.h index 0c18de1..20faa71 100644 --- a/lib/Target/PowerPC/PPCFrameLowering.h +++ b/lib/Target/PowerPC/PPCFrameLowering.h @@ -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; diff --git a/lib/Target/PowerPC/PPCRegisterInfo.cpp b/lib/Target/PowerPC/PPCRegisterInfo.cpp index 65fc4cf..c9c170e 100644 --- a/lib/Target/PowerPC/PPCRegisterInfo.cpp +++ b/lib/Target/PowerPC/PPCRegisterInfo.cpp @@ -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" diff --git a/lib/Target/Sparc/SparcRegisterInfo.cpp b/lib/Target/Sparc/SparcRegisterInfo.cpp index 56000c1..8c16251 100644 --- a/lib/Target/Sparc/SparcRegisterInfo.cpp +++ b/lib/Target/Sparc/SparcRegisterInfo.cpp @@ -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" diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index b25fff0..3320bfb 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -18,5 +18,4 @@ using namespace llvm;  TargetAsmInfo::TargetAsmInfo(const TargetMachine &TM) {    TLOF = &TM.getTargetLowering()->getObjFileLowering();    TFI = TM.getFrameLowering(); -  TFI->getInitialFrameState(InitialFrameState);  } diff --git a/lib/Target/TargetFrameLowering.cpp b/lib/Target/TargetFrameLowering.cpp index 19fd581..122f869 100644 --- a/lib/Target/TargetFrameLowering.cpp +++ b/lib/Target/TargetFrameLowering.cpp @@ -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. diff --git a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp index d46f7e2..a60b69f 100644 --- a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp @@ -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() { diff --git a/lib/Target/X86/X86FrameLowering.cpp b/lib/Target/X86/X86FrameLowering.cpp index ed45a9a..b97641f 100644 --- a/lib/Target/X86/X86FrameLowering.cpp +++ b/lib/Target/X86/X86FrameLowering.cpp @@ -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()); diff --git a/lib/Target/X86/X86FrameLowering.h b/lib/Target/X86/X86FrameLowering.h index 14c31ed..a03ea76 100644 --- a/lib/Target/X86/X86FrameLowering.h +++ b/lib/Target/X86/X86FrameLowering.h @@ -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, diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index 3f1cc1a..0e96991 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -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" diff --git a/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp b/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp index a29f160..104170c 100644 --- a/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp +++ b/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp @@ -61,6 +61,17 @@ extern "C" void LLVMInitializeXCoreMCSubtargetInfo() {                                            createXCoreMCSubtargetInfo);  } +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() { -  RegisterMCAsmInfo<XCoreMCAsmInfo> X(TheXCoreTarget); +  RegisterMCAsmInfoFn X(TheXCoreTarget, createXCoreMCAsmInfo);  } diff --git a/lib/Target/XCore/XCoreFrameLowering.cpp b/lib/Target/XCore/XCoreFrameLowering.cpp index 0578220..e4cbeb9 100644 --- a/lib/Target/XCore/XCoreFrameLowering.cpp +++ b/lib/Target/XCore/XCoreFrameLowering.cpp @@ -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, diff --git a/lib/Target/XCore/XCoreFrameLowering.h b/lib/Target/XCore/XCoreFrameLowering.h index 7da19f0..c591e93 100644 --- a/lib/Target/XCore/XCoreFrameLowering.h +++ b/lib/Target/XCore/XCoreFrameLowering.h @@ -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; diff --git a/lib/Target/XCore/XCoreInstrInfo.cpp b/lib/Target/XCore/XCoreInstrInfo.cpp index f90481f..2db70fc 100644 --- a/lib/Target/XCore/XCoreInstrInfo.cpp +++ b/lib/Target/XCore/XCoreInstrInfo.cpp @@ -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" diff --git a/lib/Target/XCore/XCoreRegisterInfo.cpp b/lib/Target/XCore/XCoreRegisterInfo.cpp index 0d5df74..1b78b37 100644 --- a/lib/Target/XCore/XCoreRegisterInfo.cpp +++ b/lib/Target/XCore/XCoreRegisterInfo.cpp @@ -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"  | 
