14#ifndef LLVM_TARGETPARSER_RISCVTARGETPARSER_H
15#define LLVM_TARGETPARSER_RISCVTARGETPARSER_H
74 bool NeedPlus =
false);
141 return isPowerOf2_32(LMUL) && LMUL <= 8 && (!Fractional || LMUL != 1);
145 bool MaskAgnostic,
bool AltFmt =
false);
151 return Lambda == 0 || (
isPowerOf2_32(Lambda) && Lambda <= 64);
161 bool AltFmtA,
bool AltFmtB,
165 bool AltFmtA,
bool AltFmtB,
bool BlockSize16);
179 unsigned VLMul = VType & 0x7;
180 return static_cast<VLMUL>(VLMul);
188 unsigned LmulLog2 =
Log2_32(LMUL);
189 return static_cast<VLMUL>(Fractional ? 8 - LmulLog2 : LmulLog2);
193 assert(VSEW < 8 &&
"Unexpected VSEW value");
194 return 1 << (VSEW + 3);
202inline static unsigned getSEW(
unsigned VType) {
203 unsigned VSEW = (VType >> 3) & 0x7;
208 assert((TWiden == 1 || TWiden == 2 || TWiden == 3) &&
209 "Unexpected TWiden value");
210 return 1 << (TWiden - 1);
214 unsigned TWiden = (VType >> 9) & 0x3;
219 unsigned TWiden = (VType >> 9) & 0x3;
220 assert(TWiden != 0 &&
"Invalid widen value");
221 return 1 << (TWiden - 1);
228inline static bool isAltFmt(
unsigned VType) {
return VType & 0x100; }
static SDValue Widen(SelectionDAG *CurDAG, SDValue N)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
Base class for user error types.
Lightweight error class with error context and mandatory checking.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringError(std::string &&S, std::error_code EC, bool PrintMsgOnly)
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Represent a constant reference to a string, i.e.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Triple - Helper class for working with autoconf configuration names.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This class implements an extremely fast bulk output stream that can only output to a stream.
ZicfilpLabelSchemeKind getZicfilpLabelScheme(const StringRef CFBranchLabelScheme)
LLVM_ABI bool isAltFmtB(uint64_t VType, unsigned XLen)
LLVM_ABI std::optional< unsigned > getLambda(uint64_t VType, unsigned XLen)
LLVM_ABI bool isBlockSize16(uint64_t VType, unsigned XLen)
static bool isValidLambda(unsigned Lambda)
LLVM_ABI uint64_t addVTypeFields(uint64_t VType, unsigned XLen, unsigned Lambda, bool AltFmtA, bool AltFmtB, bool BlockSize16)
LLVM_ABI bool isAltFmtA(uint64_t VType, unsigned XLen)
LLVM_ABI unsigned getLambdaEncoding(uint64_t VType, unsigned XLen)
LLVM_ABI std::optional< unsigned > decodeLambda(unsigned Encoding)
LLVM_ABI uint64_t getVTypeFieldsMask(unsigned XLen)
LLVM_ABI uint64_t encodeVTypeFields(unsigned XLen, unsigned Lambda, bool AltFmtA, bool AltFmtB, bool BlockSize16)
LLVM_ABI unsigned encodeLambda(unsigned Lambda)
static bool isTailAgnostic(unsigned VType)
static VLMUL encodeLMUL(unsigned LMUL, bool Fractional)
static unsigned decodeVSEW(unsigned VSEW)
@ TAIL_UNDISTURBED_MASK_UNDISTURBED
LLVM_ABI void printXSfmmVType(unsigned VType, raw_ostream &OS)
LLVM_ABI unsigned encodeXSfmmVType(unsigned SEW, unsigned Widen, bool AltFmt)
static unsigned getXSfmmWiden(unsigned VType)
static bool isValidLMUL(unsigned LMUL, bool Fractional)
LLVM_ABI std::optional< VLMUL > getSameRatioLMUL(unsigned Ratio, unsigned EEW)
static bool isMaskAgnostic(unsigned VType)
LLVM_ABI std::pair< unsigned, bool > decodeVLMUL(VLMUL VLMul)
static bool hasXSfmmWiden(unsigned VType)
static unsigned encodeSEW(unsigned SEW)
LLVM_ABI unsigned getSEWLMULRatio(unsigned SEW, VLMUL VLMul)
static bool isValidSEW(unsigned SEW)
static bool isValidVType(unsigned VType)
LLVM_ABI void printVType(unsigned VType, raw_ostream &OS)
static bool isValidXSfmmVType(unsigned VTypeI)
static unsigned decodeTWiden(unsigned TWiden)
static bool isAltFmt(unsigned VType)
LLVM_ABI unsigned encodeVTYPE(VLMUL VLMUL, unsigned SEW, bool TailAgnostic, bool MaskAgnostic, bool AltFmt=false)
static unsigned getSEW(unsigned VType)
static VLMUL getVLMUL(unsigned VType)
LLVM_ABI bool hasFastVectorUnalignedAccess(StringRef CPU)
LLVM_ABI void getFeaturesForCPU(StringRef CPU, SmallVectorImpl< std::string > &EnabledFeatures, bool NeedPlus=false)
LLVM_ABI void fillValidTuneCPUArchList(SmallVectorImpl< StringRef > &Values, bool IsRV64)
LLVM_ABI CPUModel getCPUModel(StringRef CPU)
LLVM_ABI Error parseTuneFeatureString(StringRef ProcName, StringRef TFString, SmallVectorImpl< std::string > &TuneFeatures)
Parse the tune feature string with the respective processor.
LLVM_ABI void getAllTuneFeatures(SmallVectorImpl< StringRef > &TuneFeatures)
LLVM_ABI StringRef getMArchFromMcpu(StringRef CPU)
LLVM_ABI bool parseCPU(StringRef CPU, bool IsRV64)
LLVM_ABI bool hasFastScalarUnalignedAccess(StringRef CPU)
static constexpr unsigned RVVBitsPerBlock
LLVM_ABI bool hasValidCPUModel(StringRef CPU)
LLVM_ABI StringRef getCPUNameFromCPUModel(const CPUModel &Model)
static constexpr unsigned RVVBytesPerBlock
LLVM_ABI bool parseTuneCPU(StringRef CPU, bool IsRV64)
LLVM_ABI void fillValidCPUArchList(SmallVectorImpl< StringRef > &Values, bool IsRV64)
LLVM_ABI void getCPUConfigurableTuneFeatures(StringRef CPU, SmallVectorImpl< StringRef > &Directives)
This is an optimization pass for GlobalISel generic memory operations.
RelativeUniformCounterPtr Values
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
StringLiteral DefaultMarch
bool FastVectorUnalignedAccess
bool FastScalarUnalignedAccess
bool operator==(const CPUModel &Other) const
ParserError(const Twine &S)
ParserWarning(const Twine &S)