[PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as
Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 28 03:12:26 PDT 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251507: When running clang with an arm triple such as '--target=thumbv7m-none-eabi' (authored by alelab01).
Changed prior to commit:
http://reviews.llvm.org/D14121?vs=38633&id=38643#toc
Repository:
rL LLVM
http://reviews.llvm.org/D14121
Files:
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/test/Driver/arm-ias-Wa.s
Index: cfe/trunk/test/Driver/arm-ias-Wa.s
===================================================================
--- cfe/trunk/test/Driver/arm-ias-Wa.s
+++ cfe/trunk/test/Driver/arm-ias-Wa.s
@@ -62,3 +62,20 @@
// RUN: | FileCheck --check-prefix=CHECK-DUP-HDIV %s
// CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm"
// CHECK-DUP-HDIV: "-target-feature" "+hwdiv"
+
+// ========================================================== Triple
+// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7 -c %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-{{.*}}"
+
+// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-R-PROFILE %s
+// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi"
+
+// RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN: %clang -target x86_64-apple-darwin -arch armv7m -c %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-{{.*}}"
+
Index: cfe/trunk/lib/Driver/ToolChain.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -23,10 +23,12 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetParser.h"
using namespace clang::driver;
using namespace clang::driver::tools;
using namespace clang;
+using namespace llvm;
using namespace llvm::opt;
static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
@@ -466,9 +468,9 @@
: tools::arm::getARMTargetCPU(MCPU, MArch, Triple);
StringRef Suffix =
tools::arm::getLLVMArchSuffixForARM(CPU, MArch, Triple);
- bool ThumbDefault = Suffix.startswith("v6m") || Suffix.startswith("v7m") ||
- Suffix.startswith("v7em") ||
- (Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());
+ bool IsMProfile = ARM::parseArchProfile(Suffix) == ARM::PK_M;
+ bool ThumbDefault = IsMProfile || (ARM::parseArchVersion(Suffix) == 7 &&
+ getTriple().isOSBinFormatMachO());
// FIXME: this is invalid for WindowsCE
if (getTriple().isOSWindows())
ThumbDefault = true;
@@ -478,9 +480,9 @@
else
ArchName = "arm";
- // Assembly files should start in ARM mode.
- if (InputType != types::TY_PP_Asm &&
- Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault))
+ // Assembly files should start in ARM mode, unless arch is M-profile.
+ if (IsMProfile || (InputType != types::TY_PP_Asm &&
+ Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault)))
{
if (IsBigEndian)
ArchName = "thumbeb";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14121.38643.patch
Type: text/x-patch
Size: 2920 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151028/097fae36/attachment-0001.bin>
More information about the cfe-commits
mailing list