[llvm] 5f856c5 - [NFC][RISCV] Bundle up ISAInfo updates and checks

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 28 07:13:28 PST 2022


Author: eopXD
Date: 2022-01-28T07:13:24-08:00
New Revision: 5f856c5b308e5de9dc004e89bd5f447ac7e96435

URL: https://github.com/llvm/llvm-project/commit/5f856c5b308e5de9dc004e89bd5f447ac7e96435
DIFF: https://github.com/llvm/llvm-project/commit/5f856c5b308e5de9dc004e89bd5f447ac7e96435.diff

LOG: [NFC][RISCV] Bundle up ISAInfo updates and checks

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D118334

Added: 
    

Modified: 
    llvm/include/llvm/Support/RISCVISAInfo.h
    llvm/lib/Support/RISCVISAInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/RISCVISAInfo.h b/llvm/include/llvm/Support/RISCVISAInfo.h
index b450c1df3558d..7fa0e6ee3acfe 100644
--- a/llvm/include/llvm/Support/RISCVISAInfo.h
+++ b/llvm/include/llvm/Support/RISCVISAInfo.h
@@ -92,6 +92,9 @@ class RISCVISAInfo {
   void updateFLen();
   void updateMinVLen();
   void updateMaxELen();
+
+  static llvm::Expected<std::unique_ptr<RISCVISAInfo>>
+  postProcessAndChecking(std::unique_ptr<RISCVISAInfo> &&ISAInfo);
 };
 
 } // namespace llvm

diff  --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index 97baf3df56f83..9c1b579dae115 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -461,15 +461,7 @@ RISCVISAInfo::parseFeatures(unsigned XLen,
       ISAInfo->Exts.erase(ExtName.str());
   }
 
-  ISAInfo->updateImplication();
-  ISAInfo->updateFLen();
-  ISAInfo->updateMinVLen();
-  ISAInfo->updateMaxELen();
-
-  if (Error Result = ISAInfo->checkDependency())
-    return std::move(Result);
-
-  return std::move(ISAInfo);
+  return RISCVISAInfo::postProcessAndChecking(std::move(ISAInfo));
 }
 
 llvm::Expected<std::unique_ptr<RISCVISAInfo>>
@@ -686,15 +678,7 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
     }
   }
 
-  ISAInfo->updateImplication();
-  ISAInfo->updateFLen();
-  ISAInfo->updateMinVLen();
-  ISAInfo->updateMaxELen();
-
-  if (Error Result = ISAInfo->checkDependency())
-    return std::move(Result);
-
-  return std::move(ISAInfo);
+  return RISCVISAInfo::postProcessAndChecking(std::move(ISAInfo));
 }
 
 Error RISCVISAInfo::checkDependency() {
@@ -919,3 +903,15 @@ std::vector<std::string> RISCVISAInfo::toFeatureVector() const {
   }
   return FeatureVector;
 }
+
+llvm::Expected<std::unique_ptr<RISCVISAInfo>>
+RISCVISAInfo::postProcessAndChecking(std::unique_ptr<RISCVISAInfo> &&ISAInfo) {
+  ISAInfo->updateImplication();
+  ISAInfo->updateFLen();
+  ISAInfo->updateMinVLen();
+  ISAInfo->updateMaxELen();
+
+  if (Error Result = ISAInfo->checkDependency())
+    return std::move(Result);
+  return std::move(ISAInfo);
+}


        


More information about the llvm-commits mailing list