| OLD | NEW |
| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 for (InstList::const_iterator I = Insts.begin(), E = Insts.end(); I != E; | 476 for (InstList::const_iterator I = Insts.begin(), E = Insts.end(); I != E; |
| 477 ++I) { | 477 ++I) { |
| 478 Inst *Inst = *I; | 478 Inst *Inst = *I; |
| 479 if (Inst->isDeleted()) | 479 if (Inst->isDeleted()) |
| 480 continue; | 480 continue; |
| 481 // Here we detect redundant assignments like "mov eax, eax" and | 481 // Here we detect redundant assignments like "mov eax, eax" and |
| 482 // suppress them. | 482 // suppress them. |
| 483 if (Inst->isRedundantAssign()) | 483 if (Inst->isRedundantAssign()) |
| 484 continue; | 484 continue; |
| 485 (*I)->emit(Func); | 485 (*I)->emit(Func); |
| 486 // Update emitted instruction count, plus fill/spill count for |
| 487 // Variable operands without a physical register. |
| 488 if (uint32_t Count = (*I)->getEmitInstCount()) { |
| 489 Func->getContext()->statsUpdateEmitted(Count); |
| 490 if (Variable *Dest = (*I)->getDest()) { |
| 491 if (!Dest->hasReg()) |
| 492 Func->getContext()->statsUpdateFills(); |
| 493 } |
| 494 for (SizeT S = 0; S < (*I)->getSrcSize(); ++S) { |
| 495 if (Variable *Src = llvm::dyn_cast<Variable>((*I)->getSrc(S))) { |
| 496 if (!Src->hasReg()) |
| 497 Func->getContext()->statsUpdateSpills(); |
| 498 } |
| 499 } |
| 500 } |
| 486 } | 501 } |
| 487 } | 502 } |
| 488 | 503 |
| 489 void CfgNode::dump(Cfg *Func) const { | 504 void CfgNode::dump(Cfg *Func) const { |
| 490 Func->setCurrentNode(this); | 505 Func->setCurrentNode(this); |
| 491 Ostream &Str = Func->getContext()->getStrDump(); | 506 Ostream &Str = Func->getContext()->getStrDump(); |
| 492 Liveness *Liveness = Func->getLiveness(); | 507 Liveness *Liveness = Func->getLiveness(); |
| 493 if (Func->getContext()->isVerbose(IceV_Instructions)) { | 508 if (Func->getContext()->isVerbose(IceV_Instructions)) { |
| 494 Str << getName() << ":\n"; | 509 Str << getName() << ":\n"; |
| 495 } | 510 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 I != E; ++I) { | 565 I != E; ++I) { |
| 551 if (I != OutEdges.begin()) | 566 if (I != OutEdges.begin()) |
| 552 Str << ", "; | 567 Str << ", "; |
| 553 Str << "%" << (*I)->getName(); | 568 Str << "%" << (*I)->getName(); |
| 554 } | 569 } |
| 555 Str << "\n"; | 570 Str << "\n"; |
| 556 } | 571 } |
| 557 } | 572 } |
| 558 | 573 |
| 559 } // end of namespace Ice | 574 } // end of namespace Ice |
| OLD | NEW |