forked from OSchip/llvm-project
Change the last few internal StringRef triples into Triple objects.
Summary: This concludes the patch series to eliminate StringRef forms of GNU triples from the internals of LLVM that began in r239036. At this point, the StringRef-form of GNU Triples should only be used in the public API (including IR serialization) and a couple objects that directly interact with the API (most notably the Module class). The next step is to replace these Triple objects with the TargetTuple object that will represent our authoratative/unambiguous internal equivalent to GNU Triples. Reviewers: rengolin Subscribers: llvm-commits, jholewinski, ted, rengolin Differential Revision: http://reviews.llvm.org/D10962 llvm-svn: 241472
This commit is contained in:
parent
ef8f95417a
commit
f423f5627c
|
@ -71,7 +71,7 @@ MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
|
|||
|
||||
MCRelocationInfo *createMCRelocationInfo(const Triple &TT, MCContext &Ctx);
|
||||
|
||||
MCSymbolizer *createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo,
|
||||
MCSymbolizer *createMCSymbolizer(const Triple &TT, LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp,
|
||||
void *DisInfo, MCContext *Ctx,
|
||||
std::unique_ptr<MCRelocationInfo> &&RelInfo);
|
||||
|
@ -92,17 +92,18 @@ public:
|
|||
|
||||
typedef MCAsmInfo *(*MCAsmInfoCtorFnTy)(const MCRegisterInfo &MRI,
|
||||
const Triple &TT);
|
||||
typedef MCCodeGenInfo *(*MCCodeGenInfoCtorFnTy)(StringRef TT, Reloc::Model RM,
|
||||
typedef MCCodeGenInfo *(*MCCodeGenInfoCtorFnTy)(const Triple &TT,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL);
|
||||
typedef MCInstrInfo *(*MCInstrInfoCtorFnTy)(void);
|
||||
typedef MCInstrAnalysis *(*MCInstrAnalysisCtorFnTy)(const MCInstrInfo *Info);
|
||||
typedef MCRegisterInfo *(*MCRegInfoCtorFnTy)(StringRef TT);
|
||||
typedef MCRegisterInfo *(*MCRegInfoCtorFnTy)(const Triple &TT);
|
||||
typedef MCSubtargetInfo *(*MCSubtargetInfoCtorFnTy)(const Triple &TT,
|
||||
StringRef CPU,
|
||||
StringRef Features);
|
||||
typedef TargetMachine *(*TargetMachineCtorTy)(
|
||||
const Target &T, StringRef TT, StringRef CPU, StringRef Features,
|
||||
const Target &T, const Triple &TT, StringRef CPU, StringRef Features,
|
||||
const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL);
|
||||
// If it weren't for layering issues (this header is in llvm/Support, but
|
||||
|
@ -150,7 +151,7 @@ public:
|
|||
typedef MCRelocationInfo *(*MCRelocationInfoCtorTy)(const Triple &TT,
|
||||
MCContext &Ctx);
|
||||
typedef MCSymbolizer *(*MCSymbolizerCtorTy)(
|
||||
StringRef TT, LLVMOpInfoCallback GetOpInfo,
|
||||
const Triple &TT, LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo, MCContext *Ctx,
|
||||
std::unique_ptr<MCRelocationInfo> &&RelInfo);
|
||||
|
||||
|
@ -300,12 +301,12 @@ public:
|
|||
|
||||
/// createMCCodeGenInfo - Create a MCCodeGenInfo implementation.
|
||||
///
|
||||
MCCodeGenInfo *createMCCodeGenInfo(StringRef Triple, Reloc::Model RM,
|
||||
MCCodeGenInfo *createMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) const {
|
||||
if (!MCCodeGenInfoCtorFn)
|
||||
return nullptr;
|
||||
return MCCodeGenInfoCtorFn(Triple, RM, CM, OL);
|
||||
return MCCodeGenInfoCtorFn(Triple(TT), RM, CM, OL);
|
||||
}
|
||||
|
||||
/// createMCInstrInfo - Create a MCInstrInfo implementation.
|
||||
|
@ -326,10 +327,10 @@ public:
|
|||
|
||||
/// createMCRegInfo - Create a MCRegisterInfo implementation.
|
||||
///
|
||||
MCRegisterInfo *createMCRegInfo(StringRef Triple) const {
|
||||
MCRegisterInfo *createMCRegInfo(StringRef TT) const {
|
||||
if (!MCRegInfoCtorFn)
|
||||
return nullptr;
|
||||
return MCRegInfoCtorFn(Triple);
|
||||
return MCRegInfoCtorFn(Triple(TT));
|
||||
}
|
||||
|
||||
/// createMCSubtargetInfo - Create a MCSubtargetInfo implementation.
|
||||
|
@ -356,15 +357,15 @@ public:
|
|||
/// either the target triple from the module, or the target triple of the
|
||||
/// host if that does not exist.
|
||||
TargetMachine *
|
||||
createTargetMachine(StringRef Triple, StringRef CPU, StringRef Features,
|
||||
createTargetMachine(StringRef TT, StringRef CPU, StringRef Features,
|
||||
const TargetOptions &Options,
|
||||
Reloc::Model RM = Reloc::Default,
|
||||
CodeModel::Model CM = CodeModel::Default,
|
||||
CodeGenOpt::Level OL = CodeGenOpt::Default) const {
|
||||
if (!TargetMachineCtorFn)
|
||||
return nullptr;
|
||||
return TargetMachineCtorFn(*this, Triple, CPU, Features, Options, RM, CM,
|
||||
OL);
|
||||
return TargetMachineCtorFn(*this, Triple(TT), CPU, Features, Options, RM,
|
||||
CM, OL);
|
||||
}
|
||||
|
||||
/// createMCAsmBackend - Create a target specific assembly parser.
|
||||
|
@ -529,7 +530,8 @@ public:
|
|||
std::unique_ptr<MCRelocationInfo> &&RelInfo) const {
|
||||
MCSymbolizerCtorTy Fn =
|
||||
MCSymbolizerCtorFn ? MCSymbolizerCtorFn : llvm::createMCSymbolizer;
|
||||
return Fn(TT, GetOpInfo, SymbolLookUp, DisInfo, Ctx, std::move(RelInfo));
|
||||
return Fn(Triple(TT), GetOpInfo, SymbolLookUp, DisInfo, Ctx,
|
||||
std::move(RelInfo));
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
@ -924,7 +926,7 @@ template <class MCCodeGenInfoImpl> struct RegisterMCCodeGenInfo {
|
|||
}
|
||||
|
||||
private:
|
||||
static MCCodeGenInfo *Allocator(StringRef /*TT*/, Reloc::Model /*RM*/,
|
||||
static MCCodeGenInfo *Allocator(const Triple & /*TT*/, Reloc::Model /*RM*/,
|
||||
CodeModel::Model /*CM*/,
|
||||
CodeGenOpt::Level /*OL*/) {
|
||||
return new MCCodeGenInfoImpl();
|
||||
|
@ -1023,7 +1025,7 @@ template <class MCRegisterInfoImpl> struct RegisterMCRegInfo {
|
|||
}
|
||||
|
||||
private:
|
||||
static MCRegisterInfo *Allocator(StringRef /*TT*/) {
|
||||
static MCRegisterInfo *Allocator(const Triple & /*TT*/) {
|
||||
return new MCRegisterInfoImpl();
|
||||
}
|
||||
};
|
||||
|
@ -1090,11 +1092,11 @@ template <class TargetMachineImpl> struct RegisterTargetMachine {
|
|||
}
|
||||
|
||||
private:
|
||||
static TargetMachine *Allocator(const Target &T, StringRef TT, StringRef CPU,
|
||||
StringRef FS, const TargetOptions &Options,
|
||||
Reloc::Model RM, CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
return new TargetMachineImpl(T, Triple(TT), CPU, FS, Options, RM, CM, OL);
|
||||
static TargetMachine *Allocator(const Target &T, const Triple &TT,
|
||||
StringRef CPU, StringRef FS,
|
||||
const TargetOptions &Options, Reloc::Model RM,
|
||||
CodeModel::Model CM, CodeGenOpt::Level OL) {
|
||||
return new TargetMachineImpl(T, TT, CPU, FS, Options, RM, CM, OL);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
class Triple;
|
||||
}
|
||||
|
||||
// This function tries to add a symbolic operand in place of the immediate
|
||||
// Value in the MCInst. The immediate Value has had any PC adjustment made by
|
||||
// the caller. If the instruction is a branch instruction then IsBranch is true,
|
||||
|
@ -184,7 +188,7 @@ void MCExternalSymbolizer::tryAddingPcLoadReferenceComment(raw_ostream &cStream,
|
|||
}
|
||||
|
||||
namespace llvm {
|
||||
MCSymbolizer *createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo,
|
||||
MCSymbolizer *createMCSymbolizer(const Triple &TT, LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp,
|
||||
void *DisInfo, MCContext *Ctx,
|
||||
std::unique_ptr<MCRelocationInfo> &&RelInfo) {
|
||||
|
|
|
@ -228,7 +228,7 @@ DecodeStatus AArch64Disassembler::getInstruction(MCInst &MI, uint64_t &Size,
|
|||
}
|
||||
|
||||
static MCSymbolizer *
|
||||
createAArch64ExternalSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo,
|
||||
createAArch64ExternalSymbolizer(const Triple &TT, LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp,
|
||||
void *DisInfo, MCContext *Ctx,
|
||||
std::unique_ptr<MCRelocationInfo> &&RelInfo) {
|
||||
|
|
|
@ -51,7 +51,7 @@ createAArch64MCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createAArch64MCRegisterInfo(StringRef Triple) {
|
||||
static MCRegisterInfo *createAArch64MCRegisterInfo(const Triple &Triple) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitAArch64MCRegisterInfo(X, AArch64::LR);
|
||||
return X;
|
||||
|
@ -75,11 +75,11 @@ static MCAsmInfo *createAArch64MCAsmInfo(const MCRegisterInfo &MRI,
|
|||
return MAI;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createAArch64MCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createAArch64MCCodeGenInfo(const Triple &TT,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
Triple TheTriple(TT);
|
||||
assert((TheTriple.isOSBinFormatELF() || TheTriple.isOSBinFormatMachO()) &&
|
||||
assert((TT.isOSBinFormatELF() || TT.isOSBinFormatMachO()) &&
|
||||
"Only expect Darwin and ELF targets");
|
||||
|
||||
if (CM == CodeModel::Default)
|
||||
|
@ -94,7 +94,7 @@ static MCCodeGenInfo *createAArch64MCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||
"Only small and large code models are allowed on AArch64");
|
||||
|
||||
// AArch64 Darwin is always PIC.
|
||||
if (TheTriple.isOSDarwin())
|
||||
if (TT.isOSDarwin())
|
||||
RM = Reloc::PIC_;
|
||||
// On ELF platforms the default static relocation model has a smart enough
|
||||
// linker to cope with referencing external symbols defined in a shared
|
||||
|
|
|
@ -44,7 +44,7 @@ static MCInstrInfo *createAMDGPUMCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createAMDGPUMCRegisterInfo(StringRef TT) {
|
||||
static MCRegisterInfo *createAMDGPUMCRegisterInfo(const Triple &TT) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitAMDGPUMCRegisterInfo(X, 0);
|
||||
return X;
|
||||
|
@ -57,9 +57,10 @@ createAMDGPUMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createAMDGPUMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
static MCCodeGenInfo *createAMDGPUMCCodeGenInfo(const Triple &TT,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
X->initMCCodeGenInfo(RM, CM, OL);
|
||||
return X;
|
||||
|
|
|
@ -268,7 +268,7 @@ static MCInstrInfo *createARMMCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createARMMCRegisterInfo(StringRef Triple) {
|
||||
static MCRegisterInfo *createARMMCRegisterInfo(const Triple &Triple) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitARMMCRegisterInfo(X, ARM::LR, 0, 0, ARM::PC);
|
||||
return X;
|
||||
|
@ -292,14 +292,13 @@ static MCAsmInfo *createARMMCAsmInfo(const MCRegisterInfo &MRI,
|
|||
return MAI;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createARMMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createARMMCCodeGenInfo(const Triple &TT, Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
if (RM == Reloc::Default) {
|
||||
Triple TheTriple(TT);
|
||||
// Default relocation model on Darwin is PIC, not DynamicNoPIC.
|
||||
RM = TheTriple.isOSDarwin() ? Reloc::PIC_ : Reloc::DynamicNoPIC;
|
||||
RM = TT.isOSDarwin() ? Reloc::PIC_ : Reloc::DynamicNoPIC;
|
||||
}
|
||||
X->initMCCodeGenInfo(RM, CM, OL);
|
||||
return X;
|
||||
|
|
|
@ -40,7 +40,7 @@ static MCInstrInfo *createBPFMCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createBPFMCRegisterInfo(StringRef TT) {
|
||||
static MCRegisterInfo *createBPFMCRegisterInfo(const Triple &TT) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitBPFMCRegisterInfo(X, BPF::R11 /* RAReg doesn't exist */);
|
||||
return X;
|
||||
|
@ -53,7 +53,7 @@ static MCSubtargetInfo *createBPFMCSubtargetInfo(const Triple &TT,
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createBPFMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createBPFMCCodeGenInfo(const Triple &TT, Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
|
|
@ -46,7 +46,7 @@ MCInstrInfo *llvm::createHexagonMCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createHexagonMCRegisterInfo(StringRef TT) {
|
||||
static MCRegisterInfo *createHexagonMCRegisterInfo(const Triple &TT) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitHexagonMCRegisterInfo(X, Hexagon::R0);
|
||||
return X;
|
||||
|
@ -151,7 +151,8 @@ static MCAsmInfo *createHexagonMCAsmInfo(const MCRegisterInfo &MRI,
|
|||
return MAI;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createHexagonMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createHexagonMCCodeGenInfo(const Triple &TT,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
|
|
@ -37,7 +37,7 @@ static MCInstrInfo *createMSP430MCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createMSP430MCRegisterInfo(StringRef TT) {
|
||||
static MCRegisterInfo *createMSP430MCRegisterInfo(const Triple &TT) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitMSP430MCRegisterInfo(X, MSP430::PC);
|
||||
return X;
|
||||
|
@ -50,7 +50,8 @@ createMSP430MCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createMSP430MCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createMSP430MCCodeGenInfo(const Triple &TT,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
|
|
@ -59,7 +59,7 @@ static MCInstrInfo *createMipsMCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createMipsMCRegisterInfo(StringRef TT) {
|
||||
static MCRegisterInfo *createMipsMCRegisterInfo(const Triple &TT) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitMipsMCRegisterInfo(X, Mips::RA);
|
||||
return X;
|
||||
|
@ -84,7 +84,7 @@ static MCAsmInfo *createMipsMCAsmInfo(const MCRegisterInfo &MRI,
|
|||
return MAI;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createMipsMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createMipsMCCodeGenInfo(const Triple &TT, Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
|
|
@ -37,7 +37,7 @@ static MCInstrInfo *createNVPTXMCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createNVPTXMCRegisterInfo(StringRef TT) {
|
||||
static MCRegisterInfo *createNVPTXMCRegisterInfo(const Triple &TT) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
// PTX does not have a return address register.
|
||||
InitNVPTXMCRegisterInfo(X, 0);
|
||||
|
@ -51,8 +51,10 @@ createNVPTXMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createNVPTXMCCodeGenInfo(
|
||||
StringRef TT, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL) {
|
||||
static MCCodeGenInfo *createNVPTXMCCodeGenInfo(const Triple &TT,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
||||
// The default relocation model is used regardless of what the client has
|
||||
|
|
|
@ -51,10 +51,9 @@ static MCInstrInfo *createPPCMCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createPPCMCRegisterInfo(StringRef TT) {
|
||||
Triple TheTriple(TT);
|
||||
bool isPPC64 = (TheTriple.getArch() == Triple::ppc64 ||
|
||||
TheTriple.getArch() == Triple::ppc64le);
|
||||
static MCRegisterInfo *createPPCMCRegisterInfo(const Triple &TT) {
|
||||
bool isPPC64 =
|
||||
(TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le);
|
||||
unsigned Flavour = isPPC64 ? 0 : 1;
|
||||
unsigned RA = isPPC64 ? PPC::LR8 : PPC::LR;
|
||||
|
||||
|
@ -90,22 +89,20 @@ static MCAsmInfo *createPPCMCAsmInfo(const MCRegisterInfo &MRI,
|
|||
return MAI;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createPPCMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createPPCMCCodeGenInfo(const Triple &TT, Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
||||
if (RM == Reloc::Default) {
|
||||
Triple T(TT);
|
||||
if (T.isOSDarwin())
|
||||
if (TT.isOSDarwin())
|
||||
RM = Reloc::DynamicNoPIC;
|
||||
else
|
||||
RM = Reloc::Static;
|
||||
}
|
||||
if (CM == CodeModel::Default) {
|
||||
Triple T(TT);
|
||||
if (!T.isOSDarwin() &&
|
||||
(T.getArch() == Triple::ppc64 || T.getArch() == Triple::ppc64le))
|
||||
if (!TT.isOSDarwin() &&
|
||||
(TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le))
|
||||
CM = CodeModel::Medium;
|
||||
}
|
||||
X->initMCCodeGenInfo(RM, CM, OL);
|
||||
|
|
|
@ -57,7 +57,7 @@ static MCInstrInfo *createSparcMCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createSparcMCRegisterInfo(StringRef TT) {
|
||||
static MCRegisterInfo *createSparcMCRegisterInfo(const Triple &TT) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitSparcMCRegisterInfo(X, SP::O7);
|
||||
return X;
|
||||
|
@ -83,7 +83,8 @@ createSparcMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
|
|||
//
|
||||
// All code models require that the text segment is smaller than 2GB.
|
||||
|
||||
static MCCodeGenInfo *createSparcMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createSparcMCCodeGenInfo(const Triple &TT,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
@ -100,7 +101,8 @@ static MCCodeGenInfo *createSparcMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createSparcV9MCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createSparcV9MCCodeGenInfo(const Triple &TT,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
|
|
@ -148,7 +148,7 @@ static MCInstrInfo *createSystemZMCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createSystemZMCRegisterInfo(StringRef TT) {
|
||||
static MCRegisterInfo *createSystemZMCRegisterInfo(const Triple &TT) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitSystemZMCRegisterInfo(X, SystemZ::R14D);
|
||||
return X;
|
||||
|
@ -161,7 +161,8 @@ createSystemZMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createSystemZMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createSystemZMCCodeGenInfo(const Triple &TT,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
|
|
@ -99,17 +99,14 @@ static MCInstrInfo *createX86MCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createX86MCRegisterInfo(StringRef TT) {
|
||||
Triple TheTriple(TT);
|
||||
unsigned RA = (TheTriple.getArch() == Triple::x86_64)
|
||||
? X86::RIP // Should have dwarf #16.
|
||||
: X86::EIP; // Should have dwarf #8.
|
||||
static MCRegisterInfo *createX86MCRegisterInfo(const Triple &TT) {
|
||||
unsigned RA = (TT.getArch() == Triple::x86_64)
|
||||
? X86::RIP // Should have dwarf #16.
|
||||
: X86::EIP; // Should have dwarf #8.
|
||||
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitX86MCRegisterInfo(X, RA,
|
||||
X86_MC::getDwarfRegFlavour(TheTriple, false),
|
||||
X86_MC::getDwarfRegFlavour(TheTriple, true),
|
||||
RA);
|
||||
InitX86MCRegisterInfo(X, RA, X86_MC::getDwarfRegFlavour(TT, false),
|
||||
X86_MC::getDwarfRegFlavour(TT, true), RA);
|
||||
X86_MC::InitLLVM2SEHRegisterMapping(X);
|
||||
return X;
|
||||
}
|
||||
|
@ -156,24 +153,23 @@ static MCAsmInfo *createX86MCAsmInfo(const MCRegisterInfo &MRI,
|
|||
return MAI;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createX86MCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createX86MCCodeGenInfo(const Triple &TT, Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
||||
Triple T(TT);
|
||||
bool is64Bit = T.getArch() == Triple::x86_64;
|
||||
bool is64Bit = TT.getArch() == Triple::x86_64;
|
||||
|
||||
if (RM == Reloc::Default) {
|
||||
// Darwin defaults to PIC in 64 bit mode and dynamic-no-pic in 32 bit mode.
|
||||
// Win64 requires rip-rel addressing, thus we force it to PIC. Otherwise we
|
||||
// use static relocation model by default.
|
||||
if (T.isOSDarwin()) {
|
||||
if (TT.isOSDarwin()) {
|
||||
if (is64Bit)
|
||||
RM = Reloc::PIC_;
|
||||
else
|
||||
RM = Reloc::DynamicNoPIC;
|
||||
} else if (T.isOSWindows() && is64Bit)
|
||||
} else if (TT.isOSWindows() && is64Bit)
|
||||
RM = Reloc::PIC_;
|
||||
else
|
||||
RM = Reloc::Static;
|
||||
|
@ -186,13 +182,13 @@ static MCCodeGenInfo *createX86MCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||
if (RM == Reloc::DynamicNoPIC) {
|
||||
if (is64Bit)
|
||||
RM = Reloc::PIC_;
|
||||
else if (!T.isOSDarwin())
|
||||
else if (!TT.isOSDarwin())
|
||||
RM = Reloc::Static;
|
||||
}
|
||||
|
||||
// If we are on Darwin, disallow static relocation model in X86-64 mode, since
|
||||
// the Mach-O file format doesn't support it.
|
||||
if (RM == Reloc::Static && T.isOSDarwin() && is64Bit)
|
||||
if (RM == Reloc::Static && TT.isOSDarwin() && is64Bit)
|
||||
RM = Reloc::PIC_;
|
||||
|
||||
// For static codegen, if we're not already set, use Small codegen.
|
||||
|
|
|
@ -40,7 +40,7 @@ static MCInstrInfo *createXCoreMCInstrInfo() {
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCRegisterInfo *createXCoreMCRegisterInfo(StringRef TT) {
|
||||
static MCRegisterInfo *createXCoreMCRegisterInfo(const Triple &TT) {
|
||||
MCRegisterInfo *X = new MCRegisterInfo();
|
||||
InitXCoreMCRegisterInfo(X, XCore::LR);
|
||||
return X;
|
||||
|
@ -64,7 +64,8 @@ static MCAsmInfo *createXCoreMCAsmInfo(const MCRegisterInfo &MRI,
|
|||
return MAI;
|
||||
}
|
||||
|
||||
static MCCodeGenInfo *createXCoreMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
||||
static MCCodeGenInfo *createXCoreMCCodeGenInfo(const Triple &TT,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||
|
|
Loading…
Reference in New Issue