auto merge of #8410 : luqmana/rust/mcpu, r=sanxiyn

Adds `--target-cpu` flag which lets you choose a more specific target cpu instead of just passing the default, `generic`. It's more or less akin to `-mcpu`/`-mtune` in clang/gcc.
This commit is contained in:
bors
2013-08-11 20:50:14 -07:00
6 changed files with 36 additions and 28 deletions

View File

@@ -372,6 +372,7 @@ extern "C" bool
LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
LLVMModuleRef M,
const char *triple,
const char *cpu,
const char *feature,
const char *path,
TargetMachine::CodeGenFileType FileType,
@@ -401,7 +402,7 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
std::string Err;
std::string Trip(Triple::normalize(triple));
std::string FeaturesStr(feature);
std::string CPUStr("generic");
std::string CPUStr(cpu);
const Target *TheTarget = TargetRegistry::lookupTarget(Trip, Err);
TargetMachine *Target =
TheTarget->createTargetMachine(Trip, CPUStr, FeaturesStr,