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

Side by Side Diff: src/IceOperand.cpp

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: Add comment Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/IceOperand.h ('k') | src/IceRegAlloc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceOperand.cpp - High-level operand implementation -----===// 1 //===- subzero/src/IceOperand.cpp - High-level operand implementation -----===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 RegNumT::BaseType RegNumT::Limit = 0; 94 RegNumT::BaseType RegNumT::Limit = 0;
95 95
96 bool operator<(const RegWeight &A, const RegWeight &B) { 96 bool operator<(const RegWeight &A, const RegWeight &B) {
97 return A.getWeight() < B.getWeight(); 97 return A.getWeight() < B.getWeight();
98 } 98 }
99 bool operator<=(const RegWeight &A, const RegWeight &B) { return !(B < A); } 99 bool operator<=(const RegWeight &A, const RegWeight &B) { return !(B < A); }
100 bool operator==(const RegWeight &A, const RegWeight &B) { 100 bool operator==(const RegWeight &A, const RegWeight &B) {
101 return !(B < A) && !(A < B); 101 return !(B < A) && !(A < B);
102 } 102 }
103 103
104 void LiveRange::addSegment(InstNumberT Start, InstNumberT End) { 104 void LiveRange::addSegment(InstNumberT Start, InstNumberT End, CfgNode *Node) {
105 if (!Range.empty()) { 105 if (getFlags().getSplitGlobalVars()) {
106 // Check for merge opportunity. 106 // Disable merging to make sure a live range 'segment' has a single node.
107 InstNumberT CurrentEnd = Range.back().second; 107 // Might be possible to enable when the target segment has the same node.
108 assert(Start >= CurrentEnd); 108 assert(NodeMap.find(Start) == NodeMap.end());
109 if (Start == CurrentEnd) { 109 NodeMap[Start] = Node;
110 Range.back().second = End; 110 } else {
111 return; 111 if (!Range.empty()) {
112 // Check for merge opportunity.
113 InstNumberT CurrentEnd = Range.back().second;
114 assert(Start >= CurrentEnd);
115 if (Start == CurrentEnd) {
116 Range.back().second = End;
117 return;
118 }
112 } 119 }
113 } 120 }
114 Range.push_back(RangeElementType(Start, End)); 121 Range.push_back(RangeElementType(Start, End));
115 } 122 }
116 123
117 // Returns true if this live range ends before Other's live range starts. This 124 // Returns true if this live range ends before Other's live range starts. This
118 // means that the highest instruction number in this live range is less than or 125 // means that the highest instruction number in this live range is less than or
119 // equal to the lowest instruction number of the Other live range. 126 // equal to the lowest instruction number of the Other live range.
120 bool LiveRange::endsBefore(const LiveRange &Other) const { 127 bool LiveRange::endsBefore(const LiveRange &Other) const {
121 // Neither range should be empty, but let's be graceful. 128 // Neither range should be empty, but let's be graceful.
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 if (getType() != IceType_i32 && getType() != IceType_i16 && 656 if (getType() != IceType_i32 && getType() != IceType_i16 &&
650 getType() != IceType_i8) 657 getType() != IceType_i8)
651 return false; 658 return false;
652 // The Following checks if the signed representation of Value is between 659 // The Following checks if the signed representation of Value is between
653 // -Threshold/2 and +Threshold/2 660 // -Threshold/2 and +Threshold/2
654 bool largerThanThreshold = Threshold / 2 + Value >= Threshold; 661 bool largerThanThreshold = Threshold / 2 + Value >= Threshold;
655 return largerThanThreshold; 662 return largerThanThreshold;
656 } 663 }
657 664
658 } // end of namespace Ice 665 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceOperand.h ('k') | src/IceRegAlloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698