[llvm] [LLVM][TableGen] Adopt `indent` for indentation (PR #109275)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 05:11:58 PDT 2024


https://github.com/jurahul updated https://github.com/llvm/llvm-project/pull/109275

>From 4f21bdc17eb4d724289f3a0aa9913fd30456fde0 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Tue, 17 Sep 2024 04:58:49 -0700
Subject: [PATCH] [LLVM][TableGen] Adopt `indent` for indentation

Adopt `indent` for indentation DAGISelMatcher and DecoderEmitter.
---
 llvm/utils/TableGen/Common/DAGISelMatcher.cpp | 180 +++++++++---------
 llvm/utils/TableGen/Common/DAGISelMatcher.h   |  78 ++++----
 llvm/utils/TableGen/DAGISelMatcherOpt.cpp     |   5 +-
 llvm/utils/TableGen/DecoderEmitter.cpp        | 129 ++++++-------
 4 files changed, 192 insertions(+), 200 deletions(-)

diff --git a/llvm/utils/TableGen/Common/DAGISelMatcher.cpp b/llvm/utils/TableGen/Common/DAGISelMatcher.cpp
index d38b0992cf0e42..8780c4f5b61c27 100644
--- a/llvm/utils/TableGen/Common/DAGISelMatcher.cpp
+++ b/llvm/utils/TableGen/Common/DAGISelMatcher.cpp
@@ -19,13 +19,13 @@ void Matcher::anchor() {}
 
 void Matcher::dump() const { print(errs()); }
 
-void Matcher::print(raw_ostream &OS, unsigned Indent) const {
+void Matcher::print(raw_ostream &OS, indent Indent) const {
   printImpl(OS, Indent);
   if (Next)
     return Next->print(OS, Indent);
 }
 
-void Matcher::printOne(raw_ostream &OS) const { printImpl(OS, 0); }
+void Matcher::printOne(raw_ostream &OS) const { printImpl(OS, indent(0)); }
 
 /// unlinkNode - Unlink the specified node from this chain.  If Other == this,
 /// we unlink the next pointer and return it.  Otherwise we unlink Other from
@@ -111,156 +111,150 @@ unsigned CheckPredicateMatcher::getOperandNo(unsigned i) const {
 
 // printImpl methods.
 
-void ScopeMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "Scope\n";
+void ScopeMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "Scope\n";
   for (const Matcher *C : Children) {
     if (!C)
-      OS.indent(Indent + 1) << "NULL POINTER\n";
+      OS << Indent + 1 << "NULL POINTER\n";
     else
       C->print(OS, Indent + 2);
   }
 }
 
-void RecordMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "Record\n";
+void RecordMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "Record\n";
 }
 
-void RecordChildMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "RecordChild: " << ChildNo << '\n';
+void RecordChildMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "RecordChild: " << ChildNo << '\n';
 }
 
-void RecordMemRefMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "RecordMemRef\n";
+void RecordMemRefMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "RecordMemRef\n";
 }
 
-void CaptureGlueInputMatcher::printImpl(raw_ostream &OS,
-                                        unsigned Indent) const {
-  OS.indent(Indent) << "CaptureGlueInput\n";
+void CaptureGlueInputMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CaptureGlueInput\n";
 }
 
-void MoveChildMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "MoveChild " << ChildNo << '\n';
+void MoveChildMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "MoveChild " << ChildNo << '\n';
 }
 
-void MoveSiblingMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "MoveSibling " << SiblingNo << '\n';
+void MoveSiblingMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "MoveSibling " << SiblingNo << '\n';
 }
 
-void MoveParentMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "MoveParent\n";
+void MoveParentMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "MoveParent\n";
 }
 
-void CheckSameMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckSame " << MatchNumber << '\n';
+void CheckSameMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckSame " << MatchNumber << '\n';
 }
 
-void CheckChildSameMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckChild" << ChildNo << "Same\n";
+void CheckChildSameMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckChild" << ChildNo << "Same\n";
 }
 
 void CheckPatternPredicateMatcher::printImpl(raw_ostream &OS,
-                                             unsigned Indent) const {
-  OS.indent(Indent) << "CheckPatternPredicate " << Predicate << '\n';
+                                             indent Indent) const {
+  OS << Indent << "CheckPatternPredicate " << Predicate << '\n';
 }
 
-void CheckPredicateMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckPredicate " << getPredicate().getFnName() << '\n';
+void CheckPredicateMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckPredicate " << getPredicate().getFnName() << '\n';
 }
 
-void CheckOpcodeMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckOpcode " << Opcode.getEnumName() << '\n';
+void CheckOpcodeMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckOpcode " << Opcode.getEnumName() << '\n';
 }
 
-void SwitchOpcodeMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "SwitchOpcode: {\n";
+void SwitchOpcodeMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "SwitchOpcode: {\n";
   for (const auto &C : Cases) {
-    OS.indent(Indent) << "case " << C.first->getEnumName() << ":\n";
+    OS << Indent << "case " << C.first->getEnumName() << ":\n";
     C.second->print(OS, Indent + 2);
   }
-  OS.indent(Indent) << "}\n";
+  OS << Indent << "}\n";
 }
 
-void CheckTypeMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckType " << getEnumName(Type) << ", ResNo=" << ResNo
-                    << '\n';
+void CheckTypeMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckType " << getEnumName(Type) << ", ResNo=" << ResNo
+     << '\n';
 }
 
-void SwitchTypeMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "SwitchType: {\n";
+void SwitchTypeMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "SwitchType: {\n";
   for (const auto &C : Cases) {
-    OS.indent(Indent) << "case " << getEnumName(C.first) << ":\n";
+    OS << Indent << "case " << getEnumName(C.first) << ":\n";
     C.second->print(OS, Indent + 2);
   }
-  OS.indent(Indent) << "}\n";
+  OS << Indent << "}\n";
 }
 
-void CheckChildTypeMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckChildType " << ChildNo << " " << getEnumName(Type)
-                    << '\n';
+void CheckChildTypeMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckChildType " << ChildNo << " " << getEnumName(Type)
+     << '\n';
 }
 
-void CheckIntegerMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckInteger " << Value << '\n';
+void CheckIntegerMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckInteger " << Value << '\n';
 }
 
-void CheckChildIntegerMatcher::printImpl(raw_ostream &OS,
-                                         unsigned Indent) const {
-  OS.indent(Indent) << "CheckChildInteger " << ChildNo << " " << Value << '\n';
+void CheckChildIntegerMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckChildInteger " << ChildNo << " " << Value << '\n';
 }
 
-void CheckCondCodeMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckCondCode ISD::" << CondCodeName << '\n';
+void CheckCondCodeMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckCondCode ISD::" << CondCodeName << '\n';
 }
 
 void CheckChild2CondCodeMatcher::printImpl(raw_ostream &OS,
-                                           unsigned Indent) const {
-  OS.indent(Indent) << "CheckChild2CondCode ISD::" << CondCodeName << '\n';
+                                           indent Indent) const {
+  OS << Indent << "CheckChild2CondCode ISD::" << CondCodeName << '\n';
 }
 
-void CheckValueTypeMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckValueType " << getEnumName(VT) << '\n';
+void CheckValueTypeMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckValueType " << getEnumName(VT) << '\n';
 }
 
-void CheckComplexPatMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckComplexPat " << Pattern.getSelectFunc() << '\n';
+void CheckComplexPatMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckComplexPat " << Pattern.getSelectFunc() << '\n';
 }
 
-void CheckAndImmMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckAndImm " << Value << '\n';
+void CheckAndImmMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckAndImm " << Value << '\n';
 }
 
-void CheckOrImmMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "CheckOrImm " << Value << '\n';
+void CheckOrImmMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckOrImm " << Value << '\n';
 }
 
 void CheckFoldableChainNodeMatcher::printImpl(raw_ostream &OS,
-                                              unsigned Indent) const {
-  OS.indent(Indent) << "CheckFoldableChainNode\n";
+                                              indent Indent) const {
+  OS << Indent << "CheckFoldableChainNode\n";
 }
 
-void CheckImmAllOnesVMatcher::printImpl(raw_ostream &OS,
-                                        unsigned Indent) const {
-  OS.indent(Indent) << "CheckAllOnesV\n";
+void CheckImmAllOnesVMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckAllOnesV\n";
 }
 
-void CheckImmAllZerosVMatcher::printImpl(raw_ostream &OS,
-                                         unsigned Indent) const {
-  OS.indent(Indent) << "CheckAllZerosV\n";
+void CheckImmAllZerosVMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CheckAllZerosV\n";
 }
 
-void EmitIntegerMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "EmitInteger " << Val << " VT=" << getEnumName(VT)
-                    << '\n';
+void EmitIntegerMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "EmitInteger " << Val << " VT=" << getEnumName(VT) << '\n';
 }
 
-void EmitStringIntegerMatcher::printImpl(raw_ostream &OS,
-                                         unsigned Indent) const {
-  OS.indent(Indent) << "EmitStringInteger " << Val << " VT=" << getEnumName(VT)
-                    << '\n';
+void EmitStringIntegerMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "EmitStringInteger " << Val << " VT=" << getEnumName(VT)
+     << '\n';
 }
 
-void EmitRegisterMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "EmitRegister ";
+void EmitRegisterMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "EmitRegister ";
   if (Reg)
     OS << Reg->getName();
   else
@@ -269,26 +263,26 @@ void EmitRegisterMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
 }
 
 void EmitConvertToTargetMatcher::printImpl(raw_ostream &OS,
-                                           unsigned Indent) const {
-  OS.indent(Indent) << "EmitConvertToTarget " << Slot << '\n';
+                                           indent Indent) const {
+  OS << Indent << "EmitConvertToTarget " << Slot << '\n';
 }
 
 void EmitMergeInputChainsMatcher::printImpl(raw_ostream &OS,
-                                            unsigned Indent) const {
-  OS.indent(Indent) << "EmitMergeInputChains <todo: args>\n";
+                                            indent Indent) const {
+  OS << Indent << "EmitMergeInputChains <todo: args>\n";
 }
 
-void EmitCopyToRegMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "EmitCopyToReg <todo: args>\n";
+void EmitCopyToRegMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "EmitCopyToReg <todo: args>\n";
 }
 
-void EmitNodeXFormMatcher::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent) << "EmitNodeXForm " << NodeXForm->getName()
-                    << " Slot=" << Slot << '\n';
+void EmitNodeXFormMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "EmitNodeXForm " << NodeXForm->getName() << " Slot=" << Slot
+     << '\n';
 }
 
-void EmitNodeMatcherCommon::printImpl(raw_ostream &OS, unsigned Indent) const {
-  OS.indent(Indent);
+void EmitNodeMatcherCommon::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent;
   OS << (isa<MorphNodeToMatcher>(this) ? "MorphNodeTo: " : "EmitNode: ")
      << CGI.Namespace << "::" << CGI.TheDef->getName() << ": <todo flags> ";
 
@@ -300,10 +294,10 @@ void EmitNodeMatcherCommon::printImpl(raw_ostream &OS, unsigned Indent) const {
   OS << ")\n";
 }
 
-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";
+void CompleteMatchMatcher::printImpl(raw_ostream &OS, indent Indent) const {
+  OS << Indent << "CompleteMatch <todo args>\n";
+  OS << Indent << "Src = " << Pattern.getSrcPattern() << "\n";
+  OS << Indent << "Dst = " << Pattern.getDstPattern() << "\n";
 }
 
 bool CheckOpcodeMatcher::isEqualImpl(const Matcher *M) const {
diff --git a/llvm/utils/TableGen/Common/DAGISelMatcher.h b/llvm/utils/TableGen/Common/DAGISelMatcher.h
index 32924afdda0342..44ca704a2351e5 100644
--- a/llvm/utils/TableGen/Common/DAGISelMatcher.h
+++ b/llvm/utils/TableGen/Common/DAGISelMatcher.h
@@ -185,12 +185,12 @@ class Matcher {
     return Other->isContradictoryImpl(this);
   }
 
-  void print(raw_ostream &OS, unsigned indent = 0) const;
+  void print(raw_ostream &OS, indent Indent = indent(0)) const;
   void printOne(raw_ostream &OS) const;
   void dump() const;
 
 protected:
-  virtual void printImpl(raw_ostream &OS, unsigned indent) const = 0;
+  virtual void printImpl(raw_ostream &OS, indent Indent) const = 0;
   virtual bool isEqualImpl(const Matcher *M) const = 0;
   virtual bool isContradictoryImpl(const Matcher *M) const { return false; }
 };
@@ -234,7 +234,7 @@ class ScopeMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == Scope; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return false; }
 };
 
@@ -258,7 +258,7 @@ class RecordMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == RecordNode; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return true; }
 };
 
@@ -289,7 +289,7 @@ class RecordChildMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == RecordChild; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<RecordChildMatcher>(M)->getChildNo() == getChildNo();
   }
@@ -303,7 +303,7 @@ class RecordMemRefMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == RecordMemRef; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return true; }
 };
 
@@ -318,7 +318,7 @@ class CaptureGlueInputMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return true; }
 };
 
@@ -335,7 +335,7 @@ class MoveChildMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == MoveChild; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<MoveChildMatcher>(M)->getChildNo() == getChildNo();
   }
@@ -355,7 +355,7 @@ class MoveSiblingMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == MoveSibling; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned Indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<MoveSiblingMatcher>(M)->getSiblingNo() == getSiblingNo();
   }
@@ -370,7 +370,7 @@ class MoveParentMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == MoveParent; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned Indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return true; }
 };
 
@@ -389,7 +389,7 @@ class CheckSameMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == CheckSame; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned Indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckSameMatcher>(M)->getMatchNumber() == getMatchNumber();
   }
@@ -414,7 +414,7 @@ class CheckChildSameMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned Indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckChildSameMatcher>(M)->ChildNo == ChildNo &&
            cast<CheckChildSameMatcher>(M)->MatchNumber == MatchNumber;
@@ -438,7 +438,7 @@ class CheckPatternPredicateMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckPatternPredicateMatcher>(M)->getPredicate() == Predicate;
   }
@@ -463,7 +463,7 @@ class CheckPredicateMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckPredicateMatcher>(M)->Pred == Pred;
   }
@@ -483,7 +483,7 @@ class CheckOpcodeMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == CheckOpcode; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override;
   bool isContradictoryImpl(const Matcher *M) const override;
 };
@@ -510,7 +510,7 @@ class SwitchOpcodeMatcher : public Matcher {
   const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return false; }
 };
 
@@ -530,7 +530,7 @@ class CheckTypeMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == CheckType; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckTypeMatcher>(M)->Type == Type;
   }
@@ -559,7 +559,7 @@ class SwitchTypeMatcher : public Matcher {
   const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return false; }
 };
 
@@ -581,7 +581,7 @@ class CheckChildTypeMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckChildTypeMatcher>(M)->ChildNo == ChildNo &&
            cast<CheckChildTypeMatcher>(M)->Type == Type;
@@ -602,7 +602,7 @@ class CheckIntegerMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == CheckInteger; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckIntegerMatcher>(M)->Value == Value;
   }
@@ -627,7 +627,7 @@ class CheckChildIntegerMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckChildIntegerMatcher>(M)->ChildNo == ChildNo &&
            cast<CheckChildIntegerMatcher>(M)->Value == Value;
@@ -651,7 +651,7 @@ class CheckCondCodeMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckCondCodeMatcher>(M)->CondCodeName == CondCodeName;
   }
@@ -674,7 +674,7 @@ class CheckChild2CondCodeMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckChild2CondCodeMatcher>(M)->CondCodeName == CondCodeName;
   }
@@ -697,7 +697,7 @@ class CheckValueTypeMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckValueTypeMatcher>(M)->VT == VT;
   }
@@ -737,7 +737,7 @@ class CheckComplexPatMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return &cast<CheckComplexPatMatcher>(M)->Pattern == &Pattern &&
            cast<CheckComplexPatMatcher>(M)->MatchNumber == MatchNumber;
@@ -757,7 +757,7 @@ class CheckAndImmMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == CheckAndImm; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckAndImmMatcher>(M)->Value == Value;
   }
@@ -776,7 +776,7 @@ class CheckOrImmMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == CheckOrImm; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CheckOrImmMatcher>(M)->Value == Value;
   }
@@ -793,7 +793,7 @@ class CheckImmAllOnesVMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return true; }
   bool isContradictoryImpl(const Matcher *M) const override;
 };
@@ -809,7 +809,7 @@ class CheckImmAllZerosVMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return true; }
   bool isContradictoryImpl(const Matcher *M) const override;
 };
@@ -825,7 +825,7 @@ class CheckFoldableChainNodeMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override { return true; }
 };
 
@@ -845,7 +845,7 @@ class EmitIntegerMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == EmitInteger; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<EmitIntegerMatcher>(M)->Val == Val &&
            cast<EmitIntegerMatcher>(M)->VT == VT;
@@ -870,7 +870,7 @@ class EmitStringIntegerMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<EmitStringIntegerMatcher>(M)->Val == Val &&
            cast<EmitStringIntegerMatcher>(M)->VT == VT;
@@ -894,7 +894,7 @@ class EmitRegisterMatcher : public Matcher {
   static bool classof(const Matcher *N) { return N->getKind() == EmitRegister; }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<EmitRegisterMatcher>(M)->Reg == Reg &&
            cast<EmitRegisterMatcher>(M)->VT == VT;
@@ -918,7 +918,7 @@ class EmitConvertToTargetMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<EmitConvertToTargetMatcher>(M)->Slot == Slot;
   }
@@ -947,7 +947,7 @@ class EmitMergeInputChainsMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<EmitMergeInputChainsMatcher>(M)->ChainNodes == ChainNodes;
   }
@@ -972,7 +972,7 @@ class EmitCopyToRegMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<EmitCopyToRegMatcher>(M)->SrcSlot == SrcSlot &&
            cast<EmitCopyToRegMatcher>(M)->DestPhysReg == DestPhysReg;
@@ -997,7 +997,7 @@ class EmitNodeXFormMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<EmitNodeXFormMatcher>(M)->Slot == Slot &&
            cast<EmitNodeXFormMatcher>(M)->NodeXForm == NodeXForm;
@@ -1056,7 +1056,7 @@ class EmitNodeMatcherCommon : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override;
 };
 
@@ -1122,7 +1122,7 @@ class CompleteMatchMatcher : public Matcher {
   }
 
 private:
-  void printImpl(raw_ostream &OS, unsigned indent) const override;
+  void printImpl(raw_ostream &OS, indent Indent) const override;
   bool isEqualImpl(const Matcher *M) const override {
     return cast<CompleteMatchMatcher>(M)->Results == Results &&
            &cast<CompleteMatchMatcher>(M)->Pattern == &Pattern;
diff --git a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
index 224102e49d9891..590786bb7fced3 100644
--- a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
@@ -310,8 +310,9 @@ static void FactorNodes(std::unique_ptr<Matcher> &InputMatcherPtr) {
     if (J != E &&
         // Don't print if it's obvious nothing extract could be merged anyway.
         std::next(J) != E) {
-      LLVM_DEBUG(errs() << "Couldn't merge this:\n"; Optn->print(errs(), 4);
-                 errs() << "into this:\n"; (*J)->print(errs(), 4);
+      LLVM_DEBUG(errs() << "Couldn't merge this:\n";
+                 Optn->print(errs(), indent(4)); errs() << "into this:\n";
+                 (*J)->print(errs(), indent(4));
                  (*std::next(J))->printOne(errs());
                  if (std::next(J, 2) != E)(*std::next(J, 2))->printOne(errs());
                  errs() << "\n");
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index f3a4a77cc9b7f6..b9e6f24752ce22 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -163,15 +163,15 @@ class DecoderEmitter {
       : RK(R), Target(R), PredicateNamespace(PredicateNamespace) {}
 
   // Emit the decoder state machine table.
-  void emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
-                 unsigned Indent, unsigned BitWidth, StringRef Namespace,
+  void emitTable(formatted_raw_ostream &OS, DecoderTable &Table, indent Indent,
+                 unsigned BitWidth, StringRef Namespace,
                  const EncodingIDsVec &EncodingIDs) const;
   void emitInstrLenTable(formatted_raw_ostream &OS,
                          std::vector<unsigned> &InstrLen) const;
   void emitPredicateFunction(formatted_raw_ostream &OS,
-                             PredicateSet &Predicates, unsigned Indent) const;
+                             PredicateSet &Predicates, indent Indent) const;
   void emitDecoderFunction(formatted_raw_ostream &OS, DecoderSet &Decoders,
-                           unsigned Indent) const;
+                           indent Indent) const;
 
   // run - Output the code emitter
   void run(raw_ostream &o);
@@ -541,11 +541,11 @@ class FilterChooser {
   void emitSingletonTableEntry(DecoderTableInfo &TableInfo,
                                const Filter &Best) const;
 
-  void emitBinaryParser(raw_ostream &OS, unsigned Indent,
+  void emitBinaryParser(raw_ostream &OS, indent Indent,
                         const OperandInfo &OpInfo,
                         bool &OpHasCompleteDecoder) const;
 
-  void emitDecoder(raw_ostream &OS, unsigned Indent, unsigned Opc,
+  void emitDecoder(raw_ostream &OS, indent Indent, unsigned Opc,
                    bool &HasCompleteDecoder) const;
   unsigned getDecoderIndex(DecoderSet &Decoders, unsigned Opc,
                            bool &HasCompleteDecoder) const;
@@ -791,7 +791,7 @@ unsigned Filter::usefulness() const {
 
 // Emit the decoder state machine table.
 void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
-                               unsigned Indent, unsigned BitWidth,
+                               indent Indent, unsigned BitWidth,
                                StringRef Namespace,
                                const EncodingIDsVec &EncodingIDs) const {
   // We'll need to be able to map from a decoded opcode into the corresponding
@@ -802,8 +802,8 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
   for (const auto &EI : EncodingIDs)
     OpcodeToEncodingID[EI.Opcode] = EI.EncodingID;
 
-  OS.indent(Indent) << "static const uint8_t DecoderTable" << Namespace
-                    << BitWidth << "[] = {\n";
+  OS << Indent << "static const uint8_t DecoderTable" << Namespace << BitWidth
+     << "[] = {\n";
 
   Indent += 2;
 
@@ -850,7 +850,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
       PrintFatalError("invalid decode table opcode");
     case MCD::OPC_ExtractField: {
       ++I;
-      OS.indent(Indent) << "MCD::OPC_ExtractField, ";
+      OS << Indent << "MCD::OPC_ExtractField, ";
 
       // ULEB128 encoded start value.
       const char *ErrMsg = nullptr;
@@ -868,7 +868,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
     }
     case MCD::OPC_FilterValue: {
       ++I;
-      OS.indent(Indent) << "MCD::OPC_FilterValue, ";
+      OS << Indent << "MCD::OPC_FilterValue, ";
       // The filter value is ULEB128 encoded.
       I += emitULEB128(I, OS);
 
@@ -880,7 +880,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
     }
     case MCD::OPC_CheckField: {
       ++I;
-      OS.indent(Indent) << "MCD::OPC_CheckField, ";
+      OS << Indent << "MCD::OPC_CheckField, ";
       // ULEB128 encoded start value.
       I += emitULEB128(I, OS);
       // 8-bit length.
@@ -897,7 +897,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
     }
     case MCD::OPC_CheckPredicate: {
       ++I;
-      OS.indent(Indent) << "MCD::OPC_CheckPredicate, ";
+      OS << Indent << "MCD::OPC_CheckPredicate, ";
       I += emitULEB128(I, OS);
 
       // 24-bit numtoskip value.
@@ -916,7 +916,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
                                    Table.data() + Table.size(), &ErrMsg);
       assert(ErrMsg == nullptr && "ULEB128 value too large!");
 
-      OS.indent(Indent) << "MCD::OPC_" << (IsTry ? "Try" : "") << "Decode, ";
+      OS << Indent << "MCD::OPC_" << (IsTry ? "Try" : "") << "Decode, ";
       I += emitULEB128(I, OS);
 
       // Decoder index.
@@ -943,7 +943,7 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
     }
     case MCD::OPC_SoftFail: {
       ++I;
-      OS.indent(Indent) << "MCD::OPC_SoftFail";
+      OS << Indent << "MCD::OPC_SoftFail";
       // Positive mask
       uint64_t Value = 0;
       unsigned Shift = 0;
@@ -975,16 +975,16 @@ void DecoderEmitter::emitTable(formatted_raw_ostream &OS, DecoderTable &Table,
     }
     case MCD::OPC_Fail: {
       ++I;
-      OS.indent(Indent) << "MCD::OPC_Fail,\n";
+      OS << Indent << "MCD::OPC_Fail,\n";
       break;
     }
     }
   }
-  OS.indent(Indent) << "0\n";
+  OS << Indent << "0\n";
 
   Indent -= 2;
 
-  OS.indent(Indent) << "};\n\n";
+  OS << Indent << "};\n\n";
 }
 
 void DecoderEmitter::emitInstrLenTable(formatted_raw_ostream &OS,
@@ -998,60 +998,60 @@ void DecoderEmitter::emitInstrLenTable(formatted_raw_ostream &OS,
 
 void DecoderEmitter::emitPredicateFunction(formatted_raw_ostream &OS,
                                            PredicateSet &Predicates,
-                                           unsigned Indent) const {
+                                           indent Indent) const {
   // The predicate function is just a big switch statement based on the
   // input predicate index.
-  OS.indent(Indent) << "static bool checkDecoderPredicate(unsigned Idx, "
-                    << "const FeatureBitset &Bits) {\n";
+  OS << Indent << "static bool checkDecoderPredicate(unsigned Idx, "
+     << "const FeatureBitset &Bits) {\n";
   Indent += 2;
   if (!Predicates.empty()) {
-    OS.indent(Indent) << "switch (Idx) {\n";
-    OS.indent(Indent) << "default: llvm_unreachable(\"Invalid index!\");\n";
+    OS << Indent << "switch (Idx) {\n";
+    OS << Indent << "default: llvm_unreachable(\"Invalid index!\");\n";
     unsigned Index = 0;
     for (const auto &Predicate : Predicates) {
-      OS.indent(Indent) << "case " << Index++ << ":\n";
-      OS.indent(Indent + 2) << "return (" << Predicate << ");\n";
+      OS << Indent << "case " << Index++ << ":\n";
+      OS << Indent + 2 << "return (" << Predicate << ");\n";
     }
-    OS.indent(Indent) << "}\n";
+    OS << Indent << "}\n";
   } else {
     // No case statement to emit
-    OS.indent(Indent) << "llvm_unreachable(\"Invalid index!\");\n";
+    OS << Indent << "llvm_unreachable(\"Invalid index!\");\n";
   }
   Indent -= 2;
-  OS.indent(Indent) << "}\n\n";
+  OS << Indent << "}\n\n";
 }
 
 void DecoderEmitter::emitDecoderFunction(formatted_raw_ostream &OS,
                                          DecoderSet &Decoders,
-                                         unsigned Indent) const {
+                                         indent Indent) const {
   // The decoder function is just a big switch statement based on the
   // input decoder index.
-  OS.indent(Indent) << "template <typename InsnType>\n";
-  OS.indent(Indent) << "static DecodeStatus decodeToMCInst(DecodeStatus S,"
-                    << " unsigned Idx, InsnType insn, MCInst &MI,\n";
-  OS.indent(Indent)
-      << "                                   uint64_t "
-      << "Address, const MCDisassembler *Decoder, bool &DecodeComplete) {\n";
+  OS << Indent << "template <typename InsnType>\n";
+  OS << Indent << "static DecodeStatus decodeToMCInst(DecodeStatus S,"
+     << " unsigned Idx, InsnType insn, MCInst &MI,\n";
+  OS << Indent << "                                   uint64_t "
+     << "Address, const MCDisassembler *Decoder, bool &DecodeComplete) {\n";
   Indent += 2;
-  OS.indent(Indent) << "DecodeComplete = true;\n";
+  OS << Indent << "DecodeComplete = true;\n";
   // TODO: When InsnType is large, using uint64_t limits all fields to 64 bits
   // It would be better for emitBinaryParser to use a 64-bit tmp whenever
   // possible but fall back to an InsnType-sized tmp for truly large fields.
-  OS.indent(Indent) << "using TmpType = "
-                       "std::conditional_t<std::is_integral<InsnType>::"
-                       "value, InsnType, uint64_t>;\n";
-  OS.indent(Indent) << "TmpType tmp;\n";
-  OS.indent(Indent) << "switch (Idx) {\n";
-  OS.indent(Indent) << "default: llvm_unreachable(\"Invalid index!\");\n";
+  OS << Indent
+     << "using TmpType = "
+        "std::conditional_t<std::is_integral<InsnType>::"
+        "value, InsnType, uint64_t>;\n";
+  OS << Indent << "TmpType tmp;\n";
+  OS << Indent << "switch (Idx) {\n";
+  OS << Indent << "default: llvm_unreachable(\"Invalid index!\");\n";
   unsigned Index = 0;
   for (const auto &Decoder : Decoders) {
-    OS.indent(Indent) << "case " << Index++ << ":\n";
+    OS << Indent << "case " << Index++ << ":\n";
     OS << Decoder;
-    OS.indent(Indent + 2) << "return S;\n";
+    OS << Indent + 2 << "return S;\n";
   }
-  OS.indent(Indent) << "}\n";
+  OS << Indent << "}\n";
   Indent -= 2;
-  OS.indent(Indent) << "}\n";
+  OS << Indent << "}\n";
 }
 
 // Populates the field of the insn given the start position and the number of
@@ -1172,7 +1172,7 @@ unsigned FilterChooser::getIslands(std::vector<unsigned> &StartBits,
   return Num;
 }
 
-void FilterChooser::emitBinaryParser(raw_ostream &OS, unsigned Indent,
+void FilterChooser::emitBinaryParser(raw_ostream &OS, indent Indent,
                                      const OperandInfo &OpInfo,
                                      bool &OpHasCompleteDecoder) const {
   const std::string &Decoder = OpInfo.Decoder;
@@ -1180,13 +1180,13 @@ void FilterChooser::emitBinaryParser(raw_ostream &OS, unsigned Indent,
   bool UseInsertBits = OpInfo.numFields() != 1 || OpInfo.InitValue != 0;
 
   if (UseInsertBits) {
-    OS.indent(Indent) << "tmp = 0x";
+    OS << Indent << "tmp = 0x";
     OS.write_hex(OpInfo.InitValue);
     OS << ";\n";
   }
 
   for (const EncodingField &EF : OpInfo) {
-    OS.indent(Indent);
+    OS << Indent;
     if (UseInsertBits)
       OS << "insertBits(tmp, ";
     else
@@ -1201,18 +1201,17 @@ void FilterChooser::emitBinaryParser(raw_ostream &OS, unsigned Indent,
 
   if (Decoder != "") {
     OpHasCompleteDecoder = OpInfo.HasCompleteDecoder;
-    OS.indent(Indent) << "if (!Check(S, " << Decoder
-                      << "(MI, tmp, Address, Decoder))) { "
-                      << (OpHasCompleteDecoder ? ""
-                                               : "DecodeComplete = false; ")
-                      << "return MCDisassembler::Fail; }\n";
+    OS << Indent << "if (!Check(S, " << Decoder
+       << "(MI, tmp, Address, Decoder))) { "
+       << (OpHasCompleteDecoder ? "" : "DecodeComplete = false; ")
+       << "return MCDisassembler::Fail; }\n";
   } else {
     OpHasCompleteDecoder = true;
-    OS.indent(Indent) << "MI.addOperand(MCOperand::createImm(tmp));\n";
+    OS << Indent << "MI.addOperand(MCOperand::createImm(tmp));\n";
   }
 }
 
-void FilterChooser::emitDecoder(raw_ostream &OS, unsigned Indent, unsigned Opc,
+void FilterChooser::emitDecoder(raw_ostream &OS, indent Indent, unsigned Opc,
                                 bool &HasCompleteDecoder) const {
   HasCompleteDecoder = true;
 
@@ -1220,11 +1219,10 @@ void FilterChooser::emitDecoder(raw_ostream &OS, unsigned Indent, unsigned Opc,
     // If a custom instruction decoder was specified, use that.
     if (Op.numFields() == 0 && !Op.Decoder.empty()) {
       HasCompleteDecoder = Op.HasCompleteDecoder;
-      OS.indent(Indent) << "if (!Check(S, " << Op.Decoder
-                        << "(MI, insn, Address, Decoder))) { "
-                        << (HasCompleteDecoder ? ""
-                                               : "DecodeComplete = false; ")
-                        << "return MCDisassembler::Fail; }\n";
+      OS << Indent << "if (!Check(S, " << Op.Decoder
+         << "(MI, insn, Address, Decoder))) { "
+         << (HasCompleteDecoder ? "" : "DecodeComplete = false; ")
+         << "return MCDisassembler::Fail; }\n";
       break;
     }
 
@@ -1242,8 +1240,7 @@ unsigned FilterChooser::getDecoderIndex(DecoderSet &Decoders, unsigned Opc,
   // FIXME: emitDecoder() function can take a buffer directly rather than
   // a stream.
   raw_svector_ostream S(Decoder);
-  unsigned I = 4;
-  emitDecoder(S, I, Opc, HasCompleteDecoder);
+  emitDecoder(S, indent(4), Opc, HasCompleteDecoder);
 
   // Using the full decoder string as the key value here is a bit
   // heavyweight, but is effective. If the string comparisons become a
@@ -2624,7 +2621,7 @@ namespace llvm {
     TableInfo.Table.push_back(MCD::OPC_Fail);
 
     // Print the table to the output stream.
-    emitTable(OS, TableInfo.Table, 0, FC.getBitWidth(), Opc.first.first,
+    emitTable(OS, TableInfo.Table, indent(0), FC.getBitWidth(), Opc.first.first,
               Opc.second);
   }
 
@@ -2634,10 +2631,10 @@ namespace llvm {
   if (IsVarLenInst)
     emitInstrLenTable(OS, InstrLen);
   // Emit the predicate function.
-  emitPredicateFunction(OS, TableInfo.Predicates, 0);
+  emitPredicateFunction(OS, TableInfo.Predicates, indent(0));
 
   // Emit the decoder function.
-  emitDecoderFunction(OS, TableInfo.Decoders, 0);
+  emitDecoderFunction(OS, TableInfo.Decoders, indent(0));
 
   // Emit the main entry point for the decoder, decodeInstruction().
   emitDecodeInstruction(OS, IsVarLenInst);



More information about the llvm-commits mailing list