diff options
author | Dylan Noblesmith <nobled@dreamwidth.org> | 2011-12-12 04:20:36 +0000 |
---|---|---|
committer | Dylan Noblesmith <nobled@dreamwidth.org> | 2011-12-12 04:20:36 +0000 |
commit | 7f26246a7101ccdb26679a55d8bd8c5331e35e0e (patch) | |
tree | 2f00a34e0f2d9ed1cf58fbe6ea04ab2d6f0045bd /llvm/lib/ExecutionEngine/TargetSelect.cpp | |
parent | 08608f6744b7bf179193f0891119d1f8ccc3568f (diff) | |
download | bcm5719-llvm-7f26246a7101ccdb26679a55d8bd8c5331e35e0e.tar.gz bcm5719-llvm-7f26246a7101ccdb26679a55d8bd8c5331e35e0e.zip |
ExecutionEngine: refactor interface
The OptLevel is now redundant with the TargetMachine*.
And selectTarget() isn't really JIT-specific and could probably
get refactored into one of the lower level libraries.
llvm-svn: 146355
Diffstat (limited to 'llvm/lib/ExecutionEngine/TargetSelect.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/TargetSelect.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/llvm/lib/ExecutionEngine/TargetSelect.cpp b/llvm/lib/ExecutionEngine/TargetSelect.cpp index ea93a77287c..3937fe55c24 100644 --- a/llvm/lib/ExecutionEngine/TargetSelect.cpp +++ b/llvm/lib/ExecutionEngine/TargetSelect.cpp @@ -7,26 +7,26 @@ // //===----------------------------------------------------------------------===// // -// This just asks the TargetRegistry for the appropriate JIT to use, and allows -// the user to specify a specific one on the commandline with -march=x. Clients -// should initialize targets prior to calling createJIT. +// This just asks the TargetRegistry for the appropriate target to use, and +// allows the user to specify a specific one on the commandline with -march=x, +// -mcpu=y, and -mattr=a,-b,+c. Clients should initialize targets prior to +// calling selectTarget(). // //===----------------------------------------------------------------------===// #include "llvm/ExecutionEngine/ExecutionEngine.h" -#include "llvm/Module.h" #include "llvm/ADT/Triple.h" #include "llvm/MC/SubtargetFeature.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Host.h" #include "llvm/Support/TargetRegistry.h" -#include "llvm/Support/raw_ostream.h" + using namespace llvm; /// selectTarget - Pick a target either via -march or by guessing the native /// arch. Add any CPU features specified via -mcpu or -mattr. -TargetMachine *EngineBuilder::selectTarget(Module *Mod, +TargetMachine *EngineBuilder::selectTarget(const Triple &TargetTriple, StringRef MArch, StringRef MCPU, const SmallVectorImpl<std::string>& MAttrs, @@ -35,7 +35,7 @@ TargetMachine *EngineBuilder::selectTarget(Module *Mod, CodeModel::Model CM, CodeGenOpt::Level OL, std::string *ErrorStr) { - Triple TheTriple(Mod->getTargetTriple()); + Triple TheTriple(TargetTriple); if (TheTriple.getTriple().empty()) TheTriple.setTriple(sys::getDefaultTargetTriple()); @@ -57,7 +57,7 @@ TargetMachine *EngineBuilder::selectTarget(Module *Mod, } // Adjust the triple to match (if known), otherwise stick with the - // module/host triple. + // requested/host triple. Triple::ArchType Type = Triple::getArchTypeForLLVMName(MArch); if (Type != Triple::UnknownArch) TheTriple.setArch(Type); @@ -71,12 +71,6 @@ TargetMachine *EngineBuilder::selectTarget(Module *Mod, } } - if (!TheTarget->hasJIT()) { - errs() << "WARNING: This target JIT is not designed for the host you are" - << " running. If bad things happen, please choose a different " - << "-march switch.\n"; - } - // Package up features to be passed to target/subtarget std::string FeaturesStr; if (!MAttrs.empty()) { |