mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-01 16:22:41 +00:00
clang-format TargetRegistry.h. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238255 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
90b5eb2319
commit
116e31ffbe
@ -28,87 +28,82 @@
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
class AsmPrinter;
|
||||
class MCAsmBackend;
|
||||
class MCAsmInfo;
|
||||
class MCAsmParser;
|
||||
class MCCodeEmitter;
|
||||
class MCCodeGenInfo;
|
||||
class MCContext;
|
||||
class MCDisassembler;
|
||||
class MCInstrAnalysis;
|
||||
class MCInstPrinter;
|
||||
class MCInstrInfo;
|
||||
class MCRegisterInfo;
|
||||
class MCStreamer;
|
||||
class MCSubtargetInfo;
|
||||
class MCSymbolizer;
|
||||
class MCRelocationInfo;
|
||||
class MCTargetAsmParser;
|
||||
class MCTargetOptions;
|
||||
class MCTargetStreamer;
|
||||
class TargetMachine;
|
||||
class TargetOptions;
|
||||
class raw_ostream;
|
||||
class raw_pwrite_stream;
|
||||
class formatted_raw_ostream;
|
||||
class AsmPrinter;
|
||||
class MCAsmBackend;
|
||||
class MCAsmInfo;
|
||||
class MCAsmParser;
|
||||
class MCCodeEmitter;
|
||||
class MCCodeGenInfo;
|
||||
class MCContext;
|
||||
class MCDisassembler;
|
||||
class MCInstrAnalysis;
|
||||
class MCInstPrinter;
|
||||
class MCInstrInfo;
|
||||
class MCRegisterInfo;
|
||||
class MCStreamer;
|
||||
class MCSubtargetInfo;
|
||||
class MCSymbolizer;
|
||||
class MCRelocationInfo;
|
||||
class MCTargetAsmParser;
|
||||
class MCTargetOptions;
|
||||
class MCTargetStreamer;
|
||||
class TargetMachine;
|
||||
class TargetOptions;
|
||||
class raw_ostream;
|
||||
class raw_pwrite_stream;
|
||||
class formatted_raw_ostream;
|
||||
|
||||
MCStreamer *createNullStreamer(MCContext &Ctx);
|
||||
MCStreamer *createAsmStreamer(MCContext &Ctx,
|
||||
MCStreamer *createNullStreamer(MCContext &Ctx);
|
||||
MCStreamer *createAsmStreamer(MCContext &Ctx,
|
||||
std::unique_ptr<formatted_raw_ostream> OS,
|
||||
bool isVerboseAsm, bool useDwarfDirectory,
|
||||
MCInstPrinter *InstPrint, MCCodeEmitter *CE,
|
||||
MCAsmBackend *TAB, bool ShowInst);
|
||||
|
||||
/// Takes ownership of \p TAB and \p CE.
|
||||
MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
|
||||
/// Takes ownership of \p TAB and \p CE.
|
||||
MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
|
||||
raw_pwrite_stream &OS, MCCodeEmitter *CE,
|
||||
bool RelaxAll);
|
||||
MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
|
||||
MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
|
||||
raw_pwrite_stream &OS, MCCodeEmitter *CE,
|
||||
bool RelaxAll, bool DWARFMustBeAtTheEnd,
|
||||
bool LabelSections = false);
|
||||
|
||||
MCRelocationInfo *createMCRelocationInfo(StringRef TT, MCContext &Ctx);
|
||||
MCRelocationInfo *createMCRelocationInfo(StringRef TT, MCContext &Ctx);
|
||||
|
||||
MCSymbolizer *createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo,
|
||||
MCSymbolizer *createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo,
|
||||
LLVMSymbolLookupCallback SymbolLookUp,
|
||||
void *DisInfo, MCContext *Ctx,
|
||||
std::unique_ptr<MCRelocationInfo> &&RelInfo);
|
||||
|
||||
/// Target - Wrapper for Target specific information.
|
||||
///
|
||||
/// For registration purposes, this is a POD type so that targets can be
|
||||
/// registered without the use of static constructors.
|
||||
///
|
||||
/// Targets should implement a single global instance of this class (which
|
||||
/// will be zero initialized), and pass that instance to the TargetRegistry as
|
||||
/// part of their initialization.
|
||||
class Target {
|
||||
public:
|
||||
/// Target - Wrapper for Target specific information.
|
||||
///
|
||||
/// For registration purposes, this is a POD type so that targets can be
|
||||
/// registered without the use of static constructors.
|
||||
///
|
||||
/// Targets should implement a single global instance of this class (which
|
||||
/// will be zero initialized), and pass that instance to the TargetRegistry as
|
||||
/// part of their initialization.
|
||||
class Target {
|
||||
public:
|
||||
friend struct TargetRegistry;
|
||||
|
||||
typedef bool (*ArchMatchFnTy)(Triple::ArchType Arch);
|
||||
|
||||
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);
|
||||
typedef MCInstrAnalysis *(*MCInstrAnalysisCtorFnTy)(const MCInstrInfo*Info);
|
||||
typedef MCInstrAnalysis *(*MCInstrAnalysisCtorFnTy)(const MCInstrInfo *Info);
|
||||
typedef MCRegisterInfo *(*MCRegInfoCtorFnTy)(StringRef TT);
|
||||
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,
|
||||
@ -160,7 +154,7 @@ namespace llvm {
|
||||
LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo, MCContext *Ctx,
|
||||
std::unique_ptr<MCRelocationInfo> &&RelInfo);
|
||||
|
||||
private:
|
||||
private:
|
||||
/// Next - The next registered target in the linked list, maintained by the
|
||||
/// TargetRegistry.
|
||||
Target *Next;
|
||||
@ -254,7 +248,7 @@ namespace llvm {
|
||||
/// MCSymbolizer, if registered (default = llvm::createMCSymbolizer)
|
||||
MCSymbolizerCtorTy MCSymbolizerCtorFn;
|
||||
|
||||
public:
|
||||
public:
|
||||
Target()
|
||||
: COFFStreamerCtorFn(nullptr), MachOStreamerCtorFn(nullptr),
|
||||
ELFStreamerCtorFn(nullptr), NullTargetStreamerCtorFn(nullptr),
|
||||
@ -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,
|
||||
@ -539,10 +533,10 @@ namespace llvm {
|
||||
}
|
||||
|
||||
/// @}
|
||||
};
|
||||
};
|
||||
|
||||
/// TargetRegistry - Generic interface to target specific features.
|
||||
struct TargetRegistry {
|
||||
/// TargetRegistry - Generic interface to target specific features.
|
||||
struct TargetRegistry {
|
||||
// FIXME: Make this a namespace, probably just move all the Register*
|
||||
// functions into Target (currently they all just set members on the Target
|
||||
// anyway, and Target friends this class so those functions can...
|
||||
@ -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,29 +845,27 @@ 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
|
||||
/// target's initialization function. Usage:
|
||||
///
|
||||
///
|
||||
/// Target TheFooTarget; // The global target instance.
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTargetInfo() {
|
||||
/// RegisterTarget<Triple::foo> X(TheFooTarget, "foo", "Foo description");
|
||||
/// }
|
||||
template<Triple::ArchType TargetArchType = Triple::UnknownArch,
|
||||
/// RegisterTarget - Helper template for registering a target, for use in the
|
||||
/// target's initialization function. Usage:
|
||||
///
|
||||
///
|
||||
/// Target TheFooTarget; // The global target instance.
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTargetInfo() {
|
||||
/// RegisterTarget<Triple::foo> X(TheFooTarget, "foo", "Foo description");
|
||||
/// }
|
||||
template <Triple::ArchType TargetArchType = Triple::UnknownArch,
|
||||
bool HasJIT = false>
|
||||
struct RegisterTarget {
|
||||
struct RegisterTarget {
|
||||
RegisterTarget(Target &T, const char *Name, const char *Desc) {
|
||||
TargetRegistry::RegisterTarget(T, Name, Desc, &getArchMatch, HasJIT);
|
||||
}
|
||||
@ -893,321 +873,310 @@ namespace llvm {
|
||||
static bool getArchMatch(Triple::ArchType Arch) {
|
||||
return Arch == TargetArchType;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCAsmInfo - Helper template for registering a target assembly info
|
||||
/// implementation. This invokes the static "Create" method on the class to
|
||||
/// actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmInfo<FooMCAsmInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCAsmInfoImpl>
|
||||
struct RegisterMCAsmInfo {
|
||||
/// RegisterMCAsmInfo - Helper template for registering a target assembly info
|
||||
/// implementation. This invokes the static "Create" method on the class to
|
||||
/// actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmInfo<FooMCAsmInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template <class MCAsmInfoImpl> struct RegisterMCAsmInfo {
|
||||
RegisterMCAsmInfo(Target &T) {
|
||||
TargetRegistry::RegisterMCAsmInfo(T, &Allocator);
|
||||
}
|
||||
private:
|
||||
static MCAsmInfo *Allocator(const MCRegisterInfo &/*MRI*/, StringRef TT) {
|
||||
|
||||
private:
|
||||
static MCAsmInfo *Allocator(const MCRegisterInfo & /*MRI*/, StringRef TT) {
|
||||
return new MCAsmInfoImpl(TT);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
/// RegisterMCAsmInfoFn - Helper template for registering a target assembly info
|
||||
/// implementation. This invokes the specified function to do the
|
||||
/// construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmInfoFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCAsmInfoFn {
|
||||
/// RegisterMCAsmInfoFn - Helper template for registering a target assembly info
|
||||
/// implementation. This invokes the specified function to do the
|
||||
/// construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmInfoFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCAsmInfoFn {
|
||||
RegisterMCAsmInfoFn(Target &T, Target::MCAsmInfoCtorFnTy Fn) {
|
||||
TargetRegistry::RegisterMCAsmInfo(T, Fn);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// 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:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCCodeGenInfo<FooMCCodeGenInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCCodeGenInfoImpl>
|
||||
struct RegisterMCCodeGenInfo {
|
||||
/// 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:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCCodeGenInfo<FooMCCodeGenInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template <class MCCodeGenInfoImpl> struct RegisterMCCodeGenInfo {
|
||||
RegisterMCCodeGenInfo(Target &T) {
|
||||
TargetRegistry::RegisterMCCodeGenInfo(T, &Allocator);
|
||||
}
|
||||
private:
|
||||
|
||||
private:
|
||||
static MCCodeGenInfo *Allocator(StringRef /*TT*/, Reloc::Model /*RM*/,
|
||||
CodeModel::Model /*CM*/,
|
||||
CodeGenOpt::Level /*OL*/) {
|
||||
return new MCCodeGenInfoImpl();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCCodeGenInfoFn - Helper template for registering a target codegen
|
||||
/// info implementation. This invokes the specified function to do the
|
||||
/// construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCCodeGenInfoFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCCodeGenInfoFn {
|
||||
/// RegisterMCCodeGenInfoFn - Helper template for registering a target codegen
|
||||
/// info implementation. This invokes the specified function to do the
|
||||
/// construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCCodeGenInfoFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCCodeGenInfoFn {
|
||||
RegisterMCCodeGenInfoFn(Target &T, Target::MCCodeGenInfoCtorFnTy Fn) {
|
||||
TargetRegistry::RegisterMCCodeGenInfo(T, Fn);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCInstrInfo - Helper template for registering a target instruction
|
||||
/// info implementation. This invokes the static "Create" method on the class
|
||||
/// to actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrInfo<FooMCInstrInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCInstrInfoImpl>
|
||||
struct RegisterMCInstrInfo {
|
||||
/// RegisterMCInstrInfo - Helper template for registering a target instruction
|
||||
/// info implementation. This invokes the static "Create" method on the class
|
||||
/// to actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrInfo<FooMCInstrInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template <class MCInstrInfoImpl> struct RegisterMCInstrInfo {
|
||||
RegisterMCInstrInfo(Target &T) {
|
||||
TargetRegistry::RegisterMCInstrInfo(T, &Allocator);
|
||||
}
|
||||
private:
|
||||
static MCInstrInfo *Allocator() {
|
||||
return new MCInstrInfoImpl();
|
||||
}
|
||||
};
|
||||
|
||||
/// RegisterMCInstrInfoFn - Helper template for registering a target
|
||||
/// instruction info implementation. This invokes the specified function to
|
||||
/// do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrInfoFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCInstrInfoFn {
|
||||
private:
|
||||
static MCInstrInfo *Allocator() { return new MCInstrInfoImpl(); }
|
||||
};
|
||||
|
||||
/// RegisterMCInstrInfoFn - Helper template for registering a target
|
||||
/// instruction info implementation. This invokes the specified function to
|
||||
/// do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrInfoFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCInstrInfoFn {
|
||||
RegisterMCInstrInfoFn(Target &T, Target::MCInstrInfoCtorFnTy Fn) {
|
||||
TargetRegistry::RegisterMCInstrInfo(T, Fn);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCInstrAnalysis - Helper template for registering a target
|
||||
/// instruction analyzer implementation. This invokes the static "Create"
|
||||
/// method on the class to actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrAnalysis<FooMCInstrAnalysis> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCInstrAnalysisImpl>
|
||||
struct RegisterMCInstrAnalysis {
|
||||
/// RegisterMCInstrAnalysis - Helper template for registering a target
|
||||
/// instruction analyzer implementation. This invokes the static "Create"
|
||||
/// method on the class to actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrAnalysis<FooMCInstrAnalysis> X(TheFooTarget);
|
||||
/// }
|
||||
template <class MCInstrAnalysisImpl> struct RegisterMCInstrAnalysis {
|
||||
RegisterMCInstrAnalysis(Target &T) {
|
||||
TargetRegistry::RegisterMCInstrAnalysis(T, &Allocator);
|
||||
}
|
||||
private:
|
||||
|
||||
private:
|
||||
static MCInstrAnalysis *Allocator(const MCInstrInfo *Info) {
|
||||
return new MCInstrAnalysisImpl(Info);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCInstrAnalysisFn - Helper template for registering a target
|
||||
/// instruction analyzer implementation. This invokes the specified function
|
||||
/// to do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrAnalysisFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCInstrAnalysisFn {
|
||||
/// RegisterMCInstrAnalysisFn - Helper template for registering a target
|
||||
/// instruction analyzer implementation. This invokes the specified function
|
||||
/// to do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCInstrAnalysisFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCInstrAnalysisFn {
|
||||
RegisterMCInstrAnalysisFn(Target &T, Target::MCInstrAnalysisCtorFnTy Fn) {
|
||||
TargetRegistry::RegisterMCInstrAnalysis(T, Fn);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCRegInfo - Helper template for registering a target register info
|
||||
/// implementation. This invokes the static "Create" method on the class to
|
||||
/// actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCRegInfo<FooMCRegInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCRegisterInfoImpl>
|
||||
struct RegisterMCRegInfo {
|
||||
/// RegisterMCRegInfo - Helper template for registering a target register info
|
||||
/// implementation. This invokes the static "Create" method on the class to
|
||||
/// actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCRegInfo<FooMCRegInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template <class MCRegisterInfoImpl> struct RegisterMCRegInfo {
|
||||
RegisterMCRegInfo(Target &T) {
|
||||
TargetRegistry::RegisterMCRegInfo(T, &Allocator);
|
||||
}
|
||||
private:
|
||||
|
||||
private:
|
||||
static MCRegisterInfo *Allocator(StringRef /*TT*/) {
|
||||
return new MCRegisterInfoImpl();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCRegInfoFn - Helper template for registering a target register
|
||||
/// info implementation. This invokes the specified function to do the
|
||||
/// construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCRegInfoFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCRegInfoFn {
|
||||
/// RegisterMCRegInfoFn - Helper template for registering a target register
|
||||
/// info implementation. This invokes the specified function to do the
|
||||
/// construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCRegInfoFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCRegInfoFn {
|
||||
RegisterMCRegInfoFn(Target &T, Target::MCRegInfoCtorFnTy Fn) {
|
||||
TargetRegistry::RegisterMCRegInfo(T, Fn);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCSubtargetInfo - Helper template for registering a target
|
||||
/// subtarget info implementation. This invokes the static "Create" method
|
||||
/// on the class to actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCSubtargetInfo<FooMCSubtargetInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCSubtargetInfoImpl>
|
||||
struct RegisterMCSubtargetInfo {
|
||||
/// RegisterMCSubtargetInfo - Helper template for registering a target
|
||||
/// subtarget info implementation. This invokes the static "Create" method
|
||||
/// on the class to actually do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCSubtargetInfo<FooMCSubtargetInfo> X(TheFooTarget);
|
||||
/// }
|
||||
template <class MCSubtargetInfoImpl> struct RegisterMCSubtargetInfo {
|
||||
RegisterMCSubtargetInfo(Target &T) {
|
||||
TargetRegistry::RegisterMCSubtargetInfo(T, &Allocator);
|
||||
}
|
||||
private:
|
||||
|
||||
private:
|
||||
static MCSubtargetInfo *Allocator(StringRef /*TT*/, StringRef /*CPU*/,
|
||||
StringRef /*FS*/) {
|
||||
return new MCSubtargetInfoImpl();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCSubtargetInfoFn - Helper template for registering a target
|
||||
/// subtarget info implementation. This invokes the specified function to
|
||||
/// do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCSubtargetInfoFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCSubtargetInfoFn {
|
||||
/// RegisterMCSubtargetInfoFn - Helper template for registering a target
|
||||
/// subtarget info implementation. This invokes the specified function to
|
||||
/// do the construction. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCSubtargetInfoFn X(TheFooTarget, TheFunction);
|
||||
/// }
|
||||
struct RegisterMCSubtargetInfoFn {
|
||||
RegisterMCSubtargetInfoFn(Target &T, Target::MCSubtargetInfoCtorFnTy Fn) {
|
||||
TargetRegistry::RegisterMCSubtargetInfo(T, Fn);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterTargetMachine - Helper template for registering a target machine
|
||||
/// implementation, for use in the target machine initialization
|
||||
/// function. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterTargetMachine<FooTargetMachine> X(TheFooTarget);
|
||||
/// }
|
||||
template<class TargetMachineImpl>
|
||||
struct RegisterTargetMachine {
|
||||
/// RegisterTargetMachine - Helper template for registering a target machine
|
||||
/// implementation, for use in the target machine initialization
|
||||
/// function. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooTarget() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterTargetMachine<FooTargetMachine> X(TheFooTarget);
|
||||
/// }
|
||||
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,
|
||||
private:
|
||||
static TargetMachine *Allocator(const Target &T, StringRef TT, StringRef CPU,
|
||||
StringRef FS, const TargetOptions &Options,
|
||||
Reloc::Model RM, CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL) {
|
||||
return new TargetMachineImpl(T, TT, CPU, FS, Options, RM, CM, OL);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCAsmBackend - Helper template for registering a target specific
|
||||
/// assembler backend. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooMCAsmBackend() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmBackend<FooAsmLexer> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCAsmBackendImpl>
|
||||
struct RegisterMCAsmBackend {
|
||||
/// RegisterMCAsmBackend - Helper template for registering a target specific
|
||||
/// assembler backend. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooMCAsmBackend() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmBackend<FooAsmLexer> X(TheFooTarget);
|
||||
/// }
|
||||
template <class MCAsmBackendImpl> struct RegisterMCAsmBackend {
|
||||
RegisterMCAsmBackend(Target &T) {
|
||||
TargetRegistry::RegisterMCAsmBackend(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static MCAsmBackend *Allocator(const Target &T,
|
||||
const MCRegisterInfo &MRI,
|
||||
private:
|
||||
static MCAsmBackend *Allocator(const Target &T, const MCRegisterInfo &MRI,
|
||||
StringRef Triple, StringRef CPU) {
|
||||
return new MCAsmBackendImpl(T, MRI, Triple, CPU);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCAsmParser - Helper template for registering a target specific
|
||||
/// assembly parser, for use in the target machine initialization
|
||||
/// function. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooMCAsmParser() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmParser<FooAsmParser> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCAsmParserImpl>
|
||||
struct RegisterMCAsmParser {
|
||||
/// RegisterMCAsmParser - Helper template for registering a target specific
|
||||
/// assembly parser, for use in the target machine initialization
|
||||
/// function. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooMCAsmParser() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCAsmParser<FooAsmParser> X(TheFooTarget);
|
||||
/// }
|
||||
template <class MCAsmParserImpl> struct RegisterMCAsmParser {
|
||||
RegisterMCAsmParser(Target &T) {
|
||||
TargetRegistry::RegisterMCAsmParser(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static MCTargetAsmParser *Allocator(MCSubtargetInfo &STI, MCAsmParser &P,
|
||||
const MCInstrInfo &MII,
|
||||
const MCTargetOptions &Options) {
|
||||
return new MCAsmParserImpl(STI, P, MII, Options);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterAsmPrinter - Helper template for registering a target specific
|
||||
/// assembly printer, for use in the target machine initialization
|
||||
/// function. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooAsmPrinter() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterAsmPrinter<FooAsmPrinter> X(TheFooTarget);
|
||||
/// }
|
||||
template<class AsmPrinterImpl>
|
||||
struct RegisterAsmPrinter {
|
||||
/// RegisterAsmPrinter - Helper template for registering a target specific
|
||||
/// assembly printer, for use in the target machine initialization
|
||||
/// function. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooAsmPrinter() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterAsmPrinter<FooAsmPrinter> X(TheFooTarget);
|
||||
/// }
|
||||
template <class AsmPrinterImpl> struct RegisterAsmPrinter {
|
||||
RegisterAsmPrinter(Target &T) {
|
||||
TargetRegistry::RegisterAsmPrinter(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static AsmPrinter *Allocator(TargetMachine &TM,
|
||||
std::unique_ptr<MCStreamer> &&Streamer) {
|
||||
return new AsmPrinterImpl(TM, std::move(Streamer));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/// RegisterMCCodeEmitter - Helper template for registering a target specific
|
||||
/// machine code emitter, for use in the target initialization
|
||||
/// function. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooMCCodeEmitter() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCCodeEmitter<FooCodeEmitter> X(TheFooTarget);
|
||||
/// }
|
||||
template<class MCCodeEmitterImpl>
|
||||
struct RegisterMCCodeEmitter {
|
||||
/// RegisterMCCodeEmitter - Helper template for registering a target specific
|
||||
/// machine code emitter, for use in the target initialization
|
||||
/// function. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooMCCodeEmitter() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterMCCodeEmitter<FooCodeEmitter> X(TheFooTarget);
|
||||
/// }
|
||||
template <class MCCodeEmitterImpl> struct RegisterMCCodeEmitter {
|
||||
RegisterMCCodeEmitter(Target &T) {
|
||||
TargetRegistry::RegisterMCCodeEmitter(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static MCCodeEmitter *Allocator(const MCInstrInfo & /*II*/,
|
||||
const MCRegisterInfo & /*MRI*/,
|
||||
MCContext & /*Ctx*/) {
|
||||
return new MCCodeEmitterImpl();
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user