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())
319 RISCVInstrInfo::isXSfmmVectorConfigInstr(
MI);
337void RISCVVSETVLIInfoAnalysis::forwardVSETVLIAVL(
VSETVLIInfo &Info)
const {
338 if (!Info.hasAVLReg())
341 if (!
DefMI || !RISCVInstrInfo::isVectorConfigInstr(*
DefMI))
346 Info.setAVL(DefInstrInfo);
354 if (
MI.getOpcode() == RISCV::PseudoVSETIVLI) {
356 }
else if (RISCVInstrInfo::isXSfmmVectorConfigTNInstr(
MI)) {
357 switch (
MI.getOpcode()) {
360 case RISCV::PseudoSF_VSETTNTX0:
363 case RISCV::PseudoSF_VSETTNT:
369 assert(
MI.getOpcode() == RISCV::PseudoVSETVLI ||
370 MI.getOpcode() == RISCV::PseudoVSETVLIX0);
371 if (
MI.getOpcode() == RISCV::PseudoVSETVLIX0)
373 else if (
MI.getOperand(1).isUndef())
384 forwardVSETVLIAVL(NewInfo);
402 const uint64_t TSFlags =
MI.getDesc().TSFlags;
404 bool TailAgnostic =
true;
405 bool MaskAgnostic =
true;
408 TailAgnostic =
false;
409 MaskAgnostic =
false;
417 "Invalid Policy Value");
429 InstrInfo.setAltFmt(AltFmt);
433 unsigned SEW = Log2SEW ? 1 << Log2SEW : 8;
438 unsigned TWiden = TWidenOp.
getImm();
440 InstrInfo.setAVLVLMAX();
450 InstrInfo.setVTYPE(VLMul, SEW, TailAgnostic, MaskAgnostic, AltFmt, TWiden);
458 int64_t Imm = VLOp.
getImm();
463 const unsigned VLMAX =
computeVLMAX(ST->getRealMaxVLen(), SEW, VLMul);
464 if (ST->getRealMinVLen() == ST->getRealMaxVLen() && VLMAX <= 31)
465 InstrInfo.setAVLImm(VLMAX);
467 InstrInfo.setAVLVLMAX();
469 InstrInfo.setAVLImm(Imm);
472 InstrInfo.setAVLImm(1);
475 InstrInfo.setAVLRegDef(VNI, VLOp.
getReg());
478 assert(RISCVInstrInfo::isScalarExtractInstr(
MI));
481 InstrInfo.setAVLImm(1);
485 assert(SEW == EEW &&
"Initial SEW doesn't match expected EEW");
489 InstrInfo.setVTYPE(VLMul, SEW, TailAgnostic, MaskAgnostic, AltFmt,
492 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.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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