forked from OSchip/llvm-project
parent
52e7a59e50
commit
c74f73f2a0
|
@ -92,8 +92,7 @@ namespace llvm {
|
|||
|
||||
typedef MCAsmInfo *(*MCAsmInfoCtorFnTy)(const MCRegisterInfo &MRI,
|
||||
StringRef TT);
|
||||
typedef MCCodeGenInfo *(*MCCodeGenInfoCtorFnTy)(StringRef TT,
|
||||
Reloc::Model RM,
|
||||
typedef MCCodeGenInfo *(*MCCodeGenInfoCtorFnTy)(StringRef TT, Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL);
|
||||
typedef MCInstrInfo *(*MCInstrInfoCtorFnTy)(void);
|
||||
|
@ -102,13 +101,9 @@ namespace llvm {
|
|||
typedef MCSubtargetInfo *(*MCSubtargetInfoCtorFnTy)(StringRef TT,
|
||||
StringRef CPU,
|
||||
StringRef Features);
|
||||
typedef TargetMachine *(*TargetMachineCtorTy)(const Target &T,
|
||||
StringRef TT,
|
||||
StringRef CPU,
|
||||
StringRef Features,
|
||||
const TargetOptions &Options,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
typedef TargetMachine *(*TargetMachineCtorTy)(
|
||||
const Target &T, StringRef 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
|
||||
// depends on MC?) this should take the Streamer by value rather than rvalue
|
||||
|
@ -117,12 +112,9 @@ namespace llvm {
|
|||
TargetMachine &TM, std::unique_ptr<MCStreamer> &&Streamer);
|
||||
typedef MCAsmBackend *(*MCAsmBackendCtorTy)(const Target &T,
|
||||
const MCRegisterInfo &MRI,
|
||||
StringRef TT,
|
||||
StringRef CPU);
|
||||
StringRef TT, StringRef CPU);
|
||||
typedef MCTargetAsmParser *(*MCAsmParserCtorTy)(
|
||||
MCSubtargetInfo &STI,
|
||||
MCAsmParser &P,
|
||||
const MCInstrInfo &MII,
|
||||
MCSubtargetInfo &STI, MCAsmParser &P, const MCInstrInfo &MII,
|
||||
const MCTargetOptions &Options);
|
||||
typedef MCDisassembler *(*MCDisassemblerCtorTy)(const Target &T,
|
||||
const MCSubtargetInfo &STI,
|
||||
|
@ -140,9 +132,11 @@ namespace llvm {
|
|||
raw_pwrite_stream &OS,
|
||||
MCCodeEmitter *Emitter,
|
||||
bool RelaxAll);
|
||||
typedef MCStreamer *(*MachOStreamerCtorTy)(
|
||||
MCContext &Ctx, MCAsmBackend &TAB, raw_pwrite_stream &OS,
|
||||
MCCodeEmitter *Emitter, bool RelaxAll, bool DWARFMustBeAtTheEnd);
|
||||
typedef MCStreamer *(*MachOStreamerCtorTy)(MCContext &Ctx, MCAsmBackend &TAB,
|
||||
raw_pwrite_stream &OS,
|
||||
MCCodeEmitter *Emitter,
|
||||
bool RelaxAll,
|
||||
bool DWARFMustBeAtTheEnd);
|
||||
typedef MCStreamer *(*COFFStreamerCtorTy)(MCContext &Ctx, MCAsmBackend &TAB,
|
||||
raw_pwrite_stream &OS,
|
||||
MCCodeEmitter *Emitter,
|
||||
|
@ -361,22 +355,23 @@ namespace llvm {
|
|||
/// feature set; it should always be provided. Generally this should be
|
||||
/// 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, const TargetOptions &Options,
|
||||
TargetMachine *
|
||||
createTargetMachine(StringRef Triple, 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, CPU, Features, Options, RM, CM,
|
||||
OL);
|
||||
}
|
||||
|
||||
/// createMCAsmBackend - Create a target specific assembly parser.
|
||||
///
|
||||
/// \param Triple The target triple string.
|
||||
MCAsmBackend *createMCAsmBackend(const MCRegisterInfo &MRI,
|
||||
StringRef Triple, StringRef CPU) const {
|
||||
MCAsmBackend *createMCAsmBackend(const MCRegisterInfo &MRI, StringRef Triple,
|
||||
StringRef CPU) const {
|
||||
if (!MCAsmBackendCtorFn)
|
||||
return nullptr;
|
||||
return MCAsmBackendCtorFn(*this, MRI, Triple, CPU);
|
||||
|
@ -386,8 +381,7 @@ namespace llvm {
|
|||
///
|
||||
/// \param Parser The target independent parser implementation to use for
|
||||
/// parsing and lexing.
|
||||
MCTargetAsmParser *createMCAsmParser(
|
||||
MCSubtargetInfo &STI,
|
||||
MCTargetAsmParser *createMCAsmParser(MCSubtargetInfo &STI,
|
||||
MCAsmParser &Parser,
|
||||
const MCInstrInfo &MII,
|
||||
const MCTargetOptions &Options) const {
|
||||
|
@ -421,7 +415,6 @@ namespace llvm {
|
|||
return MCInstPrinterCtorFn(T, SyntaxVariant, MAI, MII, MRI);
|
||||
}
|
||||
|
||||
|
||||
/// createMCCodeEmitter - Create a target specific code emitter.
|
||||
MCCodeEmitter *createMCCodeEmitter(const MCInstrInfo &II,
|
||||
const MCRegisterInfo &MRI,
|
||||
|
@ -442,8 +435,7 @@ namespace llvm {
|
|||
MCStreamer *createMCObjectStreamer(const Triple &T, MCContext &Ctx,
|
||||
MCAsmBackend &TAB, raw_pwrite_stream &OS,
|
||||
MCCodeEmitter *Emitter,
|
||||
const MCSubtargetInfo &STI,
|
||||
bool RelaxAll,
|
||||
const MCSubtargetInfo &STI, bool RelaxAll,
|
||||
bool DWARFMustBeAtTheEnd) const {
|
||||
MCStreamer *S;
|
||||
switch (T.getObjectFormat()) {
|
||||
|
@ -511,8 +503,7 @@ namespace llvm {
|
|||
///
|
||||
/// \param TT The target triple.
|
||||
/// \param Ctx The target context.
|
||||
MCRelocationInfo *
|
||||
createMCRelocationInfo(StringRef TT, MCContext &Ctx) const {
|
||||
MCRelocationInfo *createMCRelocationInfo(StringRef TT, MCContext &Ctx) const {
|
||||
MCRelocationInfoCtorTy Fn = MCRelocationInfoCtorFn
|
||||
? MCRelocationInfoCtorFn
|
||||
: llvm::createMCRelocationInfo;
|
||||
|
@ -522,12 +513,15 @@ namespace llvm {
|
|||
/// createMCSymbolizer - Create a target specific MCSymbolizer.
|
||||
///
|
||||
/// \param TT The target triple.
|
||||
/// \param GetOpInfo The function to get the symbolic information for operands.
|
||||
/// \param GetOpInfo The function to get the symbolic information for
|
||||
/// operands.
|
||||
/// \param SymbolLookUp The function to lookup a symbol name.
|
||||
/// \param DisInfo The pointer to the block of symbolic information for above call
|
||||
/// \param DisInfo The pointer to the block of symbolic information for above
|
||||
/// call
|
||||
/// back.
|
||||
/// \param Ctx The target context.
|
||||
/// \param RelInfo The relocation information for this target. Takes ownership.
|
||||
/// \param RelInfo The relocation information for this target. Takes
|
||||
/// ownership.
|
||||
MCSymbolizer *
|
||||
createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo,
|
||||
|
@ -554,15 +548,12 @@ namespace llvm {
|
|||
const Target *Current;
|
||||
explicit iterator(Target *T) : Current(T) {}
|
||||
friend struct TargetRegistry;
|
||||
|
||||
public:
|
||||
iterator() : Current(nullptr) {}
|
||||
|
||||
bool operator==(const iterator &x) const {
|
||||
return Current == x.Current;
|
||||
}
|
||||
bool operator!=(const iterator &x) const {
|
||||
return !operator==(x);
|
||||
}
|
||||
bool operator==(const iterator &x) const { return Current == x.Current; }
|
||||
bool operator!=(const iterator &x) const { return !operator==(x); }
|
||||
|
||||
// Iterator traversal: forward iteration only
|
||||
iterator &operator++() { // Preincrement
|
||||
|
@ -581,9 +572,7 @@ namespace llvm {
|
|||
return *Current;
|
||||
}
|
||||
|
||||
const Target *operator->() const {
|
||||
return &operator*();
|
||||
}
|
||||
const Target *operator->() const { return &operator*(); }
|
||||
};
|
||||
|
||||
/// printRegisteredTargetsForVersion - Print the registered targets
|
||||
|
@ -615,8 +604,7 @@ namespace llvm {
|
|||
/// \param Error - On failure, an error string describing why no target was
|
||||
/// found.
|
||||
static const Target *lookupTarget(const std::string &ArchName,
|
||||
Triple &TheTriple,
|
||||
std::string &Error);
|
||||
Triple &TheTriple, std::string &Error);
|
||||
|
||||
/// @}
|
||||
/// @name Target Registration
|
||||
|
@ -636,9 +624,7 @@ namespace llvm {
|
|||
/// @param ArchMatchFn - The arch match checking function for this target.
|
||||
/// @param HasJIT - Whether the target supports JIT code
|
||||
/// generation.
|
||||
static void RegisterTarget(Target &T,
|
||||
const char *Name,
|
||||
const char *ShortDesc,
|
||||
static void RegisterTarget(Target &T, const char *Name, const char *ShortDesc,
|
||||
Target::ArchMatchFnTy ArchMatchFn,
|
||||
bool HasJIT = false);
|
||||
|
||||
|
@ -725,8 +711,7 @@ namespace llvm {
|
|||
///
|
||||
/// @param T - The target being registered.
|
||||
/// @param Fn - A function to construct a TargetMachine for the target.
|
||||
static void RegisterTargetMachine(Target &T,
|
||||
Target::TargetMachineCtorTy Fn) {
|
||||
static void RegisterTargetMachine(Target &T, Target::TargetMachineCtorTy Fn) {
|
||||
T.TargetMachineCtorFn = Fn;
|
||||
}
|
||||
|
||||
|
@ -792,8 +777,7 @@ namespace llvm {
|
|||
///
|
||||
/// @param T - The target being registered.
|
||||
/// @param Fn - A function to construct an MCInstPrinter for the target.
|
||||
static void RegisterMCInstPrinter(Target &T,
|
||||
Target::MCInstPrinterCtorTy Fn) {
|
||||
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn) {
|
||||
T.MCInstPrinterCtorFn = Fn;
|
||||
}
|
||||
|
||||
|
@ -806,8 +790,7 @@ namespace llvm {
|
|||
///
|
||||
/// @param T - The target being registered.
|
||||
/// @param Fn - A function to construct an MCCodeEmitter for the target.
|
||||
static void RegisterMCCodeEmitter(Target &T,
|
||||
Target::MCCodeEmitterCtorTy Fn) {
|
||||
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn) {
|
||||
T.MCCodeEmitterCtorFn = Fn;
|
||||
}
|
||||
|
||||
|
@ -815,8 +798,7 @@ namespace llvm {
|
|||
T.COFFStreamerCtorFn = Fn;
|
||||
}
|
||||
|
||||
static void RegisterMachOStreamer(Target &T,
|
||||
Target::MachOStreamerCtorTy Fn) {
|
||||
static void RegisterMachOStreamer(Target &T, Target::MachOStreamerCtorTy Fn) {
|
||||
T.MachOStreamerCtorFn = Fn;
|
||||
}
|
||||
|
||||
|
@ -824,8 +806,8 @@ namespace llvm {
|
|||
T.ELFStreamerCtorFn = Fn;
|
||||
}
|
||||
|
||||
static void
|
||||
RegisterNullTargetStreamer(Target &T, Target::NullTargetStreamerCtorTy Fn) {
|
||||
static void RegisterNullTargetStreamer(Target &T,
|
||||
Target::NullTargetStreamerCtorTy Fn) {
|
||||
T.NullTargetStreamerCtorFn = Fn;
|
||||
}
|
||||
|
||||
|
@ -863,15 +845,13 @@ namespace llvm {
|
|||
///
|
||||
/// @param T - The target being registered.
|
||||
/// @param Fn - A function to construct an MCSymbolizer for the target.
|
||||
static void RegisterMCSymbolizer(Target &T,
|
||||
Target::MCSymbolizerCtorTy Fn) {
|
||||
static void RegisterMCSymbolizer(Target &T, Target::MCSymbolizerCtorTy Fn) {
|
||||
T.MCSymbolizerCtorFn = Fn;
|
||||
}
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
/// RegisterTarget - Helper template for registering a target, for use in the
|
||||
|
@ -903,16 +883,15 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmInfo<FooMCAsmInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCAsmInfoImpl>
|
||||
struct RegisterMCAsmInfo {
|
||||
template <class MCAsmInfoImpl> struct RegisterMCAsmInfo {
|
||||
RegisterMCAsmInfo(Target &T) {
|
||||
TargetRegistry::RegisterMCAsmInfo(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static MCAsmInfo *Allocator(const MCRegisterInfo & /*MRI*/, StringRef TT) {
|
||||
return new MCAsmInfoImpl(TT);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/// RegisterMCAsmInfoFn - Helper template for registering a target assembly info
|
||||
|
@ -929,7 +908,8 @@ namespace llvm {
|
|||
}
|
||||
};
|
||||
|
||||
/// RegisterMCCodeGenInfo - Helper template for registering a target codegen info
|
||||
/// RegisterMCCodeGenInfo - Helper template for registering a target codegen
|
||||
/// info
|
||||
/// implementation. This invokes the static "Create" method on the class
|
||||
/// to actually do the construction. Usage:
|
||||
///
|
||||
|
@ -937,11 +917,11 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCCodeGenInfo<FooMCCodeGenInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCCodeGenInfoImpl>
|
||||
struct RegisterMCCodeGenInfo {
|
||||
template <class MCCodeGenInfoImpl> struct RegisterMCCodeGenInfo {
|
||||
RegisterMCCodeGenInfo(Target &T) {
|
||||
TargetRegistry::RegisterMCCodeGenInfo(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static MCCodeGenInfo *Allocator(StringRef /*TT*/, Reloc::Model /*RM*/,
|
||||
CodeModel::Model /*CM*/,
|
||||
|
@ -972,15 +952,13 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrInfo<FooMCInstrInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCInstrInfoImpl>
|
||||
struct RegisterMCInstrInfo {
|
||||
template <class MCInstrInfoImpl> struct RegisterMCInstrInfo {
|
||||
RegisterMCInstrInfo(Target &T) {
|
||||
TargetRegistry::RegisterMCInstrInfo(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static MCInstrInfo *Allocator() {
|
||||
return new MCInstrInfoImpl();
|
||||
}
|
||||
static MCInstrInfo *Allocator() { return new MCInstrInfoImpl(); }
|
||||
};
|
||||
|
||||
/// RegisterMCInstrInfoFn - Helper template for registering a target
|
||||
|
@ -1005,11 +983,11 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrAnalysis<FooMCInstrAnalysis> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCInstrAnalysisImpl>
|
||||
struct RegisterMCInstrAnalysis {
|
||||
template <class MCInstrAnalysisImpl> struct RegisterMCInstrAnalysis {
|
||||
RegisterMCInstrAnalysis(Target &T) {
|
||||
TargetRegistry::RegisterMCInstrAnalysis(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static MCInstrAnalysis *Allocator(const MCInstrInfo *Info) {
|
||||
return new MCInstrAnalysisImpl(Info);
|
||||
|
@ -1038,11 +1016,11 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCRegInfo<FooMCRegInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCRegisterInfoImpl>
|
||||
struct RegisterMCRegInfo {
|
||||
template <class MCRegisterInfoImpl> struct RegisterMCRegInfo {
|
||||
RegisterMCRegInfo(Target &T) {
|
||||
TargetRegistry::RegisterMCRegInfo(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static MCRegisterInfo *Allocator(StringRef /*TT*/) {
|
||||
return new MCRegisterInfoImpl();
|
||||
|
@ -1071,11 +1049,11 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCSubtargetInfo<FooMCSubtargetInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCSubtargetInfoImpl>
|
||||
struct RegisterMCSubtargetInfo {
|
||||
template <class MCSubtargetInfoImpl> struct RegisterMCSubtargetInfo {
|
||||
RegisterMCSubtargetInfo(Target &T) {
|
||||
TargetRegistry::RegisterMCSubtargetInfo(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static MCSubtargetInfo *Allocator(StringRef /*TT*/, StringRef /*CPU*/,
|
||||
StringRef /*FS*/) {
|
||||
|
@ -1105,18 +1083,15 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterTargetMachine<FooTargetMachine> X(TheFooTarget);
|
||||
/// }
|
||||
template<class TargetMachineImpl>
|
||||
struct RegisterTargetMachine {
|
||||
template <class TargetMachineImpl> struct RegisterTargetMachine {
|
||||
RegisterTargetMachine(Target &T) {
|
||||
TargetRegistry::RegisterTargetMachine(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static TargetMachine *Allocator(const Target &T, StringRef TT,
|
||||
StringRef CPU, StringRef FS,
|
||||
const TargetOptions &Options,
|
||||
Reloc::Model RM,
|
||||
CodeModel::Model CM,
|
||||
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, TT, CPU, FS, Options, RM, CM, OL);
|
||||
}
|
||||
|
@ -1129,15 +1104,13 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmBackend<FooAsmLexer> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCAsmBackendImpl>
|
||||
struct RegisterMCAsmBackend {
|
||||
template <class MCAsmBackendImpl> struct RegisterMCAsmBackend {
|
||||
RegisterMCAsmBackend(Target &T) {
|
||||
TargetRegistry::RegisterMCAsmBackend(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static MCAsmBackend *Allocator(const Target &T,
|
||||
const MCRegisterInfo &MRI,
|
||||
static MCAsmBackend *Allocator(const Target &T, const MCRegisterInfo &MRI,
|
||||
StringRef Triple, StringRef CPU) {
|
||||
return new MCAsmBackendImpl(T, MRI, Triple, CPU);
|
||||
}
|
||||
|
@ -1151,8 +1124,7 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmParser<FooAsmParser> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCAsmParserImpl>
|
||||
struct RegisterMCAsmParser {
|
||||
template <class MCAsmParserImpl> struct RegisterMCAsmParser {
|
||||
RegisterMCAsmParser(Target &T) {
|
||||
TargetRegistry::RegisterMCAsmParser(T, &Allocator);
|
||||
}
|
||||
|
@ -1173,8 +1145,7 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterAsmPrinter<FooAsmPrinter> X(TheFooTarget);
|
||||
/// }
|
||||
template<class AsmPrinterImpl>
|
||||
struct RegisterAsmPrinter {
|
||||
template <class AsmPrinterImpl> struct RegisterAsmPrinter {
|
||||
RegisterAsmPrinter(Target &T) {
|
||||
TargetRegistry::RegisterAsmPrinter(T, &Allocator);
|
||||
}
|
||||
|
@ -1194,8 +1165,7 @@ namespace llvm {
|
|||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCCodeEmitter<FooCodeEmitter> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCCodeEmitterImpl>
|
||||
struct RegisterMCCodeEmitter {
|
||||
template <class MCCodeEmitterImpl> struct RegisterMCCodeEmitter {
|
||||
RegisterMCCodeEmitter(Target &T) {
|
||||
TargetRegistry::RegisterMCCodeEmitter(T, &Allocator);
|
||||
}
|
||||
|
@ -1207,7 +1177,6 @@ namespace llvm {
|
|||
return new MCCodeEmitterImpl();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue