diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-15 20:24:03 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-15 20:24:03 +0000 |
commit | 51b198af83cb0080c2709b04c129a3d774c07765 (patch) | |
tree | 7d6c8b0869f698fb07f0ef49b12c444a1c9ed668 /tools | |
parent | e4d54d72bd159e8b39da152557268da95a40800c (diff) | |
download | external_llvm-51b198af83cb0080c2709b04c129a3d774c07765.zip external_llvm-51b198af83cb0080c2709b04c129a3d774c07765.tar.gz external_llvm-51b198af83cb0080c2709b04c129a3d774c07765.tar.bz2 |
Reapply TargetRegistry refactoring commits.
--- Reverse-merging r75799 into '.':
U test/Analysis/PointerTracking
U include/llvm/Target/TargetMachineRegistry.h
U include/llvm/Target/TargetMachine.h
U include/llvm/Target/TargetRegistry.h
U include/llvm/Target/TargetSelect.h
U tools/lto/LTOCodeGenerator.cpp
U tools/lto/LTOModule.cpp
U tools/llc/llc.cpp
U lib/Target/PowerPC/PPCTargetMachine.h
U lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
U lib/Target/PowerPC/PPCTargetMachine.cpp
U lib/Target/PowerPC/PPC.h
U lib/Target/ARM/ARMTargetMachine.cpp
U lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
U lib/Target/ARM/ARMTargetMachine.h
U lib/Target/ARM/ARM.h
U lib/Target/XCore/XCoreTargetMachine.cpp
U lib/Target/XCore/XCoreTargetMachine.h
U lib/Target/PIC16/PIC16TargetMachine.cpp
U lib/Target/PIC16/PIC16TargetMachine.h
U lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
U lib/Target/Alpha/AlphaTargetMachine.cpp
U lib/Target/Alpha/AlphaTargetMachine.h
U lib/Target/X86/X86TargetMachine.h
U lib/Target/X86/X86.h
U lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h
U lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
U lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.h
U lib/Target/X86/X86TargetMachine.cpp
U lib/Target/MSP430/MSP430TargetMachine.cpp
U lib/Target/MSP430/MSP430TargetMachine.h
U lib/Target/CppBackend/CPPTargetMachine.h
U lib/Target/CppBackend/CPPBackend.cpp
U lib/Target/CBackend/CTargetMachine.h
U lib/Target/CBackend/CBackend.cpp
U lib/Target/TargetMachine.cpp
U lib/Target/IA64/IA64TargetMachine.cpp
U lib/Target/IA64/AsmPrinter/IA64AsmPrinter.cpp
U lib/Target/IA64/IA64TargetMachine.h
U lib/Target/IA64/IA64.h
U lib/Target/MSIL/MSILWriter.cpp
U lib/Target/CellSPU/SPUTargetMachine.h
U lib/Target/CellSPU/SPU.h
U lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
U lib/Target/CellSPU/SPUTargetMachine.cpp
U lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
U lib/Target/Mips/MipsTargetMachine.cpp
U lib/Target/Mips/MipsTargetMachine.h
U lib/Target/Mips/Mips.h
U lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
U lib/Target/Sparc/SparcTargetMachine.cpp
U lib/Target/Sparc/SparcTargetMachine.h
U lib/ExecutionEngine/JIT/TargetSelect.cpp
U lib/Support/TargetRegistry.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75820 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llc/llc.cpp | 23 | ||||
-rw-r--r-- | tools/lto/LTOCodeGenerator.cpp | 8 | ||||
-rw-r--r-- | tools/lto/LTOModule.cpp | 6 |
3 files changed, 21 insertions, 16 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index c4bb41e..47acb32 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -126,7 +126,8 @@ GetFileNameRoot(const std::string &InputFilename) { return outputFilename; } -static formatted_raw_ostream *GetOutputStream(const char *ProgName) { +static formatted_raw_ostream *GetOutputStream(const char *TargetName, + const char *ProgName) { if (OutputFilename != "") { if (OutputFilename == "-") return &fouts(); @@ -161,10 +162,10 @@ static formatted_raw_ostream *GetOutputStream(const char *ProgName) { bool Binary = false; switch (FileType) { case TargetMachine::AssemblyFile: - if (MArch->Name[0] == 'c') { - if (MArch->Name[1] == 0) + if (TargetName[0] == 'c') { + if (TargetName[1] == 0) OutputFilename += ".cbe.c"; - else if (MArch->Name[1] == 'p' && MArch->Name[2] == 'p') + else if (TargetName[1] == 'p' && TargetName[2] == 'p') OutputFilename += ".cpp"; else OutputFilename += ".s"; @@ -235,10 +236,13 @@ int main(int argc, char **argv) { // Allocate target machine. First, check whether the user has // explicitly specified an architecture to compile for. - if (MArch == 0) { + const Target *TheTarget; + if (MArch) { + TheTarget = &MArch->TheTarget; + } else { std::string Err; - MArch = TargetMachineRegistry::getClosestStaticTargetForModule(mod, Err); - if (MArch == 0) { + TheTarget = TargetRegistry::getClosestStaticTargetForModule(mod, Err); + if (TheTarget == 0) { errs() << argv[0] << ": error auto-selecting target for module '" << Err << "'. Please use the -march option to explicitly " << "pick a target.\n"; @@ -256,12 +260,13 @@ int main(int argc, char **argv) { FeaturesStr = Features.getString(); } - std::auto_ptr<TargetMachine> target(MArch->CtorFn(mod, FeaturesStr)); + std::auto_ptr<TargetMachine> + target(TheTarget->createTargetMachine(mod, FeaturesStr)); assert(target.get() && "Could not allocate target machine!"); TargetMachine &Target = *target.get(); // Figure out where we are going to send the output... - formatted_raw_ostream *Out = GetOutputStream(argv[0]); + formatted_raw_ostream *Out = GetOutputStream(TheTarget->getName(), argv[0]); if (Out == 0) return 1; CodeGenOpt::Level OLvl = CodeGenOpt::Default; diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index 9596057..5176359 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -329,9 +329,9 @@ bool LTOCodeGenerator::determineTarget(std::string& errMsg) if ( _target == NULL ) { // create target machine from info for merged modules Module* mergedModule = _linker.getModule(); - const TargetMachineRegistry::entry* march = - TargetMachineRegistry::getClosestStaticTargetForModule( - *mergedModule, errMsg); + const Target *march = + TargetRegistry::getClosestStaticTargetForModule(*mergedModule, + errMsg); if ( march == NULL ) return true; @@ -352,7 +352,7 @@ bool LTOCodeGenerator::determineTarget(std::string& errMsg) // construct LTModule, hand over ownership of module and target std::string FeatureStr = getFeatureString(_linker.getModule()->getTargetTriple().c_str()); - _target = march->CtorFn(*mergedModule, FeatureStr.c_str()); + _target = march->createTargetMachine(*mergedModule, FeatureStr.c_str()); } return false; } diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index 38ee1cc..be6543c 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -147,15 +147,15 @@ LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer, if ( !m ) return NULL; // find machine architecture for this module - const TargetMachineRegistry::entry* march = - TargetMachineRegistry::getClosestStaticTargetForModule(*m, errMsg); + const Target* march = + TargetRegistry::getClosestStaticTargetForModule(*m, errMsg); if ( march == NULL ) return NULL; // construct LTModule, hand over ownership of module and target std::string FeatureStr = getFeatureString(m->getTargetTriple().c_str()); - TargetMachine* target = march->CtorFn(*m, FeatureStr); + TargetMachine* target = march->createTargetMachine(*m, FeatureStr); return new LTOModule(m.take(), target); } |