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

Side by Side Diff: src/IceCfgNode.cpp

Issue 673543002: First pass at emitIAS for branches and binding labels (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: check the local labels too Created 6 years, 1 month 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/IceCfg.h ('k') | src/IceInstX8632.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
11 // of instruction insertion and in-edge calculation. 11 // of instruction insertion and in-edge calculation.
12 // 12 //
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #include "assembler.h"
15 #include "IceCfg.h" 16 #include "IceCfg.h"
16 #include "IceCfgNode.h" 17 #include "IceCfgNode.h"
17 #include "IceInst.h" 18 #include "IceInst.h"
18 #include "IceLiveness.h" 19 #include "IceLiveness.h"
19 #include "IceOperand.h" 20 #include "IceOperand.h"
20 #include "IceTargetLowering.h" 21 #include "IceTargetLowering.h"
21 22
22 namespace Ice { 23 namespace Ice {
23 24
24 CfgNode::CfgNode(Cfg *Func, SizeT LabelNumber, IceString Name) 25 CfgNode::CfgNode(Cfg *Func, SizeT LabelNumber, IceString Name)
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 487
487 // ======================== Dump routines ======================== // 488 // ======================== Dump routines ======================== //
488 489
489 void CfgNode::emit(Cfg *Func) const { 490 void CfgNode::emit(Cfg *Func) const {
490 Func->setCurrentNode(this); 491 Func->setCurrentNode(this);
491 Ostream &Str = Func->getContext()->getStrEmit(); 492 Ostream &Str = Func->getContext()->getStrEmit();
492 if (Func->getEntryNode() == this) { 493 if (Func->getEntryNode() == this) {
493 Str << Func->getContext()->mangleName(Func->getFunctionName()) << ":\n"; 494 Str << Func->getContext()->mangleName(Func->getFunctionName()) << ":\n";
494 } 495 }
495 Str << getAsmName() << ":\n"; 496 Str << getAsmName() << ":\n";
497 if (Func->useIntegratedAssembler()) {
498 Assembler *Asm = Func->getAssembler<Assembler>();
499 Asm->BindCfgNodeLabel(getIndex());
500 }
496 for (InstPhi *Phi : Phis) { 501 for (InstPhi *Phi : Phis) {
497 if (Phi->isDeleted()) 502 if (Phi->isDeleted())
498 continue; 503 continue;
499 // Emitting a Phi instruction should cause an error. 504 // Emitting a Phi instruction should cause an error.
500 Inst *Instr = Phi; 505 Inst *Instr = Phi;
501 Instr->emit(Func); 506 Instr->emit(Func);
502 } 507 }
503 for (Inst *I : Insts) { 508 for (Inst *I : Insts) {
504 if (I->isDeleted()) 509 if (I->isDeleted())
505 continue; 510 continue;
506 // Here we detect redundant assignments like "mov eax, eax" and 511 // Here we detect redundant assignments like "mov eax, eax" and
507 // suppress them. 512 // suppress them.
508 if (I->isRedundantAssign()) 513 if (I->isRedundantAssign())
509 continue; 514 continue;
510 if (Func->UseIntegratedAssembler()) { 515 if (Func->useIntegratedAssembler()) {
511 I->emitIAS(Func); 516 I->emitIAS(Func);
512 } else { 517 } else {
513 I->emit(Func); 518 I->emit(Func);
514 } 519 }
515 // Update emitted instruction count, plus fill/spill count for 520 // Update emitted instruction count, plus fill/spill count for
516 // Variable operands without a physical register. 521 // Variable operands without a physical register.
517 if (uint32_t Count = I->getEmitInstCount()) { 522 if (uint32_t Count = I->getEmitInstCount()) {
518 Func->getContext()->statsUpdateEmitted(Count); 523 Func->getContext()->statsUpdateEmitted(Count);
519 if (Variable *Dest = I->getDest()) { 524 if (Variable *Dest = I->getDest()) {
520 if (!Dest->hasReg()) 525 if (!Dest->hasReg())
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 if (!First) 595 if (!First)
591 Str << ", "; 596 Str << ", ";
592 First = false; 597 First = false;
593 Str << "%" << I->getName(); 598 Str << "%" << I->getName();
594 } 599 }
595 Str << "\n"; 600 Str << "\n";
596 } 601 }
597 } 602 }
598 603
599 } // end of namespace Ice 604 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCfg.h ('k') | src/IceInstX8632.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698