summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RenderMachineFunction.h
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2010-07-20 09:13:29 +0000
committerLang Hames <lhames@gmail.com>2010-07-20 09:13:29 +0000
commit245581b1aca7c4af512772fcef4bde5fb1ad7e84 (patch)
tree810643925ea0a49383991c78120749e783aa69c1 /lib/CodeGen/RenderMachineFunction.h
parent6651b3f45f8985df38ded0396c58022ada4b0297 (diff)
downloadllvm-245581b1aca7c4af512772fcef4bde5fb1ad7e84.tar.gz
llvm-245581b1aca7c4af512772fcef4bde5fb1ad7e84.tar.bz2
llvm-245581b1aca7c4af512772fcef4bde5fb1ad7e84.tar.xz
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
Diffstat (limited to 'lib/CodeGen/RenderMachineFunction.h')
-rw-r--r--lib/CodeGen/RenderMachineFunction.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/CodeGen/RenderMachineFunction.h b/lib/CodeGen/RenderMachineFunction.h
index 743938d9ed..1e604da138 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 <typename OStream> void print(OStream &os) const;
+ private:
+ unsigned ns;
+ };
+
+ Spacer s(unsigned ns) const;
+
template <typename Iterator>
std::string escapeChars(Iterator sBegin, Iterator sEnd) const;
@@ -253,38 +265,38 @@ namespace llvm {
/// \brief Render vertical text.
template <typename OStream, typename T>
- void renderVertical(const std::string &indent,
+ void renderVertical(const Spacer &indent,
OStream &os,
const T &t) const;
/// \brief Insert CSS layout info.
template <typename OStream>
- 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 <typename OStream>
- 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 <typename OStream>
- 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 <typename OStream>
- 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 <typename OStream>
- void renderWarnings(const std::string &indent,
+ void renderWarnings(const Spacer &indent,
OStream &os) const;
/// \brief Render the HTML page representing the MachineFunction.