LLVM 20.0.0git
Classes | Macros | Functions | Variables
RISCVISAInfo.cpp File Reference
#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>
#include "llvm/TargetParser/RISCVTargetParserDef.inc"

Go to the source code of this file.

Classes

struct  ImpliedExtsEntry
 
struct  RISCVExtBit
 

Macros

#define GET_SUPPORTED_EXTENSIONS
 
#define GET_SUPPORTED_PROFILES
 
#define GET_IMPLIED_EXTENSIONS
 

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< RISCVISAUtils::ExtensionVersionfindDefaultVersion (StringRef ExtName)
 
static StringRef getExtensionTypeDesc (StringRef Ext)
 
static StringRef getExtensionType (StringRef Ext)
 
static std::optional< RISCVISAUtils::ExtensionVersionisExperimentalExtension (StringRef Ext)
 
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)
 
static Error getIncompatibleError (StringRef Ext1, StringRef Ext2)
 
static Error getExtensionRequiresError (StringRef Ext, StringRef ReqExt)
 
static bool operator< (const ImpliedExtsEntry &LHS, StringRef RHS)
 
static bool operator< (StringRef LHS, const ImpliedExtsEntry &RHS)
 

Variables

static const charRISCVGImplications []
 
static constexpr StringLiteral CombineIntoExts []
 
static constexpr RISCVExtBit RISCVBitPositions []
 

Macro Definition Documentation

◆ GET_IMPLIED_EXTENSIONS

#define GET_IMPLIED_EXTENSIONS

Definition at line 800 of file RISCVISAInfo.cpp.

◆ GET_SUPPORTED_EXTENSIONS

#define GET_SUPPORTED_EXTENSIONS

Definition at line 52 of file RISCVISAInfo.cpp.

◆ GET_SUPPORTED_PROFILES

#define GET_SUPPORTED_PROFILES

Definition at line 55 of file RISCVISAInfo.cpp.

Function Documentation

◆ findDefaultVersion()

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

Definition at line 195 of file RISCVISAInfo.cpp.

References I, and llvm::lower_bound().

Referenced by getExtensionVersion(), and llvm::RISCVISAInfo::parseArchString().

◆ findLastNonVersionCharacter()

static size_t findLastNonVersionCharacter ( StringRef  Ext)
static

◆ getError()

static Error getError ( const Twine Message)
static

◆ getErrorForInvalidExt()

static Error getErrorForInvalidExt ( StringRef  ExtName)
static

◆ getExtensionRequiresError()

static Error getExtensionRequiresError ( StringRef  Ext,
StringRef  ReqExt 
)
static

Definition at line 729 of file RISCVISAInfo.cpp.

References getError().

◆ getExtensionType()

static StringRef getExtensionType ( StringRef  Ext)
static

Definition at line 220 of file RISCVISAInfo.cpp.

Referenced by llvm::RISCVISAInfo::parseArchString(), and performMemPairCombine().

◆ getExtensionTypeDesc()

static StringRef getExtensionTypeDesc ( StringRef  Ext)
static

Definition at line 210 of file RISCVISAInfo.cpp.

Referenced by getErrorForInvalidExt(), and llvm::RISCVISAInfo::parseArchString().

◆ getExtensionVersion()

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

◆ getIncompatibleError()

static Error getIncompatibleError ( StringRef  Ext1,
StringRef  Ext2 
)
static

Definition at line 724 of file RISCVISAInfo.cpp.

References getError().

◆ isExperimentalExtension()

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

◆ operator<() [1/2]

static bool operator< ( const ImpliedExtsEntry LHS,
StringRef  RHS 
)
static

Definition at line 792 of file RISCVISAInfo.cpp.

References LHS, and RHS.

◆ operator<() [2/2]

static bool operator< ( StringRef  LHS,
const ImpliedExtsEntry RHS 
)
static

Definition at line 796 of file RISCVISAInfo.cpp.

References LHS, and RHS.

◆ PrintExtension()

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

◆ stripExperimentalPrefix()

static bool stripExperimentalPrefix ( StringRef Ext)
static

◆ verifyTables()

static void verifyTables ( )
static

Definition at line 58 of file RISCVISAInfo.cpp.

References assert(), and llvm::is_sorted().

Variable Documentation

◆ CombineIntoExts

constexpr StringLiteral CombineIntoExts[]
staticconstexpr
Initial value:
= {
{"zk"}, {"zkn"}, {"zks"}, {"zvkn"}, {"zvknc"},
{"zvkng"}, {"zvks"}, {"zvksc"}, {"zvksg"},
}

Definition at line 848 of file RISCVISAInfo.cpp.

◆ RISCVBitPositions

constexpr RISCVExtBit RISCVBitPositions[]
staticconstexpr
Initial value:
= {
{"a", 0, 0}, {"c", 0, 2},
{"d", 0, 3}, {"f", 0, 5},
{"i", 0, 8}, {"m", 0, 12},
{"v", 0, 21}, {"zacas", 0, 26},
{"zba", 0, 27}, {"zbb", 0, 28},
{"zbc", 0, 29}, {"zbkb", 0, 30},
{"zbkc", 0, 31}, {"zbkx", 0, 32},
{"zbs", 0, 33}, {"zfa", 0, 34},
{"zfh", 0, 35}, {"zfhmin", 0, 36},
{"zicboz", 0, 37}, {"zicond", 0, 38},
{"zihintntl", 0, 39}, {"zihintpause", 0, 40},
{"zknd", 0, 41}, {"zkne", 0, 42},
{"zknh", 0, 43}, {"zksed", 0, 44},
{"zksh", 0, 45}, {"zkt", 0, 46},
{"ztso", 0, 47}, {"zvbb", 0, 48},
{"zvbc", 0, 49}, {"zvfh", 0, 50},
{"zvfhmin", 0, 51}, {"zvkb", 0, 52},
{"zvkg", 0, 53}, {"zvkned", 0, 54},
{"zvknha", 0, 55}, {"zvknhb", 0, 56},
{"zvksed", 0, 57}, {"zvksh", 0, 58},
{"zvkt", 0, 59}, {"zve32x", 0, 60},
{"zve32f", 0, 61}, {"zve64x", 0, 62},
{"zve64f", 0, 63}, {"zve64d", 1, 0},
{"zimop", 1, 1}, {"zca", 1, 2},
{"zcb", 1, 3}, {"zcd", 1, 4},
{"zcf", 1, 5}, {"zcmop", 1, 6},
{"zawrs", 1, 7}}

Definition at line 1019 of file RISCVISAInfo.cpp.

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

◆ RISCVGImplications

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

Definition at line 48 of file RISCVISAInfo.cpp.

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