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

Unified Diff: src/IceCfgNode.cpp

Issue 1431353003: Subzero: For filetype=asm, don't print a blank line for pseudo instrs. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 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 | « no previous file | src/IceInst.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 004a0b34d13dd754d88764455f2c843a67e7aa89..1925d19272131119277e09b79e32196f1390ae02 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -954,11 +954,13 @@ void emitRegisterUsage(Ostream &Str, const Cfg *Func, const CfgNode *Node,
Str << "\n";
}
-void emitLiveRangesEnded(Ostream &Str, const Cfg *Func, const Inst *Instr,
+/// Returns true if some text was emitted - in which case the caller definitely
+/// needs to emit a newline character.
+bool emitLiveRangesEnded(Ostream &Str, const Cfg *Func, const Inst *Instr,
CfgVector<SizeT> &LiveRegCount) {
+ bool Printed = false;
if (!BuildDefs::dump())
- return;
- bool First = true;
+ return Printed;
Variable *Dest = Instr->getDest();
// Normally we increment the live count for the dest register. But we
// shouldn't if the instruction's IsDestRedefined flag is set, because this
@@ -976,14 +978,15 @@ void emitLiveRangesEnded(Ostream &Str, const Cfg *Func, const Inst *Instr,
ShouldReport = false;
}
if (ShouldReport) {
- if (First)
- Str << " \t# END=";
- else
+ if (Printed)
Str << ",";
+ else
+ Str << " \t# END=";
Var->emit(Func);
- First = false;
+ Printed = true;
}
}
+ return Printed;
}
void updateStats(Cfg *Func, const Inst *I) {
@@ -1068,9 +1071,11 @@ void CfgNode::emit(Cfg *Func) const {
continue;
}
I.emit(Func);
+ bool Printed = false;
if (DecorateAsm)
- emitLiveRangesEnded(Str, Func, &I, LiveRegCount);
- Str << "\n";
+ Printed = emitLiveRangesEnded(Str, Func, &I, LiveRegCount);
+ if (Printed || llvm::isa<InstTarget>(&I))
+ Str << "\n";
updateStats(Func, &I);
}
if (DecorateAsm) {
« no previous file with comments | « no previous file | src/IceInst.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698