diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-16 02:23:53 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-16 02:23:53 +0000 |
commit | 1d929216916dc992f8643dda971aac58d47c7765 (patch) | |
tree | 95937fb8f9db3e4f08bd10374c36eac41aff0e4b /tools/llc | |
parent | 603bea32743dc9914a1d32ae36fc64fe497af801 (diff) | |
download | external_llvm-1d929216916dc992f8643dda971aac58d47c7765.zip external_llvm-1d929216916dc992f8643dda971aac58d47c7765.tar.gz external_llvm-1d929216916dc992f8643dda971aac58d47c7765.tar.bz2 |
Switch llc and createJIT to use simpler command line parsing for -march.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75890 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llc')
-rw-r--r-- | tools/llc/llc.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 304638c..6d66268 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -21,7 +21,7 @@ #include "llvm/Target/SubtargetFeature.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/Target/TargetMachineRegistry.h" +#include "llvm/Target/TargetRegistry.h" #include "llvm/Transforms/Scalar.h" #include "llvm/LLVMContext.h" #include "llvm/Module.h" @@ -35,7 +35,6 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PluginLoader.h" #include "llvm/Support/PrettyStackTrace.h" -#include "llvm/Support/RegistryParser.h" #include "llvm/Analysis/Verifier.h" #include "llvm/System/Signals.h" #include "llvm/Config/config.h" @@ -68,9 +67,8 @@ OptLevel("O", static cl::opt<std::string> TargetTriple("mtriple", cl::desc("Override target triple for module")); -static cl::opt<const TargetMachineRegistry::entry*, false, - RegistryParser<TargetMachine> > -MArch("march", cl::desc("Architecture to generate code for:")); +static cl::opt<std::string> +MArch("march", cl::desc("Architecture to generate code for (see --version)")); static cl::opt<std::string> MCPU("mcpu", @@ -238,9 +236,20 @@ int main(int argc, char **argv) { // Allocate target machine. First, check whether the user has // explicitly specified an architecture to compile for. - const Target *TheTarget; - if (MArch) { - TheTarget = &MArch->TheTarget; + const Target *TheTarget = 0; + if (!MArch.empty()) { + for (TargetRegistry::iterator it = TargetRegistry::begin(), + ie = TargetRegistry::end(); it != ie; ++it) { + if (MArch == it->getName()) { + TheTarget = &*it; + break; + } + } + + if (!TheTarget) { + errs() << argv[0] << ": error: invalid target '" << MArch << "'.\n"; + return 1; + } } else { std::string Err; TheTarget = TargetRegistry::getClosestStaticTargetForModule(mod, Err); |