+ : reg(Reg), preference(0), weight(Weight) {
+ }
+
+ typedef Ranges::iterator iterator;
+ iterator begin() { return ranges.begin(); }
+ iterator end() { return ranges.end(); }
+
+ typedef Ranges::const_iterator const_iterator;
+ const_iterator begin() const { return ranges.begin(); }
+ const_iterator end() const { return ranges.end(); }
+
+ typedef VNInfoList::iterator vni_iterator;
+ vni_iterator vni_begin() { return valnos.begin(); }
+ vni_iterator vni_end() { return valnos.end(); }
+
+ typedef VNInfoList::const_iterator const_vni_iterator;
+ const_vni_iterator vni_begin() const { return valnos.begin(); }
+ const_vni_iterator vni_end() const { return valnos.end(); }
+
+ /// advanceTo - Advance the specified iterator to point to the LiveRange
+ /// containing the specified position, or end() if the position is past the
+ /// end of the interval. If no LiveRange contains this position, but the
+ /// position is in a hole, this method returns an iterator pointing the the
+ /// LiveRange immediately after the hole.
+ iterator advanceTo(iterator I, unsigned Pos) {
+ if (Pos >= endNumber())
+ return end();
+ while (I->end <= Pos) ++I;
+ return I;
+ }
+
+ bool containsOneValue() const { return valnos.size() == 1; }
+
+ unsigned getNumValNums() const { return valnos.size(); }
+
+ /// getValNumInfo - Returns pointer to the specified val#.
+ ///
+ inline VNInfo *getValNumInfo(unsigned ValNo) {
+ return valnos[ValNo];
+ }
+ inline const VNInfo *getValNumInfo(unsigned ValNo) const {
+ return valnos[ValNo];
+ }
+
+ /// copyValNumInfo - Copy the value number info for one value number to
+ /// another.
+ void copyValNumInfo(VNInfo *DstValNo, const VNInfo *SrcValNo) {
+ DstValNo->def = SrcValNo->def;
+ DstValNo->reg = SrcValNo->reg;
+ DstValNo->kills = SrcValNo->kills;
+ }
+
+ /// getNextValue - Create a new value number and return it. MIIdx specifies
+ /// the instruction that defines the value number.
+ VNInfo *getNextValue(unsigned MIIdx, unsigned SrcReg,
+ BumpPtrAllocator &VNInfoAllocator) {
+#ifdef __GNUC__
+ unsigned Alignment = __alignof__(VNInfo);
+#else
+ // FIXME: ugly.
+ unsigned Alignment = 8;
+#endif
+ VNInfo *VNI= static_cast<VNInfo*>(VNInfoAllocator.Allocate(sizeof(VNInfo),
+ Alignment));
+ new (VNI) VNInfo(valnos.size(), MIIdx, SrcReg);
+ valnos.push_back(VNI);
+ return VNI;