[PATCH] D14121: Thumb state not being passed through to LLVM triple when using clang -cc1as
Alexandros Lamprineas via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 27 10:31:39 PDT 2015
labrinea updated this revision to Diff 38558.
http://reviews.llvm.org/D14121
Files:
lib/Driver/ToolChain.cpp
lib/Driver/Tools.cpp
test/Driver/arm-ias-Wa.s
Index: test/Driver/arm-ias-Wa.s
===================================================================
--- test/Driver/arm-ias-Wa.s
+++ test/Driver/arm-ias-Wa.s
@@ -62,3 +62,17 @@
// 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: | FileCheck -check-prefix=CHECK-A-PROFILE %s
+// CHECK-A-PROFILE: "-triple" "armv7-none--eabi"
+
+// 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 thumbv7m-none-eabi -c %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-M-PROFILE %s
+// CHECK-M-PROFILE: "-triple" "thumbv7m-none--eabi"
+
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5561,7 +5561,7 @@
const InputInfo &Input = Inputs[0];
std::string TripleStr =
- getToolChain().ComputeEffectiveClangTriple(Args, Input.getType());
+ getToolChain().ComputeEffectiveClangTriple(Args);
const llvm::Triple Triple(TripleStr);
// Don't warn about "clang -w -c foo.s"
Index: lib/Driver/ToolChain.cpp
===================================================================
--- lib/Driver/ToolChain.cpp
+++ 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,26 +468,24 @@
: 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") ||
+ bool ThumbDefault = (ARM::parseArchProfile(Suffix) == ARM::PK_M) ||
(Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());
// FIXME: this is invalid for WindowsCE
if (getTriple().isOSWindows())
ThumbDefault = true;
std::string ArchName;
- if (IsBigEndian)
- ArchName = "armeb";
- 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))
+ if (Args.hasFlag(options::OPT_mthumb, options::OPT_mno_thumb, ThumbDefault))
{
if (IsBigEndian)
ArchName = "thumbeb";
else
ArchName = "thumb";
+ } else {
+ if (IsBigEndian)
+ ArchName = "armeb";
+ else
+ ArchName = "arm";
}
Triple.setArchName(ArchName + Suffix.str());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14121.38558.patch
Type: text/x-patch
Size: 3095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151027/64679adc/attachment.bin>
More information about the cfe-commits
mailing list