forked from OSchip/llvm-project
Rename createCodeEmitter to createMCCodeEmitter; createObjectStreamer to createMCObjectStreamer.
llvm-svn: 136031
This commit is contained in:
parent
f1af0902cc
commit
3a79225b4c
|
@ -96,17 +96,17 @@ namespace llvm {
|
|||
typedef MCInstPrinter *(*MCInstPrinterCtorTy)(const Target &T,
|
||||
unsigned SyntaxVariant,
|
||||
const MCAsmInfo &MAI);
|
||||
typedef MCCodeEmitter *(*CodeEmitterCtorTy)(const MCInstrInfo &II,
|
||||
const MCSubtargetInfo &STI,
|
||||
MCContext &Ctx);
|
||||
typedef MCStreamer *(*ObjectStreamerCtorTy)(const Target &T,
|
||||
const std::string &TT,
|
||||
MCContext &Ctx,
|
||||
MCAsmBackend &TAB,
|
||||
raw_ostream &_OS,
|
||||
MCCodeEmitter *_Emitter,
|
||||
bool RelaxAll,
|
||||
bool NoExecStack);
|
||||
typedef MCCodeEmitter *(*MCCodeEmitterCtorTy)(const MCInstrInfo &II,
|
||||
const MCSubtargetInfo &STI,
|
||||
MCContext &Ctx);
|
||||
typedef MCStreamer *(*MCObjectStreamerCtorTy)(const Target &T,
|
||||
StringRef TT,
|
||||
MCContext &Ctx,
|
||||
MCAsmBackend &TAB,
|
||||
raw_ostream &_OS,
|
||||
MCCodeEmitter *_Emitter,
|
||||
bool RelaxAll,
|
||||
bool NoExecStack);
|
||||
typedef MCStreamer *(*AsmStreamerCtorTy)(MCContext &Ctx,
|
||||
formatted_raw_ostream &OS,
|
||||
bool isVerboseAsm,
|
||||
|
@ -183,13 +183,13 @@ namespace llvm {
|
|||
/// MCInstPrinter, if registered.
|
||||
MCInstPrinterCtorTy MCInstPrinterCtorFn;
|
||||
|
||||
/// CodeEmitterCtorFn - Construction function for this target's CodeEmitter,
|
||||
/// if registered.
|
||||
CodeEmitterCtorTy CodeEmitterCtorFn;
|
||||
/// MCCodeEmitterCtorFn - Construction function for this target's
|
||||
/// CodeEmitter, if registered.
|
||||
MCCodeEmitterCtorTy MCCodeEmitterCtorFn;
|
||||
|
||||
/// ObjectStreamerCtorFn - Construction function for this target's
|
||||
/// ObjectStreamer, if registered.
|
||||
ObjectStreamerCtorTy ObjectStreamerCtorFn;
|
||||
/// MCObjectStreamerCtorFn - Construction function for this target's
|
||||
/// MCObjectStreamer, if registered.
|
||||
MCObjectStreamerCtorTy MCObjectStreamerCtorFn;
|
||||
|
||||
/// AsmStreamerCtorFn - Construction function for this target's
|
||||
/// AsmStreamer, if registered (default = llvm::createAsmStreamer).
|
||||
|
@ -238,11 +238,11 @@ namespace llvm {
|
|||
/// hasMCInstPrinter - Check if this target has an instruction printer.
|
||||
bool hasMCInstPrinter() const { return MCInstPrinterCtorFn != 0; }
|
||||
|
||||
/// hasCodeEmitter - Check if this target supports instruction encoding.
|
||||
bool hasCodeEmitter() const { return CodeEmitterCtorFn != 0; }
|
||||
/// hasMCCodeEmitter - Check if this target supports instruction encoding.
|
||||
bool hasMCCodeEmitter() const { return MCCodeEmitterCtorFn != 0; }
|
||||
|
||||
/// hasObjectStreamer - Check if this target supports streaming to files.
|
||||
bool hasObjectStreamer() const { return ObjectStreamerCtorFn != 0; }
|
||||
/// hasMCObjectStreamer - Check if this target supports streaming to files.
|
||||
bool hasMCObjectStreamer() const { return MCObjectStreamerCtorFn != 0; }
|
||||
|
||||
/// hasAsmStreamer - Check if this target supports streaming to files.
|
||||
bool hasAsmStreamer() const { return AsmStreamerCtorFn != 0; }
|
||||
|
@ -373,16 +373,16 @@ namespace llvm {
|
|||
}
|
||||
|
||||
|
||||
/// createCodeEmitter - Create a target specific code emitter.
|
||||
MCCodeEmitter *createCodeEmitter(const MCInstrInfo &II,
|
||||
const MCSubtargetInfo &STI,
|
||||
MCContext &Ctx) const {
|
||||
if (!CodeEmitterCtorFn)
|
||||
/// createMCCodeEmitter - Create a target specific code emitter.
|
||||
MCCodeEmitter *createMCCodeEmitter(const MCInstrInfo &II,
|
||||
const MCSubtargetInfo &STI,
|
||||
MCContext &Ctx) const {
|
||||
if (!MCCodeEmitterCtorFn)
|
||||
return 0;
|
||||
return CodeEmitterCtorFn(II, STI, Ctx);
|
||||
return MCCodeEmitterCtorFn(II, STI, Ctx);
|
||||
}
|
||||
|
||||
/// createObjectStreamer - Create a target specific MCStreamer.
|
||||
/// createMCObjectStreamer - Create a target specific MCStreamer.
|
||||
///
|
||||
/// \arg TT - The target triple.
|
||||
/// \arg Ctx - The target context.
|
||||
|
@ -391,16 +391,16 @@ namespace llvm {
|
|||
/// \arg _Emitter - The target independent assembler object.Takes ownership.
|
||||
/// \arg RelaxAll - Relax all fixups?
|
||||
/// \arg NoExecStack - Mark file as not needing a executable stack.
|
||||
MCStreamer *createObjectStreamer(const std::string &TT, MCContext &Ctx,
|
||||
MCAsmBackend &TAB,
|
||||
raw_ostream &_OS,
|
||||
MCCodeEmitter *_Emitter,
|
||||
bool RelaxAll,
|
||||
bool NoExecStack) const {
|
||||
if (!ObjectStreamerCtorFn)
|
||||
MCStreamer *createMCObjectStreamer(StringRef TT, MCContext &Ctx,
|
||||
MCAsmBackend &TAB,
|
||||
raw_ostream &_OS,
|
||||
MCCodeEmitter *_Emitter,
|
||||
bool RelaxAll,
|
||||
bool NoExecStack) const {
|
||||
if (!MCObjectStreamerCtorFn)
|
||||
return 0;
|
||||
return ObjectStreamerCtorFn(*this, TT, Ctx, TAB, _OS, _Emitter, RelaxAll,
|
||||
NoExecStack);
|
||||
return MCObjectStreamerCtorFn(*this, TT, Ctx, TAB, _OS, _Emitter,
|
||||
RelaxAll, NoExecStack);
|
||||
}
|
||||
|
||||
/// createAsmStreamer - Create a target specific MCStreamer.
|
||||
|
@ -691,7 +691,7 @@ namespace llvm {
|
|||
T.MCInstPrinterCtorFn = Fn;
|
||||
}
|
||||
|
||||
/// RegisterCodeEmitter - Register a MCCodeEmitter implementation for the
|
||||
/// RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the
|
||||
/// given target.
|
||||
///
|
||||
/// Clients are responsible for ensuring that registration doesn't occur
|
||||
|
@ -700,13 +700,14 @@ namespace llvm {
|
|||
///
|
||||
/// @param T - The target being registered.
|
||||
/// @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;
|
||||
static void RegisterMCCodeEmitter(Target &T,
|
||||
Target::MCCodeEmitterCtorTy Fn) {
|
||||
if (!T.MCCodeEmitterCtorFn)
|
||||
T.MCCodeEmitterCtorFn = Fn;
|
||||
}
|
||||
|
||||
/// RegisterObjectStreamer - Register a object code MCStreamer implementation
|
||||
/// for the given target.
|
||||
/// RegisterMCObjectStreamer - Register a object code MCStreamer
|
||||
/// 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
|
||||
|
@ -714,9 +715,10 @@ namespace llvm {
|
|||
///
|
||||
/// @param T - The target being registered.
|
||||
/// @param Fn - A function to construct an MCStreamer for the target.
|
||||
static void RegisterObjectStreamer(Target &T, Target::ObjectStreamerCtorTy Fn) {
|
||||
if (!T.ObjectStreamerCtorFn)
|
||||
T.ObjectStreamerCtorFn = Fn;
|
||||
static void RegisterMCObjectStreamer(Target &T,
|
||||
Target::MCObjectStreamerCtorTy Fn) {
|
||||
if (!T.MCObjectStreamerCtorFn)
|
||||
T.MCObjectStreamerCtorFn = Fn;
|
||||
}
|
||||
|
||||
/// RegisterAsmStreamer - Register an assembly MCStreamer implementation
|
||||
|
@ -1036,25 +1038,25 @@ namespace llvm {
|
|||
}
|
||||
};
|
||||
|
||||
/// RegisterCodeEmitter - Helper template for registering a target specific
|
||||
/// RegisterMCCodeEmitter - Helper template for registering a target specific
|
||||
/// machine code emitter, for use in the target initialization
|
||||
/// function. Usage:
|
||||
///
|
||||
/// extern "C" void LLVMInitializeFooCodeEmitter() {
|
||||
/// extern "C" void LLVMInitializeFooMCCodeEmitter() {
|
||||
/// extern Target TheFooTarget;
|
||||
/// RegisterCodeEmitter<FooCodeEmitter> X(TheFooTarget);
|
||||
/// RegisterMCCodeEmitter<FooCodeEmitter> X(TheFooTarget);
|
||||
/// }
|
||||
template<class CodeEmitterImpl>
|
||||
struct RegisterCodeEmitter {
|
||||
RegisterCodeEmitter(Target &T) {
|
||||
TargetRegistry::RegisterCodeEmitter(T, &Allocator);
|
||||
template<class MCCodeEmitterImpl>
|
||||
struct RegisterMCCodeEmitter {
|
||||
RegisterMCCodeEmitter(Target &T) {
|
||||
TargetRegistry::RegisterMCCodeEmitter(T, &Allocator);
|
||||
}
|
||||
|
||||
private:
|
||||
static MCCodeEmitter *Allocator(const MCInstrInfo &II,
|
||||
const MCSubtargetInfo &STI,
|
||||
MCContext &Ctx) {
|
||||
return new CodeEmitterImpl();
|
||||
return new MCCodeEmitterImpl();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
|||
MCAsmBackend *MAB = 0;
|
||||
if (ShowMCEncoding) {
|
||||
const MCSubtargetInfo &STI = getSubtarget<MCSubtargetInfo>();
|
||||
MCE = getTarget().createCodeEmitter(*getInstrInfo(), STI, *Context);
|
||||
MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), STI, *Context);
|
||||
MAB = getTarget().createMCAsmBackend(getTargetTriple());
|
||||
}
|
||||
|
||||
|
@ -158,16 +158,16 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
|||
// Create the code emitter for the target if it exists. If not, .o file
|
||||
// emission fails.
|
||||
const MCSubtargetInfo &STI = getSubtarget<MCSubtargetInfo>();
|
||||
MCCodeEmitter *MCE = getTarget().createCodeEmitter(*getInstrInfo(), STI,
|
||||
*Context);
|
||||
MCCodeEmitter *MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), STI,
|
||||
*Context);
|
||||
MCAsmBackend *MAB = getTarget().createMCAsmBackend(getTargetTriple());
|
||||
if (MCE == 0 || MAB == 0)
|
||||
return true;
|
||||
|
||||
AsmStreamer.reset(getTarget().createObjectStreamer(getTargetTriple(),
|
||||
*Context, *MAB, Out, MCE,
|
||||
hasMCRelaxAll(),
|
||||
hasMCNoExecStack()));
|
||||
AsmStreamer.reset(getTarget().createMCObjectStreamer(getTargetTriple(),
|
||||
*Context, *MAB, Out,
|
||||
MCE, hasMCRelaxAll(),
|
||||
hasMCNoExecStack()));
|
||||
AsmStreamer.get()->InitSections();
|
||||
break;
|
||||
}
|
||||
|
@ -236,16 +236,16 @@ bool LLVMTargetMachine::addPassesToEmitMC(PassManagerBase &PM,
|
|||
// Create the code emitter for the target if it exists. If not, .o file
|
||||
// emission fails.
|
||||
const MCSubtargetInfo &STI = getSubtarget<MCSubtargetInfo>();
|
||||
MCCodeEmitter *MCE = getTarget().createCodeEmitter(*getInstrInfo(),STI, *Ctx);
|
||||
MCCodeEmitter *MCE = getTarget().createMCCodeEmitter(*getInstrInfo(),STI, *Ctx);
|
||||
MCAsmBackend *MAB = getTarget().createMCAsmBackend(getTargetTriple());
|
||||
if (MCE == 0 || MAB == 0)
|
||||
return true;
|
||||
|
||||
OwningPtr<MCStreamer> AsmStreamer;
|
||||
AsmStreamer.reset(getTarget().createObjectStreamer(getTargetTriple(), *Ctx,
|
||||
*MAB, Out, MCE,
|
||||
hasMCRelaxAll(),
|
||||
hasMCNoExecStack()));
|
||||
AsmStreamer.reset(getTarget().createMCObjectStreamer(getTargetTriple(), *Ctx,
|
||||
*MAB, Out, MCE,
|
||||
hasMCRelaxAll(),
|
||||
hasMCNoExecStack()));
|
||||
AsmStreamer.get()->InitSections();
|
||||
|
||||
// Create the AsmPrinter, which takes ownership of AsmStreamer if successful.
|
||||
|
|
|
@ -132,7 +132,7 @@ static MCCodeGenInfo *createARMMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||
}
|
||||
|
||||
// This is duplicated code. Refactor this.
|
||||
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
|
||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||
MCContext &Ctx, MCAsmBackend &MAB,
|
||||
raw_ostream &OS,
|
||||
MCCodeEmitter *Emitter,
|
||||
|
@ -185,16 +185,16 @@ extern "C" void LLVMInitializeARMTargetMC() {
|
|||
ARM_MC::createARMMCSubtargetInfo);
|
||||
|
||||
// Register the MC Code Emitter
|
||||
TargetRegistry::RegisterCodeEmitter(TheARMTarget, createARMMCCodeEmitter);
|
||||
TargetRegistry::RegisterCodeEmitter(TheThumbTarget, createARMMCCodeEmitter);
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheARMTarget, createARMMCCodeEmitter);
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheThumbTarget, createARMMCCodeEmitter);
|
||||
|
||||
// Register the asm backend.
|
||||
TargetRegistry::RegisterMCAsmBackend(TheARMTarget, createARMAsmBackend);
|
||||
TargetRegistry::RegisterMCAsmBackend(TheThumbTarget, createARMAsmBackend);
|
||||
|
||||
// Register the object streamer.
|
||||
TargetRegistry::RegisterObjectStreamer(TheARMTarget, createMCStreamer);
|
||||
TargetRegistry::RegisterObjectStreamer(TheThumbTarget, createMCStreamer);
|
||||
TargetRegistry::RegisterMCObjectStreamer(TheARMTarget, createMCStreamer);
|
||||
TargetRegistry::RegisterMCObjectStreamer(TheThumbTarget, createMCStreamer);
|
||||
|
||||
// Register the MCInstPrinter.
|
||||
TargetRegistry::RegisterMCInstPrinter(TheARMTarget, createARMMCInstPrinter);
|
||||
|
|
|
@ -71,7 +71,7 @@ static MCCodeGenInfo *createMBlazeMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
|
||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||
MCContext &Ctx, MCAsmBackend &MAB,
|
||||
raw_ostream &_OS,
|
||||
MCCodeEmitter *_Emitter,
|
||||
|
@ -121,16 +121,16 @@ extern "C" void LLVMInitializeMBlazeTargetMC() {
|
|||
createMBlazeMCSubtargetInfo);
|
||||
|
||||
// Register the MC code emitter
|
||||
TargetRegistry::RegisterCodeEmitter(TheMBlazeTarget,
|
||||
llvm::createMBlazeMCCodeEmitter);
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheMBlazeTarget,
|
||||
llvm::createMBlazeMCCodeEmitter);
|
||||
|
||||
// Register the asm backend
|
||||
TargetRegistry::RegisterMCAsmBackend(TheMBlazeTarget,
|
||||
createMBlazeAsmBackend);
|
||||
|
||||
// Register the object streamer
|
||||
TargetRegistry::RegisterObjectStreamer(TheMBlazeTarget,
|
||||
createMCStreamer);
|
||||
TargetRegistry::RegisterMCObjectStreamer(TheMBlazeTarget,
|
||||
createMCStreamer);
|
||||
|
||||
// Register the MCInstPrinter.
|
||||
TargetRegistry::RegisterMCInstPrinter(TheMBlazeTarget,
|
||||
|
|
|
@ -90,7 +90,7 @@ static MCCodeGenInfo *createPPCMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||
}
|
||||
|
||||
// This is duplicated code. Refactor this.
|
||||
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
|
||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||
MCContext &Ctx, MCAsmBackend &MAB,
|
||||
raw_ostream &OS,
|
||||
MCCodeEmitter *Emitter,
|
||||
|
@ -132,16 +132,16 @@ extern "C" void LLVMInitializePowerPCTargetMC() {
|
|||
createPPCMCSubtargetInfo);
|
||||
|
||||
// Register the MC Code Emitter
|
||||
TargetRegistry::RegisterCodeEmitter(ThePPC32Target, createPPCMCCodeEmitter);
|
||||
TargetRegistry::RegisterCodeEmitter(ThePPC64Target, createPPCMCCodeEmitter);
|
||||
TargetRegistry::RegisterMCCodeEmitter(ThePPC32Target, createPPCMCCodeEmitter);
|
||||
TargetRegistry::RegisterMCCodeEmitter(ThePPC64Target, createPPCMCCodeEmitter);
|
||||
|
||||
// Register the asm backend.
|
||||
TargetRegistry::RegisterMCAsmBackend(ThePPC32Target, createPPCAsmBackend);
|
||||
TargetRegistry::RegisterMCAsmBackend(ThePPC64Target, createPPCAsmBackend);
|
||||
|
||||
// Register the object streamer.
|
||||
TargetRegistry::RegisterObjectStreamer(ThePPC32Target, createMCStreamer);
|
||||
TargetRegistry::RegisterObjectStreamer(ThePPC64Target, createMCStreamer);
|
||||
TargetRegistry::RegisterMCObjectStreamer(ThePPC32Target, createMCStreamer);
|
||||
TargetRegistry::RegisterMCObjectStreamer(ThePPC64Target, createMCStreamer);
|
||||
|
||||
// Register the MCInstPrinter.
|
||||
TargetRegistry::RegisterMCInstPrinter(ThePPC32Target, createPPCMCInstPrinter);
|
||||
|
|
|
@ -366,7 +366,7 @@ static MCCodeGenInfo *createX86MCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||
return X;
|
||||
}
|
||||
|
||||
static MCStreamer *createMCStreamer(const Target &T, const std::string &TT,
|
||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||
MCContext &Ctx, MCAsmBackend &MAB,
|
||||
raw_ostream &_OS,
|
||||
MCCodeEmitter *_Emitter,
|
||||
|
@ -418,10 +418,10 @@ extern "C" void LLVMInitializeX86TargetMC() {
|
|||
X86_MC::createX86MCSubtargetInfo);
|
||||
|
||||
// Register the code emitter.
|
||||
TargetRegistry::RegisterCodeEmitter(TheX86_32Target,
|
||||
createX86MCCodeEmitter);
|
||||
TargetRegistry::RegisterCodeEmitter(TheX86_64Target,
|
||||
createX86MCCodeEmitter);
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheX86_32Target,
|
||||
createX86MCCodeEmitter);
|
||||
TargetRegistry::RegisterMCCodeEmitter(TheX86_64Target,
|
||||
createX86MCCodeEmitter);
|
||||
|
||||
// Register the asm backend.
|
||||
TargetRegistry::RegisterMCAsmBackend(TheX86_32Target,
|
||||
|
@ -430,10 +430,10 @@ extern "C" void LLVMInitializeX86TargetMC() {
|
|||
createX86_64AsmBackend);
|
||||
|
||||
// Register the object streamer.
|
||||
TargetRegistry::RegisterObjectStreamer(TheX86_32Target,
|
||||
createMCStreamer);
|
||||
TargetRegistry::RegisterObjectStreamer(TheX86_64Target,
|
||||
createMCStreamer);
|
||||
TargetRegistry::RegisterMCObjectStreamer(TheX86_32Target,
|
||||
createMCStreamer);
|
||||
TargetRegistry::RegisterMCObjectStreamer(TheX86_64Target,
|
||||
createMCStreamer);
|
||||
|
||||
// Register the MCInstPrinter.
|
||||
TargetRegistry::RegisterMCInstPrinter(TheX86_32Target,
|
||||
|
|
|
@ -370,7 +370,7 @@ static int AssembleInput(const char *ProgName) {
|
|||
MCCodeEmitter *CE = 0;
|
||||
MCAsmBackend *MAB = 0;
|
||||
if (ShowEncoding) {
|
||||
CE = TheTarget->createCodeEmitter(*MCII, *STI, Ctx);
|
||||
CE = TheTarget->createMCCodeEmitter(*MCII, *STI, Ctx);
|
||||
MAB = TheTarget->createMCAsmBackend(TripleName);
|
||||
}
|
||||
Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, /*asmverbose*/true,
|
||||
|
@ -381,11 +381,11 @@ static int AssembleInput(const char *ProgName) {
|
|||
Str.reset(createNullStreamer(Ctx));
|
||||
} else {
|
||||
assert(FileType == OFT_ObjectFile && "Invalid file type!");
|
||||
MCCodeEmitter *CE = TheTarget->createCodeEmitter(*MCII, *STI, Ctx);
|
||||
MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *STI, Ctx);
|
||||
MCAsmBackend *MAB = TheTarget->createMCAsmBackend(TripleName);
|
||||
Str.reset(TheTarget->createObjectStreamer(TripleName, Ctx, *MAB,
|
||||
FOS, CE, RelaxAll,
|
||||
NoExecStack));
|
||||
Str.reset(TheTarget->createMCObjectStreamer(TripleName, Ctx, *MAB,
|
||||
FOS, CE, RelaxAll,
|
||||
NoExecStack));
|
||||
}
|
||||
|
||||
if (EnableLogging) {
|
||||
|
|
Loading…
Reference in New Issue