[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/TargetSelect.cpp
Jim Laskey
jlaskey at apple.com
Thu Sep 1 14:38:37 PDT 2005
Changes in directory llvm/lib/ExecutionEngine/JIT:
TargetSelect.cpp updated: 1.7 -> 1.8
---
Log message:
1. Use SubtargetFeatures in llc/lli.
2. Propagate feature "string" to all targets.
3. Implement use of SubtargetFeatures in PowerPCTargetSubtarget.
---
Diffs of the changes: (+24 -1)
TargetSelect.cpp | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletion(-)
Index: llvm/lib/ExecutionEngine/JIT/TargetSelect.cpp
diff -u llvm/lib/ExecutionEngine/JIT/TargetSelect.cpp:1.7 llvm/lib/ExecutionEngine/JIT/TargetSelect.cpp:1.8
--- llvm/lib/ExecutionEngine/JIT/TargetSelect.cpp:1.7 Thu Apr 21 17:45:04 2005
+++ llvm/lib/ExecutionEngine/JIT/TargetSelect.cpp Thu Sep 1 16:38:20 2005
@@ -15,6 +15,7 @@
#include "JIT.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
+#include "llvm/Target/SubtargetFeature.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetMachineRegistry.h"
#include <iostream>
@@ -23,6 +24,18 @@
static cl::opt<const TargetMachineRegistry::Entry*, false, TargetNameParser>
MArch("march", cl::desc("Architecture to generate assembly for:"));
+static cl::opt<std::string>
+MCPU("mcpu",
+ cl::desc("Target a specific cpu type"),
+ cl::value_desc("cpu-name"),
+ cl::init(""));
+
+static cl::list<std::string>
+MAttrs("mattr",
+ cl::CommaSeparated,
+ cl::desc("Target specific attributes:"),
+ cl::value_desc("attributes"));
+
/// create - Create an return a new JIT compiler if there is one available
/// for the current target. Otherwise, return null.
///
@@ -37,8 +50,18 @@
<< "-march switch.\n";
}
+ // Package up features to be passed to target/subtarget
+ std::string FeaturesStr;
+ if (MCPU.size() || MAttrs.size()) {
+ SubtargetFeatures Features;
+ Features.setCPU(MCPU);
+ for (unsigned i = 0; i != MAttrs.size(); ++i)
+ Features.AddFeature(MAttrs[i]);
+ FeaturesStr = Features.getString();
+ }
+
// Allocate a target...
- TargetMachine *Target = MArch->CtorFn(*MP->getModule(), IL);
+ TargetMachine *Target = MArch->CtorFn(*MP->getModule(), IL, FeaturesStr);
assert(Target && "Could not allocate target machine!");
// If the target supports JIT code generation, return a new JIT now.
More information about the llvm-commits
mailing list