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

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: Cleanup 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..b1e592cc1399562b8bbc141d73b8a93bd24e1476 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) {
Jim Stichnoth 2016/07/29 17:04:07 How about: void addSegment(RangeElementType Segme
manasijm 2016/08/01 22:20:04 Done.
+ addSegment(Segment.first, Segment.second);
+ }
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() { return Range.size(); }
Jim Stichnoth 2016/07/29 17:04:07 SizeT getNumSegments() const ...
manasijm 2016/08/01 22:20:03 Done.
+
+ const RangeType &getSegments() { return Range; }
Jim Stichnoth 2016/07/29 17:04:07 can this be const?
manasijm 2016/08/01 22:20:03 Done.
+ CfgNode *getNodeForSegment(InstNumberT Begin) { return NodeMap[Begin]; }
Jim Stichnoth 2016/07/29 17:04:07 const?
manasijm 2016/08/01 22:20:04 Probably not.
+
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
@@ -675,6 +684,7 @@ public:
}
SizeT getIndex() const { return Number; }
+ void setIndex(SizeT NewIndex) { Number = NewIndex; }
std::string getName() const {
if (Name.hasStdString())
return Name.toString();
@@ -744,9 +754,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(); }
@@ -808,7 +819,7 @@ protected:
}
/// Number is unique across all variables, and is used as a (bit)vector index
/// for liveness analysis.
- const SizeT Number;
+ SizeT Number;
VariableString Name;
bool IsArgument = false;
bool IsImplicitArgument = false;

Powered by Google App Engine
This is Rietveld 408576698