[PATCH] D15070: [mips] Added support for -Wa, -mips32 and similar.
Daniel Sanders via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 16 06:33:02 PST 2015
dsanders requested changes to this revision.
This revision now requires changes to proceed.
================
Comment at: lib/Driver/Tools.cpp:2501-2524
@@ -2500,2 +2500,26 @@
}
+
+ const char *Feature = llvm::StringSwitch<const char *>(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", "+mips64r5")
+ .Case("-mips64r6", "+mips64r6")
+ .Default("");
+
+ StringRef FeatureStringRef = Feature;
+ if (FeatureStringRef != "") {
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back(Feature);
+ continue;
+ }
break;
----------------
We don't quite do the right thing when we get multiple -mips* options. For -Wa,-mips64r2,-mips4 we don't undo the effect of the '-target-feature +mips64r2' when we process the -mips4. As a result, the selected target is mips64r2 whereas GAS would select mips4.
We can't fix this by adding a '-target-feature -mips64r2' since would select mips64 so we'll need to wait until we've seen all the '-Wa,' arguments before we add the -target-feature (similar to --compress-debug-sections).
================
Comment at: lib/Driver/Tools.cpp:2506-2507
@@ +2505,4 @@
+ .Case("-mips3", "+mips3")
+ .Case("-mips4", "+mips4")
+ .Case("-mips32", "+mips32")
+ .Case("-mips32r2", "+mips32r2")
----------------
There should be a mips5 case too.
================
Comment at: test/Driver/mips-ias-Wa.s:66-74
@@ +65,11 @@
+
+// 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"
+
----------------
There should be a mips5 case too
================
Comment at: test/Driver/mips-ias-Wa.s:121-129
@@ +120,10 @@
+
+// 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"
----------------
These two tests aren't quite right since the selected target is the maximum of the three at the moment.
http://reviews.llvm.org/D15070
More information about the cfe-commits
mailing list