[clang] 57cf6ee - [RISCV] Add Clang frontend support for Bitmanip extension
Author: Scott Egerton Date: 2020-01-14T17:45:45Z New Revision: 57cf6ee9c84434161088c39a6f8dd2aae14eb12d URL: https://github.com/llvm/llvm-project/commit/57cf6ee9c84434161088c39a6f8dd2aae14eb12d DIFF: https://github.com/llvm/llvm-project/commit/57cf6ee9c84434161088c39a6f8dd2aae14eb12d.diff LOG: [RISCV] Add Clang frontend support for Bitmanip extension Summary: This adds the __riscv_bitmanip macro and the 'b' target feature to enable it. Reviewers: asb, simoncook, lewis-revill, PaoloS, lenary Reviewed By: lenary Subscribers: Jim, rbar, johnrusso, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71553 Added: Modified: clang/lib/Basic/Targets/RISCV.cpp clang/lib/Basic/Targets/RISCV.h clang/lib/Driver/ToolChains/Arch/RISCV.cpp clang/test/Preprocessor/riscv-target-features.c Removed: diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp index ab8272c034fd..58285f1d8134 100644 --- a/clang/lib/Basic/Targets/RISCV.cpp +++ b/clang/lib/Basic/Targets/RISCV.cpp @@ -125,6 +125,10 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts, if (HasC) Builder.defineMacro("__riscv_compressed"); + + if (HasB) { +Builder.defineMacro("__riscv_bitmanip"); + } } /// Return true if has this feature, need to sync with handleTargetFeatures. @@ -139,6 +143,7 @@ bool RISCVTargetInfo::hasFeature(StringRef Feature) const { .Case("f", HasF) .Case("d", HasD) .Case("c", HasC) + .Case("b", HasB) .Default(false); } @@ -156,6 +161,8 @@ bool RISCVTargetInfo::handleTargetFeatures(std::vector &Features, HasD = true; else if (Feature == "+c") HasC = true; +else if (Feature == "+b") + HasB = true; } return true; diff --git a/clang/lib/Basic/Targets/RISCV.h b/clang/lib/Basic/Targets/RISCV.h index 9118494a87ab..05da13230bf8 100644 --- a/clang/lib/Basic/Targets/RISCV.h +++ b/clang/lib/Basic/Targets/RISCV.h @@ -30,11 +30,12 @@ class RISCVTargetInfo : public TargetInfo { bool HasF; bool HasD; bool HasC; + bool HasB; public: RISCVTargetInfo(const llvm::Triple &Triple, const TargetOptions &) : TargetInfo(Triple), HasM(false), HasA(false), HasF(false), -HasD(false), HasC(false) { +HasD(false), HasC(false), HasB(false) { LongDoubleWidth = 128; LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::IEEEquad(); diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp index 8c343b8693f3..85869ae937e5 100644 --- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -331,6 +331,9 @@ static bool getArchFeatures(const Driver &D, StringRef MArch, case 'c': Features.push_back("+c"); break; +case 'b': + Features.push_back("+b"); + break; } } diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index a93d7e6a9a43..1d2fd60847da 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -7,6 +7,7 @@ // CHECK-NOT: __riscv_mul // CHECK-NOT: __riscv_muldiv // CHECK-NOT: __riscv_compressed +// CHECK-NOT: __riscv_bitmanip // CHECK-NOT: __riscv_flen // CHECK-NOT: __riscv_fdiv // CHECK-NOT: __riscv_fsqrt @@ -48,6 +49,12 @@ // RUN: -o - | FileCheck --check-prefix=CHECK-C-EXT %s // CHECK-C-EXT: __riscv_compressed 1 +// RUN: %clang -target riscv32-unknown-linux-gnu -march=rv32ib -x c -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-B-EXT %s +// RUN: %clang -target riscv64-unknown-linux-gnu -march=rv64ib -x c -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-B-EXT %s +// CHECK-B-EXT: __riscv_bitmanip 1 + // RUN: %clang -target riscv32-unknown-linux-gnu -march=rv32ifd -mabi=ilp32 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-SOFT %s // RUN: %clang -target riscv64-unknown-linux-gnu -march=rv64ifd -mabi=lp64 -x c -E -dM %s \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] cbe681b - Revert "[RISCV] Add Clang frontend support for Bitmanip extension"
Author: Scott Egerton Date: 2020-01-15T10:43:42Z New Revision: cbe681bd8339d3a018d25441a5f4ef9da2bd017d URL: https://github.com/llvm/llvm-project/commit/cbe681bd8339d3a018d25441a5f4ef9da2bd017d DIFF: https://github.com/llvm/llvm-project/commit/cbe681bd8339d3a018d25441a5f4ef9da2bd017d.diff LOG: Revert "[RISCV] Add Clang frontend support for Bitmanip extension" This reverts commit 57cf6ee9c84434161088c39a6f8dd2aae14eb12d. Added: Modified: clang/lib/Basic/Targets/RISCV.cpp clang/lib/Basic/Targets/RISCV.h clang/lib/Driver/ToolChains/Arch/RISCV.cpp clang/test/Preprocessor/riscv-target-features.c Removed: diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp index 58285f1d8134..ab8272c034fd 100644 --- a/clang/lib/Basic/Targets/RISCV.cpp +++ b/clang/lib/Basic/Targets/RISCV.cpp @@ -125,10 +125,6 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts, if (HasC) Builder.defineMacro("__riscv_compressed"); - - if (HasB) { -Builder.defineMacro("__riscv_bitmanip"); - } } /// Return true if has this feature, need to sync with handleTargetFeatures. @@ -143,7 +139,6 @@ bool RISCVTargetInfo::hasFeature(StringRef Feature) const { .Case("f", HasF) .Case("d", HasD) .Case("c", HasC) - .Case("b", HasB) .Default(false); } @@ -161,8 +156,6 @@ bool RISCVTargetInfo::handleTargetFeatures(std::vector &Features, HasD = true; else if (Feature == "+c") HasC = true; -else if (Feature == "+b") - HasB = true; } return true; diff --git a/clang/lib/Basic/Targets/RISCV.h b/clang/lib/Basic/Targets/RISCV.h index 05da13230bf8..9118494a87ab 100644 --- a/clang/lib/Basic/Targets/RISCV.h +++ b/clang/lib/Basic/Targets/RISCV.h @@ -30,12 +30,11 @@ class RISCVTargetInfo : public TargetInfo { bool HasF; bool HasD; bool HasC; - bool HasB; public: RISCVTargetInfo(const llvm::Triple &Triple, const TargetOptions &) : TargetInfo(Triple), HasM(false), HasA(false), HasF(false), -HasD(false), HasC(false), HasB(false) { +HasD(false), HasC(false) { LongDoubleWidth = 128; LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::IEEEquad(); diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp index 85869ae937e5..8c343b8693f3 100644 --- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp +++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp @@ -331,9 +331,6 @@ static bool getArchFeatures(const Driver &D, StringRef MArch, case 'c': Features.push_back("+c"); break; -case 'b': - Features.push_back("+b"); - break; } } diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index 1d2fd60847da..a93d7e6a9a43 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -7,7 +7,6 @@ // CHECK-NOT: __riscv_mul // CHECK-NOT: __riscv_muldiv // CHECK-NOT: __riscv_compressed -// CHECK-NOT: __riscv_bitmanip // CHECK-NOT: __riscv_flen // CHECK-NOT: __riscv_fdiv // CHECK-NOT: __riscv_fsqrt @@ -49,12 +48,6 @@ // RUN: -o - | FileCheck --check-prefix=CHECK-C-EXT %s // CHECK-C-EXT: __riscv_compressed 1 -// RUN: %clang -target riscv32-unknown-linux-gnu -march=rv32ib -x c -E -dM %s \ -// RUN: -o - | FileCheck --check-prefix=CHECK-B-EXT %s -// RUN: %clang -target riscv64-unknown-linux-gnu -march=rv64ib -x c -E -dM %s \ -// RUN: -o - | FileCheck --check-prefix=CHECK-B-EXT %s -// CHECK-B-EXT: __riscv_bitmanip 1 - // RUN: %clang -target riscv32-unknown-linux-gnu -march=rv32ifd -mabi=ilp32 -x c -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-SOFT %s // RUN: %clang -target riscv64-unknown-linux-gnu -march=rv64ifd -mabi=lp64 -x c -E -dM %s \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] a90ea38 - [Lexer] Allow UCN for dollar symbol '\u0024' in identifiers when using -fdollars-in-identifiers flag.
Author: Scott Egerton Date: 2020-01-15T11:28:57Z New Revision: a90ea386981f4fa3c7cb7f62c6900069764b05a8 URL: https://github.com/llvm/llvm-project/commit/a90ea386981f4fa3c7cb7f62c6900069764b05a8 DIFF: https://github.com/llvm/llvm-project/commit/a90ea386981f4fa3c7cb7f62c6900069764b05a8.diff LOG: [Lexer] Allow UCN for dollar symbol '\u0024' in identifiers when using -fdollars-in-identifiers flag. Summary: Previously, the -fdollars-in-identifiers flag allows the '$' symbol to be used in an identifier but the universal character name equivalent '\u0024' is not allowed. This patch changes this, so that \u0024 is valid in identifiers. Reviewers: rsmith, jordan_rose Reviewed By: rsmith Subscribers: dexonsmith, simoncook, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71758 Added: Modified: clang/lib/Lex/Lexer.cpp clang/test/Preprocessor/ucn-pp-identifier.c Removed: diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 902b17397915..648bda270578 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -1431,6 +1431,8 @@ void Lexer::SetByteOffset(unsigned Offset, bool StartOfLine) { static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) { if (LangOpts.AsmPreprocessor) { return false; + } else if (LangOpts.DollarIdents && '$' == C) { +return true; } else if (LangOpts.CPlusPlus11 || LangOpts.C11) { static const llvm::sys::UnicodeCharSet C11AllowedIDChars( C11AllowedIDCharRanges); diff --git a/clang/test/Preprocessor/ucn-pp-identifier.c b/clang/test/Preprocessor/ucn-pp-identifier.c index f045e38e94af..0929412a76ed 100644 --- a/clang/test/Preprocessor/ucn-pp-identifier.c +++ b/clang/test/Preprocessor/ucn-pp-identifier.c @@ -28,8 +28,7 @@ #define \U1000 // expected-error {{macro name must be an identifier}} #define \u0061 // expected-error {{character 'a' cannot be specified by a universal character name}} expected-error {{macro name must be an identifier}} -// FIXME: Not clear what our behavior should be here; \u0024 is "$". -#define a\u0024 // expected-warning {{whitespace}} +#define a\u0024 #if \u0110 // expected-warning {{is not defined, evaluates to 0}} #endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D13100: [mips] Separated mips specific -Wa options, so that they are not checked on other platforms.
s.egerton created this revision. s.egerton added reviewers: dsanders, vkalintiris. s.egerton added a subscriber: cfe-commits. This is a follow on to post review comments on revision r248276. http://reviews.llvm.org/D13100 Files: lib/Driver/Tools.cpp Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2351,6 +2351,11 @@ continue; } + bool IsMips = C.getDefaultToolChain().getArch() == llvm::Triple::mips || +C.getDefaultToolChain().getArch() == llvm::Triple::mipsel || +C.getDefaultToolChain().getArch() == llvm::Triple::mips64 || +C.getDefaultToolChain().getArch() == llvm::Triple::mips64el; + if (Value == "-force_cpusubtype_ALL") { // Do nothing, this is the default and we don't support anything else. } else if (Value == "-L") { @@ -2376,16 +2381,16 @@ } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") || Value.startswith("-mhwdiv") || Value.startswith("-march")) { // Do nothing, we'll validate it later. - } else if (Value == "--trap") { + } else if (IsMips && Value == "--trap") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+use-tcc-in-div"); - } else if (Value == "--break") { + } else if (IsMips && Value == "--break") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("-use-tcc-in-div"); - } else if (Value.startswith("-msoft-float")) { + } else if (IsMips && Value.startswith("-msoft-float")) { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+soft-float"); - } else if (Value.startswith("-mhard-float")) { + } else if (IsMips && Value.startswith("-mhard-float")) { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("-soft-float"); } else { Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2351,6 +2351,11 @@ continue; } + bool IsMips = C.getDefaultToolChain().getArch() == llvm::Triple::mips || +C.getDefaultToolChain().getArch() == llvm::Triple::mipsel || +C.getDefaultToolChain().getArch() == llvm::Triple::mips64 || +C.getDefaultToolChain().getArch() == llvm::Triple::mips64el; + if (Value == "-force_cpusubtype_ALL") { // Do nothing, this is the default and we don't support anything else. } else if (Value == "-L") { @@ -2376,16 +2381,16 @@ } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") || Value.startswith("-mhwdiv") || Value.startswith("-march")) { // Do nothing, we'll validate it later. - } else if (Value == "--trap") { + } else if (IsMips && Value == "--trap") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+use-tcc-in-div"); - } else if (Value == "--break") { + } else if (IsMips && Value == "--break") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("-use-tcc-in-div"); - } else if (Value.startswith("-msoft-float")) { + } else if (IsMips && Value.startswith("-msoft-float")) { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("+soft-float"); - } else if (Value.startswith("-mhard-float")) { + } else if (IsMips && Value.startswith("-mhard-float")) { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("-soft-float"); } else { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D13100: [mips] Separated mips specific -Wa options, so that they are not checked on other platforms.
s.egerton updated this revision to Diff 36252. s.egerton added a comment. Responded to comments made on the mailing list. http://reviews.llvm.org/D13100 Files: lib/Driver/Tools.cpp Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2351,10 +2351,35 @@ continue; } - bool IsMips = C.getDefaultToolChain().getArch() == llvm::Triple::mips || -C.getDefaultToolChain().getArch() == llvm::Triple::mipsel || -C.getDefaultToolChain().getArch() == llvm::Triple::mips64 || -C.getDefaultToolChain().getArch() == llvm::Triple::mips64el; + switch (C.getDefaultToolChain().getArch()) { + default: +break; + case llvm::Triple::mips: + case llvm::Triple::mipsel: + case llvm::Triple::mips64: + case llvm::Triple::mips64el: +if (Value == "--trap") { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+use-tcc-in-div"); + continue; +} +if (Value == "--break") { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-use-tcc-in-div"); + continue; +} +if (Value.startswith("-msoft-float")) { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+soft-float"); + continue; +} +if (Value.startswith("-mhard-float")) { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-soft-float"); + continue; +} +break; + } if (Value == "-force_cpusubtype_ALL") { // Do nothing, this is the default and we don't support anything else. @@ -2381,18 +2406,6 @@ } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") || Value.startswith("-mhwdiv") || Value.startswith("-march")) { // Do nothing, we'll validate it later. - } else if (IsMips && Value == "--trap") { -CmdArgs.push_back("-target-feature"); -CmdArgs.push_back("+use-tcc-in-div"); - } else if (IsMips && Value == "--break") { -CmdArgs.push_back("-target-feature"); -CmdArgs.push_back("-use-tcc-in-div"); - } else if (IsMips && Value.startswith("-msoft-float")) { -CmdArgs.push_back("-target-feature"); -CmdArgs.push_back("+soft-float"); - } else if (IsMips && Value.startswith("-mhard-float")) { -CmdArgs.push_back("-target-feature"); -CmdArgs.push_back("-soft-float"); } else { D.Diag(diag::err_drv_unsupported_option_argument) << A->getOption().getName() << Value; Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2351,10 +2351,35 @@ continue; } - bool IsMips = C.getDefaultToolChain().getArch() == llvm::Triple::mips || -C.getDefaultToolChain().getArch() == llvm::Triple::mipsel || -C.getDefaultToolChain().getArch() == llvm::Triple::mips64 || -C.getDefaultToolChain().getArch() == llvm::Triple::mips64el; + switch (C.getDefaultToolChain().getArch()) { + default: +break; + case llvm::Triple::mips: + case llvm::Triple::mipsel: + case llvm::Triple::mips64: + case llvm::Triple::mips64el: +if (Value == "--trap") { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+use-tcc-in-div"); + continue; +} +if (Value == "--break") { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-use-tcc-in-div"); + continue; +} +if (Value.startswith("-msoft-float")) { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+soft-float"); + continue; +} +if (Value.startswith("-mhard-float")) { + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-soft-float"); + continue; +} +break; + } if (Value == "-force_cpusubtype_ALL") { // Do nothing, this is the default and we don't support anything else. @@ -2381,18 +2406,6 @@ } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") || Value.startswith("-mhwdiv") || Value.startswith("-march")) { // Do nothing, we'll validate it later. - } else if (IsMips && Value == "--trap") { -CmdArgs.push_back("-target-feature"); -CmdArgs.push_back("+use-tcc-in-div"); - } else if (IsMips && Value == "--break") { -CmdArgs.push_back("-target-feature"); -CmdArgs.push_back("-use-tcc-in-div"); - } else if (IsMips && Value.startswith("-msoft-float")) { -CmdArgs.push_back("-target-feature"); -CmdArgs.push_back("+soft-float"); - } else if (IsMips && Valu
[PATCH] D12600: [mips] Added support for using the command line options -Wa, -msoft-float and -Wa, -mhard-float.
s.egerton created this revision. s.egerton added reviewers: dsanders, vkalintiris. s.egerton added a subscriber: cfe-commits. http://reviews.llvm.org/D12600 Files: lib/Driver/Tools.cpp test/Driver/mips-ias-Wa.s Index: test/Driver/mips-ias-Wa.s === --- test/Driver/mips-ias-Wa.s +++ test/Driver/mips-ias-Wa.s @@ -22,3 +22,28 @@ // RUN: FileCheck -check-prefix=TRAP-BOTH-BREAK-FIRST %s // TRAP-BOTH-BREAK-FIRST: -cc1as // TRAP-BOTH-BREAK-FIRST: "-target-feature" "-use-tcc-in-div" "-target-feature" "+use-tcc-in-div" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-DEFAULT %s +// MSOFT-FLOAT-DEFAULT: -cc1as +// MSOFT-FLOAT-DEFAULT-NOT: "-target-feature" "-soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-msoft-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-ON %s +// MSOFT-FLOAT-ON: -cc1as +// MSOFT-FLOAT-ON: "-target-feature" "+soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mhard-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-OFF %s +// MSOFT-FLOAT-OFF: -cc1as +// MSOFT-FLOAT-OFF: "-target-feature" "-soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-msoft-float,-mhard-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST %s +// MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST: -cc1as +// MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST: "-target-feature" "+soft-float" "-target-feature" "-soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mhard-float,-msoft-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s +// MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as +// MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" "-target-feature" "+soft-float" Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2341,6 +2341,12 @@ } else if (Value == "--break") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("-use-tcc-in-div"); + } else if (Value.startswith("-msoft-float")) { +CmdArgs.push_back("-target-feature"); +CmdArgs.push_back("+soft-float"); + } else if (Value.startswith("-mhard-float")) { +CmdArgs.push_back("-target-feature"); +CmdArgs.push_back("-soft-float"); } else { D.Diag(diag::err_drv_unsupported_option_argument) << A->getOption().getName() << Value; Index: test/Driver/mips-ias-Wa.s === --- test/Driver/mips-ias-Wa.s +++ test/Driver/mips-ias-Wa.s @@ -22,3 +22,28 @@ // RUN: FileCheck -check-prefix=TRAP-BOTH-BREAK-FIRST %s // TRAP-BOTH-BREAK-FIRST: -cc1as // TRAP-BOTH-BREAK-FIRST: "-target-feature" "-use-tcc-in-div" "-target-feature" "+use-tcc-in-div" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-DEFAULT %s +// MSOFT-FLOAT-DEFAULT: -cc1as +// MSOFT-FLOAT-DEFAULT-NOT: "-target-feature" "-soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-msoft-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-ON %s +// MSOFT-FLOAT-ON: -cc1as +// MSOFT-FLOAT-ON: "-target-feature" "+soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mhard-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-OFF %s +// MSOFT-FLOAT-OFF: -cc1as +// MSOFT-FLOAT-OFF: "-target-feature" "-soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-msoft-float,-mhard-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST %s +// MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST: -cc1as +// MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST: "-target-feature" "+soft-float" "-target-feature" "-soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mhard-float,-msoft-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s +// MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as +// MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" "-target-feature" "+soft-float" Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2341,6 +2341,12 @@ } else if (Value == "--break") { CmdArgs.push_back("-target-feature"); CmdArgs.push_back("-use-tcc-in-div"); + } else if (Value.startswith("-msoft-float")) { +CmdArgs.push_back("-target-feature"); +CmdArgs.push_back("+soft-float"); + } else if (Value.startswith("-mhard-float")) { +CmdArgs.push_back("-target-feature"); +CmdArgs.push_back("-soft-float"); } else { D.D
Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings
s.egerton added a subscriber: s.egerton. s.egerton added a comment. Hello. I will take a look at fixing the warnings coming from LLVMMipsAsmParser. http://reviews.llvm.org/D17983 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r257602 - [mips] Added support for -Wa,-mips32 and similar.
Author: s.egerton Date: Wed Jan 13 08:27:59 2016 New Revision: 257602 URL: http://llvm.org/viewvc/llvm-project?rev=257602&view=rev Log: [mips] Added support for -Wa,-mips32 and similar. Reviewers: vkalintiris, dsanders Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15070 Modified: cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/mips-ias-Wa.s Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=257602&r1=257601&r2=257602&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Wed Jan 13 08:27:59 2016 @@ -2580,6 +2580,7 @@ static void CollectArgsForIntegratedAsse // When using an integrated assembler, translate -Wa, and -Xassembler // options. bool CompressDebugSections = false; + const char *MipsTargetFeature = nullptr; for (const Arg *A : Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) { A->claim(); @@ -2618,7 +2619,25 @@ static void CollectArgsForIntegratedAsse CmdArgs.push_back("-soft-float"); continue; } -break; + +MipsTargetFeature = llvm::StringSwitch(Value) + .Case("-mips1", "+mips1") + .Case("-mips2", "+mips2") + .Case("-mips3", "+mips3") + .Case("-mips4", "+mips4") + .Case("-mips5", "+mips5") + .Case("-mips32", "+mips32") + .Case("-mips32r2", "+mips32r2") + .Case("-mips32r3", "+mips32r3") + .Case("-mips32r5", "+mips32r5") + .Case("-mips32r6", "+mips32r6") + .Case("-mips64", "+mips64") + .Case("-mips64r2", "+mips64r2") + .Case("-mips64r3", "+mips64r3") + .Case("-mips64r5", "+mips64r5") + .Case("-mips64r6", "+mips64r6") + .Default(nullptr); +continue; } if (Value == "-force_cpusubtype_ALL") { @@ -2666,6 +2685,10 @@ static void CollectArgsForIntegratedAsse else D.Diag(diag::warn_debug_compression_unavailable); } + if (MipsTargetFeature != nullptr) { +CmdArgs.push_back("-target-feature"); +CmdArgs.push_back(MipsTargetFeature); + } } // This adds the static libclang_rt.builtins-arch.a directly to the command line Modified: cfe/trunk/test/Driver/mips-ias-Wa.s URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-ias-Wa.s?rev=257602&r1=257601&r2=257602&view=diff == --- cfe/trunk/test/Driver/mips-ias-Wa.s (original) +++ cfe/trunk/test/Driver/mips-ias-Wa.s Wed Jan 13 08:27:59 2016 @@ -47,3 +47,94 @@ // RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" "-target-feature" "+soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips1 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS1 %s +// MIPS1: -cc1as +// MIPS1: "-target-feature" "+mips1" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS2 %s +// MIPS2: -cc1as +// MIPS2: "-target-feature" "+mips2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips3 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS3 %s +// MIPS3: -cc1as +// MIPS3: "-target-feature" "+mips3" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips4 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS4 %s +// MIPS4: -cc1as +// MIPS4: "-target-feature" "+mips4" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips5 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS5 %s +// MIPS5: -cc1as +// MIPS5: "-target-feature" "+mips5" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32 %s +// MIPS32: -cc1as +// MIPS32: "-target-feature" "+mips32" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R2 %s +// MIPS32R2: -cc1as +// MIPS32R2: "-target-feature" "+mips32r2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r3 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R3 %s +// MIPS32R3: -cc1as +// MIPS32R3: "-target-feature" "+mips32r3" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r5 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R5 %s +// MIPS32R5: -cc1as +// MIPS32R5: "-target-feature" "+mips32r5" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r6 2>&1 | \ +
r257610 - Revert r257602 because it breaks integrated-as.s on mips hosts.
Author: s.egerton Date: Wed Jan 13 10:19:33 2016 New Revision: 257610 URL: http://llvm.org/viewvc/llvm-project?rev=257610&view=rev Log: Revert r257602 because it breaks integrated-as.s on mips hosts. Modified: cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/mips-ias-Wa.s Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=257610&r1=257609&r2=257610&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Wed Jan 13 10:19:33 2016 @@ -2580,7 +2580,6 @@ static void CollectArgsForIntegratedAsse // When using an integrated assembler, translate -Wa, and -Xassembler // options. bool CompressDebugSections = false; - const char *MipsTargetFeature = nullptr; for (const Arg *A : Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) { A->claim(); @@ -2619,25 +2618,7 @@ static void CollectArgsForIntegratedAsse CmdArgs.push_back("-soft-float"); continue; } - -MipsTargetFeature = llvm::StringSwitch(Value) - .Case("-mips1", "+mips1") - .Case("-mips2", "+mips2") - .Case("-mips3", "+mips3") - .Case("-mips4", "+mips4") - .Case("-mips5", "+mips5") - .Case("-mips32", "+mips32") - .Case("-mips32r2", "+mips32r2") - .Case("-mips32r3", "+mips32r3") - .Case("-mips32r5", "+mips32r5") - .Case("-mips32r6", "+mips32r6") - .Case("-mips64", "+mips64") - .Case("-mips64r2", "+mips64r2") - .Case("-mips64r3", "+mips64r3") - .Case("-mips64r5", "+mips64r5") - .Case("-mips64r6", "+mips64r6") - .Default(nullptr); -continue; +break; } if (Value == "-force_cpusubtype_ALL") { @@ -2685,10 +2666,6 @@ static void CollectArgsForIntegratedAsse else D.Diag(diag::warn_debug_compression_unavailable); } - if (MipsTargetFeature != nullptr) { -CmdArgs.push_back("-target-feature"); -CmdArgs.push_back(MipsTargetFeature); - } } // This adds the static libclang_rt.builtins-arch.a directly to the command line Modified: cfe/trunk/test/Driver/mips-ias-Wa.s URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-ias-Wa.s?rev=257610&r1=257609&r2=257610&view=diff == --- cfe/trunk/test/Driver/mips-ias-Wa.s (original) +++ cfe/trunk/test/Driver/mips-ias-Wa.s Wed Jan 13 10:19:33 2016 @@ -47,94 +47,3 @@ // RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" "-target-feature" "+soft-float" - -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips1 2>&1 | \ -// RUN: FileCheck -check-prefix=MIPS1 %s -// MIPS1: -cc1as -// MIPS1: "-target-feature" "+mips1" - -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips2 2>&1 | \ -// RUN: FileCheck -check-prefix=MIPS2 %s -// MIPS2: -cc1as -// MIPS2: "-target-feature" "+mips2" - -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips3 2>&1 | \ -// RUN: FileCheck -check-prefix=MIPS3 %s -// MIPS3: -cc1as -// MIPS3: "-target-feature" "+mips3" - -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips4 2>&1 | \ -// RUN: FileCheck -check-prefix=MIPS4 %s -// MIPS4: -cc1as -// MIPS4: "-target-feature" "+mips4" - -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips5 2>&1 | \ -// RUN: FileCheck -check-prefix=MIPS5 %s -// MIPS5: -cc1as -// MIPS5: "-target-feature" "+mips5" - -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32 2>&1 | \ -// RUN: FileCheck -check-prefix=MIPS32 %s -// MIPS32: -cc1as -// MIPS32: "-target-feature" "+mips32" - -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r2 2>&1 | \ -// RUN: FileCheck -check-prefix=MIPS32R2 %s -// MIPS32R2: -cc1as -// MIPS32R2: "-target-feature" "+mips32r2" - -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r3 2>&1 | \ -// RUN: FileCheck -check-prefix=MIPS32R3 %s -// MIPS32R3: -cc1as -// MIPS32R3: "-target-feature" "+mips32r3" - -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r5 2>&1 | \ -// RUN: FileCheck -check-prefix=MIPS32R5 %s -// MIPS32R5: -cc1as -// MIPS32R5: "-target-feature" "+mips32r5" - -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r6 2>&1 | \ -// RUN: FileCheck -check-prefix=MIPS32R6 %s -// MIPS32R6: -cc1as -// MIPS32R6: "-target-feature" "+
r257762 - [mips] Added support for -Wa,-mips32 and similar.
Author: s.egerton Date: Thu Jan 14 07:01:48 2016 New Revision: 257762 URL: http://llvm.org/viewvc/llvm-project?rev=257762&view=rev Log: [mips] Added support for -Wa,-mips32 and similar. Reviewers: vkalintiris, dsanders Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15070 Modified: cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/mips-ias-Wa.s Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=257762&r1=257761&r2=257762&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Thu Jan 14 07:01:48 2016 @@ -2580,6 +2580,7 @@ static void CollectArgsForIntegratedAsse // When using an integrated assembler, translate -Wa, and -Xassembler // options. bool CompressDebugSections = false; + const char *MipsTargetFeature = nullptr; for (const Arg *A : Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) { A->claim(); @@ -2618,7 +2619,26 @@ static void CollectArgsForIntegratedAsse CmdArgs.push_back("-soft-float"); continue; } -break; + +MipsTargetFeature = llvm::StringSwitch(Value) +.Case("-mips1", "+mips1") +.Case("-mips2", "+mips2") +.Case("-mips3", "+mips3") +.Case("-mips4", "+mips4") +.Case("-mips5", "+mips5") +.Case("-mips32", "+mips32") +.Case("-mips32r2", "+mips32r2") +.Case("-mips32r3", "+mips32r3") +.Case("-mips32r5", "+mips32r5") +.Case("-mips32r6", "+mips32r6") +.Case("-mips64", "+mips64") +.Case("-mips64r2", "+mips64r2") +.Case("-mips64r3", "+mips64r3") +.Case("-mips64r5", "+mips64r5") +.Case("-mips64r6", "+mips64r6") +.Default(nullptr); +if (MipsTargetFeature) + continue; } if (Value == "-force_cpusubtype_ALL") { @@ -2666,6 +2686,10 @@ static void CollectArgsForIntegratedAsse else D.Diag(diag::warn_debug_compression_unavailable); } + if (MipsTargetFeature != nullptr) { +CmdArgs.push_back("-target-feature"); +CmdArgs.push_back(MipsTargetFeature); + } } // This adds the static libclang_rt.builtins-arch.a directly to the command line Modified: cfe/trunk/test/Driver/mips-ias-Wa.s URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-ias-Wa.s?rev=257762&r1=257761&r2=257762&view=diff == --- cfe/trunk/test/Driver/mips-ias-Wa.s (original) +++ cfe/trunk/test/Driver/mips-ias-Wa.s Thu Jan 14 07:01:48 2016 @@ -47,3 +47,94 @@ // RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" "-target-feature" "+soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips1 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS1 %s +// MIPS1: -cc1as +// MIPS1: "-target-feature" "+mips1" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS2 %s +// MIPS2: -cc1as +// MIPS2: "-target-feature" "+mips2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips3 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS3 %s +// MIPS3: -cc1as +// MIPS3: "-target-feature" "+mips3" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips4 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS4 %s +// MIPS4: -cc1as +// MIPS4: "-target-feature" "+mips4" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips5 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS5 %s +// MIPS5: -cc1as +// MIPS5: "-target-feature" "+mips5" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32 %s +// MIPS32: -cc1as +// MIPS32: "-target-feature" "+mips32" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R2 %s +// MIPS32R2: -cc1as +// MIPS32R2: "-target-feature" "+mips32r2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r3 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R3 %s +// MIPS32R3: -cc1as +// MIPS32R3: "-target-feature" "+mips32r3" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r5 2>&1 | \ +// RUN:
[PATCH] D15070: [mips] Added support for -Wa,-mips32 and similar.
s.egerton created this revision. s.egerton added reviewers: dsanders, vkalintiris. s.egerton added a subscriber: cfe-commits. http://reviews.llvm.org/D15070 Files: lib/Driver/Tools.cpp test/Driver/mips-ias-Wa.s Index: test/Driver/mips-ias-Wa.s === --- test/Driver/mips-ias-Wa.s +++ test/Driver/mips-ias-Wa.s @@ -47,3 +47,83 @@ // RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" "-target-feature" "+soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips1 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS1 %s +// MIPS1: -cc1as +// MIPS1: "-target-feature" "+mips1" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS2 %s +// MIPS2: -cc1as +// MIPS2: "-target-feature" "+mips2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips3 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS3 %s +// MIPS3: -cc1as +// MIPS3: "-target-feature" "+mips3" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips4 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS4 %s +// MIPS4: -cc1as +// MIPS4: "-target-feature" "+mips4" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32 %s +// MIPS32: -cc1as +// MIPS32: "-target-feature" "+mips32" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R2 %s +// MIPS32R2: -cc1as +// MIPS32R2: "-target-feature" "+mips32r2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r3 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R3 %s +// MIPS32R3: -cc1as +// MIPS32R3: "-target-feature" "+mips32r3" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r5 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R5 %s +// MIPS32R5: -cc1as +// MIPS32R5: "-target-feature" "+mips32r5" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r6 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R6 %s +// MIPS32R6: -cc1as +// MIPS32R6: "-target-feature" "+mips32r6" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64 %s +// MIPS64: -cc1as +// MIPS64: "-target-feature" "+mips64" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R2 %s +// MIPS64R2: -cc1as +// MIPS64R2: "-target-feature" "+mips64r2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r3 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R3 %s +// MIPS64R3: -cc1as +// MIPS64R3: "-target-feature" "+mips64r3" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r5 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R5 %s +// MIPS64R5: -cc1as +// MIPS64R5: "-target-feature" "+mips64r5" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r6 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R6 %s +// MIPS64R6: -cc1as +// MIPS64R6: "-target-feature" "+mips64r6" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r2,-mips4 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R2-MIPS4 %s +// MIPS64R2-MIPS4: -cc1as +// MIPS64R2-MIPS4: "-target-feature" "+mips4" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64,-mips32,-mips32r2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64-MIPS32-MIPS32R2 %s +// MIPS64-MIPS32-MIPS32R2: -cc1as +// MIPS64-MIPS32-MIPS32R2: "-target-feature" "+mips32r2" Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2498,6 +2498,30 @@ CmdArgs.push_back("-soft-float"); continue; } + +const char *Feature = llvm::StringSwitch(Value) + .Case("-mips1", "+mips1") + .Case("-mips2", "+mips2") + .Case("-mips3", "+mips3") + .Case("-mips4", "+mips4") + .Case("-mips32", "+mips32") + .Case("-mips32r2", "+mips32r2") + .Case("-mips32r3", "+mips32r3") + .Case("-mips32r5", "+mips32r5") + .Case("-mips32r6", "+mips32r6") + .Case("-mips64", "+mips64") + .Case("-mips64r2", "+mips64r2") + .Case("-mips64r3", "+mips64r3") + .Case("-mips64r5"
Re: [PATCH] D15070: [mips] Added support for -Wa, -mips32 and similar.
s.egerton updated this revision to Diff 43131. s.egerton marked 4 inline comments as done. s.egerton added a comment. Responded to reviewers comments. The -mips* option is now saved until all arguments have been parsed. The last -mips* option is the only one pushed back. The tests are now updated to check that multiple -target-feature -mips* options are not present. http://reviews.llvm.org/D15070 Files: lib/Driver/Tools.cpp test/Driver/mips-ias-Wa.s Index: test/Driver/mips-ias-Wa.s === --- test/Driver/mips-ias-Wa.s +++ test/Driver/mips-ias-Wa.s @@ -47,3 +47,91 @@ // RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" "-target-feature" "+soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips1 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS1 %s +// MIPS1: -cc1as +// MIPS1: "-target-feature" "+mips1" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS2 %s +// MIPS2: -cc1as +// MIPS2: "-target-feature" "+mips2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips3 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS3 %s +// MIPS3: -cc1as +// MIPS3: "-target-feature" "+mips3" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips4 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS4 %s +// MIPS4: -cc1as +// MIPS4: "-target-feature" "+mips4" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips5 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS5 %s +// MIPS5: -cc1as +// MIPS5: "-target-feature" "+mips5" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32 %s +// MIPS32: -cc1as +// MIPS32: "-target-feature" "+mips32" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R2 %s +// MIPS32R2: -cc1as +// MIPS32R2: "-target-feature" "+mips32r2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r3 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R3 %s +// MIPS32R3: -cc1as +// MIPS32R3: "-target-feature" "+mips32r3" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r5 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R5 %s +// MIPS32R5: -cc1as +// MIPS32R5: "-target-feature" "+mips32r5" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r6 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS32R6 %s +// MIPS32R6: -cc1as +// MIPS32R6: "-target-feature" "+mips32r6" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64 %s +// MIPS64: -cc1as +// MIPS64: "-target-feature" "+mips64" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R2 %s +// MIPS64R2: -cc1as +// MIPS64R2: "-target-feature" "+mips64r2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r3 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R3 %s +// MIPS64R3: -cc1as +// MIPS64R3: "-target-feature" "+mips64r3" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r5 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R5 %s +// MIPS64R5: -cc1as +// MIPS64R5: "-target-feature" "+mips64r5" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r6 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R6 %s +// MIPS64R6: -cc1as +// MIPS64R6: "-target-feature" "+mips64r6" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r2,-mips4 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R2-MIPS4 %s +// MIPS64R2-MIPS4: -cc1as +// MIPS64R2-MIPS4: "-target-feature" "+mips4" +// MIPS64R2-MIPS4-NOT: "-target-feature" "+mips64r2" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64,-mips32,-mips32r2 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64-MIPS32-MIPS32R2 %s +// MIPS64-MIPS32-MIPS32R2: -cc1as +// MIPS64-MIPS32-MIPS32R2: "-target-feature" "+mips32r2" +// MIPS64-MIPS32-MIPS32R2-NOT: "-target-feature" "+mips64" +// MIPS64-MIPS32-MIPS32R2-NOT: "-target-feature" "+mips32" Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2460,6 +2460,7 @@ // When using an integrated assembler, translate -Wa, and -Xassembler // options. bool CompressDebugSections = false; + const char *MipsTargetFeature = ""; for (const Arg *A : Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) { A->claim(); @@ -2498,7 +2499,25 @@ CmdArgs.push_back("-soft-float");