LLVM 22.0.0git
llvm::RISCVISAInfo Class Reference

#include "llvm/TargetParser/RISCVISAInfo.h"

Public Member Functions

 RISCVISAInfo (const RISCVISAInfo &)=delete
RISCVISAInfooperator= (const RISCVISAInfo &)=delete
LLVM_ABI std::vector< std::string > toFeatures (bool AddAllExtensions=false, bool IgnoreUnknown=true) const
 Convert RISC-V ISA info to a feature vector.
const RISCVISAUtils::OrderedExtensionMapgetExtensions () const
unsigned getXLen () const
unsigned getFLen () const
unsigned getMinVLen () const
unsigned getMaxVLen () const
unsigned getMaxELen () const
unsigned getMaxELenFp () const
LLVM_ABI bool hasExtension (StringRef Ext) const
LLVM_ABI std::string toString () const
LLVM_ABI StringRef computeDefaultABI () const

Static Public Member Functions

static LLVM_ABI llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseArchString (StringRef Arch, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck=true)
 Parse RISC-V ISA info from arch string.
static LLVM_ABI llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseNormalizedArchString (StringRef Arch)
 Parse RISC-V ISA info from an arch string that is already in normalized form (as defined in the psABI).
static LLVM_ABI llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseFeatures (unsigned XLen, const std::vector< std::string > &Features)
 Parse RISC-V ISA info from feature vector.
static LLVM_ABI llvm::Expected< std::unique_ptr< RISCVISAInfo > > createFromExtMap (unsigned XLen, const RISCVISAUtils::OrderedExtensionMap &Exts)
static LLVM_ABI bool isSupportedExtensionFeature (StringRef Ext)
static LLVM_ABI bool isSupportedExtension (StringRef Ext)
static LLVM_ABI bool isSupportedExtensionWithVersion (StringRef Ext)
static LLVM_ABI bool isSupportedExtension (StringRef Ext, unsigned MajorVersion, unsigned MinorVersion)
static LLVM_ABI std::string getTargetFeatureForExtension (StringRef Ext)
static LLVM_ABI void printSupportedExtensions (StringMap< StringRef > &DescMap)
static LLVM_ABI void printEnabledExtensions (bool IsRV64, std::set< StringRef > &EnabledFeatureNames, StringMap< StringRef > &DescMap)
static LLVM_ABI std::pair< int, int > getRISCVFeaturesBitsInfo (StringRef Ext)
 Return the group id and bit position of __riscv_feature_bits.

Static Public Attributes

static constexpr unsigned FeatureBitSize = 2

Detailed Description

Definition at line 25 of file RISCVISAInfo.h.

Constructor & Destructor Documentation

◆ RISCVISAInfo()

llvm::RISCVISAInfo::RISCVISAInfo ( const RISCVISAInfo & )
delete

Member Function Documentation

◆ computeDefaultABI()

StringRef RISCVISAInfo::computeDefaultABI ( ) const

Definition at line 1002 of file RISCVISAInfo.cpp.

References llvm_unreachable.

◆ createFromExtMap()

llvm::Expected< std::unique_ptr< RISCVISAInfo > > RISCVISAInfo::createFromExtMap ( unsigned XLen,
const RISCVISAUtils::OrderedExtensionMap & Exts )
static

Definition at line 436 of file RISCVISAInfo.cpp.

References assert(), and RISCVISAInfo().

Referenced by printEnabledExtensions().

◆ getExtensions()

const RISCVISAUtils::OrderedExtensionMap & llvm::RISCVISAInfo::getExtensions ( ) const
inline

Definition at line 57 of file RISCVISAInfo.h.

◆ getFLen()

unsigned llvm::RISCVISAInfo::getFLen ( ) const
inline

Definition at line 62 of file RISCVISAInfo.h.

◆ getMaxELen()

unsigned llvm::RISCVISAInfo::getMaxELen ( ) const
inline

Definition at line 65 of file RISCVISAInfo.h.

◆ getMaxELenFp()

unsigned llvm::RISCVISAInfo::getMaxELenFp ( ) const
inline

Definition at line 66 of file RISCVISAInfo.h.

◆ getMaxVLen()

unsigned llvm::RISCVISAInfo::getMaxVLen ( ) const
inline

Definition at line 64 of file RISCVISAInfo.h.

◆ getMinVLen()

unsigned llvm::RISCVISAInfo::getMinVLen ( ) const
inline

Definition at line 63 of file RISCVISAInfo.h.

◆ getRISCVFeaturesBitsInfo()

std::pair< int, int > RISCVISAInfo::getRISCVFeaturesBitsInfo ( StringRef Ext)
static

Return the group id and bit position of __riscv_feature_bits.

Returns <-1, -1> if not supported.

Definition at line 1075 of file RISCVISAInfo.cpp.

◆ getTargetFeatureForExtension()

std::string RISCVISAInfo::getTargetFeatureForExtension ( StringRef Ext)
static

◆ getXLen()

unsigned llvm::RISCVISAInfo::getXLen ( ) const
inline

Definition at line 61 of file RISCVISAInfo.h.

◆ hasExtension()

bool RISCVISAInfo::hasExtension ( StringRef Ext) const

Definition at line 277 of file RISCVISAInfo.cpp.

References isSupportedExtension(), and stripExperimentalPrefix().

◆ isSupportedExtension() [1/2]

bool RISCVISAInfo::isSupportedExtension ( StringRef Ext)
static

◆ isSupportedExtension() [2/2]

bool RISCVISAInfo::isSupportedExtension ( StringRef Ext,
unsigned MajorVersion,
unsigned MinorVersion )
static

Definition at line 263 of file RISCVISAInfo.cpp.

References llvm::ArrayRef(), I, and Range.

◆ isSupportedExtensionFeature()

bool RISCVISAInfo::isSupportedExtensionFeature ( StringRef Ext)
static

◆ isSupportedExtensionWithVersion()

bool RISCVISAInfo::isSupportedExtensionWithVersion ( StringRef Ext)
static

◆ operator=()

RISCVISAInfo & llvm::RISCVISAInfo::operator= ( const RISCVISAInfo & )
delete

References LLVM_ABI, and RISCVISAInfo().

◆ parseArchString()

llvm::Expected< std::unique_ptr< RISCVISAInfo > > RISCVISAInfo::parseArchString ( StringRef Arch,
bool EnableExperimentalExtension,
bool ExperimentalExtensionVersionCheck = true )
static

◆ parseFeatures()

llvm::Expected< std::unique_ptr< RISCVISAInfo > > RISCVISAInfo::parseFeatures ( unsigned XLen,
const std::vector< std::string > & Features )
static

Parse RISC-V ISA info from feature vector.

Definition at line 447 of file RISCVISAInfo.cpp.

References llvm::Add, llvm::ArrayRef(), assert(), llvm::lower_bound(), RISCVISAInfo(), and stripExperimentalPrefix().

Referenced by llvm::RISCVFeatures::parseFeatureBits().

◆ parseNormalizedArchString()

llvm::Expected< std::unique_ptr< RISCVISAInfo > > RISCVISAInfo::parseNormalizedArchString ( StringRef Arch)
static

Parse RISC-V ISA info from an arch string that is already in normalized form (as defined in the psABI).

Unlike parseArchString, this function will not error for unrecognized extension names or extension versions.

Definition at line 479 of file RISCVISAInfo.cpp.

References llvm::all_of(), llvm::CallingConv::C, llvm::StringRef::consume_front(), llvm::StringRef::drop_front(), llvm::StringRef::empty(), llvm::StringRef::find(), llvm::StringRef::getAsInteger(), getError(), llvm::isDigit(), llvm::isLower(), RISCVISAInfo(), llvm::StringRef::size(), llvm::StringRef::slice(), llvm::StringRef::str(), and llvm::StringRef::substr().

◆ printEnabledExtensions()

void RISCVISAInfo::printEnabledExtensions ( bool IsRV64,
std::set< StringRef > & EnabledFeatureNames,
StringMap< StringRef > & DescMap )
static

◆ printSupportedExtensions()

void RISCVISAInfo::printSupportedExtensions ( StringMap< StringRef > & DescMap)
static

◆ toFeatures()

std::vector< std::string > RISCVISAInfo::toFeatures ( bool AddAllExtensions = false,
bool IgnoreUnknown = true ) const

Convert RISC-V ISA info to a feature vector.

Definition at line 286 of file RISCVISAInfo.cpp.

References _, isExperimentalExtension(), and isSupportedExtension().

◆ toString()

std::string RISCVISAInfo::toString ( ) const

Definition at line 974 of file RISCVISAInfo.cpp.

References llvm::raw_string_ostream::str().

Member Data Documentation

◆ FeatureBitSize

unsigned llvm::RISCVISAInfo::FeatureBitSize = 2
staticconstexpr

Definition at line 90 of file RISCVISAInfo.h.


The documentation for this class was generated from the following files: