================
@@ -64,38 +64,20 @@ static void handleHVXTargetFeatures(const Driver &D, const 
ArgList &Args,
     return "-" + S.str();
   };
 
-  // Drop tiny core suffix for HVX version.
-  std::string HvxVer =
-      (Cpu.back() == 'T' || Cpu.back() == 't' ? Cpu.drop_back(1) : Cpu).str();
-  HasHVX = false;
-
-  // Handle -mhvx, -mhvx=, -mno-hvx. If versioned and versionless flags
-  // are both present, the last one wins.
-  Arg *HvxEnablingArg =
-      Args.getLastArg(options::OPT_mhexagon_hvx, options::OPT_mhexagon_hvx_EQ,
-                      options::OPT_mno_hexagon_hvx);
-  if (HvxEnablingArg) {
-    if (HvxEnablingArg->getOption().matches(options::OPT_mno_hexagon_hvx))
-      HvxEnablingArg = nullptr;
-  }
-
-  if (HvxEnablingArg) {
-    // If -mhvx[=] was given, it takes precedence.
-    if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx,
-                                 options::OPT_mhexagon_hvx_EQ)) {
-      // If the version was given, set HvxVer. Otherwise HvxVer
-      // will remain equal to the CPU version.
-      if (A->getOption().matches(options::OPT_mhexagon_hvx_EQ))
-        HvxVer = StringRef(A->getValue()).lower();
+  std::optional<std::string> HvxVer =
+      toolchains::HexagonToolChain::GetHVXVersion(Args);
+  HasHVX = HvxVer.has_value();
----------------
fhossein-quic wrote:

Right, but HasHVX is an out-param that the caller uses after 
handleHVXTargetFeatures returns. So, I could drop it internally and use HvxVer 
instead, but I would still need to assign HasHVX for the caller, and I prefer 
to avoid a larger rewrite vs what we have downstream (and approved on tip) in 
Hexagon.cpp unless it’s necessary.

https://github.com/llvm/llvm-project/pull/182073
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to