]> granicus.if.org Git - llvm/commitdiff
Revert "[TableGen] Replace InfoByHwMode::getAsString with writeToStream"
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 22 Sep 2017 16:18:35 +0000 (16:18 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 22 Sep 2017 16:18:35 +0000 (16:18 +0000)
This reverts commit r313989: it breaks Windows bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313990 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CodeGenDAGPatterns.cpp
utils/TableGen/CodeGenDAGPatterns.h
utils/TableGen/CodeGenRegisters.cpp
utils/TableGen/InfoByHwMode.cpp
utils/TableGen/InfoByHwMode.h

index 393076aa06a1901ca7b01151ddeb41f7e5f52b02..d4c81c327abbda2983518d3c722f2c6a5c17619e 100644 (file)
@@ -238,14 +238,10 @@ bool TypeSetByHwMode::operator==(const TypeSetByHwMode &VTS) const {
   return true;
 }
 
-raw_ostream &operator<<(raw_ostream &OS, const TypeSetByHwMode &T) {
-  T.writeToStream(OS);
-  return OS;
-}
-
 LLVM_DUMP_METHOD
 void TypeSetByHwMode::dump() const {
-  dbgs() << *this << '\n';
+  writeToStream(dbgs());
+  dbgs() << '\n';
 }
 
 bool TypeSetByHwMode::intersect(SetType &Out, const SetType &In) {
index f75e49a38218787e1747f9cd4b7fef368eb98b6e..37bfe022b4d13d27da745ca7dac9c44ddca54578 100644 (file)
@@ -240,8 +240,6 @@ private:
   bool intersect(SetType &Out, const SetType &In);
 };
 
-raw_ostream &operator<<(raw_ostream &OS, const TypeSetByHwMode &T);
-
 struct TypeInfer {
   TypeInfer(TreePattern &T) : TP(T), ForceMode(0) {}
 
index a6b0a4beb8eac467bacaa98af9b4a545f206f707..f3b01eb5a946e6a17fa0d86db04c76297584e75d 100644 (file)
@@ -836,7 +836,7 @@ bool CodeGenRegisterClass::contains(const CodeGenRegister *Reg) const {
 namespace llvm {
 
   raw_ostream &operator<<(raw_ostream &OS, const CodeGenRegisterClass::Key &K) {
-    OS << "{ " << K.RSI;
+    OS << "{ " << K.RSI.getAsString();
     for (const auto R : *K.Members)
       OS << ", " << R->getName();
     return OS << " }";
index d4de490feeb23ab2b9c7410fbe54e54b1cedb343..aee0dd6fa6a275d145c56511c5903dbd392aeddc 100644 (file)
@@ -76,31 +76,34 @@ StringRef ValueTypeByHwMode::getMVTName(MVT T) {
   return N;
 }
 
-void ValueTypeByHwMode::writeToStream(raw_ostream &OS) const {
-  if (isSimple()) {
-    OS << getMVTName(getSimple());
-    return;
-  }
+std::string ValueTypeByHwMode::getAsString() const {
+  if (isSimple())
+    return getMVTName(getSimple());
 
   std::vector<const PairType*> Pairs;
   for (const auto &P : Map)
     Pairs.push_back(&P);
   std::sort(Pairs.begin(), Pairs.end(), deref<std::less<PairType>>());
 
-  OS << '{';
+  std::stringstream str;
+  str << '{';
   for (unsigned i = 0, e = Pairs.size(); i != e; ++i) {
     const PairType *P = Pairs[i];
-    OS << '(' << getModeName(P->first)
-       << ':' << getMVTName(P->second).str() << ')';
+    str << '(' << getModeName(P->first)
+        << ':' << getMVTName(P->second).str() << ')';
     if (i != e-1)
-      OS << ',';
+      str << ',';
   }
-  OS << '}';
+  str << '}';
+  return str.str();
 }
 
 LLVM_DUMP_METHOD
 void ValueTypeByHwMode::dump() const {
-  dbgs() << *this << '\n';
+  dbgs() << "size=" << Map.size() << '\n';
+  for (const auto &P : Map)
+    dbgs() << "  " << P.first << " -> "
+           << llvm::getEnumName(P.second.SimpleTy) << '\n';
 }
 
 ValueTypeByHwMode llvm::getValueTypeByHwMode(Record *Rec,
@@ -133,9 +136,11 @@ bool RegSizeInfo::isSubClassOf(const RegSizeInfo &I) const {
          SpillSize <= I.SpillSize;
 }
 
-void RegSizeInfo::writeToStream(raw_ostream &OS) const {
-  OS << "[R=" << RegSize << ",S=" << SpillSize
-     << ",A=" << SpillAlignment << ']';
+std::string RegSizeInfo::getAsString() const {
+  std::stringstream str;
+  str << "[R=" << RegSize << ",S=" << SpillSize
+      << ",A=" << SpillAlignment << ']';
+  return str.str();
 }
 
 RegSizeInfoByHwMode::RegSizeInfoByHwMode(Record *R,
@@ -172,35 +177,22 @@ bool RegSizeInfoByHwMode::hasStricterSpillThan(const RegSizeInfoByHwMode &I)
          std::tie(B0.SpillSize, B0.SpillAlignment);
 }
 
-void RegSizeInfoByHwMode::writeToStream(raw_ostream &OS) const {
+std::string RegSizeInfoByHwMode::getAsString() const {
   typedef typename decltype(Map)::value_type PairType;
   std::vector<const PairType*> Pairs;
   for (const auto &P : Map)
     Pairs.push_back(&P);
   std::sort(Pairs.begin(), Pairs.end(), deref<std::less<PairType>>());
 
-  OS << '{';
+  std::stringstream str;
+  str << '{';
   for (unsigned i = 0, e = Pairs.size(); i != e; ++i) {
     const PairType *P = Pairs[i];
-    OS << '(' << getModeName(P->first) << ':' << P->second << ')';
+    str << '(' << getModeName(P->first)
+        << ':' << P->second.getAsString() << ')';
     if (i != e-1)
-      OS << ',';
+      str << ',';
   }
-  OS << '}';
+  str << '}';
+  return str.str();
 }
-
-raw_ostream &operator<<(raw_ostream &OS, const ValueTypeByHwMode &T) {
-  T.writeToStream(OS);
-  return OS;
-}
-
-raw_ostream &operator<<(raw_ostream &OS, const RegSizeInfo &T) {
-  T.writeToStream(OS);
-  return OS;
-}
-
-raw_ostream &operator<<(raw_ostream &OS, const RegSizeInfoByHwMode &T) {
-  T.writeToStream(OS);
-  return OS;
-}
-
index b2e217498888aa57c6655e4f2be76f70379eed0e..57640fc3025bff0a5afdcf6e159e7fe9156b5996 100644 (file)
@@ -27,7 +27,6 @@ namespace llvm {
 
 struct CodeGenHwModes;
 class Record;
-class raw_ostream;
 
 template <typename InfoT> struct InfoByHwMode;
 
@@ -131,7 +130,7 @@ struct ValueTypeByHwMode : public InfoByHwMode<MVT> {
   MVT &getOrCreateTypeForMode(unsigned Mode, MVT Type);
 
   static StringRef getMVTName(MVT T);
-  void writeToStream(raw_ostream &OS) const;
+  std::string getAsString() const;
   void dump() const;
 };
 
@@ -155,7 +154,7 @@ struct RegSizeInfo {
   }
 
   bool isSubClassOf(const RegSizeInfo &I) const;
-  void writeToStream(raw_ostream &OS) const;
+  std::string getAsString() const;
 };
 
 struct RegSizeInfoByHwMode : public InfoByHwMode<RegSizeInfo> {
@@ -170,13 +169,8 @@ struct RegSizeInfoByHwMode : public InfoByHwMode<RegSizeInfo> {
   bool isSubClassOf(const RegSizeInfoByHwMode &I) const;
   bool hasStricterSpillThan(const RegSizeInfoByHwMode &I) const;
 
-  void writeToStream(raw_ostream &OS) const;
+  std::string getAsString() const;
 };
-
-raw_ostream &operator<<(raw_ostream &OS, const ValueTypeByHwMode &T);
-raw_ostream &operator<<(raw_ostream &OS, const RegSizeInfo &T);
-raw_ostream &operator<<(raw_ostream &OS, const RegSizeInfoByHwMode &T);
-
 } // namespace llvm
 
 #endif // LLVM_UTILS_TABLEGEN_INFOBYHWMODE_H