LLVM 22.0.0git
VFABIDemangler.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "vfabi-demangler"

Functions

static ParseRet tryParseISA (StringRef &MangledName, VFISAKind &ISA)
 Extracts the <isa> information from the mangled string, and sets the ISA accordingly.
static ParseRet tryParseMask (StringRef &MangledName, bool &IsMasked)
 Extracts the <mask> information from the mangled string, and sets IsMasked accordingly.
static ParseRet tryParseVLEN (StringRef &ParseString, VFISAKind ISA, std::pair< unsigned, bool > &ParsedVF)
 Extract the <vlen> information from the mangled string, and sets ParsedVF accordingly.
static ParseRet tryParseLinearTokenWithRuntimeStep (StringRef &ParseString, VFParamKind &PKind, int &Pos, const StringRef Token)
 The function looks for the following strings at the beginning of the input string ParseString:
static ParseRet tryParseLinearWithRuntimeStep (StringRef &ParseString, VFParamKind &PKind, int &StepOrPos)
 The function looks for the following string at the beginning of the input string ParseString:
static ParseRet tryParseCompileTimeLinearToken (StringRef &ParseString, VFParamKind &PKind, int &LinearStep, const StringRef Token)
 The function looks for the following strings at the beginning of the input string ParseString:
static ParseRet tryParseLinearWithCompileTimeStep (StringRef &ParseString, VFParamKind &PKind, int &StepOrPos)
 The function looks for the following strings at the beginning of the input string ParseString:
static ParseRet tryParseParameter (StringRef &ParseString, VFParamKind &PKind, int &StepOrPos)
 Looks into the <parameters> part of the mangled name in search for valid paramaters at the beginning of the string ParseString.
static ParseRet tryParseAlign (StringRef &ParseString, Align &Alignment)
 Looks into the <parameters> part of the mangled name in search of a valid 'aligned' clause.
static std::optional< ElementCountgetElementCountForTy (const VFISAKind ISA, const Type *Ty)
static std::optional< ElementCountgetScalableECFromSignature (const FunctionType *Signature, const VFISAKind ISA, const SmallVectorImpl< VFParameter > &Params)

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "vfabi-demangler"

Definition at line 21 of file VFABIDemangler.cpp.

Function Documentation

◆ getElementCountForTy()

std::optional< ElementCount > getElementCountForTy ( const VFISAKind ISA,
const Type * Ty )
static

◆ getScalableECFromSignature()

◆ tryParseAlign()

ParseRet tryParseAlign ( StringRef & ParseString,
Align & Alignment )
static

Looks into the <parameters> part of the mangled name in search of a valid 'aligned' clause.

The function should be invoked after parsing a parameter via tryParseParameter.

On success, it removes the parsed parameter from ParseString, sets PKind to the correspondent enum value, sets StepOrPos accordingly, and return success. On a syntax error, it return a parsing error. If nothing is parsed, it returns std::nullopt.

Definition at line 281 of file VFABIDemangler.cpp.

References llvm::StringRef::consume_front(), llvm::StringRef::consumeInteger(), and llvm::isPowerOf2_64().

Referenced by llvm::VFABI::tryDemangleForVFABI().

◆ tryParseCompileTimeLinearToken()

ParseRet tryParseCompileTimeLinearToken ( StringRef & ParseString,
VFParamKind & PKind,
int & LinearStep,
const StringRef Token )
static

The function looks for the following strings at the beginning of the input string ParseString:

<token> {"n"} <number>

On success, it removes the parsed parameter from ParseString, sets PKind to the correspondent enum value, sets LinearStep to <number>, and return success. On a syntax error, it return a parsing error. If nothing is parsed, it returns std::nullopt.

The function expects <token> to be one of "l", "R", "U" or "L".

Definition at line 186 of file VFABIDemangler.cpp.

References llvm::StringRef::consume_front(), llvm::StringRef::consumeInteger(), and llvm::VFABI::getVFParamKindFromString().

Referenced by tryParseLinearWithCompileTimeStep().

◆ tryParseISA()

ParseRet tryParseISA ( StringRef & MangledName,
VFISAKind & ISA )
static

Extracts the <isa> information from the mangled string, and sets the ISA accordingly.

If successful, the <isa> token is removed from the input string MangledName.

Definition at line 37 of file VFABIDemangler.cpp.

References llvm::VFABI::_LLVM_, llvm::AdvancedSIMD, llvm::AVX, llvm::AVX2, llvm::AVX512, llvm::StringSwitch< T, R >::Case(), llvm::StringRef::consume_front(), llvm::StringSwitch< T, R >::Default(), llvm::StringRef::drop_front(), llvm::StringRef::empty(), llvm::LLVM, llvm::RVV, llvm::SSE, llvm::SVE, llvm::StringRef::take_front(), and llvm::Unknown.

Referenced by llvm::VFABI::tryDemangleForVFABI().

◆ tryParseLinearTokenWithRuntimeStep()

ParseRet tryParseLinearTokenWithRuntimeStep ( StringRef & ParseString,
VFParamKind & PKind,
int & Pos,
const StringRef Token )
static

The function looks for the following strings at the beginning of the input string ParseString:

<token> <number>

On success, it removes the parsed parameter from ParseString, sets PKind to the correspondent enum value, sets Pos to <number>, and return success. On a syntax error, it return a parsing error. If nothing is parsed, it returns std::nullopt.

The function expects <token> to be one of "ls", "Rs", "Us" or "Ls".

Definition at line 122 of file VFABIDemangler.cpp.

References llvm::StringRef::consume_front(), llvm::StringRef::consumeInteger(), and llvm::VFABI::getVFParamKindFromString().

Referenced by tryParseLinearWithRuntimeStep().

◆ tryParseLinearWithCompileTimeStep()

ParseRet tryParseLinearWithCompileTimeStep ( StringRef & ParseString,
VFParamKind & PKind,
int & StepOrPos )
static

The function looks for the following strings at the beginning of the input string ParseString:

["l" | "R" | "U" | "L"] {"n"} <number>

On success, it removes the parsed parameter from ParseString, sets PKind to the correspondent enum value, sets LinearStep to <number>, and return success. On a syntax error, it return a parsing error. If nothing is parsed, it returns std::nullopt.

Definition at line 212 of file VFABIDemangler.cpp.

References tryParseCompileTimeLinearToken().

Referenced by tryParseParameter().

◆ tryParseLinearWithRuntimeStep()

ParseRet tryParseLinearWithRuntimeStep ( StringRef & ParseString,
VFParamKind & PKind,
int & StepOrPos )
static

The function looks for the following string at the beginning of the input string ParseString:

<token> <number>

<token> is one of "ls", "Rs", "Us" or "Ls".

On success, it removes the parsed parameter from ParseString, sets PKind to the correspondent enum value, sets StepOrPos to <number>, and return success. On a syntax error, it return a parsing error. If nothing is parsed, it returns std::nullopt.

Definition at line 146 of file VFABIDemangler.cpp.

References tryParseLinearTokenWithRuntimeStep().

Referenced by tryParseParameter().

◆ tryParseMask()

ParseRet tryParseMask ( StringRef & MangledName,
bool & IsMasked )
static

Extracts the <mask> information from the mangled string, and sets IsMasked accordingly.

If successful, the <mask> token is removed from the input string MangledName.

Definition at line 62 of file VFABIDemangler.cpp.

References llvm::StringRef::consume_front().

Referenced by llvm::VFABI::tryDemangleForVFABI().

◆ tryParseParameter()

ParseRet tryParseParameter ( StringRef & ParseString,
VFParamKind & PKind,
int & StepOrPos )
static

Looks into the <parameters> part of the mangled name in search for valid paramaters at the beginning of the string ParseString.

On success, it removes the parsed parameter from ParseString, sets PKind to the correspondent enum value, sets StepOrPos accordingly, and return success. On a syntax error, it return a parsing error. If nothing is parsed, it returns std::nullopt.

Definition at line 246 of file VFABIDemangler.cpp.

References llvm::StringRef::consume_front(), llvm::OMP_Uniform, tryParseLinearWithCompileTimeStep(), tryParseLinearWithRuntimeStep(), and llvm::Vector.

Referenced by llvm::VFABI::tryDemangleForVFABI().

◆ tryParseVLEN()

ParseRet tryParseVLEN ( StringRef & ParseString,
VFISAKind ISA,
std::pair< unsigned, bool > & ParsedVF )
static

Extract the <vlen> information from the mangled string, and sets ParsedVF accordingly.

A <vlen> == "x" token is interpreted as a scalable vector length and the boolean is set to true, otherwise a nonzero unsigned integer will be directly used as a VF. On success, the <vlen> token is removed from the input string ParseString.

Definition at line 81 of file VFABIDemangler.cpp.

References llvm::StringRef::consume_front(), llvm::StringRef::consumeInteger(), llvm::dbgs(), LLVM_DEBUG, llvm::RVV, and llvm::SVE.

Referenced by llvm::VFABI::tryDemangleForVFABI().