103#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
113 OS <<
"VLAny=" <<
VLAny <<
", ";
121 OS <<
"SEWGreaterThanOrEqual";
124 OS <<
"SEWGreaterThanOrEqualAndLessThan64";
137 OS <<
"LMULLessThanOrEqualToM1";
147 OS <<
"VILL=" <<
VILL <<
", ";
148 OS <<
"AltFmt=" <<
AltFmt <<
", ";
149 OS <<
"TWiden=" <<
TWiden;
155#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
164 const DemandedFields &Used);
183 enum class AVLState :
uint8_t {
189 } State = AVLState::Uninitialized;
203 SEWLMULRatioOnly(
false), AltFmt(
false), TWiden(0) {}
211 bool isValid()
const {
return State != AVLState::Uninitialized; }
213 bool isUnknown()
const {
return State == AVLState::Unknown; }
219 State = AVLState::AVLIsReg;
224 State = AVLState::AVLIsImm;
229 bool hasAVLImm()
const {
return State == AVLState::AVLIsImm; }
230 bool hasAVLReg()
const {
return State == AVLState::AVLIsReg; }
231 bool hasAVLVLMAX()
const {
return State == AVLState::AVLIsVLMAX; }
259 if (
Info.isUnknown())
261 else if (
Info.hasAVLReg())
263 else if (
Info.hasAVLVLMAX())
275 "Can't use VTYPE for uninitialized or unknown");
280 "Can't use VTYPE for uninitialized or unknown");
285 "Can't use VTYPE for uninitialized or unknown");
290 "Can't use VTYPE for uninitialized or unknown");
295 "Can't use VTYPE for uninitialized or unknown");
300 "Can't use VTYPE for uninitialized or unknown");
309 return RISCVInstrInfo::isNonZeroLoadImmediate(*
DefMI);
326 "we either have intervals or we don't");
350 "we either have intervals or we don't");
359 "Can't set VTYPE for uninitialized or unknown");
371 "Can't set VTYPE for uninitialized or unknown");
386 "Can't encode VTYPE for uninitialized or unknown");
395 "Can't compare invalid VSETVLIInfos");
397 "Can't compare VTYPE in unknown state");
398 assert(!SEWLMULRatioOnly && !
Other.SEWLMULRatioOnly &&
399 "Can't compare when only LMUL/SEW ratio is valid.");
400 return std::tie(VLMul, SEW, TailAgnostic, MaskAgnostic, AltFmt, TWiden) ==
407 "Can't use VTYPE for uninitialized or unknown");
417 "Can't compare invalid VSETVLIInfos");
419 "Can't compare VTYPE in unknown state");
432 "Can't compare invalid VSETVLIInfos");
438 if (SEWLMULRatioOnly || Require.SEWLMULRatioOnly)
453 return !
Other.isValid();
454 if (!
Other.isValid())
459 return Other.isUnknown();
460 if (
Other.isUnknown())
467 if (SEWLMULRatioOnly !=
Other.SEWLMULRatioOnly)
471 if (SEWLMULRatioOnly)
484 if (!
Other.isValid())
503 MergeInfo.SEWLMULRatioOnly =
true;
511#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
523 case AVLState::Uninitialized:
524 OS <<
"Uninitialized";
526 case AVLState::Unknown:
529 case AVLState::AVLIsReg:
532 case AVLState::AVLIsImm:
535 case AVLState::AVLIsVLMAX:
544 std::tie(LMul, Fractional) = decodeVLMUL(VLMul);
551 <<
"TailAgnostic=" << (
bool)TailAgnostic <<
", "
552 <<
"MaskAgnostic=" << (
bool)MaskAgnostic <<
", "
553 <<
"SEWLMULRatioOnly=" << (
bool)SEWLMULRatioOnly <<
", "
554 <<
"TWiden=" << (
unsigned)TWiden <<
", "
555 <<
"AltFmt=" << (
bool)AltFmt;
563#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
579 : ST(ST), LIS(LIS) {}
MachineInstrBuilder MachineInstrBuilder & DefMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Analysis containing CSE Info
#define LLVM_ATTRIBUTE_USED
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction associated with the given index.
Representation of each machine instruction.
RISCVVSETVLIInfoAnalysis(const RISCVSubtarget *ST, LiveIntervals *LIS)
VSETVLIInfo getInfoForVSETVLI(const MachineInstr &MI) const
VSETVLIInfo computeInfoForInstr(const MachineInstr &MI) const
RISCVVSETVLIInfoAnalysis()=default
Defines the abstract state with which the forward dataflow models the values of the VL and VTYPE regi...
void setVLMul(RISCVVType::VLMUL VLMul)
bool hasNonZeroAVL(const LiveIntervals *LIS) const
void print(raw_ostream &OS) const
Implement operator<<.
bool hasSameVTYPE(const VSETVLIInfo &Other) const
unsigned getTWiden() const
bool getMaskAgnostic() const
VSETVLIInfo intersect(const VSETVLIInfo &Other) const
void setAVLImm(unsigned Imm)
unsigned getSEWLMULRatio() const
bool operator!=(const VSETVLIInfo &Other) const
void setVTYPE(unsigned VType)
Register getAVLReg() const
bool getTailAgnostic() const
const MachineInstr * getAVLDefMI(const LiveIntervals *LIS) const
bool hasSameVLMAX(const VSETVLIInfo &Other) const
bool hasCompatibleVTYPE(const DemandedFields &Used, const VSETVLIInfo &Require) const
unsigned encodeVTYPE() const
LLVM_DUMP_METHOD void dump() const
Support for debugging, callable in GDB: V->dump()
void setVTYPE(RISCVVType::VLMUL L, unsigned S, bool TA, bool MA, bool Altfmt, unsigned W)
bool isCompatible(const DemandedFields &Used, const VSETVLIInfo &Require, const LiveIntervals *LIS) const
bool hasSameAVL(const VSETVLIInfo &Other) const
const VNInfo * getAVLVNInfo() const
bool hasSEWLMULRatioOnly() const
void setAVLRegDef(const VNInfo *VNInfo, Register AVLReg)
bool operator==(const VSETVLIInfo &Other) const
bool hasSameAVLLatticeValue(const VSETVLIInfo &Other) const
RISCVVType::VLMUL getVLMUL() const
bool hasEquallyZeroAVL(const VSETVLIInfo &Other, const LiveIntervals *LIS) const
static VSETVLIInfo getUnknown()
void setAVL(const VSETVLIInfo &Info)
unsigned getAVLImm() const
Wrapper class representing virtual and physical registers.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
VNInfo - Value Number Information.
unsigned id
The ID number of this value.
This class implements an extremely fast bulk output stream that can only output to a stream.
static bool isTailAgnostic(unsigned VType)
LLVM_ABI unsigned encodeXSfmmVType(unsigned SEW, unsigned Widen, bool AltFmt)
static unsigned getXSfmmWiden(unsigned VType)
static bool isMaskAgnostic(unsigned VType)
static bool hasXSfmmWiden(unsigned VType)
LLVM_ABI unsigned getSEWLMULRatio(unsigned SEW, VLMUL VLMul)
static bool isAltFmt(unsigned VType)
LLVM_ABI unsigned encodeVTYPE(VLMUL VLMUL, unsigned SEW, bool TailAgnostic, bool MaskAgnostic, bool AltFmt=false)
static unsigned getSEW(unsigned VType)
static VLMUL getVLMUL(unsigned VType)
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...
LLVM_ATTRIBUTE_USED raw_ostream & operator<<(raw_ostream &OS, const DemandedFields &DF)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
Which subfields of VL or VTYPE have values we need to preserve?
void doUnion(const DemandedFields &B)
static DemandedFields all()
LLVM_DUMP_METHOD void dump() const
Support for debugging, callable in GDB: V->dump()
void print(raw_ostream &OS) const
Implement operator<<.
@ SEWGreaterThanOrEqualAndLessThan64
@ LMULLessThanOrEqualToM1
enum llvm::RISCV::DemandedFields::@326061152055210015167034143142117063364004052074 SEW
enum llvm::RISCV::DemandedFields::@201276154261047021277240313173154105356124146047 LMUL