[llvm-commits] [llvm] r109003 - in /llvm/trunk/lib/CodeGen: RenderMachineFunction.cpp RenderMachineFunction.h

Lang Hames lhames at gmail.com
Wed Jul 21 02:02:06 PDT 2010


Author: lhames
Date: Wed Jul 21 04:02:06 2010
New Revision: 109003

URL: http://llvm.org/viewvc/llvm-project?rev=109003&view=rev
Log:
Changed OStream templates to functions on raw_ostream, removed the unused "renderWarnings" function.

Modified:
    llvm/trunk/lib/CodeGen/RenderMachineFunction.cpp
    llvm/trunk/lib/CodeGen/RenderMachineFunction.h

Modified: llvm/trunk/lib/CodeGen/RenderMachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RenderMachineFunction.cpp?rev=109003&r1=109002&r2=109003&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RenderMachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/RenderMachineFunction.cpp Wed Jul 21 04:02:06 2010
@@ -499,8 +499,7 @@
 
   // ---------- MachineFunctionRenderer implementation ----------
 
-  template <typename OStream>
-  void RenderMachineFunction::Spacer::print(OStream &os) const {
+  void RenderMachineFunction::Spacer::print(raw_ostream &os) const {
     if (!prettyHTML)
       return;
     for (unsigned i = 0; i < ns; ++i) {
@@ -512,8 +511,7 @@
     return Spacer(ns);
   }
 
-  template <typename OStream>
-  OStream& operator<<(OStream &os, const RenderMachineFunction::Spacer &s) {
+  raw_ostream& operator<<(raw_ostream &os, const RenderMachineFunction::Spacer &s) {
     s.print(os);
     return os;
   }
@@ -583,8 +581,7 @@
   }
 
   /// \brief Render a machine instruction.
-  template <typename OStream>
-  void RenderMachineFunction::renderMachineInstr(OStream &os,
+  void RenderMachineFunction::renderMachineInstr(raw_ostream &os,
                                                  const MachineInstr *mi) const {
     std::string s;
     raw_string_ostream oss(s);
@@ -593,9 +590,9 @@
     os << escapeChars(oss.str());
   }
 
-  template <typename OStream, typename T>
+  template <typename T>
   void RenderMachineFunction::renderVertical(const Spacer &indent,
-                                             OStream &os,
+                                             raw_ostream &os,
                                              const T &t) const {
     if (ro.fancyVerticals()) {
       os << indent << "<object\n"
@@ -626,9 +623,8 @@
     }
   }
 
-  template <typename OStream>
   void RenderMachineFunction::insertCSS(const Spacer &indent,
-                                        OStream &os) const {
+                                        raw_ostream &os) const {
     os << indent << "<style type=\"text/css\">\n"
        << indent + s(2) << "body { font-color: black; }\n"
        << indent + s(2) << "table.code td { font-family: monospace; "
@@ -647,9 +643,8 @@
        << indent << "</style>\n";
   }
 
-  template <typename OStream>
   void RenderMachineFunction::renderFunctionSummary(
-                                    const Spacer &indent, OStream &os,
+                                    const Spacer &indent, raw_ostream &os,
                                     const char * const renderContextStr) const {
     os << indent << "<h1>Function: " << mf->getFunction()->getName()
                  << "</h1>\n"
@@ -657,10 +652,9 @@
   }
 
 
-  template <typename OStream>
   void RenderMachineFunction::renderPressureTableLegend(
                                                       const Spacer &indent,
-                                                      OStream &os) const {
+                                                      raw_ostream &os) const {
     os << indent << "<h2>Rendering Pressure Legend:</h2>\n"
        << indent << "<table class=\"code\">\n"
        << indent + s(2) << "<tr>\n"
@@ -685,9 +679,9 @@
        << indent << "</table>\n";
   }
 
-  template <typename OStream, typename CellType>
+  template <typename CellType>
   void RenderMachineFunction::renderCellsWithRLE(
-                   const Spacer &indent, OStream &os,
+                   const Spacer &indent, raw_ostream &os,
                    const std::pair<CellType, unsigned> &rleAccumulator,
                    const std::map<CellType, std::string> &cellTypeStrs) const {
 
@@ -706,9 +700,8 @@
   }
 
 
-  template <typename OStream>
   void RenderMachineFunction::renderCodeTablePlusPI(const Spacer &indent,
-                                                    OStream &os) const {
+                                                    raw_ostream &os) const {
 
     std::map<LiveState, std::string> lsStrs;
     lsStrs[Dead] = "l-n";
@@ -854,14 +847,8 @@
       renderPressureTableLegend(indent, os);
   }
 
-  template <typename OStream>
-  void RenderMachineFunction::renderWarnings(const Spacer &indent,
-                                             OStream &os) const {
-  }
-
-  template <typename OStream>
   void RenderMachineFunction::renderFunctionPage(
-                                    OStream &os,
+                                    raw_ostream &os,
                                     const char * const renderContextStr) const {
     os << "<html>\n"
        << s(2) << "<head>\n"

Modified: llvm/trunk/lib/CodeGen/RenderMachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RenderMachineFunction.h?rev=109003&r1=109002&r2=109003&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RenderMachineFunction.h (original)
+++ llvm/trunk/lib/CodeGen/RenderMachineFunction.h Wed Jul 21 04:02:06 2010
@@ -31,6 +31,7 @@
   class TargetRegisterClass;
   class TargetRegisterInfo;
   class VirtRegMap;
+  class raw_ostream;
 
   /// \brief Provide extra information about the physical and virtual registers
   ///        in the function being compiled.
@@ -225,8 +226,7 @@
   private:
     class Spacer;
 
-    template <typename OStream>
-    friend OStream& operator<<(OStream &os, const Spacer &s);
+    friend raw_ostream& operator<<(raw_ostream &os, const Spacer &s);
 
 
     std::string fqn;
@@ -256,7 +256,7 @@
     public:
       explicit Spacer(unsigned numSpaces) : ns(numSpaces) {}
       Spacer operator+(const Spacer &o) const { return Spacer(ns + o.ns); }
-      template <typename OStream> void print(OStream &os) const;
+      void print(raw_ostream &os) const;
     private:
       unsigned ns;
     };
@@ -267,57 +267,44 @@
     std::string escapeChars(Iterator sBegin, Iterator sEnd) const;
 
     /// \brief Render a machine instruction.
-    template <typename OStream>
-    void renderMachineInstr(OStream &os,
+    void renderMachineInstr(raw_ostream &os,
                             const MachineInstr *mi) const;
 
     /// \brief Render vertical text.
-    template <typename OStream, typename T>
+    template <typename T>
     void renderVertical(const Spacer &indent,
-                        OStream &os,
+                        raw_ostream &os,
                         const T &t) const;
 
     /// \brief Insert CSS layout info.
-    template <typename OStream>
     void insertCSS(const Spacer &indent,
-                   OStream &os) const;
+                   raw_ostream &os) const;
 
     /// \brief Render a brief summary of the function (including rendering
     ///        context).
-    template <typename OStream>
     void renderFunctionSummary(const Spacer &indent,
-                               OStream &os,
+                               raw_ostream &os,
                                const char * const renderContextStr) const;
 
     /// \brief Render a legend for the pressure table.
-    template <typename OStream>
     void renderPressureTableLegend(const Spacer &indent,
-                                   OStream &os) const;
+                                   raw_ostream &os) const;
 
     /// \brief Render a consecutive set of HTML cells of the same class using
     /// the colspan attribute for run-length encoding.
-    template <typename OStream, typename CellType>
+    template <typename CellType>
     void renderCellsWithRLE(
-                     const Spacer &indent, OStream &os,
+                     const Spacer &indent, raw_ostream &os,
                      const std::pair<CellType, unsigned> &rleAccumulator,
                      const std::map<CellType, std::string> &cellTypeStrs) const;
 
     /// \brief Render code listing, potentially with register pressure
     ///        and live intervals shown alongside.
-    template <typename OStream>
     void renderCodeTablePlusPI(const Spacer &indent,
-                               OStream &os) const;
-
-    /// \brief Render warnings about the machine function, or weird rendering
-    ///        parameter combinations (e.g. rendering specified live intervals
-    ///        over more than one machine function).
-    template <typename OStream>
-    void renderWarnings(const Spacer &indent,
-                        OStream &os) const;
+                               raw_ostream &os) const;
 
     /// \brief Render the HTML page representing the MachineFunction.
-    template <typename OStream>
-    void renderFunctionPage(OStream &os,
+    void renderFunctionPage(raw_ostream &os,
                             const char * const renderContextStr) const;
 
     std::string escapeChars(const std::string &s) const;





More information about the llvm-commits mailing list