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

Unified Diff: src/IceCfgNode.cpp

Issue 700263003: Rearrange emit vs emitIAS. Wait till function is done before dumping text. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: remove comment... might end up using the iterator 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceCfgNode.h ('k') | src/IceInstX8632.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfgNode.cpp
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index 52789b94cdc3f85426ca83822d57436979401613..543f4e9b49469dbd2ee9f1c2a3b92e83317a9419 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -864,6 +864,24 @@ void emitLiveRangesEnded(Ostream &Str, const Cfg *Func, const Inst *Instr,
}
}
+void updateStats(Cfg *Func, const Inst *I) {
+ // Update emitted instruction count, plus fill/spill count for
+ // Variable operands without a physical register.
+ if (uint32_t Count = I->getEmitInstCount()) {
+ Func->getContext()->statsUpdateEmitted(Count);
+ if (Variable *Dest = I->getDest()) {
+ if (!Dest->hasReg())
+ Func->getContext()->statsUpdateFills();
+ }
+ for (SizeT S = 0; S < I->getSrcSize(); ++S) {
+ if (Variable *Src = llvm::dyn_cast<Variable>(I->getSrc(S))) {
+ if (!Src->hasReg())
+ Func->getContext()->statsUpdateSpills();
+ }
+ }
+ }
+}
+
} // end of anonymous namespace
void CfgNode::emit(Cfg *Func) const {
@@ -871,14 +889,7 @@ void CfgNode::emit(Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit();
Liveness *Liveness = Func->getLiveness();
bool DecorateAsm = Liveness && Func->getContext()->getFlags().DecorateAsm;
- if (Func->getEntryNode() == this) {
- Str << Func->getContext()->mangleName(Func->getFunctionName()) << ":\n";
- }
Str << getAsmName() << ":\n";
- if (Func->useIntegratedAssembler()) {
- Assembler *Asm = Func->getAssembler<Assembler>();
- Asm->BindCfgNodeLabel(getIndex());
- }
std::vector<SizeT> LiveRegCount(Func->getTarget()->getNumRegisters());
if (DecorateAsm)
emitRegisterUsage(Str, Func, this, true, LiveRegCount);
@@ -899,34 +910,37 @@ void CfgNode::emit(Cfg *Func) const {
++LiveRegCount[Dest->getRegNum()];
continue;
}
- if (Func->useIntegratedAssembler()) {
- I->emitIAS(Func);
- } else {
- I->emit(Func);
- if (DecorateAsm)
- emitLiveRangesEnded(Str, Func, I, LiveRegCount);
- Str << "\n";
- }
- // Update emitted instruction count, plus fill/spill count for
- // Variable operands without a physical register.
- if (uint32_t Count = I->getEmitInstCount()) {
- Func->getContext()->statsUpdateEmitted(Count);
- if (Variable *Dest = I->getDest()) {
- if (!Dest->hasReg())
- Func->getContext()->statsUpdateFills();
- }
- for (SizeT S = 0; S < I->getSrcSize(); ++S) {
- if (Variable *Src = llvm::dyn_cast<Variable>(I->getSrc(S))) {
- if (!Src->hasReg())
- Func->getContext()->statsUpdateSpills();
- }
- }
- }
+ I->emit(Func);
+ if (DecorateAsm)
+ emitLiveRangesEnded(Str, Func, I, LiveRegCount);
+ Str << "\n";
+ updateStats(Func, I);
}
if (DecorateAsm)
emitRegisterUsage(Str, Func, this, false, LiveRegCount);
}
+void CfgNode::emitIAS(Cfg *Func) const {
+ Func->setCurrentNode(this);
+ Assembler *Asm = Func->getAssembler<Assembler>();
+ Asm->BindCfgNodeLabel(getIndex());
+ for (InstPhi *Phi : Phis) {
+ if (Phi->isDeleted())
+ continue;
+ // Emitting a Phi instruction should cause an error.
+ Inst *Instr = Phi;
+ Instr->emitIAS(Func);
+ }
+ for (Inst *I : Insts) {
+ if (I->isDeleted())
+ continue;
+ if (I->isRedundantAssign())
+ continue;
+ I->emitIAS(Func);
+ updateStats(Func, I);
+ }
+}
+
void CfgNode::dump(Cfg *Func) const {
Func->setCurrentNode(this);
Ostream &Str = Func->getContext()->getStrDump();
« no previous file with comments | « src/IceCfgNode.h ('k') | src/IceInstX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698