diff options
Diffstat (limited to 'lib/Target/CBackend')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 22 | ||||
-rw-r--r-- | lib/Target/CBackend/CTargetMachine.h | 8 |
2 files changed, 14 insertions, 16 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index caf91c882e..b1361e8c26 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -30,9 +30,10 @@ #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" @@ -58,7 +59,8 @@ extern "C" int CBackendTargetMachineModule; int CBackendTargetMachineModule = 0; // Register the target. -static RegisterTarget<CTargetMachine> X("c", "C backend"); +extern Target TheCBackendTarget; +static RegisterTarget<CTargetMachine> X(TheCBackendTarget, "c", "C backend"); // Force static initialization. extern "C" void LLVMInitializeCBackendTarget() { } @@ -3186,27 +3188,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 TargetMachineRegistry::entry* Match = - TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, E); + const Target *Match = + TargetRegistry::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->CtorFn(*TheModule, ""); + // Per platform Target Machines don't exist, so create it; + // this must be done only once. + const TargetMachine* TM = Match->createTargetMachine(*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 64b373bdf0..b1d9e0775e 100644 --- a/lib/Target/CBackend/CTargetMachine.h +++ b/lib/Target/CBackend/CTargetMachine.h @@ -22,18 +22,14 @@ namespace llvm { struct CTargetMachine : public TargetMachine { const TargetData DataLayout; // Calculates type size & alignment - CTargetMachine(const Module &M, const std::string &FS) - : DataLayout(&M) {} + CTargetMachine(const Target &T, const Module &M, const std::string &FS) + : TargetMachine(T), 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; } }; |