[llvm-commits] CVS: llvm/tools/llc/llc.cpp
Jim Laskey
jlaskey at apple.com
Thu Sep 1 14:38:38 PDT 2005
Changes in directory llvm/tools/llc:
llc.cpp updated: 1.111 -> 1.112
---
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)
llc.cpp | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletion(-)
Index: llvm/tools/llc/llc.cpp
diff -u llvm/tools/llc/llc.cpp:1.111 llvm/tools/llc/llc.cpp:1.112
--- llvm/tools/llc/llc.cpp:1.111 Sat Jul 30 13:33:25 2005
+++ llvm/tools/llc/llc.cpp Thu Sep 1 16:38:21 2005
@@ -14,6 +14,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Bytecode/Reader.h"
+#include "llvm/Target/SubtargetFeature.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetMachineRegistry.h"
#include "llvm/Transforms/Scalar.h"
@@ -47,6 +48,18 @@
static cl::opt<const TargetMachineRegistry::Entry*, false, TargetNameParser>
MArch("march", cl::desc("Architecture to generate code 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"));
+
cl::opt<TargetMachine::CodeGenFileType>
FileType("filetype", cl::init(TargetMachine::AssemblyFile),
cl::desc("Choose a file type (not all types are supported by all targets):"),
@@ -114,7 +127,17 @@
}
}
- std::auto_ptr<TargetMachine> target(MArch->CtorFn(mod, 0));
+ // 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();
+ }
+
+ std::auto_ptr<TargetMachine> target(MArch->CtorFn(mod, 0, FeaturesStr));
assert(target.get() && "Could not allocate target machine!");
TargetMachine &Target = *target.get();
const TargetData &TD = Target.getTargetData();
More information about the llvm-commits
mailing list