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 | |
parent | 7fe3dd5b7ea9ef7d3cfd6d26dfdd7ddf49718339 (diff) |
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')
44 files changed, 478 insertions, 235 deletions
diff --git a/lib/Target/ARM/ARM.h b/lib/Target/ARM/ARM.h index 1b5b828395..f6ae6806fd 100644 --- a/lib/Target/ARM/ARM.h +++ b/lib/Target/ARM/ARM.h @@ -94,7 +94,7 @@ inline static const char *ARMCondCodeToString(ARMCC::CondCodes CC) { FunctionPass *createARMISelDag(ARMBaseTargetMachine &TM); FunctionPass *createARMCodePrinterPass(formatted_raw_ostream &O, - TargetMachine &TM, + ARMBaseTargetMachine &TM, bool Verbose); FunctionPass *createARMCodeEmitterPass(ARMBaseTargetMachine &TM, MachineCodeEmitter &MCE); diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index ad80020738..932659d8b6 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -36,11 +36,8 @@ extern "C" int ARMTargetMachineModule; int ARMTargetMachineModule = 0; // Register the target. -extern Target TheARMTarget; -static RegisterTarget<ARMTargetMachine> X(TheARMTarget, "arm", "ARM"); - -extern Target TheThumbTarget; -static RegisterTarget<ThumbTargetMachine> Y(TheThumbTarget, "thumb", "Thumb"); +static RegisterTarget<ARMTargetMachine> X("arm", "ARM"); +static RegisterTarget<ThumbTargetMachine> Y("thumb", "Thumb"); // Force static initialization. extern "C" void LLVMInitializeARMTarget() { } @@ -48,32 +45,57 @@ extern "C" void LLVMInitializeARMTarget() { } // No assembler printer by default ARMBaseTargetMachine::AsmPrinterCtorFn ARMBaseTargetMachine::AsmPrinterCtor = 0; +/// ThumbTargetMachine - Create an Thumb architecture model. +/// +unsigned ThumbTargetMachine::getJITMatchQuality() { +#if defined(__thumb__) + return 10; +#endif + return 0; +} + +unsigned ThumbTargetMachine::getModuleMatchQuality(const Module &M) { + std::string TT = M.getTargetTriple(); + // Match thumb-foo-bar, as well as things like thumbv5blah-* + if (TT.size() >= 6 && + (TT.substr(0, 6) == "thumb-" || TT.substr(0, 6) == "thumbv")) + return 20; + + // If the target triple is something non-thumb, we don't match. + if (!TT.empty()) return 0; + + if (M.getEndianness() == Module::LittleEndian && + M.getPointerSize() == Module::Pointer32) + return 10; // Weak match + else if (M.getEndianness() != Module::AnyEndianness || + M.getPointerSize() != Module::AnyPointerSize) + return 0; // Match for some other target + + return getJITMatchQuality()/2; +} + /// TargetMachine ctor - Create an ARM architecture model. /// -ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, - const Module &M, +ARMBaseTargetMachine::ARMBaseTargetMachine(const Module &M, const std::string &FS, bool isThumb) - : LLVMTargetMachine(T), - Subtarget(M, FS, isThumb), + : Subtarget(M, FS, isThumb), FrameInfo(Subtarget), JITInfo(), InstrItins(Subtarget.getInstrItineraryData()) { DefRelocModel = getRelocationModel(); } -ARMTargetMachine::ARMTargetMachine(const Target &T, const Module &M, - const std::string &FS) - : ARMBaseTargetMachine(T, M, FS, false), InstrInfo(Subtarget), +ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS) + : ARMBaseTargetMachine(M, FS, false), InstrInfo(Subtarget), DataLayout(Subtarget.isAPCS_ABI() ? std::string("e-p:32:32-f64:32:32-i64:32:32") : std::string("e-p:32:32-f64:64:64-i64:64:64")), TLInfo(*this) { } -ThumbTargetMachine::ThumbTargetMachine(const Target &T, const Module &M, - const std::string &FS) - : ARMBaseTargetMachine(T, M, FS, true), +ThumbTargetMachine::ThumbTargetMachine(const Module &M, const std::string &FS) + : ARMBaseTargetMachine(M, FS, true), DataLayout(Subtarget.isAPCS_ABI() ? std::string("e-p:32:32-f64:32:32-i64:32:32-" "i16:16:32-i8:8:32-i1:8:32-a:0:32") : @@ -87,6 +109,32 @@ ThumbTargetMachine::ThumbTargetMachine(const Target &T, const Module &M, InstrInfo = new Thumb1InstrInfo(Subtarget); } +unsigned ARMTargetMachine::getJITMatchQuality() { +#if defined(__arm__) + return 10; +#endif + return 0; +} + +unsigned ARMTargetMachine::getModuleMatchQuality(const Module &M) { + std::string TT = M.getTargetTriple(); + // Match arm-foo-bar, as well as things like armv5blah-* + if (TT.size() >= 4 && + (TT.substr(0, 4) == "arm-" || TT.substr(0, 4) == "armv")) + return 20; + // If the target triple is something non-arm, we don't match. + if (!TT.empty()) return 0; + + if (M.getEndianness() == Module::LittleEndian && + M.getPointerSize() == Module::Pointer32) + return 10; // Weak match + else if (M.getEndianness() != Module::AnyEndianness || + M.getPointerSize() != Module::AnyPointerSize) + return 0; // Match for some other target + + return getJITMatchQuality()/2; +} + const TargetAsmInfo *ARMBaseTargetMachine::createTargetAsmInfo() const { switch (Subtarget.TargetType) { diff --git a/lib/Target/ARM/ARMTargetMachine.h b/lib/Target/ARM/ARMTargetMachine.h index 3fe259ad08..56b18ae36a 100644 --- a/lib/Target/ARM/ARMTargetMachine.h +++ b/lib/Target/ARM/ARMTargetMachine.h @@ -42,13 +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, + ARMBaseTargetMachine &tm, bool verbose); static AsmPrinterCtorFn AsmPrinterCtor; public: - ARMBaseTargetMachine(const Target &T, const Module &M, const std::string &FS, - bool isThumb); + ARMBaseTargetMachine(const Module &M, const std::string &FS, bool isThumb); virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; } virtual ARMJITInfo *getJITInfo() { return &JITInfo; } @@ -61,6 +60,9 @@ public: AsmPrinterCtor = F; } + static unsigned getModuleMatchQuality(const Module &M); + static unsigned getJITMatchQuality(); + virtual const TargetAsmInfo *createTargetAsmInfo() const; // Pass Pipeline Configuration @@ -97,7 +99,7 @@ class ARMTargetMachine : public ARMBaseTargetMachine { const TargetData DataLayout; // Calculates type size & alignment ARMTargetLowering TLInfo; public: - ARMTargetMachine(const Target &T, const Module &M, const std::string &FS); + ARMTargetMachine(const Module &M, const std::string &FS); virtual const ARMRegisterInfo *getRegisterInfo() const { return &InstrInfo.getRegisterInfo(); @@ -123,7 +125,7 @@ class ThumbTargetMachine : public ARMBaseTargetMachine { const TargetData DataLayout; // Calculates type size & alignment ARMTargetLowering TLInfo; public: - ThumbTargetMachine(const Target &T, const Module &M, const std::string &FS); + ThumbTargetMachine(const Module &M, const std::string &FS); /// returns either Thumb1RegisterInfo of Thumb2RegisterInfo virtual const ARMBaseRegisterInfo *getRegisterInfo() const { diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index 098f5d3225..de6adbde55 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -31,7 +31,6 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSet.h" @@ -1288,7 +1287,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) { /// regardless of whether the function is in SSA form. /// FunctionPass *llvm::createARMCodePrinterPass(formatted_raw_ostream &o, - TargetMachine &tm, + ARMBaseTargetMachine &tm, bool verbose) { return new ARMAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); } @@ -1302,8 +1301,4 @@ namespace { } // Force static initialization. -extern "C" void LLVMInitializeARMAsmPrinter() { - extern Target TheARMTarget, TheThumbTarget; - TargetRegistry::RegisterAsmPrinter(TheARMTarget, createARMCodePrinterPass); - TargetRegistry::RegisterAsmPrinter(TheThumbTarget, createARMCodePrinterPass); -} +extern "C" void LLVMInitializeARMAsmPrinter() { } diff --git a/lib/Target/Alpha/AlphaTargetMachine.cpp b/lib/Target/Alpha/AlphaTargetMachine.cpp index a7a8162c12..625d0cea54 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.cpp +++ b/lib/Target/Alpha/AlphaTargetMachine.cpp @@ -22,9 +22,7 @@ using namespace llvm; // Register the targets -extern Target TheAlphaTarget; -static RegisterTarget<AlphaTargetMachine> X(TheAlphaTarget, "alpha", - "Alpha [experimental]"); +static RegisterTarget<AlphaTargetMachine> X("alpha", "Alpha [experimental]"); // No assembler printer by default AlphaTargetMachine::AsmPrinterCtorFn AlphaTargetMachine::AsmPrinterCtor = 0; @@ -36,10 +34,35 @@ const TargetAsmInfo *AlphaTargetMachine::createTargetAsmInfo() const { return new AlphaTargetAsmInfo(*this); } -AlphaTargetMachine::AlphaTargetMachine(const Target &T, const Module &M, - const std::string &FS) - : LLVMTargetMachine(T), - DataLayout("e-f128:128:128"), +unsigned AlphaTargetMachine::getModuleMatchQuality(const Module &M) { + // We strongly match "alpha*". + std::string TT = M.getTargetTriple(); + if (TT.size() >= 5 && TT[0] == 'a' && TT[1] == 'l' && TT[2] == 'p' && + TT[3] == 'h' && TT[4] == 'a') + return 20; + // If the target triple is something non-alpha, we don't match. + if (!TT.empty()) return 0; + + if (M.getEndianness() == Module::LittleEndian && + M.getPointerSize() == Module::Pointer64) + return 10; // Weak match + else if (M.getEndianness() != Module::AnyEndianness || + M.getPointerSize() != Module::AnyPointerSize) + return 0; // Match for some other target + + return getJITMatchQuality()/2; +} + +unsigned AlphaTargetMachine::getJITMatchQuality() { +#ifdef __alpha + return 10; +#else + return 0; +#endif +} + +AlphaTargetMachine::AlphaTargetMachine(const Module &M, const std::string &FS) + : DataLayout("e-f128:128:128"), FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), JITInfo(*this), Subtarget(M, FS), diff --git a/lib/Target/Alpha/AlphaTargetMachine.h b/lib/Target/Alpha/AlphaTargetMachine.h index 6125ce57fc..75468923d8 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.h +++ b/lib/Target/Alpha/AlphaTargetMachine.h @@ -45,7 +45,7 @@ protected: static AsmPrinterCtorFn AsmPrinterCtor; public: - AlphaTargetMachine(const Target &T, const Module &M, const std::string &FS); + AlphaTargetMachine(const Module &M, const std::string &FS); virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } @@ -61,6 +61,9 @@ public: return &JITInfo; } + static unsigned getJITMatchQuality(); + static unsigned getModuleMatchQuality(const Module &M); + // Pass Pipeline Configuration virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel); diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp index ea810df721..21622dbc72 100644 --- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp @@ -24,7 +24,6 @@ #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/Target/TargetRegistry.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Mangler.h" @@ -293,6 +292,9 @@ bool AlphaAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, return false; } +// Force static initialization. +extern "C" void LLVMInitializeAlphaAsmPrinter() { } + namespace { static struct Register { Register() { @@ -300,10 +302,3 @@ namespace { } } Registrator; } - -// Force static initialization. -extern "C" void LLVMInitializeAlphaAsmPrinter() { - extern Target TheAlphaTarget; - TargetRegistry::RegisterAsmPrinter(TheAlphaTarget, - createAlphaCodePrinterPass); -} diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index b1361e8c26..caf91c882e 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -30,10 +30,9 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/IntrinsicLowering.h" #include "llvm/Transforms/Scalar.h" +#include "llvm/Target/TargetMachineRegistry.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" #include "llvm/Support/ErrorHandling.h" @@ -59,8 +58,7 @@ extern "C" int CBackendTargetMachineModule; int CBackendTargetMachineModule = 0; // Register the target. -extern Target TheCBackendTarget; -static RegisterTarget<CTargetMachine> X(TheCBackendTarget, "c", "C backend"); +static RegisterTarget<CTargetMachine> X("c", "C backend"); // Force static initialization. extern "C" void LLVMInitializeCBackendTarget() { } @@ -3188,27 +3186,27 @@ std::string CWriter::InterpretASMConstraint(InlineAsm::ConstraintInfo& c) { const char *const *table = 0; - // Grab the translation table from TargetAsmInfo if it exists. + //Grab the translation table from TargetAsmInfo if it exists if (!TAsm) { std::string E; - const Target *Match = - TargetRegistry::getClosestStaticTargetForModule(*TheModule, E); + const TargetMachineRegistry::entry* Match = + TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, E); if (Match) { - // Per platform Target Machines don't exist, so create it; - // this must be done only once. - const TargetMachine* TM = Match->createTargetMachine(*TheModule, ""); + //Per platform Target Machines don't exist, so create it + // this must be done only once + const TargetMachine* TM = Match->CtorFn(*TheModule, ""); TAsm = TM->getTargetAsmInfo(); } } if (TAsm) table = TAsm->getAsmCBE(); - // Search the translation table if it exists. + //Search the translation table if it exists for (int i = 0; table && table[i]; i += 2) if (c.Codes[0] == table[i]) return table[i+1]; - // Default is identity. + //default is identity return c.Codes[0]; } diff --git a/lib/Target/CBackend/CTargetMachine.h b/lib/Target/CBackend/CTargetMachine.h index b1d9e0775e..64b373bdf0 100644 --- a/lib/Target/CBackend/CTargetMachine.h +++ b/lib/Target/CBackend/CTargetMachine.h @@ -22,14 +22,18 @@ namespace llvm { struct CTargetMachine : public TargetMachine { const TargetData DataLayout; // Calculates type size & alignment - CTargetMachine(const Target &T, const Module &M, const std::string &FS) - : TargetMachine(T), DataLayout(&M) {} + CTargetMachine(const Module &M, const std::string &FS) + : DataLayout(&M) {} virtual bool WantsWholeFile() const { return true; } virtual bool addPassesToEmitWholeFile(PassManager &PM, formatted_raw_ostream &Out, CodeGenFileType FileType, CodeGenOpt::Level OptLevel); + + // This class always works, but must be requested explicitly on + // llc command line. + static unsigned getModuleMatchQuality(const Module &M) { return 0; } virtual const TargetData *getTargetData() const { return &DataLayout; } }; diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index 0c36457913..f0d8a36132 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 f76fc82e28..02623486dc 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 3a659d8e4d..5c794c9ffa 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 18f525d1c8..ce8e55058e 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); diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 7b2995f9b0..b2d72dd228 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -81,8 +81,7 @@ extern "C" int CppBackendTargetMachineModule; int CppBackendTargetMachineModule = 0; // Register the target. -extern Target TheCppBackendTarget; -static RegisterTarget<CPPTargetMachine> X(TheCppBackendTarget, "cpp", "C++ backend"); +static RegisterTarget<CPPTargetMachine> X("cpp", "C++ backend"); // Force static initialization. extern "C" void LLVMInitializeCppBackendTarget() { } diff --git a/lib/Target/CppBackend/CPPTargetMachine.h b/lib/Target/CppBackend/CPPTargetMachine.h index 4d6d5fe35d..84a07eaece 100644 --- a/lib/Target/CppBackend/CPPTargetMachine.h +++ b/lib/Target/CppBackend/CPPTargetMachine.h @@ -24,8 +24,8 @@ class formatted_raw_ostream; struct CPPTargetMachine : public TargetMachine { const TargetData DataLayout; // Calculates type size & alignment - CPPTargetMachine(const Target &T, const Module &M, const std::string &FS) - : TargetMachine(T), DataLayout(&M) {} + CPPTargetMachine(const Module &M, const std::string &FS) + : DataLayout(&M) {} virtual bool WantsWholeFile() const { return true; } virtual bool addPassesToEmitWholeFile(PassManager &PM, @@ -33,6 +33,9 @@ struct CPPTargetMachine : public TargetMachine { CodeGenFileType FileType, CodeGenOpt::Level OptLevel); |