factor the print method better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97125 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/DAGISelMatcher.cpp b/utils/TableGen/DAGISelMatcher.cpp
index 4b1ae82..e012928 100644
--- a/utils/TableGen/DAGISelMatcher.cpp
+++ b/utils/TableGen/DAGISelMatcher.cpp
@@ -16,176 +16,148 @@
using namespace llvm;
void Matcher::dump() const {
- print(errs());
+ print(errs(), 0);
}
-void Matcher::printNext(raw_ostream &OS, unsigned indent) const {
+void Matcher::print(raw_ostream &OS, unsigned indent) const {
+ printImpl(OS, indent);
if (Next)
return Next->print(OS, indent);
}
-void ScopeMatcher::print(raw_ostream &OS, unsigned indent) const {
+void ScopeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "Scope\n";
Check->print(OS, indent+2);
- printNext(OS, indent);
}
-void RecordMatcher::print(raw_ostream &OS, unsigned indent) const {
+void RecordMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "Record\n";
- printNext(OS, indent);
}
-void RecordChildMatcher::print(raw_ostream &OS, unsigned indent) const {
+void RecordChildMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "RecordChild: " << ChildNo << '\n';
- printNext(OS, indent);
}
-void RecordMemRefMatcher::print(raw_ostream &OS, unsigned indent) const {
+void RecordMemRefMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "RecordMemRef\n";
- printNext(OS, indent);
}
-void CaptureFlagInputMatcher::print(raw_ostream &OS, unsigned indent) const{
+void CaptureFlagInputMatcher::printImpl(raw_ostream &OS, unsigned indent) const{
OS.indent(indent) << "CaptureFlagInput\n";
- printNext(OS, indent);
}
-void MoveChildMatcher::print(raw_ostream &OS, unsigned indent) const {
+void MoveChildMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "MoveChild " << ChildNo << '\n';
- printNext(OS, indent);
}
-void MoveParentMatcher::print(raw_ostream &OS, unsigned indent) const {
+void MoveParentMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "MoveParent\n";
- printNext(OS, indent);
}
-void CheckSameMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckSameMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckSame " << MatchNumber << '\n';
- printNext(OS, indent);
}
void CheckPatternPredicateMatcher::
-print(raw_ostream &OS, unsigned indent) const {
+printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckPatternPredicate " << Predicate << '\n';
- printNext(OS, indent);
}
-void CheckPredicateMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckPredicateMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckPredicate " << PredName << '\n';
- printNext(OS, indent);
}
-void CheckOpcodeMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckOpcodeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckOpcode " << OpcodeName << '\n';
- printNext(OS, indent);
}
-void CheckMultiOpcodeMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckMultiOpcodeMatcher::printImpl(raw_ostream &OS, unsigned indent) const{
OS.indent(indent) << "CheckMultiOpcode <todo args>\n";
- printNext(OS, indent);
}
-void CheckTypeMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckType " << getEnumName(Type) << '\n';
- printNext(OS, indent);
}
-void CheckChildTypeMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckChildTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckChildType " << ChildNo << " "
<< getEnumName(Type) << '\n';
- printNext(OS, indent);
}
-void CheckIntegerMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckIntegerMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckInteger " << Value << '\n';
- printNext(OS, indent);
}
-void CheckCondCodeMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckCondCodeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckCondCode ISD::" << CondCodeName << '\n';
- printNext(OS, indent);
}
-void CheckValueTypeMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckValueTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckValueType MVT::" << TypeName << '\n';
- printNext(OS, indent);
}
-void CheckComplexPatMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckComplexPatMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckComplexPat " << Pattern.getSelectFunc() << '\n';
- printNext(OS, indent);
}
-void CheckAndImmMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckAndImmMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckAndImm " << Value << '\n';
- printNext(OS, indent);
}
-void CheckOrImmMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CheckOrImmMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CheckOrImm " << Value << '\n';
- printNext(OS, indent);
}
-void CheckFoldableChainNodeMatcher::print(raw_ostream &OS,
+void CheckFoldableChainNodeMatcher::printImpl(raw_ostream &OS,
unsigned indent) const {
OS.indent(indent) << "CheckFoldableChainNode\n";
- printNext(OS, indent);
}
-void CheckChainCompatibleMatcher::print(raw_ostream &OS,
+void CheckChainCompatibleMatcher::printImpl(raw_ostream &OS,
unsigned indent) const {
OS.indent(indent) << "CheckChainCompatible " << PreviousOp << "\n";
- printNext(OS, indent);
}
-void EmitIntegerMatcher::print(raw_ostream &OS, unsigned indent) const {
+void EmitIntegerMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "EmitInteger " << Val << " VT=" << VT << '\n';
- printNext(OS, indent);
}
void EmitStringIntegerMatcher::
-print(raw_ostream &OS, unsigned indent) const {
+printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "EmitStringInteger " << Val << " VT=" << VT << '\n';
- printNext(OS, indent);
}
-void EmitRegisterMatcher::print(raw_ostream &OS, unsigned indent) const {
+void EmitRegisterMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "EmitRegister ";
if (Reg)
OS << Reg->getName();
else
OS << "zero_reg";
OS << " VT=" << VT << '\n';
- printNext(OS, indent);
}
void EmitConvertToTargetMatcher::
-print(raw_ostream &OS, unsigned indent) const {
+printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "EmitConvertToTarget " << Slot << '\n';
- printNext(OS, indent);
}
void EmitMergeInputChainsMatcher::
-print(raw_ostream &OS, unsigned indent) const {
+printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "EmitMergeInputChains <todo: args>\n";
- printNext(OS, indent);
}
-void EmitCopyToRegMatcher::print(raw_ostream &OS, unsigned indent) const {
+void EmitCopyToRegMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "EmitCopyToReg <todo: args>\n";
- printNext(OS, indent);
}
-void EmitNodeXFormMatcher::print(raw_ostream &OS, unsigned indent) const {
+void EmitNodeXFormMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "EmitNodeXForm " << NodeXForm->getName()
<< " Slot=" << Slot << '\n';
- printNext(OS, indent);
}
-void EmitNodeMatcher::print(raw_ostream &OS, unsigned indent) const {
+void EmitNodeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "EmitNode: " << OpcodeName << ": <todo flags> ";
for (unsigned i = 0, e = VTs.size(); i != e; ++i)
@@ -194,19 +166,16 @@
for (unsigned i = 0, e = Operands.size(); i != e; ++i)
OS << Operands[i] << ' ';
OS << ")\n";
- printNext(OS, indent);
}
-void MarkFlagResultsMatcher::print(raw_ostream &OS, unsigned indent) const {
+void MarkFlagResultsMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "MarkFlagResults <todo: args>\n";
- printNext(OS, indent);
}
-void CompleteMatchMatcher::print(raw_ostream &OS, unsigned indent) const {
+void CompleteMatchMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "CompleteMatch <todo args>\n";
OS.indent(indent) << "Src = " << *Pattern.getSrcPattern() << "\n";
OS.indent(indent) << "Dst = " << *Pattern.getDstPattern() << "\n";
- printNext(OS, indent);
}
// getHashImpl Implementation.