mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-08 18:52:23 +00:00
Delete Reloc::Default.
Having an enum member named Default is quite confusing: Is it distinct from the others? This patch removes that member and instead uses Optional<Reloc> in places where we have a user input that still hasn't been maped to the default value, which is now clear has no be one of the remaining 3 options. llvm-svn: 269988
This commit is contained in:
parent
30194757f7
commit
22e87bbb08
@ -48,10 +48,7 @@ MAttrs("mattr",
|
|||||||
|
|
||||||
cl::opt<Reloc::Model> RelocModel(
|
cl::opt<Reloc::Model> RelocModel(
|
||||||
"relocation-model", cl::desc("Choose relocation model"),
|
"relocation-model", cl::desc("Choose relocation model"),
|
||||||
cl::init(Reloc::Default),
|
|
||||||
cl::values(
|
cl::values(
|
||||||
clEnumValN(Reloc::Default, "default",
|
|
||||||
"Target default relocation model"),
|
|
||||||
clEnumValN(Reloc::Static, "static", "Non-relocatable code"),
|
clEnumValN(Reloc::Static, "static", "Non-relocatable code"),
|
||||||
clEnumValN(Reloc::PIC_, "pic",
|
clEnumValN(Reloc::PIC_, "pic",
|
||||||
"Fully relocatable, position independent code"),
|
"Fully relocatable, position independent code"),
|
||||||
@ -59,6 +56,14 @@ cl::opt<Reloc::Model> RelocModel(
|
|||||||
"Relocatable external references, non-relocatable code"),
|
"Relocatable external references, non-relocatable code"),
|
||||||
clEnumValEnd));
|
clEnumValEnd));
|
||||||
|
|
||||||
|
static inline Optional<Reloc::Model> getRelocModel() {
|
||||||
|
if (RelocModel.getNumOccurrences()) {
|
||||||
|
Reloc::Model R = RelocModel;
|
||||||
|
return R;
|
||||||
|
}
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
cl::opt<ThreadModel::Model>
|
cl::opt<ThreadModel::Model>
|
||||||
TMModel("thread-model",
|
TMModel("thread-model",
|
||||||
cl::desc("Choose threading model"),
|
cl::desc("Choose threading model"),
|
||||||
|
@ -519,7 +519,7 @@ private:
|
|||||||
std::shared_ptr<MCJITMemoryManager> MemMgr;
|
std::shared_ptr<MCJITMemoryManager> MemMgr;
|
||||||
std::shared_ptr<RuntimeDyld::SymbolResolver> Resolver;
|
std::shared_ptr<RuntimeDyld::SymbolResolver> Resolver;
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
Reloc::Model RelocModel;
|
Optional<Reloc::Model> RelocModel;
|
||||||
CodeModel::Model CMModel;
|
CodeModel::Model CMModel;
|
||||||
std::string MArch;
|
std::string MArch;
|
||||||
std::string MCPU;
|
std::string MCPU;
|
||||||
|
@ -79,7 +79,7 @@ struct LTOCodeGenerator {
|
|||||||
|
|
||||||
void setTargetOptions(TargetOptions Options);
|
void setTargetOptions(TargetOptions Options);
|
||||||
void setDebugInfo(lto_debug_model);
|
void setDebugInfo(lto_debug_model);
|
||||||
void setCodePICModel(Reloc::Model Model) { RelocModel = Model; }
|
void setCodePICModel(Optional<Reloc::Model> Model) { RelocModel = Model; }
|
||||||
|
|
||||||
/// Set the file type to be emitted (assembly or object code).
|
/// Set the file type to be emitted (assembly or object code).
|
||||||
/// The default is TargetMachine::CGFT_ObjectFile.
|
/// The default is TargetMachine::CGFT_ObjectFile.
|
||||||
@ -211,7 +211,7 @@ private:
|
|||||||
bool EmitDwarfDebugInfo = false;
|
bool EmitDwarfDebugInfo = false;
|
||||||
bool ScopeRestrictionsDone = false;
|
bool ScopeRestrictionsDone = false;
|
||||||
bool HasVerifiedInput = false;
|
bool HasVerifiedInput = false;
|
||||||
Reloc::Model RelocModel = Reloc::Default;
|
Optional<Reloc::Model> RelocModel;
|
||||||
StringSet<> MustPreserveSymbols;
|
StringSet<> MustPreserveSymbols;
|
||||||
StringSet<> AsmUndefinedRefs;
|
StringSet<> AsmUndefinedRefs;
|
||||||
StringMap<GlobalValue::LinkageTypes> ExternalSymbols;
|
StringMap<GlobalValue::LinkageTypes> ExternalSymbols;
|
||||||
|
@ -37,7 +37,7 @@ struct TargetMachineBuilder {
|
|||||||
std::string MCpu;
|
std::string MCpu;
|
||||||
std::string MAttr;
|
std::string MAttr;
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
Reloc::Model RelocModel = Reloc::Default;
|
Optional<Reloc::Model> RelocModel;
|
||||||
CodeGenOpt::Level CGOptLevel = CodeGenOpt::Default;
|
CodeGenOpt::Level CGOptLevel = CodeGenOpt::Default;
|
||||||
|
|
||||||
std::unique_ptr<TargetMachine> create() const;
|
std::unique_ptr<TargetMachine> create() const;
|
||||||
@ -168,7 +168,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// CodeModel
|
/// CodeModel
|
||||||
void setCodePICModel(Reloc::Model Model) { TMBuilder.RelocModel = Model; }
|
void setCodePICModel(Optional<Reloc::Model> Model) {
|
||||||
|
TMBuilder.RelocModel = Model;
|
||||||
|
}
|
||||||
|
|
||||||
/// CodeGen optimization level
|
/// CodeGen optimization level
|
||||||
void setCodeGenOptLevel(CodeGenOpt::Level CGOptLevel) {
|
void setCodeGenOptLevel(CodeGenOpt::Level CGOptLevel) {
|
||||||
|
@ -19,7 +19,7 @@ namespace llvm {
|
|||||||
|
|
||||||
// Relocation model types.
|
// Relocation model types.
|
||||||
namespace Reloc {
|
namespace Reloc {
|
||||||
enum Model { Default, Static, PIC_, DynamicNoPIC };
|
enum Model { Static, PIC_, DynamicNoPIC };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Code model types.
|
// Code model types.
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#define LLVM_SUPPORT_TARGETREGISTRY_H
|
#define LLVM_SUPPORT_TARGETREGISTRY_H
|
||||||
|
|
||||||
#include "llvm-c/Disassembler.h"
|
#include "llvm-c/Disassembler.h"
|
||||||
|
#include "llvm/ADT/Optional.h"
|
||||||
#include "llvm/ADT/Triple.h"
|
#include "llvm/ADT/Triple.h"
|
||||||
#include "llvm/Support/CodeGen.h"
|
#include "llvm/Support/CodeGen.h"
|
||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
@ -104,8 +105,8 @@ public:
|
|||||||
StringRef Features);
|
StringRef Features);
|
||||||
typedef TargetMachine *(*TargetMachineCtorTy)(
|
typedef TargetMachine *(*TargetMachineCtorTy)(
|
||||||
const Target &T, const Triple &TT, StringRef CPU, StringRef Features,
|
const Target &T, const Triple &TT, StringRef CPU, StringRef Features,
|
||||||
const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM,
|
const TargetOptions &Options, Optional<Reloc::Model> RM,
|
||||||
CodeGenOpt::Level OL);
|
CodeModel::Model CM, CodeGenOpt::Level OL);
|
||||||
// If it weren't for layering issues (this header is in llvm/Support, but
|
// If it weren't for layering issues (this header is in llvm/Support, but
|
||||||
// depends on MC?) this should take the Streamer by value rather than rvalue
|
// depends on MC?) this should take the Streamer by value rather than rvalue
|
||||||
// reference.
|
// reference.
|
||||||
@ -359,8 +360,7 @@ public:
|
|||||||
/// host if that does not exist.
|
/// host if that does not exist.
|
||||||
TargetMachine *
|
TargetMachine *
|
||||||
createTargetMachine(StringRef TT, StringRef CPU, StringRef Features,
|
createTargetMachine(StringRef TT, StringRef CPU, StringRef Features,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options, Optional<Reloc::Model> RM,
|
||||||
Reloc::Model RM = Reloc::Default,
|
|
||||||
CodeModel::Model CM = CodeModel::Default,
|
CodeModel::Model CM = CodeModel::Default,
|
||||||
CodeGenOpt::Level OL = CodeGenOpt::Default) const {
|
CodeGenOpt::Level OL = CodeGenOpt::Default) const {
|
||||||
if (!TargetMachineCtorFn)
|
if (!TargetMachineCtorFn)
|
||||||
@ -1097,7 +1097,8 @@ template <class TargetMachineImpl> struct RegisterTargetMachine {
|
|||||||
private:
|
private:
|
||||||
static TargetMachine *Allocator(const Target &T, const Triple &TT,
|
static TargetMachine *Allocator(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options, Reloc::Model RM,
|
const TargetOptions &Options,
|
||||||
|
Optional<Reloc::Model> RM,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL) {
|
CodeModel::Model CM, CodeGenOpt::Level OL) {
|
||||||
return new TargetMachineImpl(T, TT, CPU, FS, Options, RM, CM, OL);
|
return new TargetMachineImpl(T, TT, CPU, FS, Options, RM, CM, OL);
|
||||||
}
|
}
|
||||||
|
@ -474,8 +474,7 @@ EngineBuilder::EngineBuilder() : EngineBuilder(nullptr) {}
|
|||||||
EngineBuilder::EngineBuilder(std::unique_ptr<Module> M)
|
EngineBuilder::EngineBuilder(std::unique_ptr<Module> M)
|
||||||
: M(std::move(M)), WhichEngine(EngineKind::Either), ErrorStr(nullptr),
|
: M(std::move(M)), WhichEngine(EngineKind::Either), ErrorStr(nullptr),
|
||||||
OptLevel(CodeGenOpt::Default), MemMgr(nullptr), Resolver(nullptr),
|
OptLevel(CodeGenOpt::Default), MemMgr(nullptr), Resolver(nullptr),
|
||||||
RelocModel(Reloc::Default), CMModel(CodeModel::JITDefault),
|
CMModel(CodeModel::JITDefault), UseOrcMCJITReplacement(false) {
|
||||||
UseOrcMCJITReplacement(false) {
|
|
||||||
// IR module verification is enabled by default in debug builds, and disabled
|
// IR module verification is enabled by default in debug builds, and disabled
|
||||||
// by default in release builds.
|
// by default in release builds.
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -230,8 +230,8 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, TargetOptions options,
|
|||||||
CPU = "cyclone";
|
CPU = "cyclone";
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetMachine *target = march->createTargetMachine(TripleStr, CPU, FeatureStr,
|
TargetMachine *target =
|
||||||
options);
|
march->createTargetMachine(TripleStr, CPU, FeatureStr, options, None);
|
||||||
M->setDataLayout(target->createDataLayout());
|
M->setDataLayout(target->createDataLayout());
|
||||||
|
|
||||||
std::unique_ptr<object::IRObjectFile> IRObj(
|
std::unique_ptr<object::IRObjectFile> IRObj(
|
||||||
|
@ -161,18 +161,29 @@ static void initReciprocals(AArch64TargetMachine& TM, AArch64Subtarget& ST)
|
|||||||
TM.Options.Reciprocals.setDefaults("vec-divd", false, ExtraStepsD);
|
TM.Options.Reciprocals.setDefaults("vec-divd", false, ExtraStepsD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(const Triple &TT,
|
||||||
|
Optional<Reloc::Model> RM) {
|
||||||
|
// AArch64 Darwin is always PIC.
|
||||||
|
if (TT.isOSDarwin())
|
||||||
|
return 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
|
||||||
|
// library. Hence DynamicNoPIC doesn't need to be promoted to PIC.
|
||||||
|
if (!RM.hasValue() || *RM == Reloc::DynamicNoPIC)
|
||||||
|
return Reloc::Static;
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
/// Create an AArch64 architecture model.
|
/// Create an AArch64 architecture model.
|
||||||
///
|
///
|
||||||
AArch64TargetMachine::AArch64TargetMachine(const Target &T, const Triple &TT,
|
AArch64TargetMachine::AArch64TargetMachine(
|
||||||
StringRef CPU, StringRef FS,
|
const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options, Optional<Reloc::Model> RM,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
CodeModel::Model CM, CodeGenOpt::Level OL, bool LittleEndian)
|
||||||
CodeGenOpt::Level OL,
|
|
||||||
bool LittleEndian)
|
|
||||||
// This nested ternary is horrible, but DL needs to be properly
|
// This nested ternary is horrible, but DL needs to be properly
|
||||||
// initialized before TLInfo is constructed.
|
// initialized before TLInfo is constructed.
|
||||||
: LLVMTargetMachine(T, computeDataLayout(TT, LittleEndian), TT, CPU, FS,
|
: LLVMTargetMachine(T, computeDataLayout(TT, LittleEndian), TT, CPU, FS,
|
||||||
Options, RM, CM, OL),
|
Options, getEffectiveRelocModel(TT, RM), CM, OL),
|
||||||
TLOF(createTLOF(getTargetTriple())),
|
TLOF(createTLOF(getTargetTriple())),
|
||||||
Subtarget(TT, CPU, FS, *this, LittleEndian) {
|
Subtarget(TT, CPU, FS, *this, LittleEndian) {
|
||||||
initReciprocals(*this, Subtarget);
|
initReciprocals(*this, Subtarget);
|
||||||
@ -235,16 +246,16 @@ void AArch64leTargetMachine::anchor() { }
|
|||||||
|
|
||||||
AArch64leTargetMachine::AArch64leTargetMachine(
|
AArch64leTargetMachine::AArch64leTargetMachine(
|
||||||
const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
|
const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM,
|
const TargetOptions &Options, Optional<Reloc::Model> RM,
|
||||||
CodeGenOpt::Level OL)
|
CodeModel::Model CM, CodeGenOpt::Level OL)
|
||||||
: AArch64TargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
: AArch64TargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
||||||
|
|
||||||
void AArch64beTargetMachine::anchor() { }
|
void AArch64beTargetMachine::anchor() { }
|
||||||
|
|
||||||
AArch64beTargetMachine::AArch64beTargetMachine(
|
AArch64beTargetMachine::AArch64beTargetMachine(
|
||||||
const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
|
const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM,
|
const TargetOptions &Options, Optional<Reloc::Model> RM,
|
||||||
CodeGenOpt::Level OL)
|
CodeModel::Model CM, CodeGenOpt::Level OL)
|
||||||
: AArch64TargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
: AArch64TargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -29,7 +29,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
AArch64TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
AArch64TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL, bool IsLittleEndian);
|
CodeGenOpt::Level OL, bool IsLittleEndian);
|
||||||
|
|
||||||
~AArch64TargetMachine() override;
|
~AArch64TargetMachine() override;
|
||||||
@ -56,7 +56,7 @@ class AArch64leTargetMachine : public AArch64TargetMachine {
|
|||||||
public:
|
public:
|
||||||
AArch64leTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
AArch64leTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class AArch64beTargetMachine : public AArch64TargetMachine {
|
|||||||
public:
|
public:
|
||||||
AArch64beTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
AArch64beTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,15 +90,6 @@ static MCCodeGenInfo *createAArch64MCCodeGenInfo(const Triple &TT,
|
|||||||
report_fatal_error(
|
report_fatal_error(
|
||||||
"Only small and large code models are allowed on AArch64");
|
"Only small and large code models are allowed on AArch64");
|
||||||
|
|
||||||
// AArch64 Darwin is always PIC.
|
|
||||||
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
|
|
||||||
// library. Hence DynamicNoPIC doesn't need to be promoted to PIC.
|
|
||||||
else if (RM == Reloc::Default || RM == Reloc::DynamicNoPIC)
|
|
||||||
RM = Reloc::Static;
|
|
||||||
|
|
||||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||||
X->initMCCodeGenInfo(RM, CM, OL);
|
X->initMCCodeGenInfo(RM, CM, OL);
|
||||||
return X;
|
return X;
|
||||||
|
@ -103,17 +103,22 @@ static StringRef getGPUOrDefault(const Triple &TT, StringRef GPU) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
|
||||||
|
if (!RM.hasValue())
|
||||||
|
return Reloc::PIC_;
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
AMDGPUTargetMachine::AMDGPUTargetMachine(const Target &T, const Triple &TT,
|
AMDGPUTargetMachine::AMDGPUTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
TargetOptions Options, Reloc::Model RM,
|
TargetOptions Options,
|
||||||
|
Optional<Reloc::Model> RM,
|
||||||
CodeModel::Model CM,
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OptLevel)
|
CodeGenOpt::Level OptLevel)
|
||||||
: LLVMTargetMachine(T, computeDataLayout(TT), TT,
|
: LLVMTargetMachine(T, computeDataLayout(TT), TT, getGPUOrDefault(TT, CPU),
|
||||||
getGPUOrDefault(TT, CPU), FS, Options, RM, CM,
|
FS, Options, getEffectiveRelocModel(RM), CM, OptLevel),
|
||||||
OptLevel),
|
|
||||||
TLOF(createTLOF(getTargetTriple())),
|
TLOF(createTLOF(getTargetTriple())),
|
||||||
Subtarget(TT, getTargetCPU(), FS, *this),
|
Subtarget(TT, getTargetCPU(), FS, *this), IntrinsicInfo() {
|
||||||
IntrinsicInfo() {
|
|
||||||
setRequiresStructuredCFG(true);
|
setRequiresStructuredCFG(true);
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
}
|
}
|
||||||
@ -126,7 +131,8 @@ AMDGPUTargetMachine::~AMDGPUTargetMachine() { }
|
|||||||
|
|
||||||
R600TargetMachine::R600TargetMachine(const Target &T, const Triple &TT,
|
R600TargetMachine::R600TargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
TargetOptions Options, Reloc::Model RM,
|
TargetOptions Options,
|
||||||
|
Optional<Reloc::Model> RM,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL)
|
CodeModel::Model CM, CodeGenOpt::Level OL)
|
||||||
: AMDGPUTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
|
: AMDGPUTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
|
||||||
|
|
||||||
@ -136,7 +142,8 @@ R600TargetMachine::R600TargetMachine(const Target &T, const Triple &TT,
|
|||||||
|
|
||||||
GCNTargetMachine::GCNTargetMachine(const Target &T, const Triple &TT,
|
GCNTargetMachine::GCNTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
TargetOptions Options, Reloc::Model RM,
|
TargetOptions Options,
|
||||||
|
Optional<Reloc::Model> RM,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL)
|
CodeModel::Model CM, CodeGenOpt::Level OL)
|
||||||
: AMDGPUTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
|
: AMDGPUTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
|
||||||
|
|
||||||
|
@ -38,8 +38,9 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
AMDGPUTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
AMDGPUTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, TargetOptions Options, Reloc::Model RM,
|
StringRef FS, TargetOptions Options,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL);
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
|
CodeGenOpt::Level OL);
|
||||||
~AMDGPUTargetMachine();
|
~AMDGPUTargetMachine();
|
||||||
|
|
||||||
const AMDGPUSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
const AMDGPUSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
||||||
@ -64,8 +65,9 @@ class R600TargetMachine final : public AMDGPUTargetMachine {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
R600TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
R600TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, TargetOptions Options, Reloc::Model RM,
|
StringRef FS, TargetOptions Options,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL);
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
|
CodeGenOpt::Level OL);
|
||||||
|
|
||||||
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
||||||
};
|
};
|
||||||
@ -78,8 +80,9 @@ class GCNTargetMachine final : public AMDGPUTargetMachine {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
GCNTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
GCNTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, TargetOptions Options, Reloc::Model RM,
|
StringRef FS, TargetOptions Options,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL);
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
|
CodeGenOpt::Level OL);
|
||||||
|
|
||||||
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
||||||
};
|
};
|
||||||
|
@ -172,15 +172,25 @@ static std::string computeDataLayout(const Triple &TT, StringRef CPU,
|
|||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(const Triple &TT,
|
||||||
|
Optional<Reloc::Model> RM) {
|
||||||
|
if (!RM.hasValue())
|
||||||
|
// Default relocation model on Darwin is PIC, not DynamicNoPIC.
|
||||||
|
return TT.isOSDarwin() ? Reloc::PIC_ : Reloc::DynamicNoPIC;
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
/// Create an ARM architecture model.
|
/// Create an ARM architecture model.
|
||||||
///
|
///
|
||||||
ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, const Triple &TT,
|
ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL, bool isLittle)
|
CodeGenOpt::Level OL, bool isLittle)
|
||||||
: LLVMTargetMachine(T, computeDataLayout(TT, CPU, Options, isLittle), TT,
|
: LLVMTargetMachine(T, computeDataLayout(TT, CPU, Options, isLittle), TT,
|
||||||
CPU, FS, Options, RM, CM, OL),
|
CPU, FS, Options, getEffectiveRelocModel(TT, RM), CM,
|
||||||
|
OL),
|
||||||
TargetABI(computeTargetABI(TT, CPU, Options)),
|
TargetABI(computeTargetABI(TT, CPU, Options)),
|
||||||
TLOF(createTLOF(getTargetTriple())),
|
TLOF(createTLOF(getTargetTriple())),
|
||||||
Subtarget(TT, CPU, FS, *this, isLittle), isLittle(isLittle) {
|
Subtarget(TT, CPU, FS, *this, isLittle), isLittle(isLittle) {
|
||||||
@ -248,8 +258,9 @@ void ARMTargetMachine::anchor() {}
|
|||||||
ARMTargetMachine::ARMTargetMachine(const Target &T, const Triple &TT,
|
ARMTargetMachine::ARMTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
CodeGenOpt::Level OL, bool isLittle)
|
CodeModel::Model CM, CodeGenOpt::Level OL,
|
||||||
|
bool isLittle)
|
||||||
: ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, isLittle) {
|
: ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, isLittle) {
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
if (!Subtarget.hasARMOps())
|
if (!Subtarget.hasARMOps())
|
||||||
@ -262,7 +273,8 @@ void ARMLETargetMachine::anchor() {}
|
|||||||
ARMLETargetMachine::ARMLETargetMachine(const Target &T, const Triple &TT,
|
ARMLETargetMachine::ARMLETargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: ARMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
: ARMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
||||||
|
|
||||||
@ -271,7 +283,8 @@ void ARMBETargetMachine::anchor() {}
|
|||||||
ARMBETargetMachine::ARMBETargetMachine(const Target &T, const Triple &TT,
|
ARMBETargetMachine::ARMBETargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: ARMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
: ARMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
||||||
|
|
||||||
@ -280,7 +293,8 @@ void ThumbTargetMachine::anchor() {}
|
|||||||
ThumbTargetMachine::ThumbTargetMachine(const Target &T, const Triple &TT,
|
ThumbTargetMachine::ThumbTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL, bool isLittle)
|
CodeGenOpt::Level OL, bool isLittle)
|
||||||
: ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, isLittle) {
|
: ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, isLittle) {
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
@ -291,7 +305,8 @@ void ThumbLETargetMachine::anchor() {}
|
|||||||
ThumbLETargetMachine::ThumbLETargetMachine(const Target &T, const Triple &TT,
|
ThumbLETargetMachine::ThumbLETargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: ThumbTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
: ThumbTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
||||||
|
|
||||||
@ -300,7 +315,8 @@ void ThumbBETargetMachine::anchor() {}
|
|||||||
ThumbBETargetMachine::ThumbBETargetMachine(const Target &T, const Triple &TT,
|
ThumbBETargetMachine::ThumbBETargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: ThumbTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
: ThumbTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
ARMBaseTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
ARMBaseTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL, bool isLittle);
|
CodeGenOpt::Level OL, bool isLittle);
|
||||||
~ARMBaseTargetMachine() override;
|
~ARMBaseTargetMachine() override;
|
||||||
|
|
||||||
@ -64,8 +64,9 @@ class ARMTargetMachine : public ARMBaseTargetMachine {
|
|||||||
virtual void anchor();
|
virtual void anchor();
|
||||||
public:
|
public:
|
||||||
ARMTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
ARMTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options, Reloc::Model RM,
|
StringRef FS, const TargetOptions &Options,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL, bool isLittle);
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
|
CodeGenOpt::Level OL, bool isLittle);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// ARM little endian target machine.
|
/// ARM little endian target machine.
|
||||||
@ -75,7 +76,7 @@ class ARMLETargetMachine : public ARMTargetMachine {
|
|||||||
public:
|
public:
|
||||||
ARMLETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
ARMLETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ class ARMBETargetMachine : public ARMTargetMachine {
|
|||||||
public:
|
public:
|
||||||
ARMBETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
ARMBETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -99,8 +100,8 @@ class ThumbTargetMachine : public ARMBaseTargetMachine {
|
|||||||
public:
|
public:
|
||||||
ThumbTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
ThumbTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
bool isLittle);
|
CodeGenOpt::Level OL, bool isLittle);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Thumb little endian target machine.
|
/// Thumb little endian target machine.
|
||||||
@ -110,7 +111,7 @@ class ThumbLETargetMachine : public ThumbTargetMachine {
|
|||||||
public:
|
public:
|
||||||
ThumbLETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
ThumbLETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ class ThumbBETargetMachine : public ThumbTargetMachine {
|
|||||||
public:
|
public:
|
||||||
ThumbBETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
ThumbBETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -205,10 +205,6 @@ static MCCodeGenInfo *createARMMCCodeGenInfo(const Triple &TT, Reloc::Model RM,
|
|||||||
CodeModel::Model CM,
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL) {
|
CodeGenOpt::Level OL) {
|
||||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||||
if (RM == Reloc::Default) {
|
|
||||||
// Default relocation model on Darwin is PIC, not DynamicNoPIC.
|
|
||||||
RM = TT.isOSDarwin() ? Reloc::PIC_ : Reloc::DynamicNoPIC;
|
|
||||||
}
|
|
||||||
X->initMCCodeGenInfo(RM, CM, OL);
|
X->initMCCodeGenInfo(RM, CM, OL);
|
||||||
return X;
|
return X;
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,19 @@ static std::string computeDataLayout(const Triple &TT) {
|
|||||||
return "e-m:e-p:64:64-i64:64-n32:64-S128";
|
return "e-m:e-p:64:64-i64:64-n32:64-S128";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
|
||||||
|
if (!RM.hasValue())
|
||||||
|
return Reloc::PIC_;
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
BPFTargetMachine::BPFTargetMachine(const Target &T, const Triple &TT,
|
BPFTargetMachine::BPFTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
CodeGenOpt::Level OL)
|
CodeModel::Model CM, CodeGenOpt::Level OL)
|
||||||
: LLVMTargetMachine(T, computeDataLayout(TT), TT, CPU, FS, Options, RM, CM,
|
: LLVMTargetMachine(T, computeDataLayout(TT), TT, CPU, FS, Options,
|
||||||
OL),
|
getEffectiveRelocModel(RM), CM, OL),
|
||||||
TLOF(make_unique<TargetLoweringObjectFileELF>()),
|
TLOF(make_unique<TargetLoweringObjectFileELF>()),
|
||||||
Subtarget(TT, CPU, FS, *this) {
|
Subtarget(TT, CPU, FS, *this) {
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
|
@ -24,8 +24,9 @@ class BPFTargetMachine : public LLVMTargetMachine {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
BPFTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
BPFTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options, Reloc::Model RM,
|
StringRef FS, const TargetOptions &Options,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL);
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
|
CodeGenOpt::Level OL);
|
||||||
|
|
||||||
const BPFSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
const BPFSubtarget *getSubtargetImpl() const { return &Subtarget; }
|
||||||
const BPFSubtarget *getSubtargetImpl(const Function &) const override {
|
const BPFSubtarget *getSubtargetImpl(const Function &) const override {
|
||||||
|
@ -130,19 +130,27 @@ namespace llvm {
|
|||||||
FunctionPass *createHexagonStoreWidening();
|
FunctionPass *createHexagonStoreWidening();
|
||||||
} // end namespace llvm;
|
} // end namespace llvm;
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
|
||||||
|
if (!RM.hasValue())
|
||||||
|
return Reloc::Static;
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
HexagonTargetMachine::HexagonTargetMachine(const Target &T, const Triple &TT,
|
HexagonTargetMachine::HexagonTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
// Specify the vector alignment explicitly. For v512x1, the calculated
|
// Specify the vector alignment explicitly. For v512x1, the calculated
|
||||||
// alignment would be 512*alignment(i1), which is 512 bytes, instead of
|
// alignment would be 512*alignment(i1), which is 512 bytes, instead of
|
||||||
// the required minimum of 64 bytes.
|
// the required minimum of 64 bytes.
|
||||||
: LLVMTargetMachine(T, "e-m:e-p:32:32:32-a:0-n16:32-"
|
: LLVMTargetMachine(
|
||||||
|
T, "e-m:e-p:32:32:32-a:0-n16:32-"
|
||||||
"i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-"
|
"i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-"
|
||||||
"v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048",
|
"v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048",
|
||||||
TT, CPU, FS, Options, RM, CM, (HexagonNoOpt ? CodeGenOpt::None : OL)),
|
TT, CPU, FS, Options, getEffectiveRelocModel(RM), CM,
|
||||||
|
(HexagonNoOpt ? CodeGenOpt::None : OL)),
|
||||||
TLOF(make_unique<HexagonTargetObjectFile>()) {
|
TLOF(make_unique<HexagonTargetObjectFile>()) {
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class HexagonTargetMachine : public LLVMTargetMachine {
|
|||||||
public:
|
public:
|
||||||
HexagonTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
HexagonTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
~HexagonTargetMachine() override;
|
~HexagonTargetMachine() override;
|
||||||
const HexagonSubtarget *getSubtargetImpl(const Function &F) const override;
|
const HexagonSubtarget *getSubtargetImpl(const Function &F) const override;
|
||||||
|
@ -204,8 +204,6 @@ static MCCodeGenInfo *createHexagonMCCodeGenInfo(const Triple &TT,
|
|||||||
CodeModel::Model CM,
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL) {
|
CodeGenOpt::Level OL) {
|
||||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||||
if (RM == Reloc::Default)
|
|
||||||
RM = Reloc::Static;
|
|
||||||
X->initMCCodeGenInfo(RM, CM, OL);
|
X->initMCCodeGenInfo(RM, CM, OL);
|
||||||
return X;
|
return X;
|
||||||
}
|
}
|
||||||
|
@ -26,13 +26,20 @@ extern "C" void LLVMInitializeMSP430Target() {
|
|||||||
RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
|
RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
|
||||||
|
if (!RM.hasValue())
|
||||||
|
return Reloc::Static;
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
MSP430TargetMachine::MSP430TargetMachine(const Target &T, const Triple &TT,
|
MSP430TargetMachine::MSP430TargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: LLVMTargetMachine(T, "e-m:e-p:16:16-i32:16:32-a:16-n8:16", TT, CPU, FS,
|
: LLVMTargetMachine(T, "e-m:e-p:16:16-i32:16:32-a:16-n8:16", TT, CPU, FS,
|
||||||
Options, RM, CM, OL),
|
Options, getEffectiveRelocModel(RM), CM, OL),
|
||||||
TLOF(make_unique<TargetLoweringObjectFileELF>()),
|
TLOF(make_unique<TargetLoweringObjectFileELF>()),
|
||||||
// FIXME: Check DataLayout string.
|
// FIXME: Check DataLayout string.
|
||||||
Subtarget(TT, CPU, FS, *this) {
|
Subtarget(TT, CPU, FS, *this) {
|
||||||
|
@ -30,7 +30,7 @@ class MSP430TargetMachine : public LLVMTargetMachine {
|
|||||||
public:
|
public:
|
||||||
MSP430TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
MSP430TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
~MSP430TargetMachine() override;
|
~MSP430TargetMachine() override;
|
||||||
|
|
||||||
|
@ -86,8 +86,6 @@ static MCCodeGenInfo *createMipsMCCodeGenInfo(const Triple &TT, Reloc::Model RM,
|
|||||||
CodeModel::Model CM,
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL) {
|
CodeGenOpt::Level OL) {
|
||||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||||
if (RM == Reloc::Default || CM == CodeModel::JITDefault)
|
|
||||||
RM = Reloc::Static;
|
|
||||||
X->initMCCodeGenInfo(RM, CM, OL);
|
X->initMCCodeGenInfo(RM, CM, OL);
|
||||||
return X;
|
return X;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,13 @@ static std::string computeDataLayout(const Triple &TT, StringRef CPU,
|
|||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(CodeModel::Model CM,
|
||||||
|
Optional<Reloc::Model> RM) {
|
||||||
|
if (!RM.hasValue() || CM == CodeModel::JITDefault)
|
||||||
|
return Reloc::Static;
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
// On function prologue, the stack is created by decrementing
|
// On function prologue, the stack is created by decrementing
|
||||||
// its pointer. Once decremented, all references are done with positive
|
// its pointer. Once decremented, all references are done with positive
|
||||||
// offset from the stack/frame pointer, using StackGrowsUp enables
|
// offset from the stack/frame pointer, using StackGrowsUp enables
|
||||||
@ -86,10 +93,12 @@ static std::string computeDataLayout(const Triple &TT, StringRef CPU,
|
|||||||
MipsTargetMachine::MipsTargetMachine(const Target &T, const Triple &TT,
|
MipsTargetMachine::MipsTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
CodeGenOpt::Level OL, bool isLittle)
|
CodeModel::Model CM, CodeGenOpt::Level OL,
|
||||||
|
bool isLittle)
|
||||||
: LLVMTargetMachine(T, computeDataLayout(TT, CPU, Options, isLittle), TT,
|
: LLVMTargetMachine(T, computeDataLayout(TT, CPU, Options, isLittle), TT,
|
||||||
CPU, FS, Options, RM, CM, OL),
|
CPU, FS, Options, getEffectiveRelocModel(CM, RM), CM,
|
||||||
|
OL),
|
||||||
isLittle(isLittle), TLOF(make_unique<MipsTargetObjectFile>()),
|
isLittle(isLittle), TLOF(make_unique<MipsTargetObjectFile>()),
|
||||||
ABI(MipsABIInfo::computeTargetABI(TT, CPU, Options.MCOptions)),
|
ABI(MipsABIInfo::computeTargetABI(TT, CPU, Options.MCOptions)),
|
||||||
Subtarget(nullptr), DefaultSubtarget(TT, CPU, FS, isLittle, *this),
|
Subtarget(nullptr), DefaultSubtarget(TT, CPU, FS, isLittle, *this),
|
||||||
@ -108,7 +117,8 @@ void MipsebTargetMachine::anchor() { }
|
|||||||
MipsebTargetMachine::MipsebTargetMachine(const Target &T, const Triple &TT,
|
MipsebTargetMachine::MipsebTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: MipsTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
: MipsTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
||||||
|
|
||||||
@ -117,7 +127,8 @@ void MipselTargetMachine::anchor() { }
|
|||||||
MipselTargetMachine::MipselTargetMachine(const Target &T, const Triple &TT,
|
MipselTargetMachine::MipselTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: MipsTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
: MipsTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
||||||
|
|
||||||
|
@ -40,8 +40,9 @@ class MipsTargetMachine : public LLVMTargetMachine {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
MipsTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
MipsTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options, Reloc::Model RM,
|
StringRef FS, const TargetOptions &Options,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL, bool isLittle);
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
|
CodeGenOpt::Level OL, bool isLittle);
|
||||||
~MipsTargetMachine() override;
|
~MipsTargetMachine() override;
|
||||||
|
|
||||||
TargetIRAnalysis getTargetIRAnalysis() override;
|
TargetIRAnalysis getTargetIRAnalysis() override;
|
||||||
@ -75,7 +76,7 @@ class MipsebTargetMachine : public MipsTargetMachine {
|
|||||||
public:
|
public:
|
||||||
MipsebTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
MipsebTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ class MipselTargetMachine : public MipsTargetMachine {
|
|||||||
public:
|
public:
|
||||||
MipselTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
MipselTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,9 +55,7 @@ static MCCodeGenInfo *createNVPTXMCCodeGenInfo(const Triple &TT,
|
|||||||
CodeGenOpt::Level OL) {
|
CodeGenOpt::Level OL) {
|
||||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||||
|
|
||||||
// The default relocation model is used regardless of what the client has
|
X->initMCCodeGenInfo(RM, CM, OL);
|
||||||
// specified, as it is the only relocation model currently supported.
|
|
||||||
X->initMCCodeGenInfo(Reloc::Default, CM, OL);
|
|
||||||
return X;
|
return X;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,11 +99,15 @@ static std::string computeDataLayout(bool is64Bit) {
|
|||||||
NVPTXTargetMachine::NVPTXTargetMachine(const Target &T, const Triple &TT,
|
NVPTXTargetMachine::NVPTXTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL, bool is64bit)
|
CodeGenOpt::Level OL, bool is64bit)
|
||||||
: LLVMTargetMachine(T, computeDataLayout(is64bit), TT, CPU, FS, Options, RM,
|
// The pic relocation model is used regardless of what the client has
|
||||||
CM, OL),
|
// specified, as it is the only relocation model currently supported.
|
||||||
is64bit(is64bit), TLOF(make_unique<NVPTXTargetObjectFile>()),
|
: LLVMTargetMachine(T, computeDataLayout(is64bit), TT, CPU, FS, Options,
|
||||||
|
Reloc::PIC_, CM, OL),
|
||||||
|
is64bit(is64bit),
|
||||||
|
TLOF(make_unique<NVPTXTargetObjectFile>()),
|
||||||
Subtarget(TT, CPU, FS, *this) {
|
Subtarget(TT, CPU, FS, *this) {
|
||||||
if (TT.getOS() == Triple::NVCL)
|
if (TT.getOS() == Triple::NVCL)
|
||||||
drvInterface = NVPTX::NVCL;
|
drvInterface = NVPTX::NVCL;
|
||||||
@ -119,7 +123,8 @@ void NVPTXTargetMachine32::anchor() {}
|
|||||||
NVPTXTargetMachine32::NVPTXTargetMachine32(const Target &T, const Triple &TT,
|
NVPTXTargetMachine32::NVPTXTargetMachine32(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: NVPTXTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
: NVPTXTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
||||||
|
|
||||||
@ -128,7 +133,8 @@ void NVPTXTargetMachine64::anchor() {}
|
|||||||
NVPTXTargetMachine64::NVPTXTargetMachine64(const Target &T, const Triple &TT,
|
NVPTXTargetMachine64::NVPTXTargetMachine64(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: NVPTXTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
: NVPTXTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ class NVPTXTargetMachine : public LLVMTargetMachine {
|
|||||||
public:
|
public:
|
||||||
NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OP,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
bool is64bit);
|
CodeGenOpt::Level OP, bool is64bit);
|
||||||
|
|
||||||
~NVPTXTargetMachine() override;
|
~NVPTXTargetMachine() override;
|
||||||
const NVPTXSubtarget *getSubtargetImpl(const Function &) const override {
|
const NVPTXSubtarget *getSubtargetImpl(const Function &) const override {
|
||||||
@ -71,7 +71,7 @@ class NVPTXTargetMachine32 : public NVPTXTargetMachine {
|
|||||||
public:
|
public:
|
||||||
NVPTXTargetMachine32(const Target &T, const Triple &TT, StringRef CPU,
|
NVPTXTargetMachine32(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class NVPTXTargetMachine64 : public NVPTXTargetMachine {
|
|||||||
public:
|
public:
|
||||||
NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU,
|
NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,12 +92,6 @@ static MCCodeGenInfo *createPPCMCCodeGenInfo(const Triple &TT, Reloc::Model RM,
|
|||||||
CodeGenOpt::Level OL) {
|
CodeGenOpt::Level OL) {
|
||||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||||
|
|
||||||
if (RM == Reloc::Default) {
|
|
||||||
if (TT.isOSDarwin())
|
|
||||||
RM = Reloc::DynamicNoPIC;
|
|
||||||
else
|
|
||||||
RM = Reloc::Static;
|
|
||||||
}
|
|
||||||
if (CM == CodeModel::Default) {
|
if (CM == CodeModel::Default) {
|
||||||
if (!TT.isOSDarwin() &&
|
if (!TT.isOSDarwin() &&
|
||||||
(TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le))
|
(TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le))
|
||||||
|
@ -178,6 +178,16 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
|
|||||||
return PPCTargetMachine::PPC_ABI_UNKNOWN;
|
return PPCTargetMachine::PPC_ABI_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(const Triple &TT,
|
||||||
|
Optional<Reloc::Model> RM) {
|
||||||
|
if (!RM.hasValue()) {
|
||||||
|
if (TT.isOSDarwin())
|
||||||
|
return Reloc::DynamicNoPIC;
|
||||||
|
return Reloc::Static;
|
||||||
|
}
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
// The FeatureString here is a little subtle. We are modifying the feature
|
// The FeatureString here is a little subtle. We are modifying the feature
|
||||||
// string with what are (currently) non-function specific overrides as it goes
|
// string with what are (currently) non-function specific overrides as it goes
|
||||||
// into the LLVMTargetMachine constructor and then using the stored value in the
|
// into the LLVMTargetMachine constructor and then using the stored value in the
|
||||||
@ -185,10 +195,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
|
|||||||
PPCTargetMachine::PPCTargetMachine(const Target &T, const Triple &TT,
|
PPCTargetMachine::PPCTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
CodeGenOpt::Level OL)
|
CodeModel::Model CM, CodeGenOpt::Level OL)
|
||||||
: LLVMTargetMachine(T, getDataLayoutString(TT), TT, CPU,
|
: LLVMTargetMachine(T, getDataLayoutString(TT), TT, CPU,
|
||||||
computeFSAdditions(FS, OL, TT), Options, RM, CM, OL),
|
computeFSAdditions(FS, OL, TT), Options,
|
||||||
|
getEffectiveRelocModel(TT, RM), CM, OL),
|
||||||
TLOF(createTLOF(getTargetTriple())),
|
TLOF(createTLOF(getTargetTriple())),
|
||||||
TargetABI(computeTargetABI(TT, Options)),
|
TargetABI(computeTargetABI(TT, Options)),
|
||||||
Subtarget(TargetTriple, CPU, computeFSAdditions(FS, OL, TT), *this) {
|
Subtarget(TargetTriple, CPU, computeFSAdditions(FS, OL, TT), *this) {
|
||||||
@ -220,7 +231,8 @@ void PPC32TargetMachine::anchor() { }
|
|||||||
PPC32TargetMachine::PPC32TargetMachine(const Target &T, const Triple &TT,
|
PPC32TargetMachine::PPC32TargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: PPCTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
|
: PPCTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
|
||||||
|
|
||||||
@ -229,7 +241,8 @@ void PPC64TargetMachine::anchor() { }
|
|||||||
PPC64TargetMachine::PPC64TargetMachine(const Target &T, const Triple &TT,
|
PPC64TargetMachine::PPC64TargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: PPCTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
|
: PPCTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
|
||||||
|
|
||||||
|
@ -35,8 +35,9 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options, Reloc::Model RM,
|
StringRef FS, const TargetOptions &Options,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL);
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
|
CodeGenOpt::Level OL);
|
||||||
|
|
||||||
~PPCTargetMachine() override;
|
~PPCTargetMachine() override;
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ class PPC32TargetMachine : public PPCTargetMachine {
|
|||||||
public:
|
public:
|
||||||
PPC32TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
PPC32TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ class PPC64TargetMachine : public PPCTargetMachine {
|
|||||||
public:
|
public:
|
||||||
PPC64TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
PPC64TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -53,15 +53,22 @@ static std::string computeDataLayout(const Triple &T, bool is64Bit) {
|
|||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
|
||||||
|
if (!RM.hasValue())
|
||||||
|
return Reloc::Static;
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
/// Create an ILP32 architecture model
|
/// Create an ILP32 architecture model
|
||||||
///
|
///
|
||||||
SparcTargetMachine::SparcTargetMachine(const Target &T, const Triple &TT,
|
SparcTargetMachine::SparcTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL, bool is64bit)
|
CodeGenOpt::Level OL, bool is64bit)
|
||||||
: LLVMTargetMachine(T, computeDataLayout(TT, is64bit), TT, CPU, FS, Options,
|
: LLVMTargetMachine(T, computeDataLayout(TT, is64bit), TT, CPU, FS, Options,
|
||||||
RM, CM, OL),
|
getEffectiveRelocModel(RM), CM, OL),
|
||||||
TLOF(make_unique<SparcELFTargetObjectFile>()) {
|
TLOF(make_unique<SparcELFTargetObjectFile>()) {
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
this->is64Bit = is64bit;
|
this->is64Bit = is64bit;
|
||||||
@ -144,7 +151,8 @@ void SparcV8TargetMachine::anchor() { }
|
|||||||
SparcV8TargetMachine::SparcV8TargetMachine(const Target &T, const Triple &TT,
|
SparcV8TargetMachine::SparcV8TargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: SparcTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
: SparcTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
||||||
|
|
||||||
@ -153,7 +161,8 @@ void SparcV9TargetMachine::anchor() { }
|
|||||||
SparcV9TargetMachine::SparcV9TargetMachine(const Target &T, const Triple &TT,
|
SparcV9TargetMachine::SparcV9TargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: SparcTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
: SparcTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
|
||||||
|
|
||||||
@ -162,6 +171,7 @@ void SparcelTargetMachine::anchor() {}
|
|||||||
SparcelTargetMachine::SparcelTargetMachine(const Target &T, const Triple &TT,
|
SparcelTargetMachine::SparcelTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: SparcTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
: SparcTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
|
||||||
|
@ -27,8 +27,8 @@ class SparcTargetMachine : public LLVMTargetMachine {
|
|||||||
public:
|
public:
|
||||||
SparcTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
SparcTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
bool is64bit);
|
CodeGenOpt::Level OL, bool is64bit);
|
||||||
~SparcTargetMachine() override;
|
~SparcTargetMachine() override;
|
||||||
|
|
||||||
const SparcSubtarget *getSubtargetImpl(const Function &) const override;
|
const SparcSubtarget *getSubtargetImpl(const Function &) const override;
|
||||||
@ -47,7 +47,7 @@ class SparcV8TargetMachine : public SparcTargetMachine {
|
|||||||
public:
|
public:
|
||||||
SparcV8TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
SparcV8TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ class SparcV9TargetMachine : public SparcTargetMachine {
|
|||||||
public:
|
public:
|
||||||
SparcV9TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
SparcV9TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ class SparcelTargetMachine : public SparcTargetMachine {
|
|||||||
public:
|
public:
|
||||||
SparcelTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
SparcelTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -164,12 +164,6 @@ static MCCodeGenInfo *createSystemZMCCodeGenInfo(const Triple &TT,
|
|||||||
CodeModel::Model CM,
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL) {
|
CodeGenOpt::Level OL) {
|
||||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||||
|
|
||||||
// Static code is suitable for use in a dynamic executable; there is no
|
|
||||||
// separate DynamicNoPIC model.
|
|
||||||
if (RM == Reloc::Default || RM == Reloc::DynamicNoPIC)
|
|
||||||
RM = Reloc::Static;
|
|
||||||
|
|
||||||
// For SystemZ we define the models as follows:
|
// For SystemZ we define the models as follows:
|
||||||
//
|
//
|
||||||
// Small: BRASL can call any function and will use a stub if necessary.
|
// Small: BRASL can call any function and will use a stub if necessary.
|
||||||
|
@ -80,13 +80,22 @@ static std::string computeDataLayout(const Triple &TT, StringRef CPU,
|
|||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
|
||||||
|
// Static code is suitable for use in a dynamic executable; there is no
|
||||||
|
// separate DynamicNoPIC model.
|
||||||
|
if (!RM.hasValue() || *RM == Reloc::DynamicNoPIC)
|
||||||
|
return Reloc::Static;
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
SystemZTargetMachine::SystemZTargetMachine(const Target &T, const Triple &TT,
|
SystemZTargetMachine::SystemZTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: LLVMTargetMachine(T, computeDataLayout(TT, CPU, FS), TT, CPU, FS, Options,
|
: LLVMTargetMachine(T, computeDataLayout(TT, CPU, FS), TT, CPU, FS, Options,
|
||||||
RM, CM, OL),
|
getEffectiveRelocModel(RM), CM, OL),
|
||||||
TLOF(make_unique<TargetLoweringObjectFileELF>()),
|
TLOF(make_unique<TargetLoweringObjectFileELF>()),
|
||||||
Subtarget(TT, CPU, FS, *this) {
|
Subtarget(TT, CPU, FS, *this) {
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
|
@ -29,7 +29,7 @@ class SystemZTargetMachine : public LLVMTargetMachine {
|
|||||||
public:
|
public:
|
||||||
SystemZTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
SystemZTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
~SystemZTargetMachine() override;
|
~SystemZTargetMachine() override;
|
||||||
|
|
||||||
|
@ -72,10 +72,10 @@ void TargetMachine::resetTargetOptions(const Function &F) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the code generation relocation model. The choices are static, PIC,
|
/// Returns the code generation relocation model. The choices are static, PIC,
|
||||||
/// and dynamic-no-pic, and target default.
|
/// and dynamic-no-pic.
|
||||||
Reloc::Model TargetMachine::getRelocationModel() const {
|
Reloc::Model TargetMachine::getRelocationModel() const {
|
||||||
if (!CodeGenInfo)
|
if (!CodeGenInfo)
|
||||||
return Reloc::Default;
|
return Reloc::Static; // FIXME
|
||||||
return CodeGenInfo->getRelocationModel();
|
return CodeGenInfo->getRelocationModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T,
|
|||||||
const char* Triple, const char* CPU, const char* Features,
|
const char* Triple, const char* CPU, const char* Features,
|
||||||
LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc,
|
LLVMCodeGenOptLevel Level, LLVMRelocMode Reloc,
|
||||||
LLVMCodeModel CodeModel) {
|
LLVMCodeModel CodeModel) {
|
||||||
Reloc::Model RM;
|
Optional<Reloc::Model> RM;
|
||||||
switch (Reloc){
|
switch (Reloc){
|
||||||
case LLVMRelocStatic:
|
case LLVMRelocStatic:
|
||||||
RM = Reloc::Static;
|
RM = Reloc::Static;
|
||||||
@ -117,7 +117,6 @@ LLVMTargetMachineRef LLVMCreateTargetMachine(LLVMTargetRef T,
|
|||||||
RM = Reloc::DynamicNoPIC;
|
RM = Reloc::DynamicNoPIC;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
RM = Reloc::Default;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,37 +204,6 @@ static MCCodeGenInfo *createX86MCCodeGenInfo(const Triple &TT, Reloc::Model RM,
|
|||||||
|
|
||||||
bool is64Bit = TT.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 (TT.isOSDarwin()) {
|
|
||||||
if (is64Bit)
|
|
||||||
RM = Reloc::PIC_;
|
|
||||||
else
|
|
||||||
RM = Reloc::DynamicNoPIC;
|
|
||||||
} else if (TT.isOSWindows() && is64Bit)
|
|
||||||
RM = Reloc::PIC_;
|
|
||||||
else
|
|
||||||
RM = Reloc::Static;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ELF and X86-64 don't have a distinct DynamicNoPIC model. DynamicNoPIC
|
|
||||||
// is defined as a model for code which may be used in static or dynamic
|
|
||||||
// executables but not necessarily a shared library. On X86-32 we just
|
|
||||||
// compile in -static mode, in x86-64 we use PIC.
|
|
||||||
if (RM == Reloc::DynamicNoPIC) {
|
|
||||||
if (is64Bit)
|
|
||||||
RM = Reloc::PIC_;
|
|
||||||
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 && TT.isOSDarwin() && is64Bit)
|
|
||||||
RM = Reloc::PIC_;
|
|
||||||
|
|
||||||
// For static codegen, if we're not already set, use Small codegen.
|
// For static codegen, if we're not already set, use Small codegen.
|
||||||
if (CM == CodeModel::Default)
|
if (CM == CodeModel::Default)
|
||||||
CM = CodeModel::Small;
|
CM = CodeModel::Small;
|
||||||
|
@ -106,15 +106,51 @@ static std::string computeDataLayout(const Triple &TT) {
|
|||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(const Triple &TT,
|
||||||
|
Optional<Reloc::Model> RM) {
|
||||||
|
bool is64Bit = TT.getArch() == Triple::x86_64;
|
||||||
|
if (!RM.hasValue()) {
|
||||||
|
// 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 (TT.isOSDarwin()) {
|
||||||
|
if (is64Bit)
|
||||||
|
return Reloc::PIC_;
|
||||||
|
return Reloc::DynamicNoPIC;
|
||||||
|
}
|
||||||
|
if (TT.isOSWindows() && is64Bit)
|
||||||
|
return Reloc::PIC_;
|
||||||
|
return Reloc::Static;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ELF and X86-64 don't have a distinct DynamicNoPIC model. DynamicNoPIC
|
||||||
|
// is defined as a model for code which may be used in static or dynamic
|
||||||
|
// executables but not necessarily a shared library. On X86-32 we just
|
||||||
|
// compile in -static mode, in x86-64 we use PIC.
|
||||||
|
if (*RM == Reloc::DynamicNoPIC) {
|
||||||
|
if (is64Bit)
|
||||||
|
return Reloc::PIC_;
|
||||||
|
if (!TT.isOSDarwin())
|
||||||
|
return 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 && TT.isOSDarwin() && is64Bit)
|
||||||
|
return Reloc::PIC_;
|
||||||
|
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
/// Create an X86 target.
|
/// Create an X86 target.
|
||||||
///
|
///
|
||||||
X86TargetMachine::X86TargetMachine(const Target &T, const Triple &TT,
|
X86TargetMachine::X86TargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
CodeGenOpt::Level OL)
|
CodeModel::Model CM, CodeGenOpt::Level OL)
|
||||||
: LLVMTargetMachine(T, computeDataLayout(TT), TT, CPU, FS, Options, RM, CM,
|
: LLVMTargetMachine(T, computeDataLayout(TT), TT, CPU, FS, Options,
|
||||||
OL),
|
getEffectiveRelocModel(TT, RM), CM, OL),
|
||||||
TLOF(createTLOF(getTargetTriple())),
|
TLOF(createTLOF(getTargetTriple())),
|
||||||
Subtarget(TT, CPU, FS, *this, Options.StackAlignmentOverride) {
|
Subtarget(TT, CPU, FS, *this, Options.StackAlignmentOverride) {
|
||||||
// Windows stack unwinder gets confused when execution flow "falls through"
|
// Windows stack unwinder gets confused when execution flow "falls through"
|
||||||
|
@ -30,8 +30,9 @@ class X86TargetMachine final : public LLVMTargetMachine {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
X86TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
X86TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options, Reloc::Model RM,
|
StringRef FS, const TargetOptions &Options,
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL);
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
|
CodeGenOpt::Level OL);
|
||||||
~X86TargetMachine() override;
|
~X86TargetMachine() override;
|
||||||
const X86Subtarget *getSubtargetImpl(const Function &F) const override;
|
const X86Subtarget *getSubtargetImpl(const Function &F) const override;
|
||||||
|
|
||||||
|
@ -67,9 +67,6 @@ static MCCodeGenInfo *createXCoreMCCodeGenInfo(const Triple &TT,
|
|||||||
CodeModel::Model CM,
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL) {
|
CodeGenOpt::Level OL) {
|
||||||
MCCodeGenInfo *X = new MCCodeGenInfo();
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
||||||
if (RM == Reloc::Default) {
|
|
||||||
RM = Reloc::Static;
|
|
||||||
}
|
|
||||||
if (CM == CodeModel::Default) {
|
if (CM == CodeModel::Default) {
|
||||||
CM = CodeModel::Small;
|
CM = CodeModel::Small;
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,23 @@
|
|||||||
#include "llvm/Support/TargetRegistry.h"
|
#include "llvm/Support/TargetRegistry.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
static Reloc::Model getEffectiveRelocModel(Optional<Reloc::Model> RM) {
|
||||||
|
if (!RM.hasValue())
|
||||||
|
return Reloc::Static;
|
||||||
|
return *RM;
|
||||||
|
}
|
||||||
|
|
||||||
/// Create an ILP32 architecture model
|
/// Create an ILP32 architecture model
|
||||||
///
|
///
|
||||||
XCoreTargetMachine::XCoreTargetMachine(const Target &T, const Triple &TT,
|
XCoreTargetMachine::XCoreTargetMachine(const Target &T, const Triple &TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM,
|
||||||
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: LLVMTargetMachine(
|
: LLVMTargetMachine(
|
||||||
T, "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32-f64:32-a:0:32-n32",
|
T, "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32-f64:32-a:0:32-n32",
|
||||||
TT, CPU, FS, Options, RM, CM, OL),
|
TT, CPU, FS, Options, getEffectiveRelocModel(RM), CM, OL),
|
||||||
TLOF(make_unique<XCoreTargetObjectFile>()),
|
TLOF(make_unique<XCoreTargetObjectFile>()),
|
||||||
Subtarget(TT, CPU, FS, *this) {
|
Subtarget(TT, CPU, FS, *this) {
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
|
@ -25,7 +25,7 @@ class XCoreTargetMachine : public LLVMTargetMachine {
|
|||||||
public:
|
public:
|
||||||
XCoreTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
XCoreTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
||||||
StringRef FS, const TargetOptions &Options,
|
StringRef FS, const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Optional<Reloc::Model> RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
~XCoreTargetMachine() override;
|
~XCoreTargetMachine() override;
|
||||||
|
|
||||||
|
@ -139,7 +139,6 @@
|
|||||||
; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi -mcpu=cortex-a7 -mattr=+vfp4,,+d16,-neon | FileCheck %s --check-prefix=CORTEX-A7-FPUV4
|
; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi -mcpu=cortex-a7 -mattr=+vfp4,,+d16,-neon | FileCheck %s --check-prefix=CORTEX-A7-FPUV4
|
||||||
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align -relocation-model=pic | FileCheck %s --check-prefix=RELOC-PIC
|
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align -relocation-model=pic | FileCheck %s --check-prefix=RELOC-PIC
|
||||||
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align -relocation-model=static | FileCheck %s --check-prefix=RELOC-OTHER
|
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align -relocation-model=static | FileCheck %s --check-prefix=RELOC-OTHER
|
||||||
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align -relocation-model=default | FileCheck %s --check-prefix=RELOC-OTHER
|
|
||||||
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align -relocation-model=dynamic-no-pic | FileCheck %s --check-prefix=RELOC-OTHER
|
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align -relocation-model=dynamic-no-pic | FileCheck %s --check-prefix=RELOC-OTHER
|
||||||
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align | FileCheck %s --check-prefix=RELOC-OTHER
|
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align | FileCheck %s --check-prefix=RELOC-OTHER
|
||||||
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align | FileCheck %s --check-prefix=PCS-R9-USE
|
; RUN: llc < %s -mtriple=arm-none-linux-gnueabi -mattr=+strict-align | FileCheck %s --check-prefix=PCS-R9-USE
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
; RUN: llc -O3 -code-model=default -relocation-model=default -mtriple=armv7l-unknown-linux-gnueabihf -mcpu=generic %s -o - | FileCheck %s
|
; RUN: llc -O3 -code-model=default -mtriple=armv7l-unknown-linux-gnueabihf -mcpu=generic %s -o - | FileCheck %s
|
||||||
; Check that we respect the existing chain between loads and stores when we
|
; Check that we respect the existing chain between loads and stores when we
|
||||||
; legalize unaligned loads.
|
; legalize unaligned loads.
|
||||||
; Test case from PR24669.
|
; Test case from PR24669.
|
||||||
|
@ -629,7 +629,8 @@ bool DwarfStreamer::init(Triple TheTriple, StringRef OutputFilename) {
|
|||||||
return error("no object streamer for target " + TripleName, Context);
|
return error("no object streamer for target " + TripleName, Context);
|
||||||
|
|
||||||
// Finally create the AsmPrinter we'll use to emit the DIEs.
|
// Finally create the AsmPrinter we'll use to emit the DIEs.
|
||||||
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions()));
|
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
|
||||||
|
None));
|
||||||
if (!TM)
|
if (!TM)
|
||||||
return error("no target machine for target " + TripleName, Context);
|
return error("no target machine for target " + TripleName, Context);
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ static ld_plugin_get_symbols get_symbols = nullptr;
|
|||||||
static ld_plugin_add_input_file add_input_file = nullptr;
|
static ld_plugin_add_input_file add_input_file = nullptr;
|
||||||
static ld_plugin_set_extra_library_path set_extra_library_path = nullptr;
|
static ld_plugin_set_extra_library_path set_extra_library_path = nullptr;
|
||||||
static ld_plugin_get_view get_view = nullptr;
|
static ld_plugin_get_view get_view = nullptr;
|
||||||
static Reloc::Model RelocationModel = Reloc::Default;
|
static Optional<Reloc::Model> RelocationModel;
|
||||||
static std::string output_name = "";
|
static std::string output_name = "";
|
||||||
static std::list<claimed_file> Modules;
|
static std::list<claimed_file> Modules;
|
||||||
static StringMap<ResolutionInfo> ResInfo;
|
static StringMap<ResolutionInfo> ResInfo;
|
||||||
|
@ -321,7 +321,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
|||||||
|
|
||||||
std::unique_ptr<TargetMachine> Target(
|
std::unique_ptr<TargetMachine> Target(
|
||||||
TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr, FeaturesStr,
|
TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr, FeaturesStr,
|
||||||
Options, RelocModel, CMModel, OLvl));
|
Options, getRelocModel(), CMModel, OLvl));
|
||||||
|
|
||||||
assert(Target && "Could not allocate target machine!");
|
assert(Target && "Could not allocate target machine!");
|
||||||
|
|
||||||
|
@ -187,15 +187,10 @@ namespace {
|
|||||||
cl::desc("Disable JIT lazy compilation"),
|
cl::desc("Disable JIT lazy compilation"),
|
||||||
cl::init(false));
|
cl::init(false));
|
||||||
|
|
||||||
cl::opt<Reloc::Model>
|
cl::opt<Reloc::Model> RelocModel(
|
||||||
RelocModel("relocation-model",
|
"relocation-model", cl::desc("Choose relocation model"),
|
||||||
cl::desc("Choose relocation model"),
|
|
||||||
cl::init(Reloc::Default),
|
|
||||||
cl::values(
|
cl::values(
|
||||||
clEnumValN(Reloc::Default, "default",
|
clEnumValN(Reloc::Static, "static", "Non-relocatable code"),
|
||||||
"Target default relocation model"),
|
|
||||||
clEnumValN(Reloc::Static, "static",
|
|
||||||
"Non-relocatable code"),
|
|
||||||
clEnumValN(Reloc::PIC_, "pic",
|
clEnumValN(Reloc::PIC_, "pic",
|
||||||
"Fully relocatable, position independent code"),
|
"Fully relocatable, position independent code"),
|
||||||
clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic",
|
clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic",
|
||||||
@ -425,6 +420,7 @@ int main(int argc, char **argv, char * const *envp) {
|
|||||||
builder.setMArch(MArch);
|
builder.setMArch(MArch);
|
||||||
builder.setMCPU(MCPU);
|
builder.setMCPU(MCPU);
|
||||||
builder.setMAttrs(MAttrs);
|
builder.setMAttrs(MAttrs);
|
||||||
|
if (RelocModel.getNumOccurrences())
|
||||||
builder.setRelocationModel(RelocModel);
|
builder.setRelocationModel(RelocModel);
|
||||||
builder.setCodeModel(CMModel);
|
builder.setCodeModel(CMModel);
|
||||||
builder.setErrorStr(&ErrorMsg);
|
builder.setErrorStr(&ErrorMsg);
|
||||||
|
@ -390,7 +390,7 @@ public:
|
|||||||
ThinLTOCodeGenerator ThinGenerator;
|
ThinLTOCodeGenerator ThinGenerator;
|
||||||
|
|
||||||
ThinLTOProcessing(const TargetOptions &Options) {
|
ThinLTOProcessing(const TargetOptions &Options) {
|
||||||
ThinGenerator.setCodePICModel(RelocModel);
|
ThinGenerator.setCodePICModel(getRelocModel());
|
||||||
ThinGenerator.setTargetOptions(Options);
|
ThinGenerator.setTargetOptions(Options);
|
||||||
ThinGenerator.setCacheDir(ThinLTOCacheDir);
|
ThinGenerator.setCacheDir(ThinLTOCacheDir);
|
||||||
|
|
||||||
@ -737,7 +737,7 @@ int main(int argc, char **argv) {
|
|||||||
if (UseDiagnosticHandler)
|
if (UseDiagnosticHandler)
|
||||||
CodeGen.setDiagnosticHandler(handleDiagnostics, nullptr);
|
CodeGen.setDiagnosticHandler(handleDiagnostics, nullptr);
|
||||||
|
|
||||||
CodeGen.setCodePICModel(RelocModel);
|
CodeGen.setCodePICModel(getRelocModel());
|
||||||
|
|
||||||
CodeGen.setDebugInfo(LTO_DEBUG_MODEL_DWARF);
|
CodeGen.setDebugInfo(LTO_DEBUG_MODEL_DWARF);
|
||||||
CodeGen.setTargetOptions(Options);
|
CodeGen.setTargetOptions(Options);
|
||||||
|
@ -357,7 +357,7 @@ bool lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model) {
|
|||||||
unwrap(cg)->setCodePICModel(Reloc::DynamicNoPIC);
|
unwrap(cg)->setCodePICModel(Reloc::DynamicNoPIC);
|
||||||
return false;
|
return false;
|
||||||
case LTO_CODEGEN_PIC_MODEL_DEFAULT:
|
case LTO_CODEGEN_PIC_MODEL_DEFAULT:
|
||||||
unwrap(cg)->setCodePICModel(Reloc::Default);
|
unwrap(cg)->setCodePICModel(None);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sLastErrorString = "Unknown PIC model";
|
sLastErrorString = "Unknown PIC model";
|
||||||
@ -552,7 +552,7 @@ lto_bool_t thinlto_codegen_set_pic_model(thinlto_code_gen_t cg,
|
|||||||
unwrap(cg)->setCodePICModel(Reloc::DynamicNoPIC);
|
unwrap(cg)->setCodePICModel(Reloc::DynamicNoPIC);
|
||||||
return false;
|
return false;
|
||||||
case LTO_CODEGEN_PIC_MODEL_DEFAULT:
|
case LTO_CODEGEN_PIC_MODEL_DEFAULT:
|
||||||
unwrap(cg)->setCodePICModel(Reloc::Default);
|
unwrap(cg)->setCodePICModel(None);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sLastErrorString = "Unknown PIC model";
|
sLastErrorString = "Unknown PIC model";
|
||||||
|
@ -312,10 +312,9 @@ static TargetMachine* GetTargetMachine(Triple TheTriple, StringRef CPUStr,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TheTarget->createTargetMachine(TheTriple.getTriple(),
|
return TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr,
|
||||||
CPUStr, FeaturesStr, Options,
|
FeaturesStr, Options, getRelocModel(),
|
||||||
RelocModel, CMModel,
|
CMModel, GetCodeGenOptLevel());
|
||||||
GetCodeGenOptLevel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LINK_POLLY_INTO_TOOLS
|
#ifdef LINK_POLLY_INTO_TOOLS
|
||||||
|
@ -45,7 +45,7 @@ std::unique_ptr<TargetMachine> createTargetMachine() {
|
|||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
return std::unique_ptr<TargetMachine>(
|
return std::unique_ptr<TargetMachine>(
|
||||||
T->createTargetMachine("x86_64", "", "", Options, Reloc::Default,
|
T->createTargetMachine("x86_64", "", "", Options, None,
|
||||||
CodeModel::Default, CodeGenOpt::Aggressive));
|
CodeModel::Default, CodeGenOpt::Aggressive));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user