Commit 120b4121 by Jim Stichnoth

Subzero: Refactor newline emission for Inst::emit().

The (final) newline is emitted by the caller of emit(), instead of by all the emit() implementations. This sets the stage for being able to add useful comments to the textual asm, such as annotating which registers became free after the instruction. BUG= none R=jvoung@chromium.org Review URL: https://codereview.chromium.org/681783002
parent 98712a39
...@@ -510,6 +510,7 @@ void CfgNode::emit(Cfg *Func) const { ...@@ -510,6 +510,7 @@ void CfgNode::emit(Cfg *Func) const {
I->emitIAS(Func); I->emitIAS(Func);
} else { } else {
I->emit(Func); I->emit(Func);
Str << "\n";
} }
// Update emitted instruction count, plus fill/spill count for // Update emitted instruction count, plus fill/spill count for
// Variable operands without a physical register. // Variable operands without a physical register.
......
...@@ -709,7 +709,6 @@ void InstFakeDef::emit(const Cfg *Func) const { ...@@ -709,7 +709,6 @@ void InstFakeDef::emit(const Cfg *Func) const {
getDest()->emit(Func); getDest()->emit(Func);
Str << " = def.pseudo "; Str << " = def.pseudo ";
emitSources(Func); emitSources(Func);
Str << "\n";
} }
void InstFakeDef::dump(const Cfg *Func) const { void InstFakeDef::dump(const Cfg *Func) const {
...@@ -724,7 +723,6 @@ void InstFakeUse::emit(const Cfg *Func) const { ...@@ -724,7 +723,6 @@ void InstFakeUse::emit(const Cfg *Func) const {
Str << "\t# "; Str << "\t# ";
Str << "use.pseudo "; Str << "use.pseudo ";
emitSources(Func); emitSources(Func);
Str << "\n";
} }
void InstFakeUse::dump(const Cfg *Func) const { void InstFakeUse::dump(const Cfg *Func) const {
...@@ -740,7 +738,6 @@ void InstFakeKill::emit(const Cfg *Func) const { ...@@ -740,7 +738,6 @@ void InstFakeKill::emit(const Cfg *Func) const {
Str << "// "; Str << "// ";
Str << "kill.pseudo "; Str << "kill.pseudo ";
emitSources(Func); emitSources(Func);
Str << "\n";
} }
void InstFakeKill::dump(const Cfg *Func) const { void InstFakeKill::dump(const Cfg *Func) const {
......
...@@ -464,7 +464,6 @@ public: ...@@ -464,7 +464,6 @@ public:
assert(getSrcSize() == 1); assert(getSrcSize() == 1);
Str << "\t" << Opcode << "\t"; Str << "\t" << Opcode << "\t";
getSrc(0)->emit(Func); getSrc(0)->emit(Func);
Str << "\n";
} }
void emitIAS(const Cfg *Func) const override { void emitIAS(const Cfg *Func) const override {
assert(getSrcSize() == 1); assert(getSrcSize() == 1);
...@@ -515,7 +514,6 @@ public: ...@@ -515,7 +514,6 @@ public:
getDest()->emit(Func); getDest()->emit(Func);
Str << ", "; Str << ", ";
getSrc(0)->emit(Func); getSrc(0)->emit(Func);
Str << "\n";
} }
void emitIAS(const Cfg *Func) const override { void emitIAS(const Cfg *Func) const override {
assert(getSrcSize() == 1); assert(getSrcSize() == 1);
...@@ -563,7 +561,6 @@ public: ...@@ -563,7 +561,6 @@ public:
getDest()->emit(Func); getDest()->emit(Func);
Str << ", "; Str << ", ";
getSrc(0)->emit(Func); getSrc(0)->emit(Func);
Str << "\n";
} }
void emitIAS(const Cfg *Func) const override { void emitIAS(const Cfg *Func) const override {
Type Ty = getDest()->getType(); Type Ty = getDest()->getType();
...@@ -784,7 +781,6 @@ public: ...@@ -784,7 +781,6 @@ public:
getSrc(1)->emit(Func); getSrc(1)->emit(Func);
Str << ", "; Str << ", ";
getSrc(2)->emit(Func); getSrc(2)->emit(Func);
Str << "\n";
} }
void emitIAS(const Cfg *Func) const override; void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override { void dump(const Cfg *Func) const override {
...@@ -827,7 +823,6 @@ public: ...@@ -827,7 +823,6 @@ public:
getSrc(0)->emit(Func); getSrc(0)->emit(Func);
Str << ", "; Str << ", ";
getSrc(1)->emit(Func); getSrc(1)->emit(Func);
Str << "\n";
} }
void emitIAS(const Cfg *Func) const override; void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override { void dump(const Cfg *Func) const override {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment