summaryrefslogtreecommitdiff
path: root/tools/llc
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2005-09-01 21:38:21 +0000
committerJim Laskey <jlaskey@mac.com>2005-09-01 21:38:21 +0000
commitb1e1180ca0b32f37aa74d7ad703eeaf91e66c8fa (patch)
treea34f84ab3bb875ee64e139f707e7591a5d162eca /tools/llc
parentb3302db18a779527a4b1cd7a2024543ade7e83c6 (diff)
downloadllvm-b1e1180ca0b32f37aa74d7ad703eeaf91e66c8fa.tar.gz
llvm-b1e1180ca0b32f37aa74d7ad703eeaf91e66c8fa.tar.bz2
llvm-b1e1180ca0b32f37aa74d7ad703eeaf91e66c8fa.tar.xz
1. Use SubtargetFeatures in llc/lli.
2. Propagate feature "string" to all targets. 3. Implement use of SubtargetFeatures in PowerPCTargetSubtarget. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23192 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llc')
-rw-r--r--tools/llc/llc.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 8331ecfed1..fbd2cf85fd 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -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<bool> Force("f", cl::desc("Overwrite output files"));
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 @@ int main(int argc, char **argv) {
}
}
- 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();