forked from OSchip/llvm-project
Formatting tweaks (trailing whitespace, ordering, comments).
llvm-svn: 96761
This commit is contained in:
parent
43b464cfe5
commit
dc95c69662
|
@ -94,32 +94,31 @@ namespace llvm {
|
||||||
bool HasJIT;
|
bool HasJIT;
|
||||||
|
|
||||||
AsmInfoCtorFnTy AsmInfoCtorFn;
|
AsmInfoCtorFnTy AsmInfoCtorFn;
|
||||||
|
|
||||||
/// TargetMachineCtorFn - Construction function for this target's
|
/// TargetMachineCtorFn - Construction function for this target's
|
||||||
/// TargetMachine, if registered.
|
/// TargetMachine, if registered.
|
||||||
TargetMachineCtorTy TargetMachineCtorFn;
|
TargetMachineCtorTy TargetMachineCtorFn;
|
||||||
|
|
||||||
|
/// AsmLexerCtorFn - Construction function for this target's TargetAsmLexer,
|
||||||
|
/// if registered.
|
||||||
|
AsmLexerCtorTy AsmLexerCtorFn;
|
||||||
|
|
||||||
|
/// AsmParserCtorFn - Construction function for this target's
|
||||||
|
/// TargetAsmParser, if registered.
|
||||||
|
AsmParserCtorTy AsmParserCtorFn;
|
||||||
|
|
||||||
/// AsmPrinterCtorFn - Construction function for this target's AsmPrinter,
|
/// AsmPrinterCtorFn - Construction function for this target's AsmPrinter,
|
||||||
/// if registered.
|
/// if registered.
|
||||||
AsmPrinterCtorTy AsmPrinterCtorFn;
|
AsmPrinterCtorTy AsmPrinterCtorFn;
|
||||||
|
|
||||||
/// AsmLexerCtorFn - Construction function for this target's TargetAsmLexer,
|
|
||||||
/// if registered.
|
|
||||||
AsmLexerCtorTy AsmLexerCtorFn;
|
|
||||||
|
|
||||||
/// AsmParserCtorFn - Construction function for this target's
|
|
||||||
/// TargetAsmParser, if registered.
|
|
||||||
AsmParserCtorTy AsmParserCtorFn;
|
|
||||||
|
|
||||||
/// MCDisassemblerCtorFn - Construction function for this target's
|
/// MCDisassemblerCtorFn - Construction function for this target's
|
||||||
/// MCDisassembler, if registered.
|
/// MCDisassembler, if registered.
|
||||||
MCDisassemblerCtorTy MCDisassemblerCtorFn;
|
MCDisassemblerCtorTy MCDisassemblerCtorFn;
|
||||||
|
|
||||||
|
/// MCInstPrinterCtorFn - Construction function for this target's
|
||||||
/// MCInstPrinterCtorFn - Construction function for this target's
|
|
||||||
/// MCInstPrinter, if registered.
|
/// MCInstPrinter, if registered.
|
||||||
MCInstPrinterCtorTy MCInstPrinterCtorFn;
|
MCInstPrinterCtorTy MCInstPrinterCtorFn;
|
||||||
|
|
||||||
/// CodeEmitterCtorFn - Construction function for this target's CodeEmitter,
|
/// CodeEmitterCtorFn - Construction function for this target's CodeEmitter,
|
||||||
/// if registered.
|
/// if registered.
|
||||||
CodeEmitterCtorTy CodeEmitterCtorFn;
|
CodeEmitterCtorTy CodeEmitterCtorFn;
|
||||||
|
@ -147,12 +146,15 @@ namespace llvm {
|
||||||
/// hasTargetMachine - Check if this target supports code generation.
|
/// hasTargetMachine - Check if this target supports code generation.
|
||||||
bool hasTargetMachine() const { return TargetMachineCtorFn != 0; }
|
bool hasTargetMachine() const { return TargetMachineCtorFn != 0; }
|
||||||
|
|
||||||
/// hasAsmPrinter - Check if this target supports .s printing.
|
/// hasAsmLexer - Check if this target supports .s lexing.
|
||||||
bool hasAsmPrinter() const { return AsmPrinterCtorFn != 0; }
|
bool hasAsmLexer() const { return AsmLexerCtorFn != 0; }
|
||||||
|
|
||||||
/// hasAsmParser - Check if this target supports .s parsing.
|
/// hasAsmParser - Check if this target supports .s parsing.
|
||||||
bool hasAsmParser() const { return AsmParserCtorFn != 0; }
|
bool hasAsmParser() const { return AsmParserCtorFn != 0; }
|
||||||
|
|
||||||
|
/// hasAsmPrinter - Check if this target supports .s printing.
|
||||||
|
bool hasAsmPrinter() const { return AsmPrinterCtorFn != 0; }
|
||||||
|
|
||||||
/// hasMCDisassembler - Check if this target has a disassembler.
|
/// hasMCDisassembler - Check if this target has a disassembler.
|
||||||
bool hasMCDisassembler() const { return MCDisassemblerCtorFn != 0; }
|
bool hasMCDisassembler() const { return MCDisassemblerCtorFn != 0; }
|
||||||
|
|
||||||
|
@ -165,7 +167,7 @@ namespace llvm {
|
||||||
/// @}
|
/// @}
|
||||||
/// @name Feature Constructors
|
/// @name Feature Constructors
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// createAsmInfo - Create a MCAsmInfo implementation for the specified
|
/// createAsmInfo - Create a MCAsmInfo implementation for the specified
|
||||||
/// target triple.
|
/// target triple.
|
||||||
///
|
///
|
||||||
|
@ -178,7 +180,7 @@ namespace llvm {
|
||||||
return 0;
|
return 0;
|
||||||
return AsmInfoCtorFn(*this, Triple);
|
return AsmInfoCtorFn(*this, Triple);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// createTargetMachine - Create a target specific machine implementation
|
/// createTargetMachine - Create a target specific machine implementation
|
||||||
/// for the specified \arg Triple.
|
/// for the specified \arg Triple.
|
||||||
///
|
///
|
||||||
|
@ -193,6 +195,24 @@ namespace llvm {
|
||||||
return TargetMachineCtorFn(*this, Triple, Features);
|
return TargetMachineCtorFn(*this, Triple, Features);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// createAsmLexer - Create a target specific assembly lexer.
|
||||||
|
///
|
||||||
|
TargetAsmLexer *createAsmLexer(const MCAsmInfo &MAI) const {
|
||||||
|
if (!AsmLexerCtorFn)
|
||||||
|
return 0;
|
||||||
|
return AsmLexerCtorFn(*this, MAI);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// createAsmParser - Create a target specific assembly parser.
|
||||||
|
///
|
||||||
|
/// \arg Parser - The target independent parser implementation to use for
|
||||||
|
/// parsing and lexing.
|
||||||
|
TargetAsmParser *createAsmParser(MCAsmParser &Parser) const {
|
||||||
|
if (!AsmParserCtorFn)
|
||||||
|
return 0;
|
||||||
|
return AsmParserCtorFn(*this, Parser);
|
||||||
|
}
|
||||||
|
|
||||||
/// createAsmPrinter - Create a target specific assembly printer pass. This
|
/// createAsmPrinter - Create a target specific assembly printer pass. This
|
||||||
/// takes ownership of the MCContext and MCStreamer objects but not the MAI.
|
/// takes ownership of the MCContext and MCStreamer objects but not the MAI.
|
||||||
AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM,
|
AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM,
|
||||||
|
@ -203,24 +223,6 @@ namespace llvm {
|
||||||
return AsmPrinterCtorFn(OS, TM, Ctx, Streamer, MAI);
|
return AsmPrinterCtorFn(OS, TM, Ctx, Streamer, MAI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// createAsmLexer - Create a target specific assembly lexer.
|
|
||||||
///
|
|
||||||
TargetAsmLexer *createAsmLexer(const MCAsmInfo &MAI) const {
|
|
||||||
if (!AsmLexerCtorFn)
|
|
||||||
return 0;
|
|
||||||
return AsmLexerCtorFn(*this, MAI);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// createAsmParser - Create a target specific assembly parser.
|
|
||||||
///
|
|
||||||
/// \arg Parser - The target independent parser implementation to use for
|
|
||||||
/// parsing and lexing.
|
|
||||||
TargetAsmParser *createAsmParser(MCAsmParser &Parser) const {
|
|
||||||
if (!AsmParserCtorFn)
|
|
||||||
return 0;
|
|
||||||
return AsmParserCtorFn(*this, Parser);
|
|
||||||
}
|
|
||||||
|
|
||||||
const MCDisassembler *createMCDisassembler() const {
|
const MCDisassembler *createMCDisassembler() const {
|
||||||
if (!MCDisassemblerCtorFn)
|
if (!MCDisassemblerCtorFn)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -234,8 +236,8 @@ namespace llvm {
|
||||||
return 0;
|
return 0;
|
||||||
return MCInstPrinterCtorFn(*this, SyntaxVariant, MAI, O);
|
return MCInstPrinterCtorFn(*this, SyntaxVariant, MAI, O);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// createCodeEmitter - Create a target specific code emitter.
|
/// createCodeEmitter - Create a target specific code emitter.
|
||||||
MCCodeEmitter *createCodeEmitter(TargetMachine &TM, MCContext &Ctx) const {
|
MCCodeEmitter *createCodeEmitter(TargetMachine &TM, MCContext &Ctx) const {
|
||||||
if (!CodeEmitterCtorFn)
|
if (!CodeEmitterCtorFn)
|
||||||
|
@ -270,8 +272,8 @@ namespace llvm {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
iterator operator++(int) { // Postincrement
|
iterator operator++(int) { // Postincrement
|
||||||
iterator tmp = *this;
|
iterator tmp = *this;
|
||||||
++*this;
|
++*this;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,7 +315,7 @@ namespace llvm {
|
||||||
|
|
||||||
/// RegisterTarget - Register the given target. Attempts to register a
|
/// RegisterTarget - Register the given target. Attempts to register a
|
||||||
/// target which has already been registered will be ignored.
|
/// target which has already been registered will be ignored.
|
||||||
///
|
///
|
||||||
/// Clients are responsible for ensuring that registration doesn't occur
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
/// while another thread is attempting to access the registry. Typically
|
/// while another thread is attempting to access the registry. Typically
|
||||||
/// this is done by initializing all targets at program startup.
|
/// this is done by initializing all targets at program startup.
|
||||||
|
@ -321,7 +323,7 @@ namespace llvm {
|
||||||
/// @param T - The target being registered.
|
/// @param T - The target being registered.
|
||||||
/// @param Name - The target name. This should be a static string.
|
/// @param Name - The target name. This should be a static string.
|
||||||
/// @param ShortDesc - A short target description. This should be a static
|
/// @param ShortDesc - A short target description. This should be a static
|
||||||
/// string.
|
/// string.
|
||||||
/// @param TQualityFn - The triple match quality computation function for
|
/// @param TQualityFn - The triple match quality computation function for
|
||||||
/// this target.
|
/// this target.
|
||||||
/// @param HasJIT - Whether the target supports JIT code
|
/// @param HasJIT - Whether the target supports JIT code
|
||||||
|
@ -334,11 +336,11 @@ namespace llvm {
|
||||||
|
|
||||||
/// RegisterAsmInfo - Register a MCAsmInfo implementation for the
|
/// RegisterAsmInfo - Register a MCAsmInfo implementation for the
|
||||||
/// given target.
|
/// given target.
|
||||||
///
|
///
|
||||||
/// Clients are responsible for ensuring that registration doesn't occur
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
/// while another thread is attempting to access the registry. Typically
|
/// while another thread is attempting to access the registry. Typically
|
||||||
/// this is done by initializing all targets at program startup.
|
/// this is done by initializing all targets at program startup.
|
||||||
///
|
///
|
||||||
/// @param T - The target being registered.
|
/// @param T - The target being registered.
|
||||||
/// @param Fn - A function to construct a MCAsmInfo for the target.
|
/// @param Fn - A function to construct a MCAsmInfo for the target.
|
||||||
static void RegisterAsmInfo(Target &T, Target::AsmInfoCtorFnTy Fn) {
|
static void RegisterAsmInfo(Target &T, Target::AsmInfoCtorFnTy Fn) {
|
||||||
|
@ -346,26 +348,54 @@ namespace llvm {
|
||||||
if (!T.AsmInfoCtorFn)
|
if (!T.AsmInfoCtorFn)
|
||||||
T.AsmInfoCtorFn = Fn;
|
T.AsmInfoCtorFn = Fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RegisterTargetMachine - Register a TargetMachine implementation for the
|
/// RegisterTargetMachine - Register a TargetMachine implementation for the
|
||||||
/// given target.
|
/// given target.
|
||||||
///
|
///
|
||||||
/// Clients are responsible for ensuring that registration doesn't occur
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
/// while another thread is attempting to access the registry. Typically
|
/// while another thread is attempting to access the registry. Typically
|
||||||
/// this is done by initializing all targets at program startup.
|
/// this is done by initializing all targets at program startup.
|
||||||
///
|
///
|
||||||
/// @param T - The target being registered.
|
/// @param T - The target being registered.
|
||||||
/// @param Fn - A function to construct a TargetMachine for the target.
|
/// @param Fn - A function to construct a TargetMachine for the target.
|
||||||
static void RegisterTargetMachine(Target &T,
|
static void RegisterTargetMachine(Target &T,
|
||||||
Target::TargetMachineCtorTy Fn) {
|
Target::TargetMachineCtorTy Fn) {
|
||||||
// Ignore duplicate registration.
|
// Ignore duplicate registration.
|
||||||
if (!T.TargetMachineCtorFn)
|
if (!T.TargetMachineCtorFn)
|
||||||
T.TargetMachineCtorFn = Fn;
|
T.TargetMachineCtorFn = Fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// RegisterAsmLexer - Register a TargetAsmLexer implementation for the
|
||||||
|
/// given target.
|
||||||
|
///
|
||||||
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
|
/// while another thread is attempting to access the registry. Typically
|
||||||
|
/// this is done by initializing all targets at program startup.
|
||||||
|
///
|
||||||
|
/// @param T - The target being registered.
|
||||||
|
/// @param Fn - A function to construct an AsmLexer for the target.
|
||||||
|
static void RegisterAsmLexer(Target &T, Target::AsmLexerCtorTy Fn) {
|
||||||
|
if (!T.AsmLexerCtorFn)
|
||||||
|
T.AsmLexerCtorFn = Fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// RegisterAsmParser - Register a TargetAsmParser implementation for the
|
||||||
|
/// given target.
|
||||||
|
///
|
||||||
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
|
/// while another thread is attempting to access the registry. Typically
|
||||||
|
/// this is done by initializing all targets at program startup.
|
||||||
|
///
|
||||||
|
/// @param T - The target being registered.
|
||||||
|
/// @param Fn - A function to construct an AsmParser for the target.
|
||||||
|
static void RegisterAsmParser(Target &T, Target::AsmParserCtorTy Fn) {
|
||||||
|
if (!T.AsmParserCtorFn)
|
||||||
|
T.AsmParserCtorFn = Fn;
|
||||||
|
}
|
||||||
|
|
||||||
/// RegisterAsmPrinter - Register an AsmPrinter implementation for the given
|
/// RegisterAsmPrinter - Register an AsmPrinter implementation for the given
|
||||||
/// target.
|
/// target.
|
||||||
///
|
///
|
||||||
/// Clients are responsible for ensuring that registration doesn't occur
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
/// while another thread is attempting to access the registry. Typically
|
/// while another thread is attempting to access the registry. Typically
|
||||||
/// this is done by initializing all targets at program startup.
|
/// this is done by initializing all targets at program startup.
|
||||||
|
@ -378,44 +408,16 @@ namespace llvm {
|
||||||
T.AsmPrinterCtorFn = Fn;
|
T.AsmPrinterCtorFn = Fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RegisterAsmLexer - Register a TargetAsmLexer implementation for the
|
|
||||||
/// given target.
|
|
||||||
///
|
|
||||||
/// Clients are responsible for ensuring that registration doesn't occur
|
|
||||||
/// while another thread is attempting to access the registry. Typically
|
|
||||||
/// this is done by initializing all targets at program startup.
|
|
||||||
///
|
|
||||||
/// @param T - The target being registered.
|
|
||||||
/// @param Fn - A function to construct an AsmPrinter for the target.
|
|
||||||
static void RegisterAsmLexer(Target &T, Target::AsmLexerCtorTy Fn) {
|
|
||||||
if (!T.AsmLexerCtorFn)
|
|
||||||
T.AsmLexerCtorFn = Fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// RegisterAsmParser - Register a TargetAsmParser implementation for the
|
|
||||||
/// given target.
|
|
||||||
///
|
|
||||||
/// Clients are responsible for ensuring that registration doesn't occur
|
|
||||||
/// while another thread is attempting to access the registry. Typically
|
|
||||||
/// this is done by initializing all targets at program startup.
|
|
||||||
///
|
|
||||||
/// @param T - The target being registered.
|
|
||||||
/// @param Fn - A function to construct an AsmPrinter for the target.
|
|
||||||
static void RegisterAsmParser(Target &T, Target::AsmParserCtorTy Fn) {
|
|
||||||
if (!T.AsmParserCtorFn)
|
|
||||||
T.AsmParserCtorFn = Fn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// RegisterMCDisassembler - Register a MCDisassembler implementation for
|
/// RegisterMCDisassembler - Register a MCDisassembler implementation for
|
||||||
/// the given target.
|
/// the given target.
|
||||||
///
|
///
|
||||||
/// Clients are responsible for ensuring that registration doesn't occur
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
/// while another thread is attempting to access the registry. Typically
|
/// while another thread is attempting to access the registry. Typically
|
||||||
/// this is done by initializing all targets at program startup.
|
/// this is done by initializing all targets at program startup.
|
||||||
///
|
///
|
||||||
/// @param T - The target being registered.
|
/// @param T - The target being registered.
|
||||||
/// @param Fn - A function to construct an MCDisassembler for the target.
|
/// @param Fn - A function to construct an MCDisassembler for the target.
|
||||||
static void RegisterMCDisassembler(Target &T,
|
static void RegisterMCDisassembler(Target &T,
|
||||||
Target::MCDisassemblerCtorTy Fn) {
|
Target::MCDisassemblerCtorTy Fn) {
|
||||||
if (!T.MCDisassemblerCtorFn)
|
if (!T.MCDisassemblerCtorFn)
|
||||||
T.MCDisassemblerCtorFn = Fn;
|
T.MCDisassemblerCtorFn = Fn;
|
||||||
|
@ -423,7 +425,7 @@ namespace llvm {
|
||||||
|
|
||||||
/// RegisterMCInstPrinter - Register a MCInstPrinter implementation for the
|
/// RegisterMCInstPrinter - Register a MCInstPrinter implementation for the
|
||||||
/// given target.
|
/// given target.
|
||||||
///
|
///
|
||||||
/// Clients are responsible for ensuring that registration doesn't occur
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
/// while another thread is attempting to access the registry. Typically
|
/// while another thread is attempting to access the registry. Typically
|
||||||
/// this is done by initializing all targets at program startup.
|
/// this is done by initializing all targets at program startup.
|
||||||
|
@ -435,7 +437,7 @@ namespace llvm {
|
||||||
if (!T.MCInstPrinterCtorFn)
|
if (!T.MCInstPrinterCtorFn)
|
||||||
T.MCInstPrinterCtorFn = Fn;
|
T.MCInstPrinterCtorFn = Fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RegisterCodeEmitter - Register a MCCodeEmitter implementation for the
|
/// RegisterCodeEmitter - Register a MCCodeEmitter implementation for the
|
||||||
/// given target.
|
/// given target.
|
||||||
///
|
///
|
||||||
|
@ -444,7 +446,7 @@ namespace llvm {
|
||||||
/// this is done by initializing all targets at program startup.
|
/// this is done by initializing all targets at program startup.
|
||||||
///
|
///
|
||||||
/// @param T - The target being registered.
|
/// @param T - The target being registered.
|
||||||
/// @param Fn - A function to construct an AsmPrinter for the target.
|
/// @param Fn - A function to construct an MCCodeEmitter for the target.
|
||||||
static void RegisterCodeEmitter(Target &T, Target::CodeEmitterCtorTy Fn) {
|
static void RegisterCodeEmitter(Target &T, Target::CodeEmitterCtorTy Fn) {
|
||||||
if (!T.CodeEmitterCtorFn)
|
if (!T.CodeEmitterCtorFn)
|
||||||
T.CodeEmitterCtorFn = Fn;
|
T.CodeEmitterCtorFn = Fn;
|
||||||
|
@ -498,7 +500,7 @@ namespace llvm {
|
||||||
static const MCAsmInfo *Allocator(const Target &T, StringRef TT) {
|
static const MCAsmInfo *Allocator(const Target &T, StringRef TT) {
|
||||||
return new MCAsmInfoImpl(T, TT);
|
return new MCAsmInfoImpl(T, TT);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// RegisterAsmInfoFn - Helper template for registering a target assembly info
|
/// RegisterAsmInfoFn - Helper template for registering a target assembly info
|
||||||
|
@ -537,28 +539,6 @@ namespace llvm {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// 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:
|
|
||||||
static AsmPrinter *Allocator(formatted_raw_ostream &OS, TargetMachine &TM,
|
|
||||||
MCContext &Ctx, MCStreamer &Streamer,
|
|
||||||
const MCAsmInfo *MAI) {
|
|
||||||
return new AsmPrinterImpl(OS, TM, Ctx, Streamer, MAI);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// RegisterAsmLexer - Helper template for registering a target specific
|
/// RegisterAsmLexer - Helper template for registering a target specific
|
||||||
/// assembly lexer, for use in the target machine initialization
|
/// assembly lexer, for use in the target machine initialization
|
||||||
/// function. Usage:
|
/// function. Usage:
|
||||||
|
@ -572,7 +552,7 @@ namespace llvm {
|
||||||
RegisterAsmLexer(Target &T) {
|
RegisterAsmLexer(Target &T) {
|
||||||
TargetRegistry::RegisterAsmLexer(T, &Allocator);
|
TargetRegistry::RegisterAsmLexer(T, &Allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static TargetAsmLexer *Allocator(const Target &T, const MCAsmInfo &MAI) {
|
static TargetAsmLexer *Allocator(const Target &T, const MCAsmInfo &MAI) {
|
||||||
return new AsmLexerImpl(T, MAI);
|
return new AsmLexerImpl(T, MAI);
|
||||||
|
@ -599,6 +579,28 @@ namespace llvm {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// 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:
|
||||||
|
static AsmPrinter *Allocator(formatted_raw_ostream &OS, TargetMachine &TM,
|
||||||
|
MCContext &Ctx, MCStreamer &Streamer,
|
||||||
|
const MCAsmInfo *MAI) {
|
||||||
|
return new AsmPrinterImpl(OS, TM, Ctx, Streamer, MAI);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// RegisterCodeEmitter - Helper template for registering a target specific
|
/// RegisterCodeEmitter - Helper template for registering a target specific
|
||||||
/// machine code emitter, for use in the target initialization
|
/// machine code emitter, for use in the target initialization
|
||||||
/// function. Usage:
|
/// function. Usage:
|
||||||
|
|
Loading…
Reference in New Issue