LLVM 18.0.0git
Macros | Functions | Variables
RISCVInsertVSETVLI.cpp File Reference
#include "RISCV.h"
#include "RISCVSubtarget.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include <queue>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "riscv-insert-vsetvli"
 
#define RISCV_INSERT_VSETVLI_NAME   "RISC-V Insert VSETVLI pass"
 

Functions

 INITIALIZE_PASS (RISCVInsertVSETVLI, DEBUG_TYPE, RISCV_INSERT_VSETVLI_NAME, false, false) static VSETVLIInfo computeInfoForInstr(const MachineInstr &MI
 
 if (!hasUndefinedMergeOp(MI, *MRI))
 
 assert (RISCVVType::isValidSEW(SEW) &&"Unexpected SEW")
 
 if (RISCVII::hasVLOp(TSFlags))
 
InstrInfo setAVLReg (RISCV::NoRegister)
 
 if (std::optional< unsigned > EEW=getEEWForLoadStore(MI))
 
InstrInfo setVTYPE (VLMul, SEW, TailAgnostic, MaskAgnostic)
 
static VSETVLIInfo getInfoForVSETVLI (const MachineInstr &MI)
 
static bool isLMUL1OrSmaller (RISCVII::VLMUL LMUL)
 
static bool hasFixedResult (const VSETVLIInfo &Info, const RISCVSubtarget &ST)
 Return true if the VL value configured must be equal to the requested one.
 
static void doUnion (DemandedFields &A, DemandedFields B)
 
static bool isNonZeroAVL (const MachineOperand &MO)
 
static bool canMutatePriorConfig (const MachineInstr &PrevMI, const MachineInstr &MI, const DemandedFields &Used)
 

Variables

static cl::opt< boolDisableInsertVSETVLPHIOpt ("riscv-disable-insert-vsetvl-phi-opt", cl::init(false), cl::Hidden, cl::desc("Disable looking through phis when inserting vsetvlis."))
 
static cl::opt< boolUseStrictAsserts ("riscv-insert-vsetvl-strict-asserts", cl::init(true), cl::Hidden, cl::desc("Enable strict assertion checking for the dataflow algorithm"))
 
uint64_t TSFlags
 
uint64_t const MachineRegisterInfoMRI
 
bool TailAgnostic = true
 
bool MaskAgnostic = true
 
RISCVII::VLMUL VLMul = RISCVII::getLMul(TSFlags)
 
unsigned Log2SEW = MI.getOperand(getSEWOpNum(MI)).getImm()
 
unsigned SEW = Log2SEW ? 1 << Log2SEW : 8
 
 else
 
return InstrInfo
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "riscv-insert-vsetvli"

Definition at line 34 of file RISCVInsertVSETVLI.cpp.

◆ RISCV_INSERT_VSETVLI_NAME

#define RISCV_INSERT_VSETVLI_NAME   "RISC-V Insert VSETVLI pass"

Definition at line 35 of file RISCVInsertVSETVLI.cpp.

Function Documentation

◆ assert()

assert ( RISCVVType::isValidSEW(SEW) &&"Unexpected SEW"  )

Referenced by getInfoForVSETVLI(), if(), and isNonZeroAVL().

◆ canMutatePriorConfig()

static bool canMutatePriorConfig ( const MachineInstr PrevMI,
const MachineInstr MI,
const DemandedFields &  Used 
)
static

◆ doUnion()

static void doUnion ( DemandedFields &  A,
DemandedFields  B 
)
static

Definition at line 1412 of file RISCVInsertVSETVLI.cpp.

References A, and B.

◆ getInfoForVSETVLI()

static VSETVLIInfo getInfoForVSETVLI ( const MachineInstr MI)
static

Definition at line 845 of file RISCVInsertVSETVLI.cpp.

References assert(), and MI.

◆ hasFixedResult()

static bool hasFixedResult ( const VSETVLIInfo &  Info,
const RISCVSubtarget ST 
)
static

Return true if the VL value configured must be equal to the requested one.

Definition at line 1304 of file RISCVInsertVSETVLI.cpp.

References llvm::RISCVVType::decodeVLMUL(), Info, and SEW.

◆ if() [1/3]

if ( hasUndefinedMergeOpMI, *MRI)

◆ if() [2/3]

if ( RISCVII::hasVLOp(TSFlags )

◆ if() [3/3]

if ( std::optional< unsigned EEW = getEEWForLoadStore(MI))

Definition at line 827 of file RISCVInsertVSETVLI.cpp.

References assert(), and SEW.

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( RISCVInsertVSETVLI  ,
DEBUG_TYPE  ,
RISCV_INSERT_VSETVLI_NAME  ,
false  ,
false   
) const &

◆ isLMUL1OrSmaller()

static bool isLMUL1OrSmaller ( RISCVII::VLMUL  LMUL)
static

Definition at line 946 of file RISCVInsertVSETVLI.cpp.

References llvm::RISCVVType::decodeVLMUL().

◆ isNonZeroAVL()

static bool isNonZeroAVL ( const MachineOperand MO)
static

◆ setAVLReg()

InstrInfo setAVLReg ( RISCV::NoRegister  )

◆ setVTYPE()

InstrInfo setVTYPE ( VLMul  ,
SEW  ,
TailAgnostic  ,
MaskAgnostic   
)

Variable Documentation

◆ DisableInsertVSETVLPHIOpt

cl::opt< bool > DisableInsertVSETVLPHIOpt("riscv-disable-insert-vsetvl-phi-opt", cl::init(false), cl::Hidden, cl::desc("Disable looking through phis when inserting vsetvlis.")) ( "riscv-disable-insert-vsetvl-phi-opt"  ,
cl::init(false)  ,
cl::Hidden  ,
cl::desc("Disable looking through phis when inserting vsetvlis.")   
)
static

◆ else

else
Initial value:
{
assert(isScalarExtractInstr(MI))
IRTranslator LLVM IR MI
assert(RISCVVType::isValidSEW(SEW) &&"Unexpected SEW")

Definition at line 822 of file RISCVInsertVSETVLI.cpp.

◆ InstrInfo

return InstrInfo

Definition at line 833 of file RISCVInsertVSETVLI.cpp.

Referenced by llvm::AArch64Subtarget::AArch64Subtarget(), llvm::ARCSubtarget::ARCSubtarget(), llvm::ARMSubtarget::ARMSubtarget(), llvm::AVRSubtarget::AVRSubtarget(), llvm::createLanaiMCCodeEmitter(), llvm::CSKYSubtarget::CSKYSubtarget(), llvm::GCNSubtarget::GCNSubtarget(), llvm::GCNSubtarget::getInstrInfo(), llvm::R600Subtarget::getInstrInfo(), llvm::ARCSubtarget::getInstrInfo(), llvm::BPFSubtarget::getInstrInfo(), llvm::CSKYSubtarget::getInstrInfo(), llvm::DirectXSubtarget::getInstrInfo(), llvm::HexagonSubtarget::getInstrInfo(), llvm::LoongArchSubtarget::getInstrInfo(), llvm::MipsSubtarget::getInstrInfo(), llvm::MSP430Subtarget::getInstrInfo(), llvm::NVPTXSubtarget::getInstrInfo(), llvm::RISCVSubtarget::getInstrInfo(), llvm::SparcSubtarget::getInstrInfo(), llvm::SPIRVSubtarget::getInstrInfo(), llvm::SystemZSubtarget::getInstrInfo(), llvm::VESubtarget::getInstrInfo(), llvm::WebAssemblySubtarget::getInstrInfo(), llvm::X86Subtarget::getInstrInfo(), llvm::XCoreSubtarget::getInstrInfo(), llvm::GCNSubtarget::getRegisterInfo(), llvm::R600Subtarget::getRegisterInfo(), llvm::ARCSubtarget::getRegisterInfo(), llvm::BPFSubtarget::getRegisterInfo(), llvm::MipsSubtarget::getRegisterInfo(), llvm::NVPTXSubtarget::getRegisterInfo(), llvm::SparcSubtarget::getRegisterInfo(), llvm::SPIRVSubtarget::getRegisterInfo(), llvm::SystemZSubtarget::getRegisterInfo(), llvm::VESubtarget::getRegisterInfo(), llvm::XCoreSubtarget::getRegisterInfo(), llvm::AMDGPU::getVOPDInstInfo(), llvm::HexagonSubtarget::HexagonSubtarget(), if(), llvm::GenericUniformityAnalysisImpl< ContextT >::initialize(), llvm::LoongArchSubtarget::LoongArchSubtarget(), llvm::M68kSubtarget::M68kSubtarget(), llvm::MipsSubtarget::MipsSubtarget(), llvm::MSP430Subtarget::MSP430Subtarget(), llvm::PerTargetMIParsingState::parseInstrName(), llvm::PPCSubtarget::PPCSubtarget(), llvm::R600Subtarget::R600Subtarget(), llvm::PPCRegisterInfo::requiresFrameIndexScavenging(), llvm::RISCVSubtarget::RISCVSubtarget(), llvm::SparcSubtarget::SparcSubtarget(), llvm::SPIRVSubtarget::SPIRVSubtarget(), llvm::SystemZSubtarget::SystemZSubtarget(), llvm::VESubtarget::VESubtarget(), llvm::WebAssemblySubtarget::WebAssemblySubtarget(), and llvm::X86Subtarget::X86Subtarget().

◆ Log2SEW

unsigned Log2SEW = MI.getOperand(getSEWOpNum(MI)).getImm()

◆ MaskAgnostic

bool MaskAgnostic = true

Definition at line 778 of file RISCVInsertVSETVLI.cpp.

Referenced by llvm::RISCVVType::encodeVTYPE(), and if().

◆ MRI

Initial value:
{
VSETVLIInfo InstrInfo
return InstrInfo

Definition at line 774 of file RISCVInsertVSETVLI.cpp.

◆ SEW

unsigned SEW = Log2SEW ? 1 << Log2SEW : 8

◆ TailAgnostic

bool TailAgnostic = true

Definition at line 777 of file RISCVInsertVSETVLI.cpp.

Referenced by llvm::RISCVVType::encodeVTYPE(), and if().

◆ TSFlags

uint64_t TSFlags

◆ UseStrictAsserts

cl::opt< bool > UseStrictAsserts("riscv-insert-vsetvl-strict-asserts", cl::init(true), cl::Hidden, cl::desc("Enable strict assertion checking for the dataflow algorithm")) ( "riscv-insert-vsetvl-strict-asserts"  ,
cl::init(true ,
cl::Hidden  ,
cl::desc("Enable strict assertion checking for the dataflow algorithm")   
)
static

◆ VLMul

RISCVII::VLMUL VLMul = RISCVII::getLMul(TSFlags)