r195551 - Don't pass +soft-float, +soft-float-abi to the arm assembler.
Rafael Espindola
rafael.espindola at gmail.com
Sat Nov 23 06:36:41 PST 2013
Author: rafael
Date: Sat Nov 23 08:36:40 2013
New Revision: 195551
URL: http://llvm.org/viewvc/llvm-project?rev=195551&view=rev
Log:
Don't pass +soft-float, +soft-float-abi to the arm assembler.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/arm-mfpu.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=195551&r1=195550&r2=195551&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sat Nov 23 08:36:40 2013
@@ -778,18 +778,30 @@ static StringRef getARMFloatABI(const Dr
static void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args,
- std::vector<const char *> &Features) {
+ std::vector<const char *> &Features,
+ bool ForAS) {
StringRef FloatABI = getARMFloatABI(D, Args, Triple);
- // FIXME: Note, this is a hack, the LLVM backend doesn't actually use these
- // yet (it uses the -mfloat-abi and -msoft-float options), and it is
- // stripped out by the ARM target.
- // Use software floating point operations?
- if (FloatABI == "soft")
- Features.push_back("+soft-float");
-
- // Use software floating point argument passing?
- if (FloatABI != "hard")
- Features.push_back("+soft-float-abi");
+ if (!ForAS) {
+ // FIXME: Note, this is a hack, the LLVM backend doesn't actually use these
+ // yet (it uses the -mfloat-abi and -msoft-float options), and it is
+ // stripped out by the ARM target. We should probably pass this a new
+ // -target-option, which is handled by the -cc1/-cc1as invocation.
+ //
+ // FIXME2: For consistency, it would be ideal if we set up the target
+ // machine state the same when using the frontend or the assembler. We don't
+ // currently do that for the assembler, we pass the options directly to the
+ // backend and never even instantiate the frontend TargetInfo. If we did,
+ // and used its handleTargetFeatures hook, then we could ensure the
+ // assembler and the frontend behave the same.
+
+ // Use software floating point operations?
+ if (FloatABI == "soft")
+ Features.push_back("+soft-float");
+
+ // Use software floating point argument passing?
+ if (FloatABI != "hard")
+ Features.push_back("+soft-float-abi");
+ }
// Honor -mfpu=.
if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ))
@@ -1498,7 +1510,8 @@ static void getAArch64TargetFeatures(con
}
static void getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
- const ArgList &Args, ArgStringList &CmdArgs) {
+ const ArgList &Args, ArgStringList &CmdArgs,
+ bool ForAS) {
std::vector<const char *> Features;
switch (Triple.getArch()) {
default:
@@ -1512,7 +1525,7 @@ static void getTargetFeatures(const Driv
case llvm::Triple::arm:
case llvm::Triple::thumb:
- getARMTargetFeatures(D, Triple, Args, Features);
+ getARMTargetFeatures(D, Triple, Args, Features, ForAS);
break;
case llvm::Triple::ppc:
@@ -2530,7 +2543,7 @@ void Clang::ConstructJob(Compilation &C,
}
// Add the target features
- getTargetFeatures(D, ETriple, Args, CmdArgs);
+ getTargetFeatures(D, ETriple, Args, CmdArgs, false);
// Add target specific flags.
switch(getToolChain().getArch()) {
@@ -4040,7 +4053,7 @@ void ClangAs::ConstructJob(Compilation &
// Add the target features
const Driver &D = getToolChain().getDriver();
- getTargetFeatures(D, Triple, Args, CmdArgs);
+ getTargetFeatures(D, Triple, Args, CmdArgs, true);
// Ignore explicit -force_cpusubtype_ALL option.
(void) Args.hasArg(options::OPT_force__cpusubtype__ALL);
Modified: cfe/trunk/test/Driver/arm-mfpu.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-mfpu.c?rev=195551&r1=195550&r2=195551&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arm-mfpu.c (original)
+++ cfe/trunk/test/Driver/arm-mfpu.c Sat Nov 23 08:36:40 2013
@@ -100,3 +100,7 @@
// RUN: %clang -target arm-linux-gnueabihf %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-HF %s
// CHECK-HF: "-target-cpu" "arm1136jf-s"
+
+// RUN: %clang -target armv7-apple-darwin -x assembler %s -### -c 2>&1 \
+// RUN: | FileCheck --check-prefix=ASM %s
+// ASM-NOT: -target-feature
More information about the cfe-commits
mailing list