LLVM 19.0.0git
Classes | Enumerations | Functions | Variables
RISCVISAInfo.cpp File Reference
#include "llvm/Support/RISCVISAInfo.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.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>

Go to the source code of this file.

Classes

struct  ImpliedExtsEntry
 
struct  CombinedExtsEntry
 

Enumerations

enum  RankFlags { RF_Z_EXTENSION = 1 << 6 , RF_S_EXTENSION = 1 << 7 , RF_X_EXTENSION = 1 << 8 }
 

Functions

static void verifyTables ()
 
static void PrintExtension (StringRef Name, StringRef Version, StringRef Description)
 
static bool stripExperimentalPrefix (StringRef &Ext)
 
static size_t findLastNonVersionCharacter (StringRef Ext)
 
static std::optional< RISCVISAInfo::ExtensionVersionfindDefaultVersion (StringRef ExtName)
 
static StringRef getExtensionTypeDesc (StringRef Ext)
 
static StringRef getExtensionType (StringRef Ext)
 
static std::optional< RISCVISAInfo::ExtensionVersionisExperimentalExtension (StringRef Ext)
 
static unsigned singleLetterExtensionRank (char Ext)
 
static unsigned getExtensionRank (const std::string &ExtName)
 
static Error getExtensionVersion (StringRef Ext, StringRef In, unsigned &Major, unsigned &Minor, unsigned &ConsumeLength, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck)
 
static Error splitExtsByUnderscore (StringRef Exts, std::vector< std::string > &SplitExts)
 
static Error processMultiLetterExtension (StringRef RawExt, MapVector< std::string, RISCVISAInfo::ExtensionVersion, std::map< std::string, unsigned > > &SeenExtMap, bool IgnoreUnknown, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck)
 
static Error processSingleLetterExtension (StringRef &RawExt, MapVector< std::string, RISCVISAInfo::ExtensionVersion, std::map< std::string, unsigned > > &SeenExtMap, bool IgnoreUnknown, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck)
 

Variables

static constexpr StringLiteral AllStdExts = "mafdqlcbkjtpvnh"
 
static const charRISCVGImplications []
 
static const RISCVSupportedExtension SupportedExtensions []
 
static const RISCVSupportedExtension SupportedExperimentalExtensions []
 
static const charImpliedExtsD [] = {"f"}
 
static const charImpliedExtsF [] = {"zicsr"}
 
static const charImpliedExtsV [] = {"zvl128b", "zve64d"}
 
static const charImpliedExtsXTHeadVdot [] = {"v"}
 
static const charImpliedExtsXSfvcp [] = {"zve32x"}
 
static const charImpliedExtsXSfvfnrclipxfqf [] = {"zve32f"}
 
static const charImpliedExtsXSfvfwmaccqqq [] = {"zvfbfmin"}
 
static const charImpliedExtsXSfvqmaccdod [] = {"zve32x"}
 
static const charImpliedExtsXSfvqmaccqoq [] = {"zve32x"}
 
static const charImpliedExtsZabha [] = {"a"}
 
static const charImpliedExtsZacas [] = {"a"}
 
static const charImpliedExtsZcb [] = {"zca"}
 
static const charImpliedExtsZcd [] = {"d", "zca"}
 
static const charImpliedExtsZce [] = {"zcb", "zcmp", "zcmt"}
 
static const charImpliedExtsZcf [] = {"f", "zca"}
 
static const charImpliedExtsZcmop [] = {"zca"}
 
static const charImpliedExtsZcmp [] = {"zca"}
 
static const charImpliedExtsZcmt [] = {"zca", "zicsr"}
 
static const charImpliedExtsZdinx [] = {"zfinx"}
 
static const charImpliedExtsZfa [] = {"f"}
 
static const charImpliedExtsZfbfmin [] = {"f"}
 
static const charImpliedExtsZfh [] = {"zfhmin"}
 
static const charImpliedExtsZfhmin [] = {"f"}
 
static const charImpliedExtsZfinx [] = {"zicsr"}
 
static const charImpliedExtsZhinx [] = {"zhinxmin"}
 
static const charImpliedExtsZhinxmin [] = {"zfinx"}
 
static const charImpliedExtsZicntr [] = {"zicsr"}
 
static const charImpliedExtsZicfiss [] = {"zicsr", "zimop"}
 
static const charImpliedExtsZihpm [] = {"zicsr"}
 
static const charImpliedExtsZk [] = {"zkn", "zkt", "zkr"}
 
static const charImpliedExtsZkn []
 
static const charImpliedExtsZks [] = {"zbkb", "zbkc", "zbkx", "zksed", "zksh"}
 
static const charImpliedExtsZvbb [] = {"zvkb"}
 
static const charImpliedExtsZve32f [] = {"zve32x", "f"}
 
static const charImpliedExtsZve32x [] = {"zvl32b", "zicsr"}
 
static const charImpliedExtsZve64d [] = {"zve64f", "d"}
 
static const charImpliedExtsZve64f [] = {"zve64x", "zve32f"}
 
static const charImpliedExtsZve64x [] = {"zve32x", "zvl64b"}
 
static const charImpliedExtsZvfbfmin [] = {"zve32f"}
 
static const charImpliedExtsZvfbfwma [] = {"zvfbfmin", "zfbfmin"}
 
static const charImpliedExtsZvfh [] = {"zvfhmin", "zfhmin"}
 
static const charImpliedExtsZvfhmin [] = {"zve32f"}
 
static const charImpliedExtsZvkn [] = {"zvkb", "zvkned", "zvknhb", "zvkt"}
 
static const charImpliedExtsZvknc [] = {"zvbc", "zvkn"}
 
static const charImpliedExtsZvkng [] = {"zvkg", "zvkn"}
 
static const charImpliedExtsZvknhb [] = {"zve64x"}
 
static const charImpliedExtsZvks [] = {"zvkb", "zvksed", "zvksh", "zvkt"}
 
static const charImpliedExtsZvksc [] = {"zvbc", "zvks"}
 
static const charImpliedExtsZvksg [] = {"zvkg", "zvks"}
 
static const charImpliedExtsZvl1024b [] = {"zvl512b"}
 
static const charImpliedExtsZvl128b [] = {"zvl64b"}
 
static const charImpliedExtsZvl16384b [] = {"zvl8192b"}
 
static const charImpliedExtsZvl2048b [] = {"zvl1024b"}
 
static const charImpliedExtsZvl256b [] = {"zvl128b"}
 
static const charImpliedExtsZvl32768b [] = {"zvl16384b"}
 
static const charImpliedExtsZvl4096b [] = {"zvl2048b"}
 
static const charImpliedExtsZvl512b [] = {"zvl256b"}
 
static const charImpliedExtsZvl64b [] = {"zvl32b"}
 
static const charImpliedExtsZvl65536b [] = {"zvl32768b"}
 
static const charImpliedExtsZvl8192b [] = {"zvl4096b"}
 
static constexpr ImpliedExtsEntry ImpliedExts []
 
static constexpr CombinedExtsEntry CombineIntoExts []
 

Enumeration Type Documentation

◆ RankFlags

enum RankFlags
Enumerator
RF_Z_EXTENSION 
RF_S_EXTENSION 
RF_X_EXTENSION 

Definition at line 438 of file RISCVISAInfo.cpp.

Function Documentation

◆ findDefaultVersion()

static std::optional< RISCVISAInfo::ExtensionVersion > findDefaultVersion ( StringRef  ExtName)
static

◆ findLastNonVersionCharacter()

static size_t findLastNonVersionCharacter ( StringRef  Ext)
static

◆ getExtensionRank()

static unsigned getExtensionRank ( const std::string &  ExtName)
static

◆ getExtensionType()

static StringRef getExtensionType ( StringRef  Ext)
static

Definition at line 360 of file RISCVISAInfo.cpp.

Referenced by performMemPairCombine(), and processMultiLetterExtension().

◆ getExtensionTypeDesc()

static StringRef getExtensionTypeDesc ( StringRef  Ext)
static

◆ getExtensionVersion()

static Error getExtensionVersion ( StringRef  Ext,
StringRef  In,
unsigned Major,
unsigned Minor,
unsigned ConsumeLength,
bool  EnableExperimentalExtension,
bool  ExperimentalExtensionVersionCheck 
)
static

◆ isExperimentalExtension()

static std::optional< RISCVISAInfo::ExtensionVersion > isExperimentalExtension ( StringRef  Ext)
static

◆ PrintExtension()

static void PrintExtension ( StringRef  Name,
StringRef  Version,
StringRef  Description 
)
static

◆ processMultiLetterExtension()

static Error processMultiLetterExtension ( StringRef  RawExt,
MapVector< std::string, RISCVISAInfo::ExtensionVersion, std::map< std::string, unsigned > > &  SeenExtMap,
bool  IgnoreUnknown,
bool  EnableExperimentalExtension,
bool  ExperimentalExtensionVersionCheck 
)
static

◆ processSingleLetterExtension()

static Error processSingleLetterExtension ( StringRef RawExt,
MapVector< std::string, RISCVISAInfo::ExtensionVersion, std::map< std::string, unsigned > > &  SeenExtMap,
bool  IgnoreUnknown,
bool  EnableExperimentalExtension,
bool  ExperimentalExtensionVersionCheck 
)
static

◆ singleLetterExtensionRank()

static unsigned singleLetterExtensionRank ( char  Ext)
static

◆ splitExtsByUnderscore()

static Error splitExtsByUnderscore ( StringRef  Exts,
std::vector< std::string > &  SplitExts 
)
static

◆ stripExperimentalPrefix()

static bool stripExperimentalPrefix ( StringRef Ext)
static

◆ verifyTables()

static void verifyTables ( )
static

Variable Documentation

◆ AllStdExts

constexpr StringLiteral AllStdExts = "mafdqlcbkjtpvnh"
staticconstexpr

◆ CombineIntoExts

constexpr CombinedExtsEntry CombineIntoExts[]
staticconstexpr
Initial value:
= {
{{"zk"}, {ImpliedExtsZk}},
{{"zkn"}, {ImpliedExtsZkn}},
{{"zks"}, {ImpliedExtsZks}},
{{"zvkn"}, {ImpliedExtsZvkn}},
{{"zvknc"}, {ImpliedExtsZvknc}},
{{"zvkng"}, {ImpliedExtsZvkng}},
{{"zvks"}, {ImpliedExtsZvks}},
{{"zvksc"}, {ImpliedExtsZvksc}},
{{"zvksg"}, {ImpliedExtsZvksg}},
}
static const char * ImpliedExtsZks[]
static const char * ImpliedExtsZvksg[]
static const char * ImpliedExtsZvkn[]
static const char * ImpliedExtsZvkng[]
static const char * ImpliedExtsZvks[]
static const char * ImpliedExtsZk[]
static const char * ImpliedExtsZvknc[]
static const char * ImpliedExtsZkn[]
static const char * ImpliedExtsZvksc[]

Definition at line 1222 of file RISCVISAInfo.cpp.

◆ ImpliedExts

constexpr ImpliedExtsEntry ImpliedExts[]
staticconstexpr

Definition at line 1111 of file RISCVISAInfo.cpp.

Referenced by llvm::AArch64::CpuInfo::getImpliedExtensions().

◆ ImpliedExtsD

const char* ImpliedExtsD[] = {"f"}
static

Definition at line 1037 of file RISCVISAInfo.cpp.

◆ ImpliedExtsF

const char* ImpliedExtsF[] = {"zicsr"}
static

Definition at line 1038 of file RISCVISAInfo.cpp.

◆ ImpliedExtsV

const char* ImpliedExtsV[] = {"zvl128b", "zve64d"}
static

Definition at line 1039 of file RISCVISAInfo.cpp.

◆ ImpliedExtsXSfvcp

const char* ImpliedExtsXSfvcp[] = {"zve32x"}
static

Definition at line 1041 of file RISCVISAInfo.cpp.

◆ ImpliedExtsXSfvfnrclipxfqf

const char* ImpliedExtsXSfvfnrclipxfqf[] = {"zve32f"}
static

Definition at line 1042 of file RISCVISAInfo.cpp.

◆ ImpliedExtsXSfvfwmaccqqq

const char* ImpliedExtsXSfvfwmaccqqq[] = {"zvfbfmin"}
static

Definition at line 1043 of file RISCVISAInfo.cpp.

◆ ImpliedExtsXSfvqmaccdod

const char* ImpliedExtsXSfvqmaccdod[] = {"zve32x"}
static

Definition at line 1044 of file RISCVISAInfo.cpp.

◆ ImpliedExtsXSfvqmaccqoq

const char* ImpliedExtsXSfvqmaccqoq[] = {"zve32x"}
static

Definition at line 1045 of file RISCVISAInfo.cpp.

◆ ImpliedExtsXTHeadVdot

const char* ImpliedExtsXTHeadVdot[] = {"v"}
static

Definition at line 1040 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZabha

const char* ImpliedExtsZabha[] = {"a"}
static

Definition at line 1046 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZacas

const char* ImpliedExtsZacas[] = {"a"}
static

Definition at line 1047 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZcb

const char* ImpliedExtsZcb[] = {"zca"}
static

Definition at line 1048 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZcd

const char* ImpliedExtsZcd[] = {"d", "zca"}
static

Definition at line 1049 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZce

const char* ImpliedExtsZce[] = {"zcb", "zcmp", "zcmt"}
static

Definition at line 1050 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZcf

const char* ImpliedExtsZcf[] = {"f", "zca"}
static

Definition at line 1051 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZcmop

const char* ImpliedExtsZcmop[] = {"zca"}
static

Definition at line 1052 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZcmp

const char* ImpliedExtsZcmp[] = {"zca"}
static

Definition at line 1053 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZcmt

const char* ImpliedExtsZcmt[] = {"zca", "zicsr"}
static

Definition at line 1054 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZdinx

const char* ImpliedExtsZdinx[] = {"zfinx"}
static

Definition at line 1055 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZfa

const char* ImpliedExtsZfa[] = {"f"}
static

Definition at line 1056 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZfbfmin

const char* ImpliedExtsZfbfmin[] = {"f"}
static

Definition at line 1057 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZfh

const char* ImpliedExtsZfh[] = {"zfhmin"}
static

Definition at line 1058 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZfhmin

const char* ImpliedExtsZfhmin[] = {"f"}
static

Definition at line 1059 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZfinx

const char* ImpliedExtsZfinx[] = {"zicsr"}
static

Definition at line 1060 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZhinx

const char* ImpliedExtsZhinx[] = {"zhinxmin"}
static

Definition at line 1061 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZhinxmin

const char* ImpliedExtsZhinxmin[] = {"zfinx"}
static

Definition at line 1062 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZicfiss

const char* ImpliedExtsZicfiss[] = {"zicsr", "zimop"}
static

Definition at line 1064 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZicntr

const char* ImpliedExtsZicntr[] = {"zicsr"}
static

Definition at line 1063 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZihpm

const char* ImpliedExtsZihpm[] = {"zicsr"}
static

Definition at line 1065 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZk

const char* ImpliedExtsZk[] = {"zkn", "zkt", "zkr"}
static

Definition at line 1066 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZkn

const char* ImpliedExtsZkn[]
static
Initial value:
= {"zbkb", "zbkc", "zbkx",
"zkne", "zknd", "zknh"}

Definition at line 1067 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZks

const char* ImpliedExtsZks[] = {"zbkb", "zbkc", "zbkx", "zksed", "zksh"}
static

Definition at line 1069 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvbb

const char* ImpliedExtsZvbb[] = {"zvkb"}
static

Definition at line 1070 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZve32f

const char* ImpliedExtsZve32f[] = {"zve32x", "f"}
static

Definition at line 1071 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZve32x

const char* ImpliedExtsZve32x[] = {"zvl32b", "zicsr"}
static

Definition at line 1072 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZve64d

const char* ImpliedExtsZve64d[] = {"zve64f", "d"}
static

Definition at line 1073 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZve64f

const char* ImpliedExtsZve64f[] = {"zve64x", "zve32f"}
static

Definition at line 1074 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZve64x

const char* ImpliedExtsZve64x[] = {"zve32x", "zvl64b"}
static

Definition at line 1075 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvfbfmin

const char* ImpliedExtsZvfbfmin[] = {"zve32f"}
static

Definition at line 1076 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvfbfwma

const char* ImpliedExtsZvfbfwma[] = {"zvfbfmin", "zfbfmin"}
static

Definition at line 1077 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvfh

const char* ImpliedExtsZvfh[] = {"zvfhmin", "zfhmin"}
static

Definition at line 1078 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvfhmin

const char* ImpliedExtsZvfhmin[] = {"zve32f"}
static

Definition at line 1079 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvkn

const char* ImpliedExtsZvkn[] = {"zvkb", "zvkned", "zvknhb", "zvkt"}
static

Definition at line 1080 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvknc

const char* ImpliedExtsZvknc[] = {"zvbc", "zvkn"}
static

Definition at line 1081 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvkng

const char* ImpliedExtsZvkng[] = {"zvkg", "zvkn"}
static

Definition at line 1082 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvknhb

const char* ImpliedExtsZvknhb[] = {"zve64x"}
static

Definition at line 1083 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvks

const char* ImpliedExtsZvks[] = {"zvkb", "zvksed", "zvksh", "zvkt"}
static

Definition at line 1084 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvksc

const char* ImpliedExtsZvksc[] = {"zvbc", "zvks"}
static

Definition at line 1085 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvksg

const char* ImpliedExtsZvksg[] = {"zvkg", "zvks"}
static

Definition at line 1086 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl1024b

const char* ImpliedExtsZvl1024b[] = {"zvl512b"}
static

Definition at line 1087 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl128b

const char* ImpliedExtsZvl128b[] = {"zvl64b"}
static

Definition at line 1088 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl16384b

const char* ImpliedExtsZvl16384b[] = {"zvl8192b"}
static

Definition at line 1089 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl2048b

const char* ImpliedExtsZvl2048b[] = {"zvl1024b"}
static

Definition at line 1090 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl256b

const char* ImpliedExtsZvl256b[] = {"zvl128b"}
static

Definition at line 1091 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl32768b

const char* ImpliedExtsZvl32768b[] = {"zvl16384b"}
static

Definition at line 1092 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl4096b

const char* ImpliedExtsZvl4096b[] = {"zvl2048b"}
static

Definition at line 1093 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl512b

const char* ImpliedExtsZvl512b[] = {"zvl256b"}
static

Definition at line 1094 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl64b

const char* ImpliedExtsZvl64b[] = {"zvl32b"}
static

Definition at line 1095 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl65536b

const char* ImpliedExtsZvl65536b[] = {"zvl32768b"}
static

Definition at line 1096 of file RISCVISAInfo.cpp.

◆ ImpliedExtsZvl8192b

const char* ImpliedExtsZvl8192b[] = {"zvl4096b"}
static

Definition at line 1097 of file RISCVISAInfo.cpp.

◆ RISCVGImplications

const char* RISCVGImplications[]
static
Initial value:
= {
"i", "m", "a", "f", "d", "zicsr", "zifencei"
}

Definition at line 43 of file RISCVISAInfo.cpp.

Referenced by llvm::RISCVISAInfo::parseArchString().

◆ SupportedExperimentalExtensions

const RISCVSupportedExtension SupportedExperimentalExtensions[]
static
Initial value:
= {
{"smmpm", {0, 8}},
{"smnpm", {0, 8}},
{"ssnpm", {0, 8}},
{"sspm", {0, 8}},
{"ssqosid", {1, 0}},
{"supm", {0, 8}},
{"zaamo", {0, 2}},
{"zabha", {1, 0}},
{"zacas", {1, 0}},
{"zalasr", {0, 1}},
{"zalrsc", {0, 2}},
{"zcmop", {0, 2}},
{"zfbfmin", {1, 0}},
{"zicfilp", {0, 4}},
{"zicfiss", {0, 4}},
{"zimop", {0, 1}},
{"ztso", {0, 1}},
{"zvfbfmin", {1, 0}},
{"zvfbfwma", {1, 0}},
}

Definition at line 213 of file RISCVISAInfo.cpp.

Referenced by findDefaultVersion(), isExperimentalExtension(), llvm::RISCVISAInfo::isSupportedExtension(), llvm::RISCVISAInfo::isSupportedExtensionFeature(), llvm::RISCVISAInfo::parseFeatures(), llvm::riscvExtensionsHelp(), llvm::RISCVISAInfo::toFeatures(), and verifyTables().

◆ SupportedExtensions

const RISCVSupportedExtension SupportedExtensions[]
static