[llvm-commits] [llvm] r75843 - in /llvm/trunk/lib/Target: ARM/ ARM/AsmPrinter/ Alpha/ Alpha/AsmPrinter/ CellSPU/ CellSPU/AsmPrinter/ IA64/ IA64/AsmPrinter/ Mips/ Mips/AsmPrinter/ PowerPC/ PowerPC/AsmPrinter/ Sparc/ Sparc/AsmPrinter/ X86/ X86/AsmPrinter/
Daniel Dunbar
daniel at zuster.org
Wed Jul 15 15:01:33 PDT 2009
Author: ddunbar
Date: Wed Jul 15 17:01:32 2009
New Revision: 75843
URL: http://llvm.org/viewvc/llvm-project?rev=75843&view=rev
Log:
Remove old style hacks to register AsmPrinter into TargetMachine.
- No intended functionality change.
Modified:
llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp
llvm/trunk/lib/Target/ARM/ARMTargetMachine.h
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp
llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h
llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp
llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h
llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp
llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp
llvm/trunk/lib/Target/IA64/IA64TargetMachine.h
llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp
llvm/trunk/lib/Target/Mips/MipsTargetMachine.h
llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp
llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h
llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp
llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h
llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
llvm/trunk/lib/Target/X86/X86TargetMachine.h
Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Wed Jul 15 17:01:32 2009
@@ -45,9 +45,6 @@
// Force static initialization.
extern "C" void LLVMInitializeARMTarget() { }
-// No assembler printer by default
-ARMBaseTargetMachine::AsmPrinterCtorFn ARMBaseTargetMachine::AsmPrinterCtor = 0;
-
/// TargetMachine ctor - Create an ARM architecture model.
///
ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T,
@@ -136,11 +133,10 @@
CodeGenOpt::Level OptLevel,
bool Verbose,
formatted_raw_ostream &Out) {
- // Output assembly language.
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- if (AsmPrinterCtor)
- PM.add(AsmPrinterCtor(Out, *this, Verbose));
-
+ FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
+ if (!Printer)
+ llvm_report_error("unable to create assembly printer");
+ PM.add(Printer);
return false;
}
Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.h?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetMachine.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Wed Jul 15 17:01:32 2009
@@ -38,14 +38,6 @@
InstrItineraryData InstrItins;
Reloc::Model DefRelocModel; // Reloc model before it's overridden.
-protected:
- // To avoid having target depend on the asmprinter stuff libraries, asmprinter
- // set this functions to ctor pointer at startup time if they are linked in.
- typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
- TargetMachine &tm,
- bool verbose);
- static AsmPrinterCtorFn AsmPrinterCtor;
-
public:
ARMBaseTargetMachine(const Target &T, const Module &M, const std::string &FS,
bool isThumb);
@@ -57,10 +49,6 @@
return InstrItins;
}
- static void registerAsmPrinter(AsmPrinterCtorFn F) {
- AsmPrinterCtor = F;
- }
-
virtual const TargetAsmInfo *createTargetAsmInfo() const;
// Pass Pipeline Configuration
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Wed Jul 15 17:01:32 2009
@@ -1293,14 +1293,6 @@
return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
}
-namespace {
- static struct Register {
- Register() {
- ARMBaseTargetMachine::registerAsmPrinter(createARMCodePrinterPass);
- }
- } Registrator;
-}
-
// Force static initialization.
extern "C" void LLVMInitializeARMAsmPrinter() {
extern Target TheARMTarget, TheThumbTarget;
Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.cpp Wed Jul 15 17:01:32 2009
@@ -26,9 +26,6 @@
static RegisterTarget<AlphaTargetMachine> X(TheAlphaTarget, "alpha",
"Alpha [experimental]");
-// No assembler printer by default
-AlphaTargetMachine::AsmPrinterCtorFn AlphaTargetMachine::AsmPrinterCtor = 0;
-
// Force static initialization.
extern "C" void LLVMInitializeAlphaTarget() { }
@@ -68,43 +65,34 @@
CodeGenOpt::Level OptLevel,
bool Verbose,
formatted_raw_ostream &Out) {
- // Output assembly language.
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- if (AsmPrinterCtor)
- PM.add(AsmPrinterCtor(Out, *this, Verbose));
+ FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
+ if (!Printer)
+ llvm_report_error("unable to create assembly printer");
+ PM.add(Printer);
return false;
}
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, MachineCodeEmitter &MCE) {
PM.add(createAlphaCodeEmitterPass(*this, MCE));
- if (DumpAsm) {
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- if (AsmPrinterCtor)
- PM.add(AsmPrinterCtor(ferrs(), *this, true));
- }
+ if (DumpAsm)
+ addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, JITCodeEmitter &JCE) {
PM.add(createAlphaJITCodeEmitterPass(*this, JCE));
- if (DumpAsm) {
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- if (AsmPrinterCtor)
- PM.add(AsmPrinterCtor(ferrs(), *this, true));
- }
+ if (DumpAsm)
+ addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, ObjectCodeEmitter &OCE) {
PM.add(createAlphaObjectCodeEmitterPass(*this, OCE));
- if (DumpAsm) {
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- if (AsmPrinterCtor)
- PM.add(AsmPrinterCtor(ferrs(), *this, true));
- }
+ if (DumpAsm)
+ addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaTargetMachine.h Wed Jul 15 17:01:32 2009
@@ -37,13 +37,6 @@
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
- // To avoid having target depend on the asmprinter stuff libraries, asmprinter
- // set this functions to ctor pointer at startup time if they are linked in.
- typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
- TargetMachine &tm,
- bool verbose);
- static AsmPrinterCtorFn AsmPrinterCtor;
-
public:
AlphaTargetMachine(const Target &T, const Module &M, const std::string &FS);
@@ -85,10 +78,6 @@
CodeGenOpt::Level OptLevel,
bool DumpAsm,
ObjectCodeEmitter &OCE);
-
- static void registerAsmPrinter(AsmPrinterCtorFn F) {
- AsmPrinterCtor = F;
- }
};
} // end namespace llvm
Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Wed Jul 15 17:01:32 2009
@@ -293,14 +293,6 @@
return false;
}
-namespace {
- static struct Register {
- Register() {
- AlphaTargetMachine::registerAsmPrinter(createAlphaCodePrinterPass);
- }
- } Registrator;
-}
-
// Force static initialization.
extern "C" void LLVMInitializeAlphaAsmPrinter() {
extern Target TheAlphaTarget;
Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Wed Jul 15 17:01:32 2009
@@ -605,14 +605,6 @@
return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
}
-namespace {
- static struct Register {
- Register() {
- SPUTargetMachine::registerAsmPrinter(createSPUAsmPrinterPass);
- }
- } Registrator;
-}
-
// Force static initialization.
extern "C" void LLVMInitializeCellSPUAsmPrinter() {
extern Target TheCellSPUTarget;
Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.cpp Wed Jul 15 17:01:32 2009
@@ -30,9 +30,6 @@
CELLSPU(TheCellSPUTarget, "cellspu", "STI CBEA Cell SPU [experimental]");
}
-// No assembler printer by default
-SPUTargetMachine::AsmPrinterCtorFn SPUTargetMachine::AsmPrinterCtor = 0;
-
// Force static initialization.
extern "C" void LLVMInitializeCellSPUTarget() { }
@@ -80,9 +77,9 @@
CodeGenOpt::Level OptLevel,
bool Verbose,
formatted_raw_ostream &Out) {
- // Output assembly language.
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- if (AsmPrinterCtor)
- PM.add(AsmPrinterCtor(Out, *this, Verbose));
+ FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
+ if (!Printer)
+ llvm_report_error("unable to create assembly printer");
+ PM.add(Printer);
return false;
}
Modified: llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUTargetMachine.h Wed Jul 15 17:01:32 2009
@@ -39,13 +39,6 @@
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
- // To avoid having target depend on the asmprinter stuff libraries, asmprinter
- // set this functions to ctor pointer at startup time if they are linked in.
- typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
- TargetMachine &tm,
- bool verbose);
- static AsmPrinterCtorFn AsmPrinterCtor;
-
public:
SPUTargetMachine(const Target &T, const Module &M, const std::string &FS);
@@ -89,10 +82,6 @@
virtual bool addAssemblyEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool Verbose, formatted_raw_ostream &Out);
-
- static void registerAsmPrinter(AsmPrinterCtorFn F) {
- AsmPrinterCtor = F;
- }
};
} // end namespace llvm
Modified: llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp Wed Jul 15 17:01:32 2009
@@ -375,15 +375,6 @@
return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
}
-namespace {
- static struct Register {
- Register() {
- IA64TargetMachine::registerAsmPrinter(createIA64CodePrinterPass);
- }
- } Registrator;
-}
-
-
// Force static initialization.
extern "C" void LLVMInitializeIA64AsmPrinter() {
extern Target TheIA64Target;
Modified: llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/IA64/IA64TargetMachine.cpp Wed Jul 15 17:01:32 2009
@@ -24,9 +24,6 @@
static RegisterTarget<IA64TargetMachine> X(TheIA64Target, "ia64",
"IA-64 (Itanium) [experimental]");
-// No assembler printer by default
-IA64TargetMachine::AsmPrinterCtorFn IA64TargetMachine::AsmPrinterCtor = 0;
-
// Force static initialization.
extern "C" void LLVMInitializeIA64Target() { }
@@ -65,10 +62,9 @@
CodeGenOpt::Level OptLevel,
bool Verbose,
formatted_raw_ostream &Out) {
- // Output assembly language.
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- if (AsmPrinterCtor)
- PM.add(AsmPrinterCtor(Out, *this, Verbose));
+ FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
+ if (!Printer)
+ llvm_report_error("unable to create assembly printer");
+ PM.add(Printer);
return false;
}
-
Modified: llvm/trunk/lib/Target/IA64/IA64TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64TargetMachine.h?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/IA64/IA64TargetMachine.h (original)
+++ llvm/trunk/lib/Target/IA64/IA64TargetMachine.h Wed Jul 15 17:01:32 2009
@@ -34,13 +34,6 @@
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
- // To avoid having target depend on the asmprinter stuff libraries, asmprinter
- // set this functions to ctor pointer at startup time if they are linked in.
- typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
- TargetMachine &tm,
- bool verbose);
- static AsmPrinterCtorFn AsmPrinterCtor;
-
public:
IA64TargetMachine(const Target &T, const Module &M, const std::string &FS);
@@ -61,10 +54,6 @@
virtual bool addAssemblyEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool Verbose, formatted_raw_ostream &Out);
-
- static void registerAsmPrinter(AsmPrinterCtorFn F) {
- AsmPrinterCtor = F;
- }
};
} // End llvm namespace
Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Wed Jul 15 17:01:32 2009
@@ -576,14 +576,6 @@
return AsmPrinter::doFinalization(M);
}
-namespace {
- static struct Register {
- Register() {
- MipsTargetMachine::registerAsmPrinter(createMipsCodePrinterPass);
- }
- } Registrator;
-}
-
// Force static initialization.
extern "C" void LLVMInitializeMipsAsmPrinter() {
extern Target TheMipsTarget;
Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Wed Jul 15 17:01:32 2009
@@ -35,9 +35,6 @@
static RegisterTarget<MipselTargetMachine> Y(TheMipselTarget, "mipsel",
"Mipsel");
-MipsTargetMachine::AsmPrinterCtorFn MipsTargetMachine::AsmPrinterCtor = 0;
-
-
// Force static initialization.
extern "C" void LLVMInitializeMipsTarget() { }
@@ -103,8 +100,9 @@
bool MipsTargetMachine::
addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool Verbose, formatted_raw_ostream &Out) {
- // Output assembly language.
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- PM.add(AsmPrinterCtor(Out, *this, Verbose));
+ FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
+ if (!Printer)
+ llvm_report_error("unable to create assembly printer");
+ PM.add(Printer);
return false;
}
Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.h?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetMachine.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.h Wed Jul 15 17:01:32 2009
@@ -33,22 +33,10 @@
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
- protected:
- // To avoid having target depend on the asmprinter stuff libraries,
- // asmprinter set this functions to ctor pointer at startup time if they are
- // linked in.
- typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
- TargetMachine &tm,
- bool verbose);
- static AsmPrinterCtorFn AsmPrinterCtor;
public:
MipsTargetMachine(const Target &T, const Module &M, const std::string &FS,
bool isLittle);
-
- static void registerAsmPrinter(AsmPrinterCtorFn F) {
- AsmPrinterCtor = F;
- }
virtual const MipsInstrInfo *getInstrInfo() const
{ return &InstrInfo; }
Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Wed Jul 15 17:01:32 2009
@@ -1092,14 +1092,6 @@
}
}
-namespace {
- static struct Register {
- Register() {
- PPCTargetMachine::registerAsmPrinter(createPPCAsmPrinterPass);
- }
- } Registrator;
-}
-
extern "C" int PowerPCAsmPrinterForceLink;
int PowerPCAsmPrinterForceLink = 0;
Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp Wed Jul 15 17:01:32 2009
@@ -41,9 +41,6 @@
// Force static initialization.
extern "C" void LLVMInitializePowerPCTarget() { }
-// No assembler printer by default
-PPCTargetMachine::AsmPrinterCtorFn PPCTargetMachine::AsmPrinterCtor = 0;
-
const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const {
if (Subtarget.isDarwin())
return new PPCDarwinTargetAsmInfo(*this);
@@ -105,10 +102,10 @@
CodeGenOpt::Level OptLevel,
bool Verbose,
formatted_raw_ostream &Out) {
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- if (AsmPrinterCtor)
- PM.add(AsmPrinterCtor(Out, *this, Verbose));
-
+ FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
+ if (!Printer)
+ llvm_report_error("unable to create assembly printer");
+ PM.add(Printer);
return false;
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.h Wed Jul 15 17:01:32 2009
@@ -42,13 +42,6 @@
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
- // To avoid having target depend on the asmprinter stuff libraries, asmprinter
- // set this functions to ctor pointer at startup time if they are linked in.
- typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
- TargetMachine &m,
- bool verbose);
- static AsmPrinterCtorFn AsmPrinterCtor;
-
public:
PPCTargetMachine(const Target &T, const Module &M, const std::string &FS,
bool is64Bit);
@@ -72,10 +65,6 @@
return &MachOWriterInfo;
}
- static void registerAsmPrinter(AsmPrinterCtorFn F) {
- AsmPrinterCtor = F;
- }
-
// Pass Pipeline Configuration
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Wed Jul 15 17:01:32 2009
@@ -351,14 +351,6 @@
return false;
}
-namespace {
- static struct Register {
- Register() {
- SparcTargetMachine::registerAsmPrinter(createSparcCodePrinterPass);
- }
- } Registrator;
-}
-
// Force static initialization.
extern "C" void LLVMInitializeSparcAsmPrinter() {
extern Target TheSparcTarget;
Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.cpp Wed Jul 15 17:01:32 2009
@@ -22,10 +22,6 @@
extern Target TheSparcTarget;
static RegisterTarget<SparcTargetMachine> X(TheSparcTarget, "sparc", "SPARC");
-// No assembler printer by default
-SparcTargetMachine::AsmPrinterCtorFn SparcTargetMachine::AsmPrinterCtor = 0;
-
-
// Force static initialization.
extern "C" void LLVMInitializeSparcTarget() { }
@@ -64,9 +60,9 @@
CodeGenOpt::Level OptLevel,
bool Verbose,
formatted_raw_ostream &Out) {
- // Output assembly language.
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- if (AsmPrinterCtor)
- PM.add(AsmPrinterCtor(Out, *this, Verbose));
+ FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
+ if (!Printer)
+ llvm_report_error("unable to create assembly printer");
+ PM.add(Printer);
return false;
}
Modified: llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h (original)
+++ llvm/trunk/lib/Target/Sparc/SparcTargetMachine.h Wed Jul 15 17:01:32 2009
@@ -35,13 +35,6 @@
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
- // To avoid having target depend on the asmprinter stuff libraries, asmprinter
- // set this functions to ctor pointer at startup time if they are linked in.
- typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
- TargetMachine &tm,
- bool verbose);
- static AsmPrinterCtorFn AsmPrinterCtor;
-
public:
SparcTargetMachine(const Target &T, const Module &M, const std::string &FS);
@@ -62,10 +55,6 @@
virtual bool addAssemblyEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool Verbose, formatted_raw_ostream &Out);
-
- static void registerAsmPrinter(AsmPrinterCtorFn F) {
- AsmPrinterCtor = F;
- }
};
} // end namespace llvm
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp Wed Jul 15 17:01:32 2009
@@ -34,14 +34,6 @@
return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
}
-namespace {
- static struct Register {
- Register() {
- X86TargetMachine::registerAsmPrinter(createX86CodePrinterPass);
- }
- } Registrator;
-}
-
extern "C" int X86AsmPrinterForceLink;
int X86AsmPrinterForceLink = 0;
Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Wed Jul 15 17:01:32 2009
@@ -44,9 +44,6 @@
}
-// No assembler printer by default
-X86TargetMachine::AsmPrinterCtorFn X86TargetMachine::AsmPrinterCtor = 0;
-
const TargetAsmInfo *X86TargetMachine::createTargetAsmInfo() const {
if (Subtarget.isFlavorIntel())
return new X86WinTargetAsmInfo(*this);
@@ -188,9 +185,10 @@
CodeGenOpt::Level OptLevel,
bool Verbose,
formatted_raw_ostream &Out) {
- assert(AsmPrinterCtor && "AsmPrinter was not linked in");
- if (AsmPrinterCtor)
- PM.add(AsmPrinterCtor(Out, *this, Verbose));
+ FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
+ if (!Printer)
+ llvm_report_error("unable to create assembly printer");
+ PM.add(Printer);
return false;
}
Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.h?rev=75843&r1=75842&r2=75843&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.h (original)
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.h Wed Jul 15 17:01:32 2009
@@ -41,13 +41,6 @@
protected:
virtual const TargetAsmInfo *createTargetAsmInfo() const;
- // To avoid having target depend on the asmprinter stuff libraries, asmprinter
- // set this functions to ctor pointer at startup time if they are linked in.
- typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
- TargetMachine &tm,
- bool verbose);
- static AsmPrinterCtorFn AsmPrinterCtor;
-
public:
X86TargetMachine(const Target &T, const Module &M, const std::string &FS,
bool is64Bit);
@@ -67,10 +60,6 @@
return Subtarget.isTargetELF() ? &ELFWriterInfo : 0;
}
- static void registerAsmPrinter(AsmPrinterCtorFn F) {
- AsmPrinterCtor = F;
- }
-
// Set up the pass pipeline.
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
virtual bool addPreRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
More information about the llvm-commits
mailing list