+
+ /// The index of the defining instruction (if isDefAccurate() returns true).
+ SlotIndex def;
+
+ /// VNInfo constructor.
+ /// d is presumed to point to the actual defining instr. If it doesn't
+ /// setIsDefAccurate(false) should be called after construction.
+ VNInfo(unsigned i, SlotIndex d, MachineInstr *c)
+ : flags(IS_DEF_ACCURATE), id(i), def(d) { cr.copy = c; }
+
+ /// VNInfo construtor, copies values from orig, except for the value number.
+ VNInfo(unsigned i, const VNInfo &orig)
+ : flags(orig.flags), cr(orig.cr), id(i), def(orig.def)
+ { }
+
+ /// Copy from the parameter into this VNInfo.
+ void copyFrom(VNInfo &src) {
+ flags = src.flags;
+ cr = src.cr;
+ def = src.def;
+ }
+
+ /// Used for copying value number info.
+ unsigned getFlags() const { return flags; }
+ void setFlags(unsigned flags) { this->flags = flags; }
+
+ /// For a register interval, if this VN was definied by a copy instr
+ /// getCopy() returns a pointer to it, otherwise returns 0.
+ /// For a stack interval the behaviour of this method is undefined.
+ MachineInstr* getCopy() const { return cr.copy; }
+ /// For a register interval, set the copy member.
+ /// This method should not be called on stack intervals as it may lead to
+ /// undefined behavior.
+ void setCopy(MachineInstr *c) { cr.copy = c; }
+
+ /// For a stack interval, returns the reg which this stack interval was
+ /// defined from.
+ /// For a register interval the behaviour of this method is undefined.
+ unsigned getReg() const { return cr.reg; }
+ /// For a stack interval, set the defining register.
+ /// This method should not be called on register intervals as it may lead
+ /// to undefined behaviour.
+ void setReg(unsigned reg) { cr.reg = reg; }
+
+ /// Returns true if one or more kills are PHI nodes.
+ bool hasPHIKill() const { return flags & HAS_PHI_KILL; }
+ /// Set the PHI kill flag on this value.
+ void setHasPHIKill(bool hasKill) {
+ if (hasKill)
+ flags |= HAS_PHI_KILL;
+ else
+ flags &= ~HAS_PHI_KILL;
+ }
+
+ /// Returns true if this value is re-defined by an early clobber somewhere
+ /// during the live range.
+ bool hasRedefByEC() const { return flags & REDEF_BY_EC; }
+ /// Set the "redef by early clobber" flag on this value.
+ void setHasRedefByEC(bool hasRedef) {
+ if (hasRedef)
+ flags |= REDEF_BY_EC;
+ else
+ flags &= ~REDEF_BY_EC;
+ }
+
+ /// Returns true if this value is defined by a PHI instruction (or was,
+ /// PHI instrucions may have been eliminated).
+ bool isPHIDef() const { return flags & IS_PHI_DEF; }
+ /// Set the "phi def" flag on this value.
+ void setIsPHIDef(bool phiDef) {
+ if (phiDef)
+ flags |= IS_PHI_DEF;
+ else
+ flags &= ~IS_PHI_DEF;
+ }
+
+ /// Returns true if this value is unused.
+ bool isUnused() const { return flags & IS_UNUSED; }
+ /// Set the "is unused" flag on this value.
+ void setIsUnused(bool unused) {
+ if (unused)
+ flags |= IS_UNUSED;
+ else
+ flags &= ~IS_UNUSED;
+ }
+
+ /// Returns true if the def is accurate.
+ bool isDefAccurate() const { return flags & IS_DEF_ACCURATE; }
+ /// Set the "is def accurate" flag on this value.
+ void setIsDefAccurate(bool defAccurate) {
+ if (defAccurate)
+ flags |= IS_DEF_ACCURATE;
+ else
+ flags &= ~IS_DEF_ACCURATE;
+ }