diff --git a/llvm/include/llvm/Support/RISCVISAInfo.h b/llvm/include/llvm/Support/RISCVISAInfo.h --- a/llvm/include/llvm/Support/RISCVISAInfo.h +++ b/llvm/include/llvm/Support/RISCVISAInfo.h @@ -92,6 +92,9 @@ void updateFLen(); void updateMinVLen(); void updateMaxELen(); + + static llvm::Expected> + postProcessAndChecking(std::unique_ptr &&ISAInfo); }; } // namespace llvm diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp --- a/llvm/lib/Support/RISCVISAInfo.cpp +++ b/llvm/lib/Support/RISCVISAInfo.cpp @@ -461,15 +461,7 @@ 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> @@ -686,15 +678,7 @@ } } - 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 @@ } return FeatureVector; } + +llvm::Expected> +RISCVISAInfo::postProcessAndChecking(std::unique_ptr &&ISAInfo) { + ISAInfo->updateImplication(); + ISAInfo->updateFLen(); + ISAInfo->updateMinVLen(); + ISAInfo->updateMaxELen(); + + if (Error Result = ISAInfo->checkDependency()) + return std::move(Result); + return std::move(ISAInfo); +}