diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-11-18 14:58:34 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-11-18 14:58:34 +0000 |
commit | d2e985fd323c167e20f77b045a1d99ad166e65db (patch) | |
tree | 6a111e552c75afc66228e3d8f19b6731e4013f10 /tools/lto/LTOCodeGenerator.cpp | |
parent | ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89 (diff) | |
download | FreeBSD-src-d2e985fd323c167e20f77b045a1d99ad166e65db.zip FreeBSD-src-d2e985fd323c167e20f77b045a1d99ad166e65db.tar.gz |
Update LLVM to r89205.
Diffstat (limited to 'tools/lto/LTOCodeGenerator.cpp')
-rw-r--r-- | tools/lto/LTOCodeGenerator.cpp | 50 |
1 files changed, 8 insertions, 42 deletions
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index c621721..eb82f98 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -24,6 +24,7 @@ #include "llvm/ModuleProvider.h" #include "llvm/PassManager.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/Triple.h" #include "llvm/Analysis/Passes.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/Verifier.h" @@ -242,51 +243,16 @@ bool LTOCodeGenerator::assemble(const std::string& asmPath, // build argument list std::vector<const char*> args; - std::string targetTriple = _linker.getModule()->getTargetTriple(); + llvm::Triple targetTriple(_linker.getModule()->getTargetTriple()); + const char *arch = targetTriple.getArchNameForAssembler(); + args.push_back(tool.c_str()); - if ( targetTriple.find("darwin") != std::string::npos ) { + + if (targetTriple.getOS() == Triple::Darwin) { // darwin specific command line options - if (strncmp(targetTriple.c_str(), "i386-apple-", 11) == 0) { - args.push_back("-arch"); - args.push_back("i386"); - } - else if (strncmp(targetTriple.c_str(), "x86_64-apple-", 13) == 0) { - args.push_back("-arch"); - args.push_back("x86_64"); - } - else if (strncmp(targetTriple.c_str(), "powerpc-apple-", 14) == 0) { - args.push_back("-arch"); - args.push_back("ppc"); - } - else if (strncmp(targetTriple.c_str(), "powerpc64-apple-", 16) == 0) { - args.push_back("-arch"); - args.push_back("ppc64"); - } - else if (strncmp(targetTriple.c_str(), "arm-apple-", 10) == 0) { - args.push_back("-arch"); - args.push_back("arm"); - } - else if ((strncmp(targetTriple.c_str(), "armv4t-apple-", 13) == 0) || - (strncmp(targetTriple.c_str(), "thumbv4t-apple-", 15) == 0)) { - args.push_back("-arch"); - args.push_back("armv4t"); - } - else if ((strncmp(targetTriple.c_str(), "armv5-apple-", 12) == 0) || - (strncmp(targetTriple.c_str(), "armv5e-apple-", 13) == 0) || - (strncmp(targetTriple.c_str(), "thumbv5-apple-", 14) == 0) || - (strncmp(targetTriple.c_str(), "thumbv5e-apple-", 15) == 0)) { - args.push_back("-arch"); - args.push_back("armv5"); - } - else if ((strncmp(targetTriple.c_str(), "armv6-apple-", 12) == 0) || - (strncmp(targetTriple.c_str(), "thumbv6-apple-", 14) == 0)) { - args.push_back("-arch"); - args.push_back("armv6"); - } - else if ((strncmp(targetTriple.c_str(), "armv7-apple-", 12) == 0) || - (strncmp(targetTriple.c_str(), "thumbv7-apple-", 14) == 0)) { + if (arch != NULL) { args.push_back("-arch"); - args.push_back("armv7"); + args.push_back(arch); } // add -static to assembler command line when code model requires if ( (_assemblerPath != NULL) && (_codeModel == LTO_CODEGEN_PIC_MODEL_STATIC) ) |