Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: src/IceOperand.h

Issue 2172313002: Subzero : Live Range Splitting after initial Register Allocation (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Format Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceOperand.h
diff --git a/src/IceOperand.h b/src/IceOperand.h
index 041adfd1556716e6e2b1acd4a7122782fa0eb0fd..bfdca7a86703b8477dad4ed5906ddc39a573b76d 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -603,6 +603,9 @@ bool operator==(const RegWeight &A, const RegWeight &B);
/// interval.
class LiveRange {
public:
+ using RangeElementType = std::pair<InstNumberT, InstNumberT>;
+ /// RangeType is arena-allocated from the Cfg's allocator.
+ using RangeType = CfgVector<RangeElementType>;
LiveRange() = default;
/// Special constructor for building a kill set. The advantage is that we can
/// reserve the right amount of space in advance.
@@ -618,7 +621,10 @@ public:
Range.clear();
untrim();
}
- void addSegment(InstNumberT Start, InstNumberT End);
+ void addSegment(InstNumberT Start, InstNumberT End, CfgNode *Node = nullptr);
+ void addSegment(RangeElementType Segment, CfgNode *Node = nullptr) {
+ addSegment(Segment.first, Segment.second, Node);
+ }
bool endsBefore(const LiveRange &Other) const;
bool overlaps(const LiveRange &Other, bool UseTrimmed = false) const;
@@ -637,11 +643,14 @@ public:
void dump(Ostream &Str) const;
+ SizeT getNumSegments() const { return Range.size(); }
+
+ const RangeType &getSegments() const { return Range; }
+ CfgNode *getNodeForSegment(InstNumberT Begin) { return NodeMap[Begin]; }
Jim Stichnoth 2016/08/02 05:57:50 Should probably assert that NodeMap contains Begin
manasijm 2016/08/02 21:41:58 Done.
+
private:
- using RangeElementType = std::pair<InstNumberT, InstNumberT>;
- /// RangeType is arena-allocated from the Cfg's allocator.
- using RangeType = CfgVector<RangeElementType>;
RangeType Range;
+ CfgUnorderedMap<InstNumberT, CfgNode *> NodeMap;
/// TrimmedBegin is an optimization for the overlaps() computation. Since the
/// linear-scan algorithm always calls it as overlaps(Cur) and Cur advances
/// monotonically according to live range start, we can optimize overlaps() by
@@ -744,9 +753,10 @@ public:
const LiveRange &getLiveRange() const { return Live; }
void setLiveRange(const LiveRange &Range) { Live = Range; }
void resetLiveRange() { Live.reset(); }
- void addLiveRange(InstNumberT Start, InstNumberT End) {
+ void addLiveRange(InstNumberT Start, InstNumberT End,
+ CfgNode *Node = nullptr) {
assert(!getIgnoreLiveness());
- Live.addSegment(Start, End);
+ Live.addSegment(Start, End, Node);
}
void trimLiveRange(InstNumberT Start) { Live.trim(Start); }
void untrimLiveRange() { Live.untrim(); }

Powered by Google App Engine
This is Rietveld 408576698