From c4d24d4103206a390bdc60c34aea49dc1df0aace Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Fri, 8 Aug 2014 15:47:17 +0000 Subject: [PATCH] [mips] Invert the abicalls feature bit to be noabicalls so that it's possible for -mno-abicalls to take effect. Also added the testcase that should have been in r215194. This behaviour has surprised me a few times now. The problem is that the generated MipsSubtarget::ParseSubtargetFeatures() contains code like this: if ((Bits & Mips::FeatureABICalls) != 0) IsABICalls = true; so '-abicalls' means 'leave it at the default' and '+abicalls' means 'set it to true'. In this case, (and the similar -modd-spreg case) I'd like the code to be IsABICalls = (Bits & Mips::FeatureABICalls) != 0; or possibly: if ((Bits & Mips::FeatureABICalls) != 0) IsABICalls = true; else IsABICalls = false; and preferably arrange for 'Bits & Mips::FeatureABICalls' to be true by default (on some triples). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215211 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 10 ++-------- test/Driver/mips-features.c | 6 ++---- test/Driver/mips-integrated-as.s | 6 ++---- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 303d11509d..0e51c3c82c 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1040,12 +1040,8 @@ static void getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple, Features.push_back("-n64"); Features.push_back(Args.MakeArgString(ABIFeature)); - // Preserve the current default. - // FIXME: This ought to depend on Triple.getOS() - Features.push_back(Args.MakeArgString("+abicalls")); - - AddTargetFeature(Args, Features, options::OPT_mabicalls, - options::OPT_mno_abicalls, "abicalls"); + AddTargetFeature(Args, Features, options::OPT_mno_abicalls, + options::OPT_mabicalls, "noabicalls"); StringRef FloatABI = getMipsFloatABI(D, Args); if (FloatABI == "soft") { @@ -7105,8 +7101,6 @@ void gnutools::Assemble::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-mabi"); CmdArgs.push_back(ABIName.data()); - // Preserve the current default - // FIXME: This ought to depend on Triple.getOS(). CmdArgs.push_back("-mabicalls"); Args.AddLastArg(CmdArgs, options::OPT_mabicalls, options::OPT_mno_abicalls); diff --git a/test/Driver/mips-features.c b/test/Driver/mips-features.c index 964e88bfb8..f7022306fc 100644 --- a/test/Driver/mips-features.c +++ b/test/Driver/mips-features.c @@ -1,16 +1,14 @@ // Check handling MIPS specific features options. // // -mabicalls -// RUN: %clang -target mips-linux-gnu -### -c %s 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-MABICALLS %s // RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mabicalls 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MABICALLS %s -// CHECK-MABICALLS: "-target-feature" "+abicalls" +// CHECK-MABICALLS: "-target-feature" "-noabicalls" // // -mno-abicalls // RUN: %clang -target mips-linux-gnu -### -c %s -mabicalls -mno-abicalls 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MNOABICALLS %s -// CHECK-MNOABICALLS: "-target-feature" "-abicalls" +// CHECK-MNOABICALLS: "-target-feature" "+noabicalls" // // -mips16 // RUN: %clang -target mips-linux-gnu -### -c %s \ diff --git a/test/Driver/mips-integrated-as.s b/test/Driver/mips-integrated-as.s index 398ea458dc..b648650e4b 100644 --- a/test/Driver/mips-integrated-as.s +++ b/test/Driver/mips-integrated-as.s @@ -206,14 +206,12 @@ // FPXX-ODDSPREG: "-target-feature" "+fpxx" // FPXX-ODDSPREG: "-target-feature" "-nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ -// RUN: FileCheck -check-prefix=ABICALLS-ON %s // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mabicalls 2>&1 | \ // RUN: FileCheck -check-prefix=ABICALLS-ON %s // ABICALLS-ON: -cc1as -// ABICALLS-ON: "-target-feature" "+abicalls" +// ABICALLS-ON: "-target-feature" "-noabicalls" // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mno-abicalls 2>&1 | \ // RUN: FileCheck -check-prefix=ABICALLS-OFF %s // ABICALLS-OFF: -cc1as -// ABICALLS-OFF: "-target-feature" "-abicalls" +// ABICALLS-OFF: "-target-feature" "+noabicalls" -- 2.40.0