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 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 RISCVGroup0BitPositions []
 Maps extensions with assigned bit positions within group 0 of __riscv_features_bits to their respective bit position.
 

Macro Definition Documentation

◆ GET_IMPLIED_EXTENSIONS

#define GET_IMPLIED_EXTENSIONS

Definition at line 811 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

◆ 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

◆ 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 803 of file RISCVISAInfo.cpp.

References LHS, and RHS.

◆ operator<() [2/2]

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

Definition at line 807 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 859 of file RISCVISAInfo.cpp.

◆ 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().

◆ RISCVGroup0BitPositions

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

Maps extensions with assigned bit positions within group 0 of __riscv_features_bits to their respective bit position.

At the moment all extensions are within group 0.

Definition at line 1032 of file RISCVISAInfo.cpp.

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