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

Side by Side Diff: src/IceInst.cpp

Issue 1312433004: Weight variables by their number of uses for register allocation. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Count uses in VMetadata Created 5 years, 3 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
OLDNEW
1 //===- subzero/src/IceInst.cpp - High-level instruction implementation ----===// 1 //===- subzero/src/IceInst.cpp - High-level instruction 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return false; 196 return false;
197 // Phi arguments only get added to Live in the predecessor node, but 197 // Phi arguments only get added to Live in the predecessor node, but
198 // we still need to update LiveRangesEnded. 198 // we still need to update LiveRangesEnded.
199 bool IsPhi = llvm::isa<InstPhi>(this); 199 bool IsPhi = llvm::isa<InstPhi>(this);
200 resetLastUses(); 200 resetLastUses();
201 SizeT VarIndex = 0; 201 SizeT VarIndex = 0;
202 for (SizeT I = 0; I < getSrcSize(); ++I) { 202 for (SizeT I = 0; I < getSrcSize(); ++I) {
203 Operand *Src = getSrc(I); 203 Operand *Src = getSrc(I);
204 SizeT NumVars = Src->getNumVars(); 204 SizeT NumVars = Src->getNumVars();
205 for (SizeT J = 0; J < NumVars; ++J, ++VarIndex) { 205 for (SizeT J = 0; J < NumVars; ++J, ++VarIndex) {
206 const Variable *Var = Src->getVar(J); 206 Variable *Var = Src->getVar(J);
jvoung (off chromium) 2015/08/28 20:31:45 any reason for this change?
ascull 2015/08/28 21:22:36 There was, but no longer. Done.
207 SizeT VarNum = Liveness->getLiveIndex(Var->getIndex()); 207 SizeT VarNum = Liveness->getLiveIndex(Var->getIndex());
208 if (!Live[VarNum]) { 208 if (!Live[VarNum]) {
209 setLastUse(VarIndex); 209 setLastUse(VarIndex);
210 if (!IsPhi) { 210 if (!IsPhi) {
211 Live[VarNum] = true; 211 Live[VarNum] = true;
212 // For a variable in SSA form, its live range can end at 212 // For a variable in SSA form, its live range can end at
213 // most once in a basic block. However, after lowering to 213 // most once in a basic block. However, after lowering to
214 // two-address instructions, we end up with sequences like 214 // two-address instructions, we end up with sequences like
215 // "t=b;t+=c;a=t" where t's live range begins and ends 215 // "t=b;t+=c;a=t" where t's live range begins and ends
216 // twice. ICE only allows a variable to have a single 216 // twice. ICE only allows a variable to have a single
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 // preserve these. 974 // preserve these.
975 return true; 975 return true;
976 } 976 }
977 if (!Dest->hasReg() && !SrcVar->hasReg() && 977 if (!Dest->hasReg() && !SrcVar->hasReg() &&
978 Dest->getStackOffset() == SrcVar->getStackOffset()) 978 Dest->getStackOffset() == SrcVar->getStackOffset())
979 return true; 979 return true;
980 return false; 980 return false;
981 } 981 }
982 982
983 } // end of namespace Ice 983 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCfgNode.cpp ('k') | src/IceLiveness.cpp » ('j') | src/IceOperand.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698