X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FExecutionEngine%2FTargetSelect.cpp;h=3937fe55c24d07183bd57238e8108f6636b9bdf4;hp=ea93a77287cb038e10bcb06cd2532c1b808c58aa;hb=9ea47179e647e806a2c67639bfead9d254514e59;hpb=d93e4c34963e83befbe67370fa39b66530b5e193 diff --git a/lib/ExecutionEngine/TargetSelect.cpp b/lib/ExecutionEngine/TargetSelect.cpp index ea93a77287c..3937fe55c24 100644 --- a/lib/ExecutionEngine/TargetSelect.cpp +++ b/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& 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()) {