[cfe-commits] r159747 - in /cfe/trunk: include/clang/Driver/Options.td lib/Basic/Targets.cpp lib/Driver/Tools.cpp test/Driver/mips-features.c
Simon Atanasyan
satanasyan at mips.com
Thu Jul 5 07:19:39 PDT 2012
Author: atanasyan
Date: Thu Jul 5 09:19:39 2012
New Revision: 159747
URL: http://llvm.org/viewvc/llvm-project?rev=159747&view=rev
Log:
MIPS: Add -mips16 / -mno-mips16 command line support.
Added:
cfe/trunk/test/Driver/mips-features.c
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=159747&r1=159746&r2=159747&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Jul 5 09:19:39 2012
@@ -846,6 +846,8 @@
def mbmi2 : Flag<"-mbmi2">, Group<m_x86_Features_Group>;
def mpopcnt : Flag<"-mpopcnt">, Group<m_x86_Features_Group>;
def mfma4 : Flag<"-mfma4">, Group<m_x86_Features_Group>;
+def mips16 : Flag<"-mips16">, Group<m_Group>;
+def mno_mips16 : Flag<"-mno-mips16">, Group<m_Group>;
def mthumb : Flag<"-mthumb">, Group<m_Group>;
def mtune_EQ : Joined<"-mtune=">, Group<m_Group>;
def multi__module : Flag<"-multi_module">;
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=159747&r1=159746&r2=159747&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Jul 5 09:19:39 2012
@@ -3708,7 +3708,8 @@
if (Name == "soft-float" || Name == "single-float" ||
Name == "o32" || Name == "n32" || Name == "n64" || Name == "eabi" ||
Name == "mips32" || Name == "mips32r2" ||
- Name == "mips64" || Name == "mips64r2") {
+ Name == "mips64" || Name == "mips64r2" ||
+ Name == "mips16") {
Features[Name] = Enabled;
return true;
}
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=159747&r1=159746&r2=159747&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Jul 5 09:19:39 2012
@@ -919,6 +919,15 @@
CmdArgs.push_back("-mfloat-abi");
CmdArgs.push_back("hard");
}
+
+ if (Arg *A = Args.getLastArg(options::OPT_mips16,
+ options::OPT_mno_mips16)) {
+ CmdArgs.push_back("-target-feature");
+ if (A->getOption().matches(options::OPT_mips16))
+ CmdArgs.push_back("+mips16");
+ else
+ CmdArgs.push_back("-mips16");
+ }
}
/// getPPCTargetCPU - Get the (LLVM) name of the PowerPC cpu we are targeting.
Added: cfe/trunk/test/Driver/mips-features.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-features.c?rev=159747&view=auto
==============================================================================
--- cfe/trunk/test/Driver/mips-features.c (added)
+++ cfe/trunk/test/Driver/mips-features.c Thu Jul 5 09:19:39 2012
@@ -0,0 +1,13 @@
+// Check handling MIPS specific features options.
+//
+// -mips16
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN: -mno-mips16 -mips16 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-MIPS16 %s
+// CHECK-MIPS16: "-target-feature" "+mips16"
+//
+// -mno-mips16
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN: -mips16 -mno-mips16 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NOMIPS16 %s
+// CHECK-NOMIPS16: "-target-feature" "-mips16"
More information about the cfe-commits
mailing list