31 return LI.getVNInfoBefore(
SI);
95 if (!
MI.isRegTiedToUseOperand(0, &UseOpIdx))
108 return Fractional || LMul == 1;
147 if (Used.SEWLMULRatio) {
152 if (Ratio1 != Ratio2)
184 if (
MI.isCall() ||
MI.isInlineAsm() ||
185 MI.readsRegister(RISCV::VL,
nullptr))
187 if (
MI.isCall() ||
MI.isInlineAsm() ||
188 MI.readsRegister(RISCV::VTYPE,
nullptr))
196 !VLOp.
isReg() || !VLOp.isUndef())
231 if (RISCVInstrInfo::isScalarInsertInstr(
MI)) {
242 if (RISCVInstrInfo::isFloatScalarMoveOrScalarSplatInstr(
MI) &&
243 !ST->hasVInstructionsF64())
252 if (RISCVInstrInfo::isScalarExtractInstr(
MI)) {
271 if (RISCVInstrInfo::isVSlideInstr(
MI) && VLOp.
isImm() &&
273 !ST->hasVLDependentLatency()) {
286 if (RISCVInstrInfo::isScalarSplatInstr(
MI) && VLOp.
isImm() &&
288 !ST->hasVLDependentLatency()) {
292 if (RISCVInstrInfo::isFloatScalarMoveOrScalarSplatInstr(
MI) &&
293 !ST->hasVInstructionsF64())
316 if (RISCVInstrInfo::isVExtractInstr(
MI)) {
325 RISCVInstrInfo::isXSfmmVectorConfigInstr(
MI);
343void RISCVVSETVLIInfoAnalysis::forwardVSETVLIAVL(
VSETVLIInfo &Info)
const {
344 if (!Info.hasAVLReg())
347 if (!
DefMI || !RISCVInstrInfo::isVectorConfigInstr(*
DefMI))
352 Info.setAVL(DefInstrInfo);
360 if (
MI.getOpcode() == RISCV::PseudoVSETIVLI) {
362 }
else if (RISCVInstrInfo::isXSfmmVectorConfigTNInstr(
MI)) {
363 assert(
MI.getOpcode() == RISCV::PseudoSF_VSETTNT ||
364 MI.getOpcode() == RISCV::PseudoSF_VSETTNTX0);
365 switch (
MI.getOpcode()) {
366 case RISCV::PseudoSF_VSETTNTX0:
369 case RISCV::PseudoSF_VSETTNT:
375 assert(
MI.getOpcode() == RISCV::PseudoVSETVLI ||
376 MI.getOpcode() == RISCV::PseudoVSETVLIX0);
377 if (
MI.getOpcode() == RISCV::PseudoVSETVLIX0)
379 else if (
MI.getOperand(1).isUndef())
390 forwardVSETVLIAVL(NewInfo);
408 const uint64_t TSFlags =
MI.getDesc().TSFlags;
410 bool TailAgnostic =
true;
411 bool MaskAgnostic =
true;
414 TailAgnostic =
false;
415 MaskAgnostic =
false;
423 "Invalid Policy Value");
435 InstrInfo.setAltFmt(AltFmt);
439 unsigned SEW = Log2SEW ? 1 << Log2SEW : 8;
444 unsigned TWiden = TWidenOp.
getImm();
446 InstrInfo.setAVLVLMAX();
456 InstrInfo.setVTYPE(VLMul, SEW, TailAgnostic, MaskAgnostic, AltFmt, TWiden);
464 int64_t Imm = VLOp.
getImm();
469 const unsigned VLMAX =
computeVLMAX(ST->getRealMaxVLen(), SEW, VLMul);
470 if (ST->getRealMinVLen() == ST->getRealMaxVLen() && VLMAX <= 31)
471 InstrInfo.setAVLImm(VLMAX);
473 InstrInfo.setAVLVLMAX();
475 InstrInfo.setAVLImm(Imm);
478 InstrInfo.setAVLImm(1);
481 InstrInfo.setAVLRegDef(VNI, VLOp.
getReg());
484 assert(RISCVInstrInfo::isScalarExtractInstr(
MI) ||
485 RISCVInstrInfo::isVExtractInstr(
MI));
488 InstrInfo.setAVLImm(1);
492 assert(SEW == EEW &&
"Initial SEW doesn't match expected EEW");
496 InstrInfo.setVTYPE(VLMul, SEW, TailAgnostic, MaskAgnostic, AltFmt,
499 forwardVSETVLIAVL(InstrInfo);
MachineInstrBuilder MachineInstrBuilder & DefMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
SlotIndexes * getSlotIndexes() const
LiveInterval & getInterval(Register Reg)
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
Register getReg() const
getReg - Returns the register number.
VSETVLIInfo getInfoForVSETVLI(const MachineInstr &MI) const
VSETVLIInfo computeInfoForInstr(const MachineInstr &MI) const
Defines the abstract state with which the forward dataflow models the values of the VL and VTYPE regi...
void setAVLImm(unsigned Imm)
void setVTYPE(unsigned VType)
bool hasSameVLMAX(const VSETVLIInfo &Other) const
bool hasCompatibleVTYPE(const DemandedFields &Used, const VSETVLIInfo &Require) const
unsigned encodeVTYPE() const
void setAVLRegDef(const VNInfo *VNInfo, Register AVLReg)
Wrapper class representing virtual and physical registers.
constexpr bool isValid() const
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
SlotIndex - An opaque wrapper around machine indexes.
SlotIndex getInstructionIndex(const MachineInstr &MI, bool IgnoreBundle=false) const
Returns the base index for the given instruction.
VNInfo - Value Number Information.
static unsigned getVecPolicyOpNum(const MCInstrDesc &Desc)
static bool usesMaskPolicy(uint64_t TSFlags)
static bool hasTWidenOp(uint64_t TSFlags)
static RISCVVType::VLMUL getLMul(uint64_t TSFlags)
static unsigned getVLOpNum(const MCInstrDesc &Desc)
static AltFmtType getAltFmtType(uint64_t TSFlags)
static unsigned getTWidenOpNum(const MCInstrDesc &Desc)
static bool hasVLOp(uint64_t TSFlags)
static unsigned getTNOpNum(const MCInstrDesc &Desc)
static bool hasVecPolicyOp(uint64_t TSFlags)
static unsigned getSEWOpNum(const MCInstrDesc &Desc)
static bool hasSEWOp(uint64_t TSFlags)
static bool isTailAgnostic(unsigned VType)
static unsigned getXSfmmWiden(unsigned VType)
static bool isMaskAgnostic(unsigned VType)
LLVM_ABI std::pair< unsigned, bool > decodeVLMUL(VLMUL VLMul)
static bool hasXSfmmWiden(unsigned VType)
LLVM_ABI unsigned getSEWLMULRatio(unsigned SEW, VLMUL VLMul)
static bool isValidSEW(unsigned SEW)
static bool isAltFmt(unsigned VType)
static unsigned getSEW(unsigned VType)
static VLMUL getVLMUL(unsigned VType)
static const MachineOperand & getTWidenOp(const MachineInstr &MI)
static const MachineOperand & getVLOp(const MachineInstr &MI)
DemandedFields getDemanded(const MachineInstr &MI, const RISCVSubtarget *ST)
Return the fields and properties demanded by the provided instruction.
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 instr...
static VNInfo * getVNInfoFromReg(Register Reg, const MachineInstr &MI, const LiveIntervals *LIS)
Given a virtual register Reg, return the corresponding VNInfo for it.
static bool isMaskRegOp(const MachineInstr &MI)
Return true if this is an operation on mask registers.
unsigned getRVVMCOpcode(unsigned RVVPseudoOpcode)
static const MachineOperand & getSEWOp(const MachineInstr &MI)
static std::optional< unsigned > getEEWForLoadStore(const MachineInstr &MI)
Get the EEW for a load or store instruction.
static const MachineOperand & getVecPolicyOp(const MachineInstr &MI)
static unsigned computeVLMAX(unsigned VLEN, unsigned SEW, RISCVVType::VLMUL VLMul)
static constexpr int64_t VLMaxSentinel
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.
static bool hasUndefinedPassthru(const MachineInstr &MI)
Return true if the inactive elements in the result are entirely undefined.
static bool isLMUL1OrSmaller(RISCVVType::VLMUL LMUL)
This is an optimization pass for GlobalISel generic memory operations.
DWARFExpression::Operation Op
Which subfields of VL or VTYPE have values we need to preserve?
@ SEWGreaterThanOrEqualAndLessThan64
@ LMULLessThanOrEqualToM1
enum llvm::RISCV::DemandedFields::@326061152055210015167034143142117063364004052074 SEW
enum llvm::RISCV::DemandedFields::@201276154261047021277240313173154105356124146047 LMUL