LLVM 19.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::RISCVISAInfo Class Reference

#include "llvm/Support/RISCVISAInfo.h"


struct  ExtensionComparator
 Helper class for OrderedExtensionMap. More...
struct  ExtensionVersion
 Represents the major and version number components of a RISC-V extension. More...

Public Types

typedef std::map< std::string, ExtensionVersion, ExtensionComparatorOrderedExtensionMap
 OrderedExtensionMap is std::map, it's specialized to keep entries in canonical order of extension.

Public Member Functions

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

Static Public Member Functions

static bool compareExtension (const std::string &LHS, const std::string &RHS)
static llvm::Expected< std::unique_ptr< RISCVISAInfo > > parseArchString (StringRef Arch, bool EnableExperimentalExtension, bool ExperimentalExtensionVersionCheck=true, bool IgnoreUnknown=false)
 Parse RISC-V ISA info from arch string.
static 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::Expected< std::unique_ptr< RISCVISAInfo > > parseFeatures (unsigned XLen, const std::vector< std::string > &Features)
 Parse RISC-V ISA info from feature vector.
static bool isSupportedExtensionFeature (StringRef Ext)
static bool isSupportedExtension (StringRef Ext)
static bool isSupportedExtensionWithVersion (StringRef Ext)
static bool isSupportedExtension (StringRef Ext, unsigned MajorVersion, unsigned MinorVersion)
static llvm::Expected< std::unique_ptr< RISCVISAInfo > > postProcessAndChecking (std::unique_ptr< RISCVISAInfo > &&ISAInfo)
static std::string getTargetFeatureForExtension (StringRef Ext)

Detailed Description

Definition at line 23 of file RISCVISAInfo.h.

Member Typedef Documentation

◆ OrderedExtensionMap

OrderedExtensionMap is std::map, it's specialized to keep entries in canonical order of extension.

Definition at line 46 of file RISCVISAInfo.h.

Constructor & Destructor Documentation

◆ RISCVISAInfo() [1/2]

llvm::RISCVISAInfo::RISCVISAInfo ( const RISCVISAInfo )

◆ RISCVISAInfo() [2/2]

llvm::RISCVISAInfo::RISCVISAInfo ( unsigned  XLen,
OrderedExtensionMap Exts 

Definition at line 48 of file RISCVISAInfo.h.

Member Function Documentation

◆ compareExtension()

bool RISCVISAInfo::compareExtension ( const std::string &  LHS,
const std::string &  RHS 

Definition at line 530 of file RISCVISAInfo.cpp.

References getExtensionRank(), LHS, and RHS.

Referenced by llvm::RISCVISAInfo::ExtensionComparator::operator()().

◆ computeDefaultABI()

StringRef RISCVISAInfo::computeDefaultABI ( ) const

Definition at line 1395 of file RISCVISAInfo.cpp.

References hasExtension(), and llvm_unreachable.

◆ getExtensions()

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

Definition at line 75 of file RISCVISAInfo.h.

◆ getFLen()

unsigned llvm::RISCVISAInfo::getFLen ( ) const

Definition at line 78 of file RISCVISAInfo.h.

◆ getMaxELen()

unsigned llvm::RISCVISAInfo::getMaxELen ( ) const

Definition at line 81 of file RISCVISAInfo.h.

◆ getMaxELenFp()

unsigned llvm::RISCVISAInfo::getMaxELenFp ( ) const

Definition at line 82 of file RISCVISAInfo.h.

◆ getMaxVLen()

unsigned llvm::RISCVISAInfo::getMaxVLen ( ) const

Definition at line 80 of file RISCVISAInfo.h.

◆ getMinVLen()

unsigned llvm::RISCVISAInfo::getMinVLen ( ) const

Definition at line 79 of file RISCVISAInfo.h.

◆ getTargetFeatureForExtension()

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

◆ getXLen()

unsigned llvm::RISCVISAInfo::getXLen ( ) const

Definition at line 77 of file RISCVISAInfo.h.

◆ hasExtension()

bool RISCVISAInfo::hasExtension ( StringRef  Ext) const

Definition at line 462 of file RISCVISAInfo.cpp.

References isSupportedExtension(), and stripExperimentalPrefix().

Referenced by computeDefaultABI().

◆ isSupportedExtension() [1/2]

bool RISCVISAInfo::isSupportedExtension ( StringRef  Ext)

◆ isSupportedExtension() [2/2]

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

Definition at line 448 of file RISCVISAInfo.cpp.

References I, SupportedExperimentalExtensions, and SupportedExtensions.

◆ isSupportedExtensionFeature()

bool RISCVISAInfo::isSupportedExtensionFeature ( StringRef  Ext)

◆ isSupportedExtensionWithVersion()

bool RISCVISAInfo::isSupportedExtensionWithVersion ( StringRef  Ext)

◆ operator=()

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

◆ parseArchString()

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

◆ parseFeatures()

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

◆ parseNormalizedArchString()

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

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

References llvm::any_of(), llvm::StringRef::back(), llvm::createStringError(), llvm::StringRef::drop_back(), llvm::StringRef::empty(), llvm::StringRef::getAsInteger(), llvm::invalid_argument, isDigit(), llvm::StringRef::split(), llvm::StringRef::starts_with(), and llvm::StringRef::substr().

◆ postProcessAndChecking()

llvm::Expected< std::unique_ptr< RISCVISAInfo > > RISCVISAInfo::postProcessAndChecking ( std::unique_ptr< RISCVISAInfo > &&  ISAInfo)

Definition at line 1383 of file RISCVISAInfo.cpp.

Referenced by parseArchString(), and parseFeatures().

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

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

◆ toString()

std::string RISCVISAInfo::toString ( ) const

Definition at line 1365 of file RISCVISAInfo.cpp.

References llvm::raw_string_ostream::str().

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