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

Side by Side Diff: src/IceCfgNode.cpp

Issue 580903005: Subzero: Add branch optimization. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 6 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
« no previous file with comments | « src/IceCfgNode.h ('k') | src/IceGlobalContext.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/IceCfgNode.cpp - Basic block (node) implementation -----===// 1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) 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 CfgNode class, including the complexities 10 // This file implements the CfgNode class, including the complexities
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 continue; 450 continue;
451 if (Begin <= FirstInstNum) 451 if (Begin <= FirstInstNum)
452 Begin = FirstInstNum; 452 Begin = FirstInstNum;
453 if (End == Inst::NumberSentinel) 453 if (End == Inst::NumberSentinel)
454 End = LastInstNum + 1; 454 End = LastInstNum + 1;
455 Variable *Var = Liveness->getVariable(i, this); 455 Variable *Var = Liveness->getVariable(i, this);
456 Liveness->addLiveRange(Var, Begin, End, 1); 456 Liveness->addLiveRange(Var, Begin, End, 1);
457 } 457 }
458 } 458 }
459 459
460 void CfgNode::doBranchOpt(const CfgNode *NextNode) {
461 TargetLowering *Target = Func->getTarget();
462 // Check every instruction for a branch optimization opportunity.
463 // It may be more efficient to iterate in reverse and stop after the
464 // first opportunity, unless there is some target lowering where we
465 // have the possibility of multiple such optimizations per block
466 // (currently not the case for x86 lowering).
467 for (InstList::const_iterator I = Insts.begin(), E = Insts.end(); I != E;
468 ++I) {
469 Target->doBranchOpt(*I, NextNode);
470 }
471 }
472
460 // ======================== Dump routines ======================== // 473 // ======================== Dump routines ======================== //
461 474
462 void CfgNode::emit(Cfg *Func) const { 475 void CfgNode::emit(Cfg *Func) const {
463 Func->setCurrentNode(this); 476 Func->setCurrentNode(this);
464 Ostream &Str = Func->getContext()->getStrEmit(); 477 Ostream &Str = Func->getContext()->getStrEmit();
465 if (Func->getEntryNode() == this) { 478 if (Func->getEntryNode() == this) {
466 Str << Func->getContext()->mangleName(Func->getFunctionName()) << ":\n"; 479 Str << Func->getContext()->mangleName(Func->getFunctionName()) << ":\n";
467 } 480 }
468 Str << getAsmName() << ":\n"; 481 Str << getAsmName() << ":\n";
469 for (PhiList::const_iterator I = Phis.begin(), E = Phis.end(); I != E; ++I) { 482 for (PhiList::const_iterator I = Phis.begin(), E = Phis.end(); I != E; ++I) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 I != E; ++I) { 578 I != E; ++I) {
566 if (I != OutEdges.begin()) 579 if (I != OutEdges.begin())
567 Str << ", "; 580 Str << ", ";
568 Str << "%" << (*I)->getName(); 581 Str << "%" << (*I)->getName();
569 } 582 }
570 Str << "\n"; 583 Str << "\n";
571 } 584 }
572 } 585 }
573 586
574 } // end of namespace Ice 587 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCfgNode.h ('k') | src/IceGlobalContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698