[clang] [llvm] [RISCV] Teach .option arch to support experimental extensions. (PR #89727)

Yeting Kuo via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 20:12:09 PDT 2024


================
@@ -2824,8 +2826,12 @@ bool RISCVAsmParser::parseDirectiveOption() {
         break;
       }
 
-      auto Ext = llvm::lower_bound(RISCVFeatureKV, Arch);
-      if (Ext == std::end(RISCVFeatureKV) || StringRef(Ext->Key) != Arch ||
+      std::string Feature = RISCVISAInfo::getTargetFeatureForExtension(Arch);
+      if (!enableExperimentalExtension() &&
+          StringRef(Feature).starts_with("experimental-"))
+        return Error(Loc, "Unexpected experimental extensions.");
+      auto Ext = llvm::lower_bound(RISCVFeatureKV, Feature);
+      if (Ext == std::end(RISCVFeatureKV) || StringRef(Ext->Key) != Feature ||
           !RISCVISAInfo::isSupportedExtension(Arch)) {
----------------
yetingk wrote:

Done. Thank you.

https://github.com/llvm/llvm-project/pull/89727


More information about the llvm-commits mailing list