LLVM 23.0.0git
llvm::RISCV Namespace Reference

Classes

struct  CPUInfo
struct  CPUModel
struct  DemandedFields
 Which subfields of VL or VTYPE have values we need to preserve? More...
struct  NDSVLNPseudo
struct  RISCVMaskedPseudoInfo
class  RISCVVSETVLIInfoAnalysis
struct  VLEPseudo
struct  VLSEGPseudo
struct  VLX_VSXPseudo
struct  VLXSEGPseudo
struct  VSEPseudo
class  VSETVLIInfo
 Defines the abstract state with which the forward dataflow models the values of the VL and VTYPE registers after insertion. More...
struct  VSSEGPseudo
struct  VSXSEGPseudo
struct  VXMemOpInfo

Typedefs

using Specifier = uint16_t

Enumerations

enum  PartialMappingIdx {
  PMI_GPRB32 = 0 , PMI_GPRB64 = 1 , PMI_FPRB16 = 2 , PMI_FPRB32 = 3 ,
  PMI_FPRB64 = 4 , PMI_VRB64 = 5 , PMI_VRB128 = 6 , PMI_VRB256 = 7 ,
  PMI_VRB512 = 8
}
enum  ValueMappingIdx {
  InvalidIdx = 0 , GPRB32Idx = 1 , GPRB64Idx = 4 , FPRB16Idx = 7 ,
  FPRB32Idx = 10 , FPRB64Idx = 13 , VRB64Idx = 16 , VRB128Idx = 19 ,
  VRB256Idx = 22 , VRB512Idx = 25
}
enum  Fixups {
  fixup_riscv_hi20 = FirstTargetFixupKind , fixup_riscv_lo12_i , fixup_riscv_12_i , fixup_riscv_lo12_s ,
  fixup_riscv_pcrel_hi20 , fixup_riscv_pcrel_lo12_i , fixup_riscv_pcrel_lo12_s , fixup_riscv_jal ,
  fixup_riscv_branch , fixup_riscv_rvc_jump , fixup_riscv_rvc_branch , fixup_riscv_rvc_imm ,
  fixup_riscv_call , fixup_riscv_call_plt , fixup_riscv_qc_e_branch , fixup_riscv_qc_e_32 ,
  fixup_riscv_qc_abs20_u , fixup_riscv_qc_e_call_plt , fixup_riscv_nds_branch_10 , fixup_riscv_invalid ,
  NumTargetFixupKinds = fixup_riscv_invalid - FirstTargetFixupKind
}
enum  {
  S_None , S_LO = FirstTargetFixupKind , S_PCREL_LO , S_TPREL_LO ,
  S_QC_ABS20
}
enum  CPUKind : unsigned

Functions

LLVM_ABI void getFeaturesForCPU (StringRef CPU, SmallVectorImpl< std::string > &EnabledFeatures, bool NeedPlus=false)
LLVM_ABI bool parseCPU (StringRef CPU, bool IsRV64)
LLVM_ABI bool parseTuneCPU (StringRef CPU, bool IsRV64)
LLVM_ABI StringRef getMArchFromMcpu (StringRef CPU)
LLVM_ABI void fillValidCPUArchList (SmallVectorImpl< StringRef > &Values, bool IsRV64)
LLVM_ABI void fillValidTuneCPUArchList (SmallVectorImpl< StringRef > &Values, bool IsRV64)
LLVM_ABI bool hasFastScalarUnalignedAccess (StringRef CPU)
LLVM_ABI bool hasFastVectorUnalignedAccess (StringRef CPU)
LLVM_ABI bool hasValidCPUModel (StringRef CPU)
LLVM_ABI CPUModel getCPUModel (StringRef CPU)
LLVM_ABI StringRef getCPUNameFromCPUModel (const CPUModel &Model)
Specifier parseSpecifierName (StringRef name)
StringRef getSpecifierName (Specifier Kind)
ArrayRef< MCPhysReggetArgGPRs (const RISCVABI::ABI ABI)
bool isRVVSpill (const MachineInstr &MI)
bool isVectorCopy (const TargetRegisterInfo *TRI, const MachineInstr &MI)
 Return true if MI is a copy that will be lowered to one or more vmvNr.vs.
std::optional< std::pair< unsigned, unsigned > > isRVVSpillForZvlsseg (unsigned Opcode)
bool hasEqualFRM (const MachineInstr &MI1, const MachineInstr &MI2)
std::optional< unsignedgetVectorLowDemandedScalarBits (unsigned Opcode, unsigned Log2SEW)
unsigned getRVVMCOpcode (unsigned RVVPseudoOpcode)
unsigned getDestLog2EEW (const MCInstrDesc &Desc, unsigned Log2SEW)
bool isVLKnownLE (const MachineOperand &LHS, const MachineOperand &RHS)
 Given two VL operands, do we know that LHS <= RHS?
static VNInfogetVNInfoFromReg (Register Reg, const MachineInstr &MI, const LiveIntervals *LIS)
 Given a virtual register Reg, return the corresponding VNInfo for it.
static unsigned getVLOpNum (const MachineInstr &MI)
static unsigned getSEWOpNum (const MachineInstr &MI)
static unsigned getVecPolicyOpNum (const MachineInstr &MI)
static std::optional< unsignedgetEEWForLoadStore (const MachineInstr &MI)
 Get the EEW for a load or store instruction.
static bool isMaskRegOp (const MachineInstr &MI)
 Return true if this is an operation on mask registers.
static bool hasUndefinedPassthru (const MachineInstr &MI)
 Return true if the inactive elements in the result are entirely undefined.
static bool isLMUL1OrSmaller (RISCVVType::VLMUL LMUL)
bool areCompatibleVTYPEs (uint64_t CurVType, uint64_t NewVType, const DemandedFields &Used)
 Return true if moving from CurVType to NewVType is indistinguishable from the perspective of an instruction (or set of instructions) which use only the Used subfields and properties.
DemandedFields getDemanded (const MachineInstr &MI, const RISCVSubtarget *ST)
 Return the fields and properties demanded by the provided instruction.
static unsigned computeVLMAX (unsigned VLEN, unsigned SEW, RISCVVType::VLMUL VLMul)
LLVM_ATTRIBUTE_USED raw_ostreamoperator<< (raw_ostream &OS, const DemandedFields &DF)
LLVM_ATTRIBUTE_USED raw_ostreamoperator<< (raw_ostream &OS, const VSETVLIInfo &V)
static const CPUInfogetCPUInfoByName (StringRef CPU)

Variables

static constexpr unsigned RVVBitsPerBlock = 64
static constexpr unsigned RVVBytesPerBlock = RVVBitsPerBlock / 8
const RegisterBankInfo::PartialMapping PartMappings []
const RegisterBankInfo::ValueMapping ValueMappings []
static constexpr int64_t VLMaxSentinel = -1LL
static constexpr unsigned FPMASK_Negative_Infinity = 0x001
static constexpr unsigned FPMASK_Negative_Normal = 0x002
static constexpr unsigned FPMASK_Negative_Subnormal = 0x004
static constexpr unsigned FPMASK_Negative_Zero = 0x008
static constexpr unsigned FPMASK_Positive_Zero = 0x010
static constexpr unsigned FPMASK_Positive_Subnormal = 0x020
static constexpr unsigned FPMASK_Positive_Normal = 0x040
static constexpr unsigned FPMASK_Positive_Infinity = 0x080
static constexpr unsigned FPMASK_Signaling_NaN = 0x100
static constexpr unsigned FPMASK_Quiet_NaN = 0x200
constexpr CPUInfo RISCVCPUInfo []

Typedef Documentation

◆ Specifier

Definition at line 36 of file RISCVMCAsmInfo.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
S_None 
S_LO 
S_PCREL_LO 
S_TPREL_LO 
S_QC_ABS20 

Definition at line 39 of file RISCVMCAsmInfo.h.

◆ CPUKind

Definition at line 22 of file RISCVTargetParser.cpp.

◆ Fixups

Enumerator
fixup_riscv_hi20 
fixup_riscv_lo12_i 
fixup_riscv_12_i 
fixup_riscv_lo12_s 
fixup_riscv_pcrel_hi20 
fixup_riscv_pcrel_lo12_i 
fixup_riscv_pcrel_lo12_s 
fixup_riscv_jal 
fixup_riscv_branch 
fixup_riscv_rvc_jump 
fixup_riscv_rvc_branch 
fixup_riscv_rvc_imm 
fixup_riscv_call 
fixup_riscv_call_plt 
fixup_riscv_qc_e_branch 
fixup_riscv_qc_e_32 
fixup_riscv_qc_abs20_u 
fixup_riscv_qc_e_call_plt 
fixup_riscv_nds_branch_10 
fixup_riscv_invalid 
NumTargetFixupKinds 

Definition at line 18 of file RISCVFixupKinds.h.

◆ PartialMappingIdx

Enumerator
PMI_GPRB32 
PMI_GPRB64 
PMI_FPRB16 
PMI_FPRB32 
PMI_FPRB64 
PMI_VRB64 
PMI_VRB128 
PMI_VRB256 
PMI_VRB512 

Definition at line 43 of file RISCVRegisterBankInfo.cpp.

◆ ValueMappingIdx

Enumerator
InvalidIdx 
GPRB32Idx 
GPRB64Idx 
FPRB16Idx 
FPRB32Idx 
FPRB64Idx 
VRB64Idx 
VRB128Idx 
VRB256Idx 
VRB512Idx 

Definition at line 96 of file RISCVRegisterBankInfo.cpp.

Function Documentation

◆ areCompatibleVTYPEs()

◆ computeVLMAX()

unsigned llvm::RISCV::computeVLMAX ( unsigned VLEN,
unsigned SEW,
RISCVVType::VLMUL VLMul )
static

◆ fillValidCPUArchList()

void llvm::RISCV::fillValidCPUArchList ( SmallVectorImpl< StringRef > & Values,
bool IsRV64 )

◆ fillValidTuneCPUArchList()

void llvm::RISCV::fillValidTuneCPUArchList ( SmallVectorImpl< StringRef > & Values,
bool IsRV64 )

◆ getArgGPRs()

◆ getCPUInfoByName()

const CPUInfo * llvm::RISCV::getCPUInfoByName ( StringRef CPU)
static

◆ getCPUModel()

CPUModel llvm::RISCV::getCPUModel ( StringRef CPU)

Definition at line 62 of file RISCVTargetParser.cpp.

References getCPUInfoByName(), and Info.

Referenced by hasValidCPUModel().

◆ getCPUNameFromCPUModel()

StringRef llvm::RISCV::getCPUNameFromCPUModel ( const CPUModel & Model)

Definition at line 69 of file RISCVTargetParser.cpp.

References llvm::CallingConv::C, and RISCVCPUInfo.

◆ getDemanded()

◆ getDestLog2EEW()

unsigned llvm::RISCV::getDestLog2EEW ( const MCInstrDesc & Desc,
unsigned Log2SEW )

◆ getEEWForLoadStore()

std::optional< unsigned > llvm::RISCV::getEEWForLoadStore ( const MachineInstr & MI)
static

Get the EEW for a load or store instruction.

Return std::nullopt if MI is not a load or store which ignores SEW.

Definition at line 48 of file RISCVVSETVLIInfoAnalysis.cpp.

References getRVVMCOpcode(), and MI.

Referenced by llvm::RISCV::RISCVVSETVLIInfoAnalysis::computeInfoForInstr(), and getDemanded().

◆ getFeaturesForCPU()

void llvm::RISCV::getFeaturesForCPU ( StringRef CPU,
SmallVectorImpl< std::string > & EnabledFeatures,
bool NeedPlus = false )

◆ getMArchFromMcpu()

StringRef llvm::RISCV::getMArchFromMcpu ( StringRef CPU)

Definition at line 101 of file RISCVTargetParser.cpp.

References getCPUInfoByName(), and Info.

Referenced by getFeaturesForCPU().

◆ getRVVMCOpcode()

◆ getSEWOpNum()

unsigned llvm::RISCV::getSEWOpNum ( const MachineInstr & MI)
static

◆ getSpecifierName()

StringRef llvm::RISCV::getSpecifierName ( Specifier Kind)

◆ getVecPolicyOpNum()

unsigned llvm::RISCV::getVecPolicyOpNum ( const MachineInstr & MI)
static

◆ getVectorLowDemandedScalarBits()

std::optional< unsigned > llvm::RISCV::getVectorLowDemandedScalarBits ( unsigned Opcode,
unsigned Log2SEW )

◆ getVLOpNum()

unsigned llvm::RISCV::getVLOpNum ( const MachineInstr & MI)
static

◆ getVNInfoFromReg()

VNInfo * llvm::RISCV::getVNInfoFromReg ( Register Reg,
const MachineInstr & MI,
const LiveIntervals * LIS )
static

Given a virtual register Reg, return the corresponding VNInfo for it.

This will return nullptr if the virtual register is an implicit_def or if LiveIntervals is not available.

Definition at line 24 of file RISCVVSETVLIInfoAnalysis.cpp.

References assert(), llvm::SlotIndexes::getInstructionIndex(), llvm::LiveIntervals::getInterval(), llvm::LiveIntervals::getSlotIndexes(), MI, and Reg.

Referenced by llvm::RISCV::RISCVVSETVLIInfoAnalysis::computeInfoForInstr(), and llvm::RISCV::RISCVVSETVLIInfoAnalysis::getInfoForVSETVLI().

◆ hasEqualFRM()

◆ hasFastScalarUnalignedAccess()

bool llvm::RISCV::hasFastScalarUnalignedAccess ( StringRef CPU)

Definition at line 50 of file RISCVTargetParser.cpp.

References getCPUInfoByName(), and Info.

◆ hasFastVectorUnalignedAccess()

bool llvm::RISCV::hasFastVectorUnalignedAccess ( StringRef CPU)

Definition at line 55 of file RISCVTargetParser.cpp.

References getCPUInfoByName(), and Info.

◆ hasUndefinedPassthru()

bool llvm::RISCV::hasUndefinedPassthru ( const MachineInstr & MI)
static

Return true if the inactive elements in the result are entirely undefined.

Note that this is different from "agnostic" as defined by the vector specification. Agnostic requires each lane to either be undisturbed, or take the value -1; no other value is allowed.

Definition at line 89 of file RISCVVSETVLIInfoAnalysis.cpp.

References llvm::MachineOperand::getReg(), llvm::MachineOperand::isUndef(), llvm::Register::isValid(), and MI.

Referenced by llvm::RISCV::RISCVVSETVLIInfoAnalysis::computeInfoForInstr(), and getDemanded().

◆ hasValidCPUModel()

bool llvm::RISCV::hasValidCPUModel ( StringRef CPU)

Definition at line 60 of file RISCVTargetParser.cpp.

References getCPUModel(), and llvm::RISCV::CPUModel::isValid().

◆ isLMUL1OrSmaller()

bool llvm::RISCV::isLMUL1OrSmaller ( RISCVVType::VLMUL LMUL)
static

Definition at line 102 of file RISCVVSETVLIInfoAnalysis.cpp.

References llvm::RISCVVType::decodeVLMUL().

Referenced by areCompatibleVTYPEs().

◆ isMaskRegOp()

bool llvm::RISCV::isMaskRegOp ( const MachineInstr & MI)
static

Return true if this is an operation on mask registers.

Note that this includes both arithmetic/logical ops and load/store (vlm/vsm).

Definition at line 77 of file RISCVVSETVLIInfoAnalysis.cpp.

References getSEWOpNum(), llvm::RISCVII::hasSEWOp(), and MI.

Referenced by getDemanded().

◆ isRVVSpill()

◆ isRVVSpillForZvlsseg()

std::optional< std::pair< unsigned, unsigned > > llvm::RISCV::isRVVSpillForZvlsseg ( unsigned Opcode)

◆ isVectorCopy()

bool llvm::RISCV::isVectorCopy ( const TargetRegisterInfo * TRI,
const MachineInstr & MI )

Return true if MI is a copy that will be lowered to one or more vmvNr.vs.

Definition at line 4933 of file RISCVInstrInfo.cpp.

References llvm::RISCVRegisterInfo::isRVVRegClass(), MI, and TRI.

Referenced by getDemanded().

◆ isVLKnownLE()

bool llvm::RISCV::isVLKnownLE ( const MachineOperand & LHS,
const MachineOperand & RHS )

Given two VL operands, do we know that LHS <= RHS?

Given two VL operands, do we know that LHS <= RHS? Must be used in SSA form.

Definition at line 5144 of file RISCVInstrInfo.cpp.

References assert(), getEffectiveImm(), and VLMaxSentinel.

◆ operator<<() [1/2]

LLVM_ATTRIBUTE_USED raw_ostream & llvm::RISCV::operator<< ( raw_ostream & OS,
const DemandedFields & DF )
inline

Definition at line 157 of file RISCVVSETVLIInfoAnalysis.h.

References DF.

◆ operator<<() [2/2]

LLVM_ATTRIBUTE_USED raw_ostream & llvm::RISCV::operator<< ( raw_ostream & OS,
const VSETVLIInfo & V )
inline

Definition at line 565 of file RISCVVSETVLIInfoAnalysis.h.

◆ parseCPU()

bool llvm::RISCV::parseCPU ( StringRef CPU,
bool IsRV64 )

Definition at line 79 of file RISCVTargetParser.cpp.

References getCPUInfoByName(), and Info.

Referenced by parseTuneCPU().

◆ parseSpecifierName()

RISCV::Specifier llvm::RISCV::parseSpecifierName ( StringRef name)

◆ parseTuneCPU()

bool llvm::RISCV::parseTuneCPU ( StringRef CPU,
bool IsRV64 )

Variable Documentation

◆ FPMASK_Negative_Infinity

unsigned llvm::RISCV::FPMASK_Negative_Infinity = 0x001
staticconstexpr

Definition at line 406 of file RISCVInstrInfo.h.

◆ FPMASK_Negative_Normal

unsigned llvm::RISCV::FPMASK_Negative_Normal = 0x002
staticconstexpr

Definition at line 407 of file RISCVInstrInfo.h.

◆ FPMASK_Negative_Subnormal

unsigned llvm::RISCV::FPMASK_Negative_Subnormal = 0x004
staticconstexpr

Definition at line 408 of file RISCVInstrInfo.h.

◆ FPMASK_Negative_Zero

unsigned llvm::RISCV::FPMASK_Negative_Zero = 0x008
staticconstexpr

Definition at line 409 of file RISCVInstrInfo.h.

◆ FPMASK_Positive_Infinity

unsigned llvm::RISCV::FPMASK_Positive_Infinity = 0x080
staticconstexpr

Definition at line 413 of file RISCVInstrInfo.h.

◆ FPMASK_Positive_Normal

unsigned llvm::RISCV::FPMASK_Positive_Normal = 0x040
staticconstexpr

Definition at line 412 of file RISCVInstrInfo.h.

◆ FPMASK_Positive_Subnormal

unsigned llvm::RISCV::FPMASK_Positive_Subnormal = 0x020
staticconstexpr

Definition at line 411 of file RISCVInstrInfo.h.

◆ FPMASK_Positive_Zero

unsigned llvm::RISCV::FPMASK_Positive_Zero = 0x010
staticconstexpr

Definition at line 410 of file RISCVInstrInfo.h.

◆ FPMASK_Quiet_NaN

unsigned llvm::RISCV::FPMASK_Quiet_NaN = 0x200
staticconstexpr

Definition at line 415 of file RISCVInstrInfo.h.

◆ FPMASK_Signaling_NaN

unsigned llvm::RISCV::FPMASK_Signaling_NaN = 0x100
staticconstexpr

Definition at line 414 of file RISCVInstrInfo.h.

◆ PartMappings

const RegisterBankInfo::PartialMapping llvm::RISCV::PartMappings[]
Initial value:
= {
{0, 32, GPRBRegBank},
{0, 64, GPRBRegBank},
{0, 16, FPRBRegBank},
{0, 32, FPRBRegBank},
{0, 64, FPRBRegBank},
{0, 64, VRBRegBank},
{0, 128, VRBRegBank},
{0, 256, VRBRegBank},
{0, 512, VRBRegBank},
}

Definition at line 29 of file RISCVRegisterBankInfo.cpp.

◆ RISCVCPUInfo

CPUInfo llvm::RISCV::RISCVCPUInfo[]
constexpr
Initial value:
= {
#define PROC(ENUM, NAME, DEFAULT_MARCH, FAST_SCALAR_UNALIGN, FAST_VECTOR_UNALIGN, MVENDORID, MARCHID, MIMPID)
\
\
\
\
\
\
\
}

Definition at line 30 of file RISCVTargetParser.cpp.

Referenced by fillValidCPUArchList(), fillValidTuneCPUArchList(), getCPUInfoByName(), and getCPUNameFromCPUModel().

◆ RVVBitsPerBlock

◆ RVVBytesPerBlock

◆ ValueMappings

◆ VLMaxSentinel

int64_t llvm::RISCV::VLMaxSentinel = -1LL
staticconstexpr