diff options
Diffstat (limited to 'lib/Target/CellSPU')
-rw-r--r-- | lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp | 14 | ||||
-rw-r--r-- | lib/Target/CellSPU/SPU.h | 2 | ||||
-rw-r--r-- | lib/Target/CellSPU/SPUTargetMachine.cpp | 23 | ||||
-rw-r--r-- | lib/Target/CellSPU/SPUTargetMachine.h | 10 |
4 files changed, 18 insertions, 31 deletions
diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index f0d8a36132..0c36457913 100644 --- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp +++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp @@ -37,6 +37,7 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include <set> @@ -289,7 +290,7 @@ namespace { class VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter { DwarfWriter *DW; public: - explicit LinuxAsmPrinter(formatted_raw_ostream &O, SPUTargetMachine &TM, + explicit LinuxAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T, bool V) : SPUAsmPrinter(O, TM, T, V), DW(0) {} @@ -599,14 +600,11 @@ bool LinuxAsmPrinter::doFinalization(Module &M) { /// that the Linux SPU assembler can deal with. /// FunctionPass *llvm::createSPUAsmPrinterPass(formatted_raw_ostream &o, - SPUTargetMachine &tm, + TargetMachine &tm, bool verbose) { return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } -// Force static initialization. -extern "C" void LLVMInitializeCellSPUAsmPrinter() { } - namespace { static struct Register { Register() { @@ -614,3 +612,9 @@ namespace { } } Registrator; } + +// Force static initialization. +extern "C" void LLVMInitializeCellSPUAsmPrinter() { + extern Target TheCellSPUTarget; + TargetRegistry::RegisterAsmPrinter(TheCellSPUTarget, createSPUAsmPrinterPass); +} diff --git a/lib/Target/CellSPU/SPU.h b/lib/Target/CellSPU/SPU.h index 02623486dc..f76fc82e28 100644 --- a/lib/Target/CellSPU/SPU.h +++ b/lib/Target/CellSPU/SPU.h @@ -25,7 +25,7 @@ namespace llvm { FunctionPass *createSPUISelDag(SPUTargetMachine &TM); FunctionPass *createSPUAsmPrinterPass(formatted_raw_ostream &o, - SPUTargetMachine &tm, + TargetMachine &tm, bool verbose); /*--== Utility functions/predicates/etc used all over the place: --==*/ diff --git a/lib/Target/CellSPU/SPUTargetMachine.cpp b/lib/Target/CellSPU/SPUTargetMachine.cpp index 5c794c9ffa..3a659d8e4d 100644 --- a/lib/Target/CellSPU/SPUTargetMachine.cpp +++ b/lib/Target/CellSPU/SPUTargetMachine.cpp @@ -23,10 +23,11 @@ using namespace llvm; +extern Target TheCellSPUTarget; namespace { // Register the targets RegisterTarget<SPUTargetMachine> - CELLSPU("cellspu", "STI CBEA Cell SPU [experimental]"); + CELLSPU(TheCellSPUTarget, "cellspu", "STI CBEA Cell SPU [experimental]"); } // No assembler printer by default @@ -47,22 +48,10 @@ SPUTargetMachine::createTargetAsmInfo() const return new SPULinuxTargetAsmInfo(*this); } -unsigned -SPUTargetMachine::getModuleMatchQuality(const Module &M) -{ - // We strongly match "spu-*" or "cellspu-*". - std::string TT = M.getTargetTriple(); - if ((TT.size() == 3 && std::string(TT.begin(), TT.begin()+3) == "spu") - || (TT.size() == 7 && std::string(TT.begin(), TT.begin()+7) == "cellspu") - || (TT.size() >= 4 && std::string(TT.begin(), TT.begin()+4) == "spu-") - || (TT.size() >= 8 && std::string(TT.begin(), TT.begin()+8) == "cellspu-")) - return 20; - - return 0; // No match at all... -} - -SPUTargetMachine::SPUTargetMachine(const Module &M, const std::string &FS) - : Subtarget(*this, M, FS), +SPUTargetMachine::SPUTargetMachine(const Target &T, const Module &M, + const std::string &FS) + : LLVMTargetMachine(T), + Subtarget(*this, M, FS), DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this), FrameInfo(*this), diff --git a/lib/Target/CellSPU/SPUTargetMachine.h b/lib/Target/CellSPU/SPUTargetMachine.h index ce8e55058e..18f525d1c8 100644 --- a/lib/Target/CellSPU/SPUTargetMachine.h +++ b/lib/Target/CellSPU/SPUTargetMachine.h @@ -42,12 +42,12 @@ 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, - SPUTargetMachine &tm, + TargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; public: - SPUTargetMachine(const Module &M, const std::string &FS); + SPUTargetMachine(const Target &T, const Module &M, const std::string &FS); /// Return the subtarget implementation object virtual const SPUSubtarget *getSubtargetImpl() const { @@ -66,12 +66,6 @@ public: virtual TargetJITInfo *getJITInfo() { return NULL; } - - //! Module match function - /*! - Module matching function called by TargetMachineRegistry(). - */ - static unsigned getModuleMatchQuality(const Module &M); virtual SPUTargetLowering *getTargetLowering() const { return const_cast<SPUTargetLowering*>(&TLInfo); |