diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-04-25 10:18:25 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-04-25 10:18:25 +0000 |
commit | 93c49d5e58d25cde1a6b0acac8e2a322534c8c36 (patch) | |
tree | 4ebb4f66fc308b5190bcdcd7f4863f465e69344a /llvm/tools/llvm-mca/llvm-mca.cpp | |
parent | 80daae2736696efd64238add0ed1cce9797f9d83 (diff) | |
download | bcm5719-llvm-93c49d5e58d25cde1a6b0acac8e2a322534c8c36.tar.gz bcm5719-llvm-93c49d5e58d25cde1a6b0acac8e2a322534c8c36.zip |
[llvm-mca] Default to the native host cpu if flag -mcpu is not specified.
llvm-svn: 330809
Diffstat (limited to 'llvm/tools/llvm-mca/llvm-mca.cpp')
-rw-r--r-- | llvm/tools/llvm-mca/llvm-mca.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp index da0a3628c2f..0e1d18ee09e 100644 --- a/llvm/tools/llvm-mca/llvm-mca.cpp +++ b/llvm/tools/llvm-mca/llvm-mca.cpp @@ -16,7 +16,7 @@ // -o <file> // // The target defaults to the host target. -// The cpu defaults to 'generic'. +// The cpu defaults to the 'native' host cpu. // The output defaults to standard output. // //===----------------------------------------------------------------------===// @@ -38,6 +38,7 @@ #include "llvm/MC/MCParser/MCTargetAsmParser.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/Support/Host.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/FileSystem.h" @@ -69,7 +70,7 @@ static cl::opt<std::string> static cl::opt<std::string> MCPU("mcpu", cl::desc("Target a specific cpu type (-mcpu=help for details)"), - cl::value_desc("cpu-name"), cl::init("generic")); + cl::value_desc("cpu-name"), cl::init("native")); static cl::opt<int> OutputAsmVariant("output-asm-variant", @@ -329,6 +330,10 @@ int main(int argc, char **argv) { MCStreamerWrapper Str(Ctx, Regions); std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo()); + + if (!MCPU.compare("native")) + MCPU = llvm::sys::getHostCPUName(); + std::unique_ptr<MCSubtargetInfo> STI( TheTarget->createMCSubtargetInfo(TripleName, MCPU, /* FeaturesStr */ "")); if (!STI->isCPUStringValid(MCPU)) |