forked from OSchip/llvm-project
Formatting tweaks (trailing whitespace, ordering, comments).
llvm-svn: 96761
This commit is contained in:
parent
43b464cfe5
commit
dc95c69662
|
@ -99,10 +99,6 @@ namespace llvm {
|
|||
/// TargetMachine, if registered.
|
||||
TargetMachineCtorTy TargetMachineCtorFn;
|
||||
|
||||
/// AsmPrinterCtorFn - Construction function for this target's AsmPrinter,
|
||||
/// if registered.
|
||||
AsmPrinterCtorTy AsmPrinterCtorFn;
|
||||
|
||||
/// AsmLexerCtorFn - Construction function for this target's TargetAsmLexer,
|
||||
/// if registered.
|
||||
AsmLexerCtorTy AsmLexerCtorFn;
|
||||
|
@ -111,11 +107,14 @@ namespace llvm {
|
|||
/// TargetAsmParser, if registered.
|
||||
AsmParserCtorTy AsmParserCtorFn;
|
||||
|
||||
/// AsmPrinterCtorFn - Construction function for this target's AsmPrinter,
|
||||
/// if registered.
|
||||
AsmPrinterCtorTy AsmPrinterCtorFn;
|
||||
|
||||
/// MCDisassemblerCtorFn - Construction function for this target's
|
||||
/// MCDisassembler, if registered.
|
||||
MCDisassemblerCtorTy MCDisassemblerCtorFn;
|
||||
|
||||
|
||||
/// MCInstPrinterCtorFn - Construction function for this target's
|
||||
/// MCInstPrinter, if registered.
|
||||
MCInstPrinterCtorTy MCInstPrinterCtorFn;
|
||||
|
@ -147,12 +146,15 @@ namespace llvm {
|
|||
/// hasTargetMachine - Check if this target supports code generation.
|
||||
bool hasTargetMachine() const { return TargetMachineCtorFn != 0; }
|
||||
|
||||
/// hasAsmPrinter - Check if this target supports .s printing.
|
||||
bool hasAsmPrinter() const { return AsmPrinterCtorFn != 0; }
|
||||
/// hasAsmLexer - Check if this target supports .s lexing.
|
||||
bool hasAsmLexer() const { return AsmLexerCtorFn != 0; }
|
||||
|
||||
/// hasAsmParser - Check if this target supports .s parsing.
|
||||
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.
|
||||
bool hasMCDisassembler() const { return MCDisassemblerCtorFn != 0; }
|
||||
|
||||
|
@ -193,16 +195,6 @@ namespace llvm {
|
|||
return TargetMachineCtorFn(*this, Triple, Features);
|
||||
}
|
||||
|
||||
/// createAsmPrinter - Create a target specific assembly printer pass. This
|
||||
/// takes ownership of the MCContext and MCStreamer objects but not the MAI.
|
||||
AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *MAI) const {
|
||||
if (!AsmPrinterCtorFn)
|
||||
return 0;
|
||||
return AsmPrinterCtorFn(OS, TM, Ctx, Streamer, MAI);
|
||||
}
|
||||
|
||||
/// createAsmLexer - Create a target specific assembly lexer.
|
||||
///
|
||||
TargetAsmLexer *createAsmLexer(const MCAsmInfo &MAI) const {
|
||||
|
@ -221,6 +213,16 @@ namespace llvm {
|
|||
return AsmParserCtorFn(*this, Parser);
|
||||
}
|
||||
|
||||
/// createAsmPrinter - Create a target specific assembly printer pass. This
|
||||
/// takes ownership of the MCContext and MCStreamer objects but not the MAI.
|
||||
AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM,
|
||||
MCContext &Ctx, MCStreamer &Streamer,
|
||||
const MCAsmInfo *MAI) const {
|
||||
if (!AsmPrinterCtorFn)
|
||||
return 0;
|
||||
return AsmPrinterCtorFn(OS, TM, Ctx, Streamer, MAI);
|
||||
}
|
||||
|
||||
const MCDisassembler *createMCDisassembler() const {
|
||||
if (!MCDisassemblerCtorFn)
|
||||
return 0;
|
||||
|
@ -363,21 +365,6 @@ namespace llvm {
|
|||
T.TargetMachineCtorFn = Fn;
|
||||
}
|
||||
|
||||
/// RegisterAsmPrinter - Register an AsmPrinter 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 RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn) {
|
||||
// Ignore duplicate registration.
|
||||
if (!T.AsmPrinterCtorFn)
|
||||
T.AsmPrinterCtorFn = Fn;
|
||||
}
|
||||
|
||||
/// RegisterAsmLexer - Register a TargetAsmLexer implementation for the
|
||||
/// given target.
|
||||
///
|
||||
|
@ -386,7 +373,7 @@ namespace llvm {
|
|||
/// 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.
|
||||
/// @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;
|
||||
|
@ -400,12 +387,27 @@ namespace llvm {
|
|||
/// 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.
|
||||
/// @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
|
||||
/// 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 RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn) {
|
||||
// Ignore duplicate registration.
|
||||
if (!T.AsmPrinterCtorFn)
|
||||
T.AsmPrinterCtorFn = Fn;
|
||||
}
|
||||
|
||||
/// RegisterMCDisassembler - Register a MCDisassembler implementation for
|
||||
/// the given target.
|
||||
///
|
||||
|
@ -444,7 +446,7 @@ namespace llvm {
|
|||
/// 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.
|
||||
/// @param Fn - A function to construct an MCCodeEmitter for the target.
|
||||
static void RegisterCodeEmitter(Target &T, Target::CodeEmitterCtorTy Fn) {
|
||||
if (!T.CodeEmitterCtorFn)
|
||||
T.CodeEmitterCtorFn = Fn;
|
||||
|
@ -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
|
||||
/// assembly lexer, for use in the target machine initialization
|
||||
/// function. Usage:
|
||||
|
@ -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
|
||||
/// machine code emitter, for use in the target initialization
|
||||
/// function. Usage:
|
||||
|
|
Loading…
Reference in New Issue