X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FCodeGen%2FLiveInterval.h;h=f1ea2c03f13cc3f851be190b4d80a9416906be2b;hp=21634cbd1551584df88c2ab760832afa581e8c16;hb=c75c50f45b3d6d1d61ce6b411d12cedaadd71d5b;hpb=c4a74461e4028894e35f2711c3c5c3f98b326c08 diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h index 21634cbd155..f1ea2c03f13 100644 --- a/include/llvm/CodeGen/LiveInterval.h +++ b/include/llvm/CodeGen/LiveInterval.h @@ -25,6 +25,7 @@ #include "llvm/CodeGen/SlotIndexes.h" #include "llvm/Support/AlignOf.h" #include "llvm/Support/Allocator.h" +#include "llvm/Target/TargetRegisterInfo.h" #include #include #include @@ -199,7 +200,7 @@ namespace llvm { // of live ranges of physical registers in computeRegUnitRange. // After that the set is flushed to the segment vector and deleted. typedef std::set SegmentSet; - SegmentSet *segmentSet; + std::unique_ptr segmentSet; typedef Segments::iterator iterator; iterator begin() { return segments.begin(); } @@ -218,15 +219,13 @@ namespace llvm { const_vni_iterator vni_end() const { return valnos.end(); } /// Constructs a new LiveRange object. - LiveRange(bool UseSegmentSet = false) : segmentSet(nullptr) { - if (UseSegmentSet) - segmentSet = new SegmentSet(); - } + LiveRange(bool UseSegmentSet = false) + : segmentSet(UseSegmentSet ? llvm::make_unique() + : nullptr) {} /// Constructs a new LiveRange object by copying segments and valnos from /// another LiveRange. - LiveRange(const LiveRange &Other, BumpPtrAllocator &Allocator) - : segmentSet(nullptr) { + LiveRange(const LiveRange &Other, BumpPtrAllocator &Allocator) { assert(Other.segmentSet == nullptr && "Copying of LiveRanges with active SegmentSets is not supported"); @@ -240,8 +239,6 @@ namespace llvm { } } - ~LiveRange() { delete segmentSet; } - /// advanceTo - Advance the specified iterator to point to the Segment /// containing the specified position, or end() if the position is past the /// end of the range. If no Segment contains this position, but the @@ -547,6 +544,11 @@ namespace llvm { return true; } + // Returns true if any segment in the live range contains any of the + // provided slot indexes. Slots which occur in holes between + // segments will not cause the function to return true. + bool isLiveAtIndexes(ArrayRef Slots) const; + bool operator<(const LiveRange& other) const { const SlotIndex &thisIndex = beginIndex(); const SlotIndex &otherIndex = other.beginIndex(); @@ -599,15 +601,15 @@ namespace llvm { class SubRange : public LiveRange { public: SubRange *Next; - unsigned LaneMask; + LaneBitmask LaneMask; /// Constructs a new SubRange object. - SubRange(unsigned LaneMask) + SubRange(LaneBitmask LaneMask) : Next(nullptr), LaneMask(LaneMask) { } /// Constructs a new SubRange object by copying liveness from @p Other. - SubRange(unsigned LaneMask, const LiveRange &Other, + SubRange(LaneBitmask LaneMask, const LiveRange &Other, BumpPtrAllocator &Allocator) : LiveRange(Other, Allocator), Next(nullptr), LaneMask(LaneMask) { } @@ -681,7 +683,8 @@ namespace llvm { /// Creates a new empty subregister live range. The range is added at the /// beginning of the subrange list; subrange iterators stay valid. - SubRange *createSubRange(BumpPtrAllocator &Allocator, unsigned LaneMask) { + SubRange *createSubRange(BumpPtrAllocator &Allocator, + LaneBitmask LaneMask) { SubRange *Range = new (Allocator) SubRange(LaneMask); appendSubRange(Range); return Range; @@ -689,7 +692,8 @@ namespace llvm { /// Like createSubRange() but the new range is filled with a copy of the /// liveness information in @p CopyFrom. - SubRange *createSubRangeFrom(BumpPtrAllocator &Allocator, unsigned LaneMask, + SubRange *createSubRangeFrom(BumpPtrAllocator &Allocator, + LaneBitmask LaneMask, const LiveRange &CopyFrom) { SubRange *Range = new (Allocator) SubRange(LaneMask, CopyFrom, Allocator); appendSubRange(Range); @@ -745,8 +749,6 @@ namespace llvm { #endif private: - LiveInterval& operator=(const LiveInterval& rhs) = delete; - /// Appends @p Range to SubRanges list. void appendSubRange(SubRange *Range) { Range->Next = SubRanges; @@ -848,28 +850,23 @@ namespace llvm { LiveIntervals &LIS; IntEqClasses EqClass; - // Note that values a and b are connected. - void Connect(unsigned a, unsigned b); - - unsigned Renumber(); - public: explicit ConnectedVNInfoEqClasses(LiveIntervals &lis) : LIS(lis) {} - /// Classify - Classify the values in LI into connected components. - /// Return the number of connected components. - unsigned Classify(const LiveInterval *LI); + /// Classify the values in \p LR into connected components. + /// Returns the number of connected components. + unsigned Classify(const LiveRange &LR); /// getEqClass - Classify creates equivalence classes numbered 0..N. Return /// the equivalence class assigned the VNI. unsigned getEqClass(const VNInfo *VNI) const { return EqClass[VNI->id]; } - /// Distribute - Distribute values in LIV[0] into a separate LiveInterval - /// for each connected component. LIV must have a LiveInterval for each - /// connected component. The LiveIntervals in Liv[1..] must be empty. - /// Instructions using LIV[0] are rewritten. - void Distribute(LiveInterval *LIV[], MachineRegisterInfo &MRI); - + /// Distribute values in \p LI into a separate LiveIntervals + /// for each connected component. LIV must have an empty LiveInterval for + /// each additional connected component. The first connected component is + /// left in \p LI. + void Distribute(LiveInterval &LI, LiveInterval *LIV[], + MachineRegisterInfo &MRI); }; }