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

Unified Diff: src/IceInstX8632.cpp

Issue 570713006: Subzero: Refactor Operand::dump(). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Use a more general dump function Created 6 years, 3 months 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/IceInstX8632.h ('k') | src/IceOperand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstX8632.cpp
diff --git a/src/IceInstX8632.cpp b/src/IceInstX8632.cpp
index 373ab59e47503c4b3535edaaf87bc17a4aa015f5..06804f3bb8be7d442f2e06cd9a29415675055b1f 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -1356,11 +1356,6 @@ void InstX8632Xchg::dump(const Cfg *Func) const {
dumpSources(Func);
}
-void OperandX8632::dump(const Cfg *Func) const {
- Ostream &Str = Func->getContext()->getStrDump();
- Str << "<OperandX8632>";
-}
-
void OperandX8632Mem::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit();
Str << TypeX8632Attributes[getType()].WidthString << " ";
@@ -1405,8 +1400,7 @@ void OperandX8632Mem::emit(const Cfg *Func) const {
Str << "]";
}
-void OperandX8632Mem::dump(const Cfg *Func) const {
- Ostream &Str = Func->getContext()->getStrDump();
+void OperandX8632Mem::dump(const Cfg *Func, Ostream &Str) const {
if (SegmentReg != DefaultSegment) {
assert(SegmentReg >= 0 && SegmentReg < SegReg_NUM);
Str << InstX8632SegmentRegNames[SegmentReg] << ":";
@@ -1414,7 +1408,10 @@ void OperandX8632Mem::dump(const Cfg *Func) const {
bool Dumped = false;
Str << "[";
if (Base) {
- Base->dump(Func);
+ if (Func)
+ Base->dump(Func);
+ else
+ Base->dump(Str);
Dumped = true;
}
if (Index) {
@@ -1422,7 +1419,10 @@ void OperandX8632Mem::dump(const Cfg *Func) const {
Str << "+";
if (Shift > 0)
Str << (1u << Shift) << "*";
- Index->dump(Func);
+ if (Func)
+ Index->dump(Func);
+ else
+ Index->dump(Str);
Dumped = true;
}
// Pretty-print the Offset.
@@ -1438,11 +1438,11 @@ void OperandX8632Mem::dump(const Cfg *Func) const {
if (!OffsetIsZero) { // Suppress if Offset is known to be 0
if (!OffsetIsNegative) // Suppress if Offset is known to be negative
Str << "+";
- Offset->dump(Func);
+ Offset->dump(Func, Str);
}
} else {
// There is only the offset.
- Offset->dump(Func);
+ Offset->dump(Func, Str);
}
Str << "]";
}
@@ -1468,8 +1468,7 @@ void VariableSplit::emit(const Cfg *Func) const {
Str << "]";
}
-void VariableSplit::dump(const Cfg *Func) const {
- Ostream &Str = Func->getContext()->getStrDump();
+void VariableSplit::dump(const Cfg *Func, Ostream &Str) const {
switch (Part) {
case Low:
Str << "low";
@@ -1482,7 +1481,10 @@ void VariableSplit::dump(const Cfg *Func) const {
break;
}
Str << "(";
- Var->dump(Func);
+ if (Func)
+ Var->dump(Func);
+ else
+ Var->dump(Str);
Str << ")";
}
« no previous file with comments | « src/IceInstX8632.h ('k') | src/IceOperand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698