aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalUnion.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/LiveIntervalUnion.h')
-rw-r--r--lib/CodeGen/LiveIntervalUnion.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/lib/CodeGen/LiveIntervalUnion.h b/lib/CodeGen/LiveIntervalUnion.h
index 74499f6821..b6eaa71cfa 100644
--- a/lib/CodeGen/LiveIntervalUnion.h
+++ b/lib/CodeGen/LiveIntervalUnion.h
@@ -174,10 +174,10 @@ public:
// result has no way to tell if it's valid to dereference them.
// Access the lvr segment.
- const LiveInterval::iterator &lvrSegPos() const { return lvrSegI_; }
+ LiveInterval::iterator lvrSegPos() const { return lvrSegI_; }
// Access the liu segment.
- const SegmentIter &liuSegPos() const { return liuSegI_; }
+ SegmentIter liuSegPos() const { return liuSegI_; }
bool operator==(const InterferenceResult &ir) const {
return lvrSegI_ == ir.lvrSegI_ && liuSegI_ == ir.liuSegI_;
@@ -193,17 +193,21 @@ public:
LiveIntervalUnion *liu_;
LiveInterval *lvr_;
InterferenceResult firstInterference_;
- // TBD: interfering vregs
+ SmallVector<LiveInterval*,4> interferingVRegs_;
+ bool seenUnspillableVReg_;
public:
Query(): liu_(), lvr_() {}
- Query(LiveInterval *lvr, LiveIntervalUnion *liu): liu_(liu), lvr_(lvr) {}
+ Query(LiveInterval *lvr, LiveIntervalUnion *liu):
+ liu_(liu), lvr_(lvr), seenUnspillableVReg_(false) {}
void clear() {
liu_ = NULL;
lvr_ = NULL;
firstInterference_ = InterferenceResult();
+ interferingVRegs_.clear();
+ seenUnspillableVReg_ = false;
}
void init(LiveInterval *lvr, LiveIntervalUnion *liu) {
@@ -218,6 +222,8 @@ public:
lvr_ = lvr;
// Clear cached results.
firstInterference_ = InterferenceResult();
+ interferingVRegs_.clear();
+ seenUnspillableVReg_ = false;
}
LiveInterval &lvr() const { assert(lvr_ && "uninitialized"); return *lvr_; }
@@ -242,9 +248,24 @@ public:
// of segments. Visiting each unique interfering pairs means that the same
// lvr or liu segment may be visited multiple times.
bool nextInterference(InterferenceResult &ir) const;
-
- // TBD: bool collectInterferingVirtRegs(unsigned maxInterference)
+ // Count the virtual registers in this union that interfere with this
+ // query's live virtual register, up to maxInterferingRegs.
+ unsigned collectInterferingVRegs(unsigned maxInterferingRegs = UINT_MAX);
+
+ // Was this virtual register visited during collectInterferingVRegs?
+ bool isSeenInterference(LiveInterval *lvr) const;
+
+ // Did collectInterferingVRegs encounter an unspillable vreg?
+ bool seenUnspillableVReg() const {
+ return seenUnspillableVReg_;
+ }
+
+ // Vector generated by collectInterferingVRegs.
+ const SmallVectorImpl<LiveInterval*> &interferingVRegs() const {
+ return interferingVRegs_;
+ }
+
private:
// Private interface for queries
void findIntersection(InterferenceResult &ir) const;