mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Move most targets TargetMachine constructor to only taking a target triple.
- The C, C++, MSIL, and Mips backends still need the module. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77927 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c20a6fd8ce
commit
e28039cfd1
@ -23,6 +23,9 @@
|
||||
// FIXME: We shouldn't need this header, but we need it until there is a
|
||||
// different interface to get the TargetAsmInfo.
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
// FIXME: We shouldn't need this header, but we need it until there is a
|
||||
// different interface to the target machines.
|
||||
#include "llvm/Module.h"
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
@ -320,6 +323,19 @@ namespace llvm {
|
||||
TargetRegistry::RegisterTargetMachine(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static TargetMachine *Allocator(const Target &T, const Module &M,
|
||||
const std::string &FS) {
|
||||
return new TargetMachineImpl(T, M.getTargetTriple(), FS);
|
||||
}
|
||||
};
|
||||
|
||||
template<class TargetMachineImpl>
|
||||
struct RegisterTargetMachineDeprecated {
|
||||
RegisterTargetMachineDeprecated(Target &T) {
|
||||
TargetRegistry::RegisterTargetMachine(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static TargetMachine *Allocator(const Target &T, const Module &M,
|
||||
const std::string &FS) {
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "ARMTargetAsmInfo.h"
|
||||
#include "ARMFrameInfo.h"
|
||||
#include "ARM.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
@ -37,29 +36,29 @@ extern "C" void LLVMInitializeARMTarget() {
|
||||
/// TargetMachine ctor - Create an ARM architecture model.
|
||||
///
|
||||
ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T,
|
||||
const Module &M,
|
||||
const std::string &TT,
|
||||
const std::string &FS,
|
||||
bool isThumb)
|
||||
: LLVMTargetMachine(T),
|
||||
Subtarget(M.getTargetTriple(), FS, isThumb),
|
||||
Subtarget(TT, FS, isThumb),
|
||||
FrameInfo(Subtarget),
|
||||
JITInfo(),
|
||||
InstrItins(Subtarget.getInstrItineraryData()) {
|
||||
DefRelocModel = getRelocationModel();
|
||||
}
|
||||
|
||||
ARMTargetMachine::ARMTargetMachine(const Target &T, const Module &M,
|
||||
ARMTargetMachine::ARMTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: ARMBaseTargetMachine(T, M, FS, false), InstrInfo(Subtarget),
|
||||
: ARMBaseTargetMachine(T, TT, FS, false), InstrInfo(Subtarget),
|
||||
DataLayout(Subtarget.isAPCS_ABI() ?
|
||||
std::string("e-p:32:32-f64:32:32-i64:32:32") :
|
||||
std::string("e-p:32:32-f64:64:64-i64:64:64")),
|
||||
TLInfo(*this) {
|
||||
}
|
||||
|
||||
ThumbTargetMachine::ThumbTargetMachine(const Target &T, const Module &M,
|
||||
ThumbTargetMachine::ThumbTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: ARMBaseTargetMachine(T, M, FS, true),
|
||||
: ARMBaseTargetMachine(T, TT, FS, true),
|
||||
DataLayout(Subtarget.isAPCS_ABI() ?
|
||||
std::string("e-p:32:32-f64:32:32-i64:32:32-"
|
||||
"i16:16:32-i8:8:32-i1:8:32-a:0:32") :
|
||||
|
@ -26,8 +26,6 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Module;
|
||||
|
||||
class ARMBaseTargetMachine : public LLVMTargetMachine {
|
||||
protected:
|
||||
ARMSubtarget Subtarget;
|
||||
@ -39,8 +37,8 @@ private:
|
||||
Reloc::Model DefRelocModel; // Reloc model before it's overridden.
|
||||
|
||||
public:
|
||||
ARMBaseTargetMachine(const Target &T, const Module &M, const std::string &FS,
|
||||
bool isThumb);
|
||||
ARMBaseTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS, bool isThumb);
|
||||
|
||||
virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
virtual ARMJITInfo *getJITInfo() { return &JITInfo; }
|
||||
@ -79,7 +77,8 @@ class ARMTargetMachine : public ARMBaseTargetMachine {
|
||||
const TargetData DataLayout; // Calculates type size & alignment
|
||||
ARMTargetLowering TLInfo;
|
||||
public:
|
||||
ARMTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
ARMTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
|
||||
virtual const ARMRegisterInfo *getRegisterInfo() const {
|
||||
return &InstrInfo.getRegisterInfo();
|
||||
@ -91,9 +90,6 @@ public:
|
||||
|
||||
virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
||||
|
||||
static unsigned getJITMatchQuality();
|
||||
static unsigned getModuleMatchQuality(const Module &M);
|
||||
};
|
||||
|
||||
/// ThumbTargetMachine - Thumb target machine.
|
||||
@ -105,7 +101,8 @@ class ThumbTargetMachine : public ARMBaseTargetMachine {
|
||||
const TargetData DataLayout; // Calculates type size & alignment
|
||||
ARMTargetLowering TLInfo;
|
||||
public:
|
||||
ThumbTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
ThumbTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
|
||||
/// returns either Thumb1RegisterInfo of Thumb2RegisterInfo
|
||||
virtual const ARMBaseRegisterInfo *getRegisterInfo() const {
|
||||
@ -119,9 +116,6 @@ public:
|
||||
/// returns either Thumb1InstrInfo or Thumb2InstrInfo
|
||||
virtual const ARMBaseInstrInfo *getInstrInfo() const { return InstrInfo; }
|
||||
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
||||
|
||||
static unsigned getJITMatchQuality();
|
||||
static unsigned getModuleMatchQuality(const Module &M);
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "AlphaJITInfo.h"
|
||||
#include "AlphaTargetAsmInfo.h"
|
||||
#include "AlphaTargetMachine.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
@ -30,13 +29,13 @@ const TargetAsmInfo *AlphaTargetMachine::createTargetAsmInfo() const {
|
||||
return new AlphaTargetAsmInfo();
|
||||
}
|
||||
|
||||
AlphaTargetMachine::AlphaTargetMachine(const Target &T, const Module &M,
|
||||
AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: LLVMTargetMachine(T),
|
||||
DataLayout("e-f128:128:128"),
|
||||
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
|
||||
JITInfo(*this),
|
||||
Subtarget(M.getTargetTriple(), FS),
|
||||
Subtarget(TT, FS),
|
||||
TLInfo(*this) {
|
||||
setRelocationModel(Reloc::PIC_);
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
AlphaTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
AlphaTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
|
||||
virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "BlackfinTargetMachine.h"
|
||||
#include "Blackfin.h"
|
||||
#include "BlackfinTargetAsmInfo.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
|
||||
@ -28,25 +27,16 @@ const TargetAsmInfo* BlackfinTargetMachine::createTargetAsmInfo() const {
|
||||
}
|
||||
|
||||
BlackfinTargetMachine::BlackfinTargetMachine(const Target &T,
|
||||
const Module &M,
|
||||
const std::string &TT,
|
||||
const std::string &FS)
|
||||
: LLVMTargetMachine(T),
|
||||
DataLayout("e-p:32:32-i64:32-f64:32"),
|
||||
Subtarget(M.getTargetTriple(), FS),
|
||||
Subtarget(TT, FS),
|
||||
TLInfo(*this),
|
||||
InstrInfo(Subtarget),
|
||||
FrameInfo(TargetFrameInfo::StackGrowsDown, 4, 0) {
|
||||
}
|
||||
|
||||
unsigned BlackfinTargetMachine::getModuleMatchQuality(const Module &M) {
|
||||
std::string TT = M.getTargetTriple();
|
||||
if (TT.size() >= 5 && std::string(TT.begin(), TT.begin()+5) == "bfin-")
|
||||
return 20;
|
||||
|
||||
// Otherwise we don't match.
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool BlackfinTargetMachine::addInstSelector(PassManagerBase &PM,
|
||||
CodeGenOpt::Level OptLevel) {
|
||||
PM.add(createBlackfinISelDag(*this, OptLevel));
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Module;
|
||||
|
||||
class BlackfinTargetMachine : public LLVMTargetMachine {
|
||||
const TargetData DataLayout;
|
||||
BlackfinSubtarget Subtarget;
|
||||
@ -36,7 +34,7 @@ namespace llvm {
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
BlackfinTargetMachine(const Target &T, const Module &M,
|
||||
BlackfinTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
|
||||
virtual const BlackfinInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
@ -51,7 +49,6 @@ namespace llvm {
|
||||
return const_cast<BlackfinTargetLowering*>(&TLInfo);
|
||||
}
|
||||
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
||||
static unsigned getModuleMatchQuality(const Module &M);
|
||||
virtual bool addInstSelector(PassManagerBase &PM,
|
||||
CodeGenOpt::Level OptLevel);
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ using namespace llvm;
|
||||
|
||||
extern "C" void LLVMInitializeCBackendTarget() {
|
||||
// Register the target.
|
||||
RegisterTargetMachine<CTargetMachine> X(TheCBackendTarget);
|
||||
RegisterTargetMachineDeprecated<CTargetMachine> X(TheCBackendTarget);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -22,7 +22,8 @@ namespace llvm {
|
||||
struct CTargetMachine : public TargetMachine {
|
||||
const TargetData DataLayout; // Calculates type size & alignment
|
||||
|
||||
CTargetMachine(const Target &T, const Module &M, const std::string &FS)
|
||||
CTargetMachine(const Target &T, const Module &M,
|
||||
const std::string &FS)
|
||||
: TargetMachine(T), DataLayout(&M) {}
|
||||
|
||||
virtual bool WantsWholeFile() const { return true; }
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "SPURegisterNames.h"
|
||||
#include "SPUTargetAsmInfo.h"
|
||||
#include "SPUTargetMachine.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/CodeGen/RegAllocRegistry.h"
|
||||
#include "llvm/CodeGen/SchedulerRegistry.h"
|
||||
@ -38,10 +37,10 @@ const TargetAsmInfo *SPUTargetMachine::createTargetAsmInfo() const {
|
||||
return new SPULinuxTargetAsmInfo();
|
||||
}
|
||||
|
||||
SPUTargetMachine::SPUTargetMachine(const Target &T, const Module &M,
|
||||
SPUTargetMachine::SPUTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: LLVMTargetMachine(T),
|
||||
Subtarget(M.getTargetTriple(), FS),
|
||||
Subtarget(TT, FS),
|
||||
DataLayout(Subtarget.getTargetDataString()),
|
||||
InstrInfo(*this),
|
||||
FrameInfo(*this),
|
||||
|
@ -40,7 +40,8 @@ protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
SPUTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
SPUTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
|
||||
/// Return the subtarget implementation object
|
||||
virtual const SPUSubtarget *getSubtargetImpl() const {
|
||||
|
@ -74,7 +74,7 @@ static cl::opt<std::string> NameToGenerate("cppfor", cl::Optional,
|
||||
|
||||
extern "C" void LLVMInitializeCppBackendTarget() {
|
||||
// Register the target.
|
||||
RegisterTargetMachine<CPPTargetMachine> X(TheCppBackendTarget);
|
||||
RegisterTargetMachineDeprecated<CPPTargetMachine> X(TheCppBackendTarget);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -24,7 +24,8 @@ class formatted_raw_ostream;
|
||||
struct CPPTargetMachine : public TargetMachine {
|
||||
const TargetData DataLayout; // Calculates type size & alignment
|
||||
|
||||
CPPTargetMachine(const Target &T, const Module &M, const std::string &FS)
|
||||
CPPTargetMachine(const Target &T, const Module &M,
|
||||
const std::string &FS)
|
||||
: TargetMachine(T), DataLayout(&M) {}
|
||||
|
||||
virtual bool WantsWholeFile() const { return true; }
|
||||
|
@ -42,16 +42,13 @@ namespace llvm {
|
||||
CodeGenFileType FileType,
|
||||
CodeGenOpt::Level OptLevel);
|
||||
|
||||
// This class always works, but shouldn't be the default in most cases.
|
||||
static unsigned getModuleMatchQuality(const Module &M) { return 1; }
|
||||
|
||||
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
||||
};
|
||||
}
|
||||
|
||||
extern "C" void LLVMInitializeMSILTarget() {
|
||||
// Register the target.
|
||||
RegisterTargetMachine<MSILTarget> X(TheMSILTarget);
|
||||
RegisterTargetMachineDeprecated<MSILTarget> X(TheMSILTarget);
|
||||
}
|
||||
|
||||
bool MSILModule::runOnModule(Module &M) {
|
||||
|
@ -14,17 +14,16 @@
|
||||
#include "MSP430.h"
|
||||
#include "MSP430TargetAsmInfo.h"
|
||||
#include "MSP430TargetMachine.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Target/TargetAsmInfo.h"
|
||||
using namespace llvm;
|
||||
|
||||
MSP430TargetMachine::MSP430TargetMachine(const Target &T,
|
||||
const Module &M,
|
||||
const std::string &TT,
|
||||
const std::string &FS) :
|
||||
LLVMTargetMachine(T),
|
||||
Subtarget(M.getTargetTriple(), FS),
|
||||
Subtarget(TT, FS),
|
||||
// FIXME: Check TargetData string.
|
||||
DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
|
||||
InstrInfo(*this), TLInfo(*this),
|
||||
|
@ -41,7 +41,8 @@ protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
MSP430TargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
MSP430TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
virtual const MSP430InstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
|
@ -14,15 +14,14 @@
|
||||
#include "Mips.h"
|
||||
#include "MipsTargetAsmInfo.h"
|
||||
#include "MipsTargetMachine.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
using namespace llvm;
|
||||
|
||||
extern "C" void LLVMInitializeMipsTarget() {
|
||||
// Register the target.
|
||||
RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget);
|
||||
RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget);
|
||||
RegisterTargetMachineDeprecated<MipsTargetMachine> X(TheMipsTarget);
|
||||
RegisterTargetMachineDeprecated<MipselTargetMachine> Y(TheMipselTarget);
|
||||
}
|
||||
|
||||
const TargetAsmInfo *MipsTargetMachine::
|
||||
@ -39,7 +38,7 @@ createTargetAsmInfo() const
|
||||
// an easier handling.
|
||||
// Using CodeModel::Large enables different CALL behavior.
|
||||
MipsTargetMachine::
|
||||
MipsTargetMachine(const Target &T, const Module &M, const std::string &FS,
|
||||
MipsTargetMachine(const Target &T, const Module &M, const std::string &FS,
|
||||
bool isLittle=false):
|
||||
LLVMTargetMachine(T),
|
||||
Subtarget(*this, M.getTargetTriple(), FS, isLittle),
|
||||
|
@ -35,8 +35,8 @@ namespace llvm {
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
MipsTargetMachine(const Target &T, const Module &M, const std::string &FS,
|
||||
bool isLittle);
|
||||
MipsTargetMachine(const Target &T, const Module &M,
|
||||
const std::string &FS, bool isLittle);
|
||||
|
||||
virtual const MipsInstrInfo *getInstrInfo() const
|
||||
{ return &InstrInfo; }
|
||||
@ -67,8 +67,6 @@ namespace llvm {
|
||||
class MipselTargetMachine : public MipsTargetMachine {
|
||||
public:
|
||||
MipselTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
|
||||
static unsigned getModuleMatchQuality(const Module &M);
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "PIC16.h"
|
||||
#include "PIC16TargetAsmInfo.h"
|
||||
#include "PIC16TargetMachine.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Target/TargetAsmInfo.h"
|
||||
@ -22,19 +21,19 @@
|
||||
using namespace llvm;
|
||||
|
||||
// PIC16TargetMachine - Traditional PIC16 Machine.
|
||||
PIC16TargetMachine::PIC16TargetMachine(const Target &T, const Module &M,
|
||||
PIC16TargetMachine::PIC16TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS, bool Cooper)
|
||||
: LLVMTargetMachine(T),
|
||||
Subtarget(M.getTargetTriple(), FS, Cooper),
|
||||
Subtarget(TT, FS, Cooper),
|
||||
DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
|
||||
InstrInfo(*this), TLInfo(*this),
|
||||
FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
|
||||
|
||||
// CooperTargetMachine - Uses the same PIC16TargetMachine, but makes IsCooper
|
||||
// as true.
|
||||
CooperTargetMachine::CooperTargetMachine(const Target &T, const Module &M,
|
||||
CooperTargetMachine::CooperTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: PIC16TargetMachine(T, M, FS, true) {}
|
||||
: PIC16TargetMachine(T, TT, FS, true) {}
|
||||
|
||||
|
||||
const TargetAsmInfo *PIC16TargetMachine::createTargetAsmInfo() const {
|
||||
|
@ -41,8 +41,8 @@ protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
PIC16TargetMachine(const Target &T, const Module &M, const std::string &FS,
|
||||
bool Cooper = false);
|
||||
PIC16TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS, bool Cooper = false);
|
||||
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
virtual const PIC16InstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
@ -65,7 +65,8 @@ public:
|
||||
/// CooperTargetMachine
|
||||
class CooperTargetMachine : public PIC16TargetMachine {
|
||||
public:
|
||||
CooperTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
CooperTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
}; // CooperTargetMachine.
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "PPC.h"
|
||||
#include "PPCTargetAsmInfo.h"
|
||||
#include "PPCTargetMachine.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
@ -34,10 +33,10 @@ const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const {
|
||||
return new PPCLinuxTargetAsmInfo(*this);
|
||||
}
|
||||
|
||||
PPCTargetMachine::PPCTargetMachine(const Target&T, const Module &M,
|
||||
PPCTargetMachine::PPCTargetMachine(const Target&T, const std::string &TT,
|
||||
const std::string &FS, bool is64Bit)
|
||||
: LLVMTargetMachine(T),
|
||||
Subtarget(M.getTargetTriple(), FS, is64Bit),
|
||||
Subtarget(TT, FS, is64Bit),
|
||||
DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this),
|
||||
FrameInfo(*this, is64Bit), JITInfo(*this, is64Bit), TLInfo(*this),
|
||||
InstrItins(Subtarget.getInstrItineraryData()), MachOWriterInfo(*this) {
|
||||
@ -54,15 +53,15 @@ PPCTargetMachine::PPCTargetMachine(const Target&T, const Module &M,
|
||||
/// groups, which typically degrades performance.
|
||||
bool PPCTargetMachine::getEnableTailMergeDefault() const { return false; }
|
||||
|
||||
PPC32TargetMachine::PPC32TargetMachine(const Target &T, const Module &M,
|
||||
PPC32TargetMachine::PPC32TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: PPCTargetMachine(T, M, FS, false) {
|
||||
: PPCTargetMachine(T, TT, FS, false) {
|
||||
}
|
||||
|
||||
|
||||
PPC64TargetMachine::PPC64TargetMachine(const Target &T, const Module &M,
|
||||
PPC64TargetMachine::PPC64TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: PPCTargetMachine(T, M, FS, true) {
|
||||
: PPCTargetMachine(T, TT, FS, true) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,8 +43,8 @@ protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
PPCTargetMachine(const Target &T, const Module &M, const std::string &FS,
|
||||
bool is64Bit);
|
||||
PPCTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS, bool is64Bit);
|
||||
|
||||
virtual const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const PPCFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
@ -90,14 +90,16 @@ public:
|
||||
///
|
||||
class PPC32TargetMachine : public PPCTargetMachine {
|
||||
public:
|
||||
PPC32TargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
PPC32TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
};
|
||||
|
||||
/// PPC64TargetMachine - PowerPC 64-bit target machine.
|
||||
///
|
||||
class PPC64TargetMachine : public PPCTargetMachine {
|
||||
public:
|
||||
PPC64TargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
PPC64TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "SparcTargetAsmInfo.h"
|
||||
#include "SparcTargetMachine.h"
|
||||
#include "Sparc.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
using namespace llvm;
|
||||
@ -30,11 +29,11 @@ const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const {
|
||||
|
||||
/// SparcTargetMachine ctor - Create an ILP32 architecture model
|
||||
///
|
||||
SparcTargetMachine::SparcTargetMachine(const Target &T, const Module &M,
|
||||
SparcTargetMachine::SparcTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: LLVMTargetMachine(T),
|
||||
DataLayout("E-p:32:32-f128:128:128"),
|
||||
Subtarget(M.getTargetTriple(), FS), TLInfo(*this), InstrInfo(Subtarget),
|
||||
Subtarget(TT, FS), TLInfo(*this), InstrInfo(Subtarget),
|
||||
FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Module;
|
||||
|
||||
class SparcTargetMachine : public LLVMTargetMachine {
|
||||
const TargetData DataLayout; // Calculates type size & alignment
|
||||
SparcSubtarget Subtarget;
|
||||
@ -36,7 +34,8 @@ protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
SparcTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
SparcTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
|
||||
virtual const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "SystemZTargetAsmInfo.h"
|
||||
#include "SystemZTargetMachine.h"
|
||||
#include "SystemZ.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
using namespace llvm;
|
||||
@ -30,10 +29,10 @@ const TargetAsmInfo *SystemZTargetMachine::createTargetAsmInfo() const {
|
||||
/// SystemZTargetMachine ctor - Create an ILP64 architecture model
|
||||
///
|
||||
SystemZTargetMachine::SystemZTargetMachine(const Target &T,
|
||||
const Module &M,
|
||||
const std::string &TT,
|
||||
const std::string &FS)
|
||||
: LLVMTargetMachine(T),
|
||||
Subtarget(M.getTargetTriple(), FS),
|
||||
Subtarget(TT, FS),
|
||||
DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
|
||||
"-f64:64:64-f128:128:128-a0:16:16"),
|
||||
InstrInfo(*this), TLInfo(*this),
|
||||
@ -49,14 +48,3 @@ bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM,
|
||||
PM.add(createSystemZISelDag(*this, OptLevel));
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned SystemZTargetMachine::getModuleMatchQuality(const Module &M) {
|
||||
std::string TT = M.getTargetTriple();
|
||||
|
||||
// We strongly match s390x
|
||||
if (TT.size() >= 5 && TT[0] == 's' && TT[1] == '3' && TT[2] == '9' &&
|
||||
TT[3] == '0' && TT[4] == 'x')
|
||||
return 20;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
SystemZTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
SystemZTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
virtual const SystemZInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
@ -57,7 +58,6 @@ public:
|
||||
}
|
||||
|
||||
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||
static unsigned getModuleMatchQuality(const Module &M);
|
||||
}; // SystemZTargetMachine.
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "X86TargetAsmInfo.h"
|
||||
#include "X86TargetMachine.h"
|
||||
#include "X86.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
@ -46,23 +45,23 @@ const TargetAsmInfo *X86TargetMachine::createTargetAsmInfo() const {
|
||||
}
|
||||
}
|
||||
|
||||
X86_32TargetMachine::X86_32TargetMachine(const Target &T, const Module &M,
|
||||
X86_32TargetMachine::X86_32TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: X86TargetMachine(T, M, FS, false) {
|
||||
: X86TargetMachine(T, TT, FS, false) {
|
||||
}
|
||||
|
||||
|
||||
X86_64TargetMachine::X86_64TargetMachine(const Target &T, const Module &M,
|
||||
X86_64TargetMachine::X86_64TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: X86TargetMachine(T, M, FS, true) {
|
||||
: X86TargetMachine(T, TT, FS, true) {
|
||||
}
|
||||
|
||||
/// X86TargetMachine ctor - Create an X86 target.
|
||||
///
|
||||
X86TargetMachine::X86TargetMachine(const Target &T, const Module &M,
|
||||
X86TargetMachine::X86TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS, bool is64Bit)
|
||||
: LLVMTargetMachine(T),
|
||||
Subtarget(M.getTargetTriple(), FS, is64Bit),
|
||||
Subtarget(TT, FS, is64Bit),
|
||||
DataLayout(Subtarget.getDataLayout()),
|
||||
FrameInfo(TargetFrameInfo::StackGrowsDown,
|
||||
Subtarget.getStackAlignment(), Subtarget.is64Bit() ? -8 : -4),
|
||||
|
@ -42,8 +42,8 @@ protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
X86TargetMachine(const Target &T, const Module &M, const std::string &FS,
|
||||
bool is64Bit);
|
||||
X86TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS, bool is64Bit);
|
||||
|
||||
virtual const X86InstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
@ -85,20 +85,16 @@ public:
|
||||
///
|
||||
class X86_32TargetMachine : public X86TargetMachine {
|
||||
public:
|
||||
X86_32TargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
|
||||
static unsigned getJITMatchQuality();
|
||||
static unsigned getModuleMatchQuality(const Module &M);
|
||||
X86_32TargetMachine(const Target &T, const std::string &M,
|
||||
const std::string &FS);
|
||||
};
|
||||
|
||||
/// X86_64TargetMachine - X86 64-bit target machine.
|
||||
///
|
||||
class X86_64TargetMachine : public X86TargetMachine {
|
||||
public:
|
||||
X86_64TargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
|
||||
static unsigned getJITMatchQuality();
|
||||
static unsigned getModuleMatchQuality(const Module &M);
|
||||
X86_64TargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -23,10 +23,10 @@ const TargetAsmInfo *XCoreTargetMachine::createTargetAsmInfo() const {
|
||||
|
||||
/// XCoreTargetMachine ctor - Create an ILP32 architecture model
|
||||
///
|
||||
XCoreTargetMachine::XCoreTargetMachine(const Target &T, const Module &M,
|
||||
XCoreTargetMachine::XCoreTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS)
|
||||
: LLVMTargetMachine(T),
|
||||
Subtarget(M.getTargetTriple(), FS),
|
||||
Subtarget(TT, FS),
|
||||
DataLayout("e-p:32:32:32-a0:0:32-f32:32:32-f64:32:32-i1:8:32-i8:8:32-"
|
||||
"i16:16:32-i32:32:32-i64:32:32"),
|
||||
InstrInfo(),
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Module;
|
||||
|
||||
class XCoreTargetMachine : public LLVMTargetMachine {
|
||||
XCoreSubtarget Subtarget;
|
||||
const TargetData DataLayout; // Calculates type size & alignment
|
||||
@ -36,7 +34,8 @@ protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
XCoreTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
XCoreTargetMachine(const Target &T, const std::string &TT,
|
||||
const std::string &FS);
|
||||
|
||||
virtual const XCoreInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
virtual const XCoreFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
|
Loading…
Reference in New Issue
Block a user