#include "llvm/TargetParser/RISCVISAInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/raw_ostream.h"
#include <array>
#include <atomic>
#include <optional>
#include <string>
#include <vector>
usingnamespacellvm;
namespace {
struct RISCVSupportedExtension { … };
struct RISCVProfile { … };
}
static const char *RISCVGImplications[] = …;
#define GET_SUPPORTED_EXTENSIONS
#include "llvm/TargetParser/RISCVTargetParserDef.inc"
#define GET_SUPPORTED_PROFILES
#include "llvm/TargetParser/RISCVTargetParserDef.inc"
static void verifyTables() { … }
static void PrintExtension(StringRef Name, StringRef Version,
StringRef Description) { … }
void RISCVISAInfo::printSupportedExtensions(StringMap<StringRef> &DescMap) { … }
void RISCVISAInfo::printEnabledExtensions(
bool IsRV64, std::set<StringRef> &EnabledFeatureNames,
StringMap<StringRef> &DescMap) { … }
static bool stripExperimentalPrefix(StringRef &Ext) { … }
static size_t findLastNonVersionCharacter(StringRef Ext) { … }
namespace {
struct LessExtName { … };
}
static std::optional<RISCVISAUtils::ExtensionVersion>
findDefaultVersion(StringRef ExtName) { … }
static StringRef getExtensionTypeDesc(StringRef Ext) { … }
static StringRef getExtensionType(StringRef Ext) { … }
static std::optional<RISCVISAUtils::ExtensionVersion>
isExperimentalExtension(StringRef Ext) { … }
bool RISCVISAInfo::isSupportedExtensionFeature(StringRef Ext) { … }
bool RISCVISAInfo::isSupportedExtension(StringRef Ext) { … }
bool RISCVISAInfo::isSupportedExtension(StringRef Ext, unsigned MajorVersion,
unsigned MinorVersion) { … }
bool RISCVISAInfo::hasExtension(StringRef Ext) const { … }
std::vector<std::string> RISCVISAInfo::toFeatures(bool AddAllExtensions,
bool IgnoreUnknown) const { … }
static Error getError(const Twine &Message) { … }
static Error getErrorForInvalidExt(StringRef ExtName) { … }
static Error getExtensionVersion(StringRef Ext, StringRef In, unsigned &Major,
unsigned &Minor, unsigned &ConsumeLength,
bool EnableExperimentalExtension,
bool ExperimentalExtensionVersionCheck) { … }
llvm::Expected<std::unique_ptr<RISCVISAInfo>>
RISCVISAInfo::createFromExtMap(unsigned XLen,
const RISCVISAUtils::OrderedExtensionMap &Exts) { … }
llvm::Expected<std::unique_ptr<RISCVISAInfo>>
RISCVISAInfo::parseFeatures(unsigned XLen,
const std::vector<std::string> &Features) { … }
llvm::Expected<std::unique_ptr<RISCVISAInfo>>
RISCVISAInfo::parseNormalizedArchString(StringRef Arch) { … }
llvm::Expected<std::unique_ptr<RISCVISAInfo>>
RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
bool ExperimentalExtensionVersionCheck) { … }
static Error getIncompatibleError(StringRef Ext1, StringRef Ext2) { … }
static Error getExtensionRequiresError(StringRef Ext, StringRef ReqExt) { … }
Error RISCVISAInfo::checkDependency() { … }
struct ImpliedExtsEntry { … };
static bool operator<(const ImpliedExtsEntry &LHS, StringRef RHS) { … }
static bool operator<(StringRef LHS, const ImpliedExtsEntry &RHS) { … }
#define GET_IMPLIED_EXTENSIONS
#include "llvm/TargetParser/RISCVTargetParserDef.inc"
void RISCVISAInfo::updateImplication() { … }
static constexpr StringLiteral CombineIntoExts[] = …;
void RISCVISAInfo::updateCombination() { … }
void RISCVISAInfo::updateImpliedLengths() { … }
std::string RISCVISAInfo::toString() const { … }
llvm::Expected<std::unique_ptr<RISCVISAInfo>>
RISCVISAInfo::postProcessAndChecking(std::unique_ptr<RISCVISAInfo> &&ISAInfo) { … }
StringRef RISCVISAInfo::computeDefaultABI() const { … }
bool RISCVISAInfo::isSupportedExtensionWithVersion(StringRef Ext) { … }
std::string RISCVISAInfo::getTargetFeatureForExtension(StringRef Ext) { … }
struct RISCVExtBit { … };
constexpr static RISCVExtBit RISCVBitPositions[] = …;
std::pair<int, int> RISCVISAInfo::getRISCVFeaturesBitsInfo(StringRef Ext) { … }