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

Side by Side Diff: src/IceCfg.cpp

Issue 656023002: Subzero: Register allocator performance improvements and simplifications. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | src/IceCfgNode.cpp » ('j') | src/IceOperand.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// 1 //===- subzero/src/IceCfg.cpp - Control flow graph 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 // This file implements the Cfg class, including constant pool 10 // This file implements the Cfg class, including constant pool
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 Node->livenessPostprocess(Mode, getLiveness()); 212 Node->livenessPostprocess(Mode, getLiveness());
213 if (Mode == Liveness_Intervals) { 213 if (Mode == Liveness_Intervals) {
214 // Special treatment for live in-args. Their liveness needs to 214 // Special treatment for live in-args. Their liveness needs to
215 // extend beyond the beginning of the function, otherwise an arg 215 // extend beyond the beginning of the function, otherwise an arg
216 // whose only use is in the first instruction will end up having 216 // whose only use is in the first instruction will end up having
217 // the trivial live range [1,1) and will *not* interfere with 217 // the trivial live range [1,1) and will *not* interfere with
218 // other arguments. So if the first instruction of the method is 218 // other arguments. So if the first instruction of the method is
219 // "r=arg1+arg2", both args may be assigned the same register. 219 // "r=arg1+arg2", both args may be assigned the same register.
220 for (SizeT I = 0; I < Args.size(); ++I) { 220 for (SizeT I = 0; I < Args.size(); ++I) {
221 Variable *Arg = Args[I]; 221 Variable *Arg = Args[I];
222 if (!Live->getLiveRange(Arg).isEmpty()) { 222 if (!Arg->getLiveRange().isEmpty()) {
223 // Add live range [-1,0) with weight 0. TODO: Here and below, 223 // Add live range [-1,0) with weight 0. TODO: Here and below,
224 // use better symbolic constants along the lines of 224 // use better symbolic constants along the lines of
225 // Inst::NumberDeleted and Inst::NumberSentinel instead of -1 225 // Inst::NumberDeleted and Inst::NumberSentinel instead of -1
226 // and 0. 226 // and 0.
227 Live->addLiveRange(Arg, -1, 0, 0); 227 Arg->addLiveRange(-1, 0, 0);
228 } 228 }
229 // Do the same for i64 args that may have been lowered into i32 229 // Do the same for i64 args that may have been lowered into i32
230 // Lo and Hi components. 230 // Lo and Hi components.
231 Variable *Lo = Arg->getLo(); 231 Variable *Lo = Arg->getLo();
232 if (Lo && !Live->getLiveRange(Lo).isEmpty()) 232 if (Lo && !Lo->getLiveRange().isEmpty())
233 Live->addLiveRange(Lo, -1, 0, 0); 233 Lo->addLiveRange(-1, 0, 0);
234 Variable *Hi = Arg->getHi(); 234 Variable *Hi = Arg->getHi();
235 if (Hi && !Live->getLiveRange(Hi).isEmpty()) 235 if (Hi && !Hi->getLiveRange().isEmpty())
236 Live->addLiveRange(Hi, -1, 0, 0); 236 Hi->addLiveRange(-1, 0, 0);
237 }
238 // Copy Liveness::LiveRanges into individual variables. TODO:
239 // Remove Variable::LiveRange and redirect to
240 // Liveness::LiveRanges. TODO: make sure Variable weights
241 // are applied properly.
242 SizeT NumVars = Variables.size();
243 for (SizeT i = 0; i < NumVars; ++i) {
244 Variable *Var = Variables[i];
245 Var->setLiveRange(Live->getLiveRange(Var));
246 if (Var->getWeight().isInf())
247 Var->setLiveRangeInfiniteWeight();
248 } 237 }
249 } 238 }
250 } 239 }
251 240
252 // Traverse every Variable of every Inst and verify that it 241 // Traverse every Variable of every Inst and verify that it
253 // appears within the Variable's computed live range. 242 // appears within the Variable's computed live range.
254 bool Cfg::validateLiveness() const { 243 bool Cfg::validateLiveness() const {
255 TimerMarker T(TimerStack::TT_validateLiveness, this); 244 TimerMarker T(TimerStack::TT_validateLiveness, this);
256 bool Valid = true; 245 bool Valid = true;
257 Ostream &Str = Ctx->getStrDump(); 246 Ostream &Str = Ctx->getStrDump();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 377 }
389 } 378 }
390 // Print each basic block 379 // Print each basic block
391 for (CfgNode *Node : Nodes) 380 for (CfgNode *Node : Nodes)
392 Node->dump(this); 381 Node->dump(this);
393 if (getContext()->isVerbose(IceV_Instructions)) 382 if (getContext()->isVerbose(IceV_Instructions))
394 Str << "}\n"; 383 Str << "}\n";
395 } 384 }
396 385
397 } // end of namespace Ice 386 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceCfgNode.cpp » ('j') | src/IceOperand.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698