LLVM 19.0.0git
Macros | Functions | Variables
RISCVInsertVSETVLI.cpp File Reference
#include "RISCV.h"
#include "RISCVSubtarget.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LiveDebugVariables.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveStacks.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"
 
#define RISCV_COALESCE_VSETVLI_NAME   "RISC-V Coalesce VSETVLI pass"
 

Functions

 STATISTIC (NumInsertedVSETVL, "Number of VSETVL inst inserted")
 
 STATISTIC (NumCoalescedVSETVL, "Number of VSETVL inst coalesced")
 
INITIALIZE_PASS(RISCVInsertVSETVLI, DEBUG_TYPE, RISCV_INSERT_VSETVLI_NAME, false, false) char RISCVCoalesceVSETVLI INITIALIZE_PASS (RISCVCoalesceVSETVLI, "riscv-coalesce-vsetvli", RISCV_COALESCE_VSETVLI_NAME, false, false) static VSETVLIInfo getInfoForVSETVLI(const MachineInstr &MI
 
 if (MI.getOpcode()==RISCV::PseudoVSETIVLI)
 
 assert ((AVLReg !=RISCV::X0||MI.getOperand(0).getReg() !=RISCV::X0) &&"Can't handle X0, X0 vsetvli yet")
 
 if (AVLReg==RISCV::X0) NewInfo.setAVLVLMAX()
 
else NewInfo setAVLRegDef (MRI.getVRegDef(AVLReg), AVLReg)
 
NewInfo setVTYPE (MI.getOperand(2).getImm())
 
static unsigned computeVLMAX (unsigned VLEN, unsigned SEW, RISCVII::VLMUL VLMul)
 
static VSETVLIInfo computeInfoForInstr (const MachineInstr &MI, uint64_t TSFlags, const RISCVSubtarget &ST, const MachineRegisterInfo *MRI)
 
static bool isLMUL1OrSmaller (RISCVII::VLMUL LMUL)
 
static VSETVLIInfo adjustIncoming (VSETVLIInfo PrevInfo, VSETVLIInfo NewInfo, DemandedFields &Demanded)
 
static bool canMutatePriorConfig (const MachineInstr &PrevMI, const MachineInstr &MI, const DemandedFields &Used, const MachineRegisterInfo &MRI)
 

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."))
 
INITIALIZE_PASS(RISCVInsertVSETVLI, DEBUG_TYPE, RISCV_INSERT_VSETVLI_NAME, false, false) char RISCVCoalesceVSETVLI const MachineRegisterInfoMRI
 
 else
 
Register AVLReg = MI.getOperand(1).getReg()
 
return NewInfo
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "riscv-insert-vsetvli"

Definition at line 37 of file RISCVInsertVSETVLI.cpp.

◆ RISCV_COALESCE_VSETVLI_NAME

#define RISCV_COALESCE_VSETVLI_NAME   "RISC-V Coalesce VSETVLI pass"

Definition at line 39 of file RISCVInsertVSETVLI.cpp.

◆ RISCV_INSERT_VSETVLI_NAME

#define RISCV_INSERT_VSETVLI_NAME   "RISC-V Insert VSETVLI pass"

Definition at line 38 of file RISCVInsertVSETVLI.cpp.

Function Documentation

◆ adjustIncoming()

static VSETVLIInfo adjustIncoming ( VSETVLIInfo  PrevInfo,
VSETVLIInfo  NewInfo,
DemandedFields &  Demanded 
)
static

Definition at line 1154 of file RISCVInsertVSETVLI.cpp.

References llvm::RISCVVType::getSameRatioLMUL(), Info, and NewInfo.

◆ assert()

assert ( (AVLReg !=RISCV::X0||MI.getOperand(0).getReg() !=RISCV::X0) &&"Can't handle  X0,
X0 vsetvli yet"   
)

◆ canMutatePriorConfig()

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

◆ computeInfoForInstr()

static VSETVLIInfo computeInfoForInstr ( const MachineInstr MI,
uint64_t  TSFlags,
const RISCVSubtarget ST,
const MachineRegisterInfo MRI 
)
static

◆ computeVLMAX()

static unsigned computeVLMAX ( unsigned  VLEN,
unsigned  SEW,
RISCVII::VLMUL  VLMul 
)
static

Definition at line 896 of file RISCVInsertVSETVLI.cpp.

References llvm::RISCVVType::decodeVLMUL().

Referenced by computeInfoForInstr().

◆ if() [1/2]

if ( AVLReg  = =RISCV::X0)

◆ if() [2/2]

if ( MI.  getOpcode() = = RISCV::PseudoVSETIVLI)

Definition at line 878 of file RISCVInsertVSETVLI.cpp.

References MI, and NewInfo.

◆ INITIALIZE_PASS()

INITIALIZE_PASS(RISCVInsertVSETVLI, DEBUG_TYPE, RISCV_INSERT_VSETVLI_NAME, false, false) char RISCVCoalesceVSETVLI INITIALIZE_PASS ( RISCVCoalesceVSETVLI  ,
"riscv-coalesce-vsetvli"  ,
RISCV_COALESCE_VSETVLI_NAME  ,
false  ,
false   
) const &

◆ isLMUL1OrSmaller()

static bool isLMUL1OrSmaller ( RISCVII::VLMUL  LMUL)
static

Definition at line 1082 of file RISCVInsertVSETVLI.cpp.

References llvm::RISCVVType::decodeVLMUL().

◆ setAVLRegDef()

else NewInfo setAVLRegDef ( MRI.  getVRegDefAVLReg,
AVLReg   
)

◆ setVTYPE()

NewInfo setVTYPE ( MI.  getOperand2).getImm()

◆ STATISTIC() [1/2]

STATISTIC ( NumCoalescedVSETVL  ,
"Number of VSETVL inst coalesced"   
)

◆ STATISTIC() [2/2]

STATISTIC ( NumInsertedVSETVL  ,
"Number of VSETVL inst inserted"   
)

Variable Documentation

◆ AVLReg

Register AVLReg = MI.getOperand(1).getReg()

Definition at line 883 of file RISCVInsertVSETVLI.cpp.

◆ 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(MI.getOpcode() == RISCV::PseudoVSETVLI ||
MI.getOpcode() == RISCV::PseudoVSETVLIX0)
IRTranslator LLVM IR MI
assert((AVLReg !=RISCV::X0||MI.getOperand(0).getReg() !=RISCV::X0) &&"Can't handle X0, X0 vsetvli yet")

Definition at line 880 of file RISCVInsertVSETVLI.cpp.

◆ MRI

INITIALIZE_PASS(RISCVInsertVSETVLI, DEBUG_TYPE, RISCV_INSERT_VSETVLI_NAME, false, false) char RISCVCoalesceVSETVLI const MachineRegisterInfo& MRI
Initial value:
{
VSETVLIInfo NewInfo
return NewInfo

Definition at line 876 of file RISCVInsertVSETVLI.cpp.

Referenced by canMutatePriorConfig(), and computeInfoForInstr().

◆ NewInfo

return NewInfo

Definition at line 893 of file RISCVInsertVSETVLI.cpp.

Referenced by adjustIncoming(), llvm::AMDGPU::getMaskedMIMGOp(), and if().