r180775 - [Mips] Pass -mips16, -mmicromips, -mdsp and -mdspr2 flags to the
Simon Atanasyan
simon at atanasyan.com
Tue Apr 30 00:47:14 PDT 2013
Author: atanasyan
Date: Tue Apr 30 02:47:13 2013
New Revision: 180775
URL: http://llvm.org/viewvc/llvm-project?rev=180775&view=rev
Log:
[Mips] Pass -mips16, -mmicromips, -mdsp and -mdspr2 flags to the
assembler.
Modified:
cfe/trunk/include/clang/Driver/ArgList.h
cfe/trunk/lib/Driver/ArgList.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/mips-as.c
Modified: cfe/trunk/include/clang/Driver/ArgList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ArgList.h?rev=180775&r1=180774&r2=180775&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ArgList.h (original)
+++ cfe/trunk/include/clang/Driver/ArgList.h Tue Apr 30 02:47:13 2013
@@ -248,6 +248,8 @@ namespace driver {
/// AddLastArg - Render only the last argument match \p Id0, if present.
void AddLastArg(ArgStringList &Output, OptSpecifier Id0) const;
+ void AddLastArg(ArgStringList &Output, OptSpecifier Id0,
+ OptSpecifier Id1) const;
/// AddAllArgs - Render all arguments matching the given ids.
void AddAllArgs(ArgStringList &Output, OptSpecifier Id0,
Modified: cfe/trunk/lib/Driver/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=180775&r1=180774&r2=180775&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ArgList.cpp (original)
+++ cfe/trunk/lib/Driver/ArgList.cpp Tue Apr 30 02:47:13 2013
@@ -248,6 +248,14 @@ void ArgList::AddLastArg(ArgStringList &
}
}
+void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id0,
+ OptSpecifier Id1) const {
+ if (Arg *A = getLastArg(Id0, Id1)) {
+ A->claim();
+ A->render(*this, Output);
+ }
+}
+
void ArgList::AddAllArgs(ArgStringList &Output, OptSpecifier Id0,
OptSpecifier Id1, OptSpecifier Id2) const {
for (arg_iterator it = filtered_begin(Id0, Id1, Id2),
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=180775&r1=180774&r2=180775&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Apr 30 02:47:13 2013
@@ -5803,6 +5803,12 @@ void gnutools::Assemble::ConstructJob(Co
else
CmdArgs.push_back("-EL");
+ Args.AddLastArg(CmdArgs, options::OPT_mips16, options::OPT_mno_mips16);
+ Args.AddLastArg(CmdArgs, options::OPT_mmicromips,
+ options::OPT_mno_micromips);
+ Args.AddLastArg(CmdArgs, options::OPT_mdsp, options::OPT_mno_dsp);
+ Args.AddLastArg(CmdArgs, options::OPT_mdspr2, options::OPT_mno_dspr2);
+
Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
options::OPT_fpic, options::OPT_fno_pic,
options::OPT_fPIE, options::OPT_fno_PIE,
Modified: cfe/trunk/test/Driver/mips-as.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-as.c?rev=180775&r1=180774&r2=180775&view=diff
==============================================================================
--- cfe/trunk/test/Driver/mips-as.c (original)
+++ cfe/trunk/test/Driver/mips-as.c Tue Apr 30 02:47:13 2013
@@ -71,3 +71,47 @@
// RUN: -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R2 %s
// MIPS-ALIAS-64R2: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EB"
+//
+// RUN: %clang -target mips-linux-gnu -mno-mips16 -mips16 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-16 %s
+// MIPS-16: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB" "-mips16"
+//
+// RUN: %clang -target mips-linux-gnu -mips16 -mno-mips16 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-N16 %s
+// MIPS-N16: as{{(.exe)?}}"
+// MIPS-N16-NOT: "-mips16"
+//
+// RUN: %clang -target mips-linux-gnu -mno-micromips -mmicromips -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-MICRO %s
+// MIPS-MICRO: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB" "-mmicromips"
+//
+// RUN: %clang -target mips-linux-gnu -mmicromips -mno-micromips -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-NMICRO %s
+// MIPS-NMICRO: as{{(.exe)?}}"
+// MIPS-NMICRO-NOT: "-mmicromips"
+//
+// RUN: %clang -target mips-linux-gnu -mno-dsp -mdsp -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-DSP %s
+// MIPS-DSP: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB" "-mdsp"
+//
+// RUN: %clang -target mips-linux-gnu -mdsp -mno-dsp -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-NDSP %s
+// MIPS-NDSP: as{{(.exe)?}}"
+// MIPS-NDSP-NOT: "-mdsp"
+//
+// RUN: %clang -target mips-linux-gnu -mno-dspr2 -mdspr2 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-DSPR2 %s
+// MIPS-DSPR2: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB" "-mdspr2"
+//
+// RUN: %clang -target mips-linux-gnu -mdspr2 -mno-dspr2 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-NDSPR2 %s
+// MIPS-NDSPR2: as{{(.exe)?}}"
+// MIPS-NDSPR2-NOT: "-mdspr2"
More information about the cfe-commits
mailing list