From 5ec4614a0b90235bbd7588602507dfae0bff53e0 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 20 Jul 2010 09:13:29 +0000 Subject: Added support for turning HTML indentation on and off (indentation off by default). Reduces output file size ~20% on my test cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108822 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RenderMachineFunction.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'lib/CodeGen/RenderMachineFunction.h') diff --git a/lib/CodeGen/RenderMachineFunction.h b/lib/CodeGen/RenderMachineFunction.h index 743938d..1e604da 100644 --- a/lib/CodeGen/RenderMachineFunction.h +++ b/lib/CodeGen/RenderMachineFunction.h @@ -243,6 +243,18 @@ namespace llvm { // ---------- Rendering methods ---------- + /// For inserting spaces when pretty printing. + class Spacer { + public: + explicit Spacer(unsigned numSpaces) : ns(numSpaces) {} + Spacer operator+(const Spacer &o) const { return Spacer(ns + o.ns); } + template void print(OStream &os) const; + private: + unsigned ns; + }; + + Spacer s(unsigned ns) const; + template std::string escapeChars(Iterator sBegin, Iterator sEnd) const; @@ -253,38 +265,38 @@ namespace llvm { /// \brief Render vertical text. template - void renderVertical(const std::string &indent, + void renderVertical(const Spacer &indent, OStream &os, const T &t) const; /// \brief Insert CSS layout info. template - void insertCSS(const std::string &indent, + void insertCSS(const Spacer &indent, OStream &os) const; /// \brief Render a brief summary of the function (including rendering /// context). template - void renderFunctionSummary(const std::string &indent, + void renderFunctionSummary(const Spacer &indent, OStream &os, const char * const renderContextStr) const; /// \brief Render a legend for the pressure table. template - void renderPressureTableLegend(const std::string &indent, + void renderPressureTableLegend(const Spacer &indent, OStream &os) const; /// \brief Render code listing, potentially with register pressure /// and live intervals shown alongside. template - void renderCodeTablePlusPI(const std::string &indent, + 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 - void renderWarnings(const std::string &indent, + void renderWarnings(const Spacer &indent, OStream &os) const; /// \brief Render the HTML page representing the MachineFunction. -- cgit v1.1