r245914 - Reimplement the PPC explicit option checking to be a bit more obvious

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 24 17:59:11 PDT 2015


Author: echristo
Date: Mon Aug 24 19:59:11 2015
New Revision: 245914

URL: http://llvm.org/viewvc/llvm-project?rev=245914&view=rev
Log:
Reimplement the PPC explicit option checking to be a bit more obvious
that we're looking for conflicting options and give an explanation.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245914&r1=245913&r2=245914&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Aug 24 19:59:11 2015
@@ -1070,14 +1070,25 @@ bool PPCTargetInfo::handleTargetFeatures
     // TODO: Finish this list and add an assert that we've handled them
     // all.
   }
-  if (!HasVSX && (HasP8Vector || HasDirectMove)) {
-    if (HasP8Vector)
-      Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower8-vector" <<
-                                                        "-mno-vsx";
-    else if (HasDirectMove)
-      Diags.Report(diag::err_opt_not_valid_with_opt) << "-mdirect-move" <<
-                                                        "-mno-vsx";
-    return false;
+
+  // Handle explicit options being passed to the compiler here: if we've
+  // explicitly turned off vsx and turned on power8-vector or direct-move then
+  // go ahead and error since the customer has expressed a somewhat incompatible
+  // set of options.
+  if (std::find(Features.begin(), Features.end(), "-vsx") != Features.end()) {
+    if (std::find(Features.begin(), Features.end(), "+power8-vector") !=
+        Features.end()) {
+      Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower8-vector"
+                                                     << "-mno-vsx";
+      return false;
+    }
+
+    if (std::find(Features.begin(), Features.end(), "+direct-move") !=
+        Features.end()) {
+      Diags.Report(diag::err_opt_not_valid_with_opt) << "-mdirect-move"
+                                                     << "-mno-vsx";
+      return false;
+    }
   }
 
   return true;




More information about the cfe-commits mailing list