summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2013-05-09 13:14:39 +0200
committerAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2014-05-09 23:20:47 +0200
commit210661236e93ca80679c935a5555b901d22ef1af (patch)
tree5e5d5f66257dea07b25797f1eebb4cb7a599872d
parent677ff22d1907a315e33cd3f5ef636ba3d580e20b (diff)
downloadclang-210661236e93ca80679c935a5555b901d22ef1af.tar.gz
clang-210661236e93ca80679c935a5555b901d22ef1af.tar.bz2
clang-210661236e93ca80679c935a5555b901d22ef1af.tar.xz
[Embtk] ARM: getARMTargetCPU(): use default configured cpu if -march and -mcpu are not specified
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
-rw-r--r--lib/Driver/ToolChain.cpp4
-rw-r--r--lib/Driver/Tools.cpp3
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index 36aae33ec8..ee2f5c5239 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -21,6 +21,7 @@
#include "llvm/Option/Option.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Host.h"
using namespace clang::driver;
using namespace clang;
using namespace llvm::opt;
@@ -172,6 +173,9 @@ static const char *getARMTargetCPU(const ArgList &Args,
// If we have -mcpu=, use that.
if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
return A->getValue();
+ else if (llvm::sys::hasDefaultTargetCpu())
+ // Default target mcpu was configured, return it!
+ return llvm::sys::getDefaultTargetCpu().c_str();
}
StringRef MArch;
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 30782e995d..18aea1ec2a 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -488,6 +488,9 @@ static std::string getARMTargetCPU(const ArgList &Args,
return llvm::sys::getHostCPUName();
else
return MCPU;
+ } else if (llvm::sys::hasDefaultTargetCpu()) {
+ // Default target mcpu was configured, return it!
+ return llvm::sys::getDefaultTargetCpu();
}
StringRef MArch;