diff options
author | Stuart Hastings <stuart@apple.com> | 2009-07-15 17:27:11 +0000 |
---|---|---|
committer | Stuart Hastings <stuart@apple.com> | 2009-07-15 17:27:11 +0000 |
commit | 2286f8dc4cec0625f7d7a14e2570926cf8599646 (patch) | |
tree | 2443581013659cf94139995c03b6883ff4ab43db /lib/Target/CellSPU | |
parent | 7fe3dd5b7ea9ef7d3cfd6d26dfdd7ddf49718339 (diff) | |
download | external_llvm-2286f8dc4cec0625f7d7a14e2570926cf8599646.zip external_llvm-2286f8dc4cec0625f7d7a14e2570926cf8599646.tar.gz external_llvm-2286f8dc4cec0625f7d7a14e2570926cf8599646.tar.bz2 |
Revert 75762, 75763, 75766..75769, 75772..75775, 75778, 75780, 75782 to repair broken LLVM-GCC build.
Will revert 75770 in the llvm-gcc trunk.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75799 91177308-0d34-0410-b5e6-96231b3b80d8
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, 31 insertions, 18 deletions
diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index 0c36457..f0d8a36 100644 --- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp +++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp @@ -37,7 +37,6 @@ #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> @@ -290,7 +289,7 @@ namespace { class VISIBILITY_HIDDEN LinuxAsmPrinter : public SPUAsmPrinter { DwarfWriter *DW; public: - explicit LinuxAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, + explicit LinuxAsmPrinter(formatted_raw_ostream &O, SPUTargetMachine &TM, const TargetAsmInfo *T, bool V) : SPUAsmPrinter(O, TM, T, V), DW(0) {} @@ -600,11 +599,14 @@ bool LinuxAsmPrinter::doFinalization(Module &M) { /// that the Linux SPU assembler can deal with. /// FunctionPass *llvm::createSPUAsmPrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, + SPUTargetMachine &tm, bool verbose) { return new LinuxAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } +// Force static initialization. +extern "C" void LLVMInitializeCellSPUAsmPrinter() { } + namespace { static struct Register { Register() { @@ -612,9 +614,3 @@ 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 f76fc82..0262348 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, - TargetMachine &tm, + SPUTargetMachine &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 3a659d8..5c794c9 100644 --- a/lib/Target/CellSPU/SPUTargetMachine.cpp +++ b/lib/Target/CellSPU/SPUTargetMachine.cpp @@ -23,11 +23,10 @@ using namespace llvm; -extern Target TheCellSPUTarget; namespace { // Register the targets RegisterTarget<SPUTargetMachine> - CELLSPU(TheCellSPUTarget, "cellspu", "STI CBEA Cell SPU [experimental]"); + CELLSPU("cellspu", "STI CBEA Cell SPU [experimental]"); } // No assembler printer by default @@ -48,10 +47,22 @@ SPUTargetMachine::createTargetAsmInfo() const return new SPULinuxTargetAsmInfo(*this); } -SPUTargetMachine::SPUTargetMachine(const Target &T, const Module &M, - const std::string &FS) - : LLVMTargetMachine(T), - Subtarget(*this, M, FS), +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), DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this), FrameInfo(*this), diff --git a/lib/Target/CellSPU/SPUTargetMachine.h b/lib/Target/CellSPU/SPUTargetMachine.h index 18f525d..ce8e550 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, - TargetMachine &tm, + SPUTargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; public: - SPUTargetMachine(const Target &T, const Module &M, const std::string &FS); + SPUTargetMachine(const Module &M, const std::string &FS); /// Return the subtarget implementation object virtual const SPUSubtarget *getSubtargetImpl() const { @@ -66,6 +66,12 @@ 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); |