From 0c795d61878156817cedbac51ec2921f2634c1a5 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sat, 25 Jul 2009 06:49:55 +0000 Subject: [PATCH] Add new helpers for registering targets. - Less boilerplate == good. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77052 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/TargetMachineRegistry.h | 55 ----------- include/llvm/Target/TargetRegistry.h | 95 +++++++++++++++++++ lib/Target/ARM/ARM.h | 3 - lib/Target/ARM/ARMTargetMachine.cpp | 15 ++- lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 15 +-- lib/Target/Alpha/Alpha.h | 3 - lib/Target/Alpha/AlphaTargetMachine.cpp | 12 +-- .../Alpha/AsmPrinter/AlphaAsmPrinter.cpp | 14 +-- lib/Target/CBackend/CBackend.cpp | 10 +- .../CellSPU/AsmPrinter/SPUAsmPrinter.cpp | 12 +-- lib/Target/CellSPU/SPU.h | 3 - lib/Target/CellSPU/SPUTargetMachine.cpp | 12 +-- lib/Target/CppBackend/CPPBackend.cpp | 11 +-- lib/Target/MSIL/MSILWriter.cpp | 9 +- lib/Target/MSIL/MSILWriter.h | 1 - lib/Target/MSP430/MSP430.h | 3 - lib/Target/MSP430/MSP430AsmPrinter.cpp | 20 ++-- lib/Target/MSP430/MSP430TargetMachine.cpp | 12 --- lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp | 16 +--- lib/Target/Mips/Mips.h | 3 - lib/Target/Mips/MipsTargetMachine.cpp | 15 ++- lib/Target/PIC16/PIC16.h | 5 +- lib/Target/PIC16/PIC16AsmPrinter.cpp | 20 ++-- lib/Target/PIC16/PIC16TargetMachine.cpp | 16 ---- .../PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 2 +- lib/Target/PowerPC/PPC.h | 3 - lib/Target/PowerPC/PPCTargetMachine.cpp | 16 ++-- .../Sparc/AsmPrinter/SparcAsmPrinter.cpp | 14 +-- lib/Target/Sparc/Sparc.h | 3 - lib/Target/Sparc/SparcTargetMachine.cpp | 11 +-- .../SystemZ/AsmPrinter/SystemZAsmPrinter.cpp | 14 +-- lib/Target/SystemZ/SystemZ.h | 3 - lib/Target/SystemZ/SystemZTargetMachine.cpp | 15 +-- lib/Target/X86/AsmParser/X86AsmParser.cpp | 10 +- lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp | 6 +- lib/Target/X86/X86.h | 8 -- lib/Target/X86/X86TargetMachine.cpp | 14 +-- lib/Target/XCore/XCore.h | 3 - lib/Target/XCore/XCoreAsmPrinter.cpp | 18 ++-- lib/Target/XCore/XCoreTargetMachine.cpp | 12 --- 40 files changed, 188 insertions(+), 344 deletions(-) delete mode 100644 include/llvm/Target/TargetMachineRegistry.h diff --git a/include/llvm/Target/TargetMachineRegistry.h b/include/llvm/Target/TargetMachineRegistry.h deleted file mode 100644 index a1b13d360d0..00000000000 --- a/include/llvm/Target/TargetMachineRegistry.h +++ /dev/null @@ -1,55 +0,0 @@ -//===-- Target/TargetMachineRegistry.h - Target Registration ----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file exposes two classes: the TargetMachineRegistry class, which allows -// tools to inspect all of registered targets, and the RegisterTarget class, -// which TargetMachine implementations should use to register themselves with -// the system. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_TARGET_TARGETMACHINEREGISTRY_H -#define LLVM_TARGET_TARGETMACHINEREGISTRY_H - -#include "llvm/Module.h" -#include "llvm/Target/TargetRegistry.h" - -namespace llvm { - class Module; - class Target; - class TargetMachine; - - //===--------------------------------------------------------------------===// - /// RegisterTarget - This class is used to make targets automatically register - /// themselves with the tools they are linked with. Targets should define an - /// single global Target instance and register it using the TargetRegistry - /// interfaces. Targets must also include a static instance of this class. - /// - /// The type 'TargetMachineImpl' should provide a constructor with two - /// parameters: - /// - const Module& M: the module that is being compiled: - /// - const std::string& FS: target-specific string describing target - /// flavour. - - template - struct RegisterTarget { - RegisterTarget(Target &T, const char *Name, const char *ShortDesc) { - TargetRegistry::RegisterTargetMachine(T, &Allocator); - } - - private: - static TargetMachine *Allocator(const Target &T, const Module &M, - const std::string &FS) { - return new TargetMachineImpl(T, M, FS); - } - }; - -} - -#endif diff --git a/include/llvm/Target/TargetRegistry.h b/include/llvm/Target/TargetRegistry.h index 5ad74ec547a..6d692df27b8 100644 --- a/include/llvm/Target/TargetRegistry.h +++ b/include/llvm/Target/TargetRegistry.h @@ -19,6 +19,9 @@ #ifndef LLVM_TARGET_TARGETREGISTRY_H #define LLVM_TARGET_TARGETREGISTRY_H +// FIXME: We shouldn't need this header, but we need it until there is a +// different interface to get the TargetAsmInfo. +#include "llvm/Target/TargetMachine.h" #include #include @@ -278,6 +281,98 @@ namespace llvm { /// @} }; + + //===--------------------------------------------------------------------===// + + /// RegisterTarget - Helper template for registering a target, for use in the + /// target's initialization function. Usage: + /// + /// + /// Target TheFooTarget; // The global target instance. + /// + /// namespace { + /// struct FooInfo { + /// static unsigned getJITMatchQuality() { ... } + /// static unsigned getTripleMatchQuality(const std::string &) { ... } + /// static unsigned getModuleMatchQuality(const Module &) { ... } + /// }; + /// } + /// + /// extern "C" void LLVMInitializeFooTargetInfo() { + /// RegisterTarget X(TheFooTarget, "foo", "Foo description"); + /// } + template + struct RegisterTarget { + RegisterTarget(Target &T, const char *Name, const char *Desc) { + TargetRegistry::RegisterTarget(T, Name, Desc, + &TargetInfoImpl::getTripleMatchQuality, + &TargetInfoImpl::getModuleMatchQuality, + &TargetInfoImpl::getJITMatchQuality); + } + }; + + /// 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 X(TheFooTarget); + /// } + template + struct RegisterTargetMachine { + RegisterTargetMachine(Target &T) { + TargetRegistry::RegisterTargetMachine(T, &Allocator); + } + + private: + static TargetMachine *Allocator(const Target &T, const Module &M, + const std::string &FS) { + return new TargetMachineImpl(T, M, FS); + } + }; + + /// 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 X(TheFooTarget); + /// } + template + struct RegisterAsmPrinter { + RegisterAsmPrinter(Target &T) { + TargetRegistry::RegisterAsmPrinter(T, &Allocator); + } + + private: + static FunctionPass *Allocator(formatted_raw_ostream &OS, + TargetMachine &TM, + bool Verbose) { + return new AsmPrinterImpl(OS, TM, TM.getTargetAsmInfo(), Verbose); + } + }; + + /// RegisterAsmParser - Helper template for registering a target specific asm + /// parser, for use in the target machine initialization function. Usage: + /// + /// extern "C" void LLVMInitializeFooAsmPrinter() { + /// extern Target TheFooTarget; + /// RegisterAsmPrinter X(TheFooTarget); + /// } + template + struct RegisterAsmParser { + RegisterAsmParser(Target &T) { + TargetRegistry::RegisterAsmParser(T, &Allocator); + } + + private: + static TargetAsmParser *Allocator(const Target &T) { + return new AsmParserImpl(T); + } + }; + } #endif diff --git a/lib/Target/ARM/ARM.h b/lib/Target/ARM/ARM.h index 5a3555a2532..b41ef90f129 100644 --- a/lib/Target/ARM/ARM.h +++ b/lib/Target/ARM/ARM.h @@ -93,9 +93,6 @@ inline static const char *ARMCondCodeToString(ARMCC::CondCodes CC) { } FunctionPass *createARMISelDag(ARMBaseTargetMachine &TM); -FunctionPass *createARMCodePrinterPass(formatted_raw_ostream &O, - TargetMachine &TM, - bool Verbose); FunctionPass *createARMCodeEmitterPass(ARMBaseTargetMachine &TM, MachineCodeEmitter &MCE); diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index 08bb38215e3..d71029475f2 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -19,8 +19,8 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FormattedStream.h" -#include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/Target/TargetRegistry.h" using namespace llvm; static cl::opt DisableLdStOpti("disable-arm-loadstore-opti", cl::Hidden, @@ -28,14 +28,11 @@ static cl::opt DisableLdStOpti("disable-arm-loadstore-opti", cl::Hidden, static cl::opt DisableIfConversion("disable-arm-if-conversion",cl::Hidden, cl::desc("Disable if-conversion pass")); -// Register the target. -static RegisterTarget X(llvm::TheARMTarget, "arm", "ARM"); - -static RegisterTarget Y(llvm::TheThumbTarget, "thumb", - "Thumb"); - -// Force static initialization. -extern "C" void LLVMInitializeARMTarget() { } +extern "C" void LLVMInitializeARMTarget() { + // Register the target. + RegisterTargetMachine X(TheARMTarget); + RegisterTargetMachine Y(TheThumbTarget); +} /// TargetMachine ctor - Create an ARM architecture model. /// diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index cffbecd764b..3d6fb8016b1 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -1304,19 +1304,8 @@ bool ARMAsmPrinter::doFinalization(Module &M) { return AsmPrinter::doFinalization(M); } -/// createARMCodePrinterPass - Returns a pass that prints the ARM -/// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. This should work -/// regardless of whether the function is in SSA form. -/// -FunctionPass *llvm::createARMCodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { - return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); -} - // Force static initialization. extern "C" void LLVMInitializeARMAsmPrinter() { - TargetRegistry::RegisterAsmPrinter(TheARMTarget, createARMCodePrinterPass); - TargetRegistry::RegisterAsmPrinter(TheThumbTarget, createARMCodePrinterPass); + RegisterAsmPrinter X(TheARMTarget); + RegisterAsmPrinter Y(TheThumbTarget); } diff --git a/lib/Target/Alpha/Alpha.h b/lib/Target/Alpha/Alpha.h index 93c4c702603..b8a06459e1c 100644 --- a/lib/Target/Alpha/Alpha.h +++ b/lib/Target/Alpha/Alpha.h @@ -26,9 +26,6 @@ namespace llvm { class formatted_raw_ostream; FunctionPass *createAlphaISelDag(AlphaTargetMachine &TM); - FunctionPass *createAlphaCodePrinterPass(formatted_raw_ostream &OS, - TargetMachine &TM, - bool Verbose); FunctionPass *createAlphaPatternInstructionSelector(TargetMachine &TM); FunctionPass *createAlphaCodeEmitterPass(AlphaTargetMachine &TM, MachineCodeEmitter &MCE); diff --git a/lib/Target/Alpha/AlphaTargetMachine.cpp b/lib/Target/Alpha/AlphaTargetMachine.cpp index 1947e656703..70d7b152485 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.cpp +++ b/lib/Target/Alpha/AlphaTargetMachine.cpp @@ -16,17 +16,15 @@ #include "AlphaTargetMachine.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Support/FormattedStream.h" +#include "llvm/Target/TargetRegistry.h" using namespace llvm; -// Register the targets -static RegisterTarget X(TheAlphaTarget, "alpha", - "Alpha [experimental]"); - -// Force static initialization. -extern "C" void LLVMInitializeAlphaTarget() { } +extern "C" void LLVMInitializeAlphaTarget() { + // Register the target. + RegisterTargetMachine X(TheAlphaTarget); +} const TargetAsmInfo *AlphaTargetMachine::createTargetAsmInfo() const { return new AlphaTargetAsmInfo(*this); diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp index e6cc53a0722..08a2c3430e2 100644 --- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp @@ -63,17 +63,6 @@ namespace { }; } // end of anonymous namespace -/// createAlphaCodePrinterPass - Returns a pass that prints the Alpha -/// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. This should work -/// regardless of whether the function is in SSA form. -/// -FunctionPass *llvm::createAlphaCodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { - return new AlphaAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); -} - #include "AlphaGenAsmWriter.inc" void AlphaAsmPrinter::printOperand(const MachineInstr *MI, int opNum) @@ -288,6 +277,5 @@ bool AlphaAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, // Force static initialization. extern "C" void LLVMInitializeAlphaAsmPrinter() { - TargetRegistry::RegisterAsmPrinter(TheAlphaTarget, - createAlphaCodePrinterPass); + RegisterAsmPrinter X(TheAlphaTarget); } diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 4defaec163c..c2681e4f505 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -32,7 +32,6 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" -#include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/CFG.h" @@ -50,11 +49,10 @@ #include using namespace llvm; -// Register the target. -static RegisterTarget X(TheCBackendTarget, "c", "C backend"); - -// Force static initialization. -extern "C" void LLVMInitializeCBackendTarget() { } +extern "C" void LLVMInitializeCBackendTarget() { + // Register the target. + RegisterTargetMachine X(TheCBackendTarget); +} namespace { /// CBackendNameAllUsedStructsAndMergeFunctions - This pass inserts names for diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index a4475036966..df39710f3e6 100644 --- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp +++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp @@ -584,17 +584,7 @@ void LinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) { O << '\n'; } -/// createSPUCodePrinterPass - Returns a pass that prints the Cell SPU -/// assembly code for a MachineFunction to the given output stream, in a format -/// that the Linux SPU assembler can deal with. -/// -FunctionPass *llvm::createSPUAsmPrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { - return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); -} - // Force static initialization. extern "C" void LLVMInitializeCellSPUAsmPrinter() { - TargetRegistry::RegisterAsmPrinter(TheCellSPUTarget, createSPUAsmPrinterPass); + RegisterAsmPrinter X(TheCellSPUTarget); } diff --git a/lib/Target/CellSPU/SPU.h b/lib/Target/CellSPU/SPU.h index 9fc36f657ae..02713b5402d 100644 --- a/lib/Target/CellSPU/SPU.h +++ b/lib/Target/CellSPU/SPU.h @@ -24,9 +24,6 @@ namespace llvm { class formatted_raw_ostream; FunctionPass *createSPUISelDag(SPUTargetMachine &TM); - FunctionPass *createSPUAsmPrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose); /*--== Utility functions/predicates/etc used all over the place: --==*/ //! Predicate test for a signed 10-bit value diff --git a/lib/Target/CellSPU/SPUTargetMachine.cpp b/lib/Target/CellSPU/SPUTargetMachine.cpp index f1b1a742914..26215cd26fc 100644 --- a/lib/Target/CellSPU/SPUTargetMachine.cpp +++ b/lib/Target/CellSPU/SPUTargetMachine.cpp @@ -17,21 +17,17 @@ #include "SPUTargetMachine.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Target/TargetMachineRegistry.h" #include "llvm/CodeGen/RegAllocRegistry.h" #include "llvm/CodeGen/SchedulerRegistry.h" +#include "llvm/Target/TargetRegistry.h" using namespace llvm; -namespace { - // Register the targets - RegisterTarget - CELLSPU(TheCellSPUTarget, "cellspu", "STI CBEA Cell SPU [experimental]"); +extern "C" void LLVMInitializeCellSPUTarget() { + // Register the target. + RegisterTargetMachine X(TheCellSPUTarget); } -// Force static initialization. -extern "C" void LLVMInitializeCellSPUTarget() { } - const std::pair * SPUFrameInfo::getCalleeSaveSpillSlots(unsigned &NumEntries) const { NumEntries = 1; diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 7c5d09ec1b0..b552e04c4f4 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -23,7 +23,6 @@ #include "llvm/Pass.h" #include "llvm/PassManager.h" #include "llvm/TypeSymbolTable.h" -#include "llvm/Target/TargetMachineRegistry.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" @@ -31,6 +30,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Streams.h" +#include "llvm/Target/TargetRegistry.h" #include "llvm/Config/config.h" #include #include @@ -72,11 +72,10 @@ static cl::opt NameToGenerate("cppfor", cl::Optional, cl::desc("Specify the name of the thing to generate"), cl::init("!bad!")); -// Register the target. -static RegisterTarget X(TheCppBackendTarget, "cpp", "C++ backend"); - -// Force static initialization. -extern "C" void LLVMInitializeCppBackendTarget() { } +extern "C" void LLVMInitializeCppBackendTarget() { + // Register the target. + RegisterTargetMachine X(TheCppBackendTarget); +} namespace { typedef std::vector TypeList; diff --git a/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp index c3808d379ee..ccac5189f31 100644 --- a/lib/Target/MSIL/MSILWriter.cpp +++ b/lib/Target/MSIL/MSILWriter.cpp @@ -22,6 +22,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Target/TargetRegistry.h" #include "llvm/Transforms/Scalar.h" #include "llvm/ADT/StringExtras.h" #include "llvm/CodeGen/Passes.h" @@ -48,10 +49,10 @@ namespace { }; } -static RegisterTarget X(TheMSILTarget, "msil", "MSIL backend"); - -// Force static initialization. -extern "C" void LLVMInitializeMSILTarget() { } +extern "C" void LLVMInitializeMSILTarget() { + // Register the target. + RegisterTargetMachine X(TheMSILTarget); +} bool MSILModule::runOnModule(Module &M) { ModulePtr = &M; diff --git a/lib/Target/MSIL/MSILWriter.h b/lib/Target/MSIL/MSILWriter.h index 09cfb219bfe..21ff359920a 100644 --- a/lib/Target/MSIL/MSILWriter.h +++ b/lib/Target/MSIL/MSILWriter.h @@ -26,7 +26,6 @@ #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Support/Mangler.h" #include using namespace llvm; diff --git a/lib/Target/MSP430/MSP430.h b/lib/Target/MSP430/MSP430.h index 6251a42f904..d9f5f862954 100644 --- a/lib/Target/MSP430/MSP430.h +++ b/lib/Target/MSP430/MSP430.h @@ -24,9 +24,6 @@ namespace llvm { FunctionPass *createMSP430ISelDag(MSP430TargetMachine &TM, CodeGenOpt::Level OptLevel); - FunctionPass *createMSP430CodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose); extern Target TheMSP430Target; diff --git a/lib/Target/MSP430/MSP430AsmPrinter.cpp b/lib/Target/MSP430/MSP430AsmPrinter.cpp index 4905f25ceb8..bb112bc2550 100644 --- a/lib/Target/MSP430/MSP430AsmPrinter.cpp +++ b/lib/Target/MSP430/MSP430AsmPrinter.cpp @@ -1,4 +1,4 @@ -//===-- MSP430AsmPrinter.cpp - MSP430 LLVM assembly writer ------------------===// +//===-- MSP430AsmPrinter.cpp - MSP430 LLVM assembly writer ----------------===// // // The LLVM Compiler Infrastructure // @@ -27,6 +27,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/FormattedStream.h" @@ -72,17 +73,6 @@ namespace { #include "MSP430GenAsmWriter.inc" -/// createMSP430CodePrinterPass - Returns a pass that prints the MSP430 -/// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. This should work -/// regardless of whether the function is in SSA form. -/// -FunctionPass *llvm::createMSP430CodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { - return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); -} - void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { const Function *F = MF.getFunction(); @@ -255,3 +245,9 @@ void MSP430AsmPrinter::printCCOperand(const MachineInstr *MI, int OpNum) { break; } } + +extern "C" void LLVMInitializeMSP430Target() { + // Register the target. + RegisterTargetMachine X(TheMSP430Target); + RegisterAsmPrinter Y(TheMSP430Target); +} diff --git a/lib/Target/MSP430/MSP430TargetMachine.cpp b/lib/Target/MSP430/MSP430TargetMachine.cpp index ffd93da921a..d77b26b56c6 100644 --- a/lib/Target/MSP430/MSP430TargetMachine.cpp +++ b/lib/Target/MSP430/MSP430TargetMachine.cpp @@ -18,20 +18,8 @@ #include "llvm/PassManager.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetAsmInfo.h" -#include "llvm/Target/TargetMachineRegistry.h" - using namespace llvm; -// Register the targets -static RegisterTarget -X(TheMSP430Target, "msp430", "MSP430 [experimental]"); - -// Force static initialization. -extern "C" void LLVMInitializeMSP430Target() { - TargetRegistry::RegisterAsmPrinter(TheMSP430Target, - &createMSP430CodePrinterPass); -} - MSP430TargetMachine::MSP430TargetMachine(const Target &T, const Module &M, const std::string &FS) : diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp index 132c9b0000b..9eda5e222cf 100644 --- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp @@ -87,16 +87,6 @@ namespace { #include "MipsGenAsmWriter.inc" -/// createMipsCodePrinterPass - Returns a pass that prints the MIPS -/// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. This should work -/// regardless of whether the function is in SSA form. -FunctionPass *llvm::createMipsCodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { - return new MipsAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); -} - //===----------------------------------------------------------------------===// // // Mips Asm Directives @@ -560,8 +550,6 @@ void MipsAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) { // Force static initialization. extern "C" void LLVMInitializeMipsAsmPrinter() { - TargetRegistry::RegisterAsmPrinter(TheMipsTarget, createMipsCodePrinterPass); - - TargetRegistry::RegisterAsmPrinter(TheMipselTarget, - createMipsCodePrinterPass); + RegisterAsmPrinter X(TheMipsTarget); + RegisterAsmPrinter Y(TheMipselTarget); } diff --git a/lib/Target/Mips/Mips.h b/lib/Target/Mips/Mips.h index 09a80729a56..a9ab050d6f0 100644 --- a/lib/Target/Mips/Mips.h +++ b/lib/Target/Mips/Mips.h @@ -25,9 +25,6 @@ namespace llvm { FunctionPass *createMipsISelDag(MipsTargetMachine &TM); FunctionPass *createMipsDelaySlotFillerPass(MipsTargetMachine &TM); - FunctionPass *createMipsCodePrinterPass(formatted_raw_ostream &OS, - TargetMachine &TM, - bool Verbose); extern Target TheMipsTarget; extern Target TheMipselTarget; diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index e82dcee6362..b5e2da74ba7 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/lib/Target/Mips/MipsTargetMachine.cpp @@ -16,17 +16,14 @@ #include "MipsTargetMachine.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Target/TargetMachineRegistry.h" +#include "llvm/Target/TargetRegistry.h" using namespace llvm; -// Register the target. -static RegisterTarget X(TheMipsTarget, "mips", "Mips"); - -static RegisterTarget Y(TheMipselTarget, "mipsel", - "Mipsel"); - -// Force static initialization. -extern "C" void LLVMInitializeMipsTarget() { } +extern "C" void LLVMInitializeMipsTarget() { + // Register the target. + RegisterTargetMachine X(TheMipsTarget); + RegisterTargetMachine Y(TheMipselTarget); +} const TargetAsmInfo *MipsTargetMachine:: createTargetAsmInfo() const diff --git a/lib/Target/PIC16/PIC16.h b/lib/Target/PIC16/PIC16.h index b1df058cb8e..447beba7d69 100644 --- a/lib/Target/PIC16/PIC16.h +++ b/lib/Target/PIC16/PIC16.h @@ -343,10 +343,7 @@ namespace PIC16CC { FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM); - FunctionPass *createPIC16CodePrinterPass(formatted_raw_ostream &OS, - TargetMachine &TM, - bool Verbose); - // Banksel optimzer pass. + // Banksel optimizer pass. FunctionPass *createPIC16MemSelOptimizerPass(); extern Target ThePIC16Target; diff --git a/lib/Target/PIC16/PIC16AsmPrinter.cpp b/lib/Target/PIC16/PIC16AsmPrinter.cpp index 8cd57614305..95d363e4ecc 100644 --- a/lib/Target/PIC16/PIC16AsmPrinter.cpp +++ b/lib/Target/PIC16/PIC16AsmPrinter.cpp @@ -24,6 +24,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/Target/TargetRegistry.h" using namespace llvm; @@ -107,17 +108,6 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { return false; // we didn't modify anything. } -/// createPIC16CodePrinterPass - Returns a pass that prints the PIC16 -/// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. This should work -/// regardless of whether the function is in SSA form. -/// -FunctionPass *llvm::createPIC16CodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { - return new PIC16AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); -} - // printOperand - print operand of insn. void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) { @@ -435,3 +425,11 @@ void PIC16AsmPrinter::EmitRemainingAutos() { } } + +extern "C" void LLVMInitializePIC16Target() { + // Register the targets + RegisterTargetMachine A(ThePIC16Target); + RegisterTargetMachine B(TheCooperTarget); + RegisterAsmPrinter C(ThePIC16Target); + RegisterAsmPrinter D(TheCooperTarget); +} diff --git a/lib/Target/PIC16/PIC16TargetMachine.cpp b/lib/Target/PIC16/PIC16TargetMachine.cpp index dca6ade9384..6a4492c5484 100644 --- a/lib/Target/PIC16/PIC16TargetMachine.cpp +++ b/lib/Target/PIC16/PIC16TargetMachine.cpp @@ -18,25 +18,9 @@ #include "llvm/PassManager.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetAsmInfo.h" -#include "llvm/Target/TargetMachineRegistry.h" using namespace llvm; -// Register the targets -static RegisterTarget -X(ThePIC16Target, "pic16", "PIC16 14-bit [experimental]."); - -static RegisterTarget -Y(TheCooperTarget, "cooper", "PIC16 Cooper [experimental]."); - -// Force static initialization. -extern "C" void LLVMInitializePIC16Target() { - TargetRegistry::RegisterAsmPrinter(ThePIC16Target, - &createPIC16CodePrinterPass); - TargetRegistry::RegisterAsmPrinter(TheCooperTarget, - &createPIC16CodePrinterPass); -} - // PIC16TargetMachine - Traditional PIC16 Machine. PIC16TargetMachine::PIC16TargetMachine(const Target &T, const Module &M, const std::string &FS, bool Cooper) diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 1ac3e32e568..146979ef565 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -1075,7 +1075,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) { /// for a MachineFunction to the given output stream, in a format that the /// Darwin assembler can deal with. /// -FunctionPass *llvm::createPPCAsmPrinterPass(formatted_raw_ostream &o, +static FunctionPass *createPPCAsmPrinterPass(formatted_raw_ostream &o, TargetMachine &tm, bool verbose) { const PPCSubtarget *Subtarget = &tm.getSubtarget(); diff --git a/lib/Target/PowerPC/PPC.h b/lib/Target/PowerPC/PPC.h index 6d8974f2e08..7b98268bd83 100644 --- a/lib/Target/PowerPC/PPC.h +++ b/lib/Target/PowerPC/PPC.h @@ -29,9 +29,6 @@ namespace llvm { FunctionPass *createPPCBranchSelectionPass(); FunctionPass *createPPCISelDag(PPCTargetMachine &TM); -FunctionPass *createPPCAsmPrinterPass(formatted_raw_ostream &OS, - TargetMachine &TM, - bool Verbose); FunctionPass *createPPCCodeEmitterPass(PPCTargetMachine &TM, MachineCodeEmitter &MCE); FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM, diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp index 3d5ae5221af..bb228c614ec 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -16,20 +16,16 @@ #include "PPCTargetMachine.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/Target/TargetRegistry.h" #include "llvm/Support/FormattedStream.h" using namespace llvm; -// Register the targets -static RegisterTarget -X(ThePPC32Target, "ppc32", "PowerPC 32"); - -static RegisterTarget -Y(ThePPC64Target, "ppc64", "PowerPC 64"); - -// Force static initialization. -extern "C" void LLVMInitializePowerPCTarget() { } +extern "C" void LLVMInitializePowerPCTarget() { + // Register the targets + RegisterTargetMachine A(ThePPC32Target); + RegisterTargetMachine B(ThePPC64Target); +} const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const { if (Subtarget.isDarwin()) diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp index 39682c7a00b..ad99cca4ac0 100644 --- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp @@ -76,17 +76,6 @@ namespace { #include "SparcGenAsmWriter.inc" -/// createSparcCodePrinterPass - Returns a pass that prints the SPARC -/// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. This should work -/// regardless of whether the function is in SSA form. -/// -FunctionPass *llvm::createSparcCodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { - return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); -} - /// runOnMachineFunction - This uses the printInstruction() /// method to print assembly for each instruction. @@ -336,6 +325,5 @@ bool SparcAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, // Force static initialization. extern "C" void LLVMInitializeSparcAsmPrinter() { - TargetRegistry::RegisterAsmPrinter(TheSparcTarget, - createSparcCodePrinterPass); + RegisterAsmPrinter X(TheSparcTarget); } diff --git a/lib/Target/Sparc/Sparc.h b/lib/Target/Sparc/Sparc.h index 06ad1a4da35..bb5155e1c26 100644 --- a/lib/Target/Sparc/Sparc.h +++ b/lib/Target/Sparc/Sparc.h @@ -25,9 +25,6 @@ namespace llvm { class formatted_raw_ostream; FunctionPass *createSparcISelDag(SparcTargetMachine &TM); - FunctionPass *createSparcCodePrinterPass(formatted_raw_ostream &OS, - TargetMachine &TM, - bool Verbose); FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM); FunctionPass *createSparcFPMoverPass(TargetMachine &TM); diff --git a/lib/Target/Sparc/SparcTargetMachine.cpp b/lib/Target/Sparc/SparcTargetMachine.cpp index 686cf910283..0605db393ec 100644 --- a/lib/Target/Sparc/SparcTargetMachine.cpp +++ b/lib/Target/Sparc/SparcTargetMachine.cpp @@ -15,14 +15,13 @@ #include "Sparc.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Target/TargetMachineRegistry.h" +#include "llvm/Target/TargetRegistry.h" using namespace llvm; -// Register the target. -static RegisterTarget X(TheSparcTarget, "sparc", "SPARC"); - -// Force static initialization. -extern "C" void LLVMInitializeSparcTarget() { } +extern "C" void LLVMInitializeSparcTarget() { + // Register the target. + RegisterTargetMachine X(TheSparcTarget); +} const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const { // FIXME: Handle Solaris subtarget someday :) diff --git a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp index ae449be9808..572326e76d4 100644 --- a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp +++ b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp @@ -78,17 +78,6 @@ namespace { #include "SystemZGenAsmWriter.inc" -/// createSystemZCodePrinterPass - Returns a pass that prints the SystemZ -/// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. This should work -/// regardless of whether the function is in SSA form. -/// -FunctionPass *llvm::createSystemZCodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { - return new SystemZAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); -} - void SystemZAsmPrinter::emitFunctionHeader(const MachineFunction &MF) { unsigned FnAlign = MF.getAlignment(); const Function *F = MF.getFunction(); @@ -403,6 +392,5 @@ void SystemZAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) { // Force static initialization. extern "C" void LLVMInitializeSystemZAsmPrinter() { - TargetRegistry::RegisterAsmPrinter(TheSystemZTarget, - createSystemZCodePrinterPass); + RegisterAsmPrinter X(TheSystemZTarget); } diff --git a/lib/Target/SystemZ/SystemZ.h b/lib/Target/SystemZ/SystemZ.h index 466b44787c8..ea5240a10c9 100644 --- a/lib/Target/SystemZ/SystemZ.h +++ b/lib/Target/SystemZ/SystemZ.h @@ -46,9 +46,6 @@ namespace llvm { FunctionPass *createSystemZISelDag(SystemZTargetMachine &TM, CodeGenOpt::Level OptLevel); - FunctionPass *createSystemZCodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose); extern Target TheSystemZTarget; diff --git a/lib/Target/SystemZ/SystemZTargetMachine.cpp b/lib/Target/SystemZ/SystemZTargetMachine.cpp index 8799190e2e0..8c11a47d1a6 100644 --- a/lib/Target/SystemZ/SystemZTargetMachine.cpp +++ b/lib/Target/SystemZ/SystemZTargetMachine.cpp @@ -1,4 +1,4 @@ -//===-- SystemZTargetMachine.cpp - Define TargetMachine for SystemZ -----------===// +//===-- SystemZTargetMachine.cpp - Define TargetMachine for SystemZ -------===// // // The LLVM Compiler Infrastructure // @@ -15,19 +15,12 @@ #include "SystemZ.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Target/TargetMachineRegistry.h" +#include "llvm/Target/TargetRegistry.h" using namespace llvm; -namespace { - // Register the target. - RegisterTarget X(TheSystemZTarget, - "systemz", - "SystemZ [experimental]"); -} - -// Force static initialization. extern "C" void LLVMInitializeSystemZTarget() { - + // Register the target. + RegisterTargetMachine X(TheSystemZTarget); } const TargetAsmInfo *SystemZTargetMachine::createTargetAsmInfo() const { diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 7c50f31ab8f..c278de0af19 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -56,14 +56,8 @@ bool X86ATTAsmParser::ParseInstruction(MCAsmParser &AP, const char *Name, return MatchInstruction(Name, Operands, Inst); } -namespace { - TargetAsmParser *createAsmParser(const Target &T) { - return new X86ATTAsmParser(T); - } -} - // Force static initialization. extern "C" void LLVMInitializeX86AsmParser() { - TargetRegistry::RegisterAsmParser(TheX86_32Target, &createAsmParser); - TargetRegistry::RegisterAsmParser(TheX86_64Target, &createAsmParser); + RegisterAsmParser X(TheX86_32Target); + RegisterAsmParser Y(TheX86_64Target); } diff --git a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp index b6caf30c791..ebf9acf9d86 100644 --- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp @@ -25,9 +25,9 @@ using namespace llvm; /// for a MachineFunction to the given output stream, using the given target /// machine description. /// -FunctionPass *llvm::createX86CodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { +static FunctionPass *createX86CodePrinterPass(formatted_raw_ostream &o, + TargetMachine &tm, + bool verbose) { const X86Subtarget *Subtarget = &tm.getSubtarget(); if (Subtarget->isFlavorIntel()) diff --git a/lib/Target/X86/X86.h b/lib/Target/X86/X86.h index 0c3bc3977cc..2647d687091 100644 --- a/lib/Target/X86/X86.h +++ b/lib/Target/X86/X86.h @@ -42,14 +42,6 @@ FunctionPass *createX86FloatingPointStackifierPass(); /// FunctionPass *createX87FPRegKillInserterPass(); -/// createX86CodePrinterPass - Returns a pass that prints the X86 -/// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. -/// -FunctionPass *createX86CodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool Verbose); - /// createX86CodeEmitterPass - Return a pass that emits the collected X86 code /// to the specified MCE object. diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index fa3ec6904de..a720e6e894d 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -20,19 +20,13 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/Target/TargetMachineRegistry.h" +#include "llvm/Target/TargetRegistry.h" using namespace llvm; -// Register the target. -static RegisterTarget -X(TheX86_32Target, "x86", "32-bit X86: Pentium-Pro and above"); - -static RegisterTarget -Y(TheX86_64Target, "x86-64", "64-bit X86: EM64T and AMD64"); - -// Force static initialization. extern "C" void LLVMInitializeX86Target() { - + // Register the target. + RegisterTargetMachine X(TheX86_32Target); + RegisterTargetMachine Y(TheX86_64Target); } const TargetAsmInfo *X86TargetMachine::createTargetAsmInfo() const { diff --git a/lib/Target/XCore/XCore.h b/lib/Target/XCore/XCore.h index b7b86304b10..8937fbe123c 100644 --- a/lib/Target/XCore/XCore.h +++ b/lib/Target/XCore/XCore.h @@ -24,9 +24,6 @@ namespace llvm { class formatted_raw_ostream; FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM); - FunctionPass *createXCoreCodePrinterPass(formatted_raw_ostream &OS, - TargetMachine &TM, - bool Verbose); extern Target TheXCoreTarget; diff --git a/lib/Target/XCore/XCoreAsmPrinter.cpp b/lib/Target/XCore/XCoreAsmPrinter.cpp index 2a4d57b7ad3..5f2484293f6 100644 --- a/lib/Target/XCore/XCoreAsmPrinter.cpp +++ b/lib/Target/XCore/XCoreAsmPrinter.cpp @@ -28,6 +28,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetRegistry.h" #include "llvm/Support/Mangler.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" @@ -91,17 +92,6 @@ namespace { #include "XCoreGenAsmWriter.inc" -/// createXCoreCodePrinterPass - Returns a pass that prints the XCore -/// assembly code for a MachineFunction to the given output stream, -/// using the given target machine description. This should work -/// regardless of whether the function is in SSA form. -/// -FunctionPass *llvm::createXCoreCodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, - bool verbose) { - return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); -} - void XCoreAsmPrinter:: emitGlobalDirective(const std::string &name) { @@ -387,3 +377,9 @@ bool XCoreAsmPrinter::doInitialization(Module &M) { } + +// Force static initialization. +extern "C" void LLVMInitializeXCoreTarget() { + RegisterTargetMachine X(TheXCoreTarget); + RegisterAsmPrinter Y(TheXCoreTarget); +} diff --git a/lib/Target/XCore/XCoreTargetMachine.cpp b/lib/Target/XCore/XCoreTargetMachine.cpp index edc437b5e30..faea9605721 100644 --- a/lib/Target/XCore/XCoreTargetMachine.cpp +++ b/lib/Target/XCore/XCoreTargetMachine.cpp @@ -15,20 +15,8 @@ #include "XCore.h" #include "llvm/Module.h" #include "llvm/PassManager.h" -#include "llvm/Target/TargetMachineRegistry.h" using namespace llvm; -namespace { - // Register the target. - RegisterTarget X(TheXCoreTarget, "xcore", "XCore"); -} - -// Force static initialization. -extern "C" void LLVMInitializeXCoreTarget() { - TargetRegistry::RegisterAsmPrinter(TheXCoreTarget, - &createXCoreCodePrinterPass); -} - const TargetAsmInfo *XCoreTargetMachine::createTargetAsmInfo() const { return new XCoreTargetAsmInfo(*this); } -- 2.34.1