LLVM 22.0.0git
|
#include "llvm/IR/VFABIDemangler.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/VectorTypeUtils.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <limits>
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< ElementCount > | getElementCountForTy (const VFISAKind ISA, const Type *Ty) |
static std::optional< ElementCount > | getScalableECFromSignature (const FunctionType *Signature, const VFISAKind ISA, const SmallVectorImpl< VFParameter > &Params) |
#define DEBUG_TYPE "vfabi-demangler" |
Definition at line 21 of file VFABIDemangler.cpp.
|
static |
Definition at line 305 of file VFABIDemangler.cpp.
References assert(), llvm::ElementCount::getScalable(), llvm::RVV, and llvm::SVE.
Referenced by getScalableECFromSignature().
|
static |
Definition at line 325 of file VFABIDemangler.cpp.
References llvm::dyn_cast(), llvm::getContainedTypes(), getElementCountForTy(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getKnownMinValue(), llvm::ElementCount::getScalable(), llvm::details::FixedOrScalableQuantity< ElementCount, unsigned >::isKnownLT(), llvm::isUnpackedStructLiteral(), llvm::Type::isVoidTy(), and llvm::Vector.
Referenced by llvm::VFABI::tryDemangleForVFABI().
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().
|
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().
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().
|
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().
|
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().
|
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().
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().
|
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().
|
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().