aboutsummaryrefslogtreecommitdiff
path: root/llvm/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
commit716b184108e2a1f045b8e708ac767793c3502549 (patch)
tree6c4e0f8e1311e2cddc782ad1e939fe7bd7d59654 /llvm/lib/CodeGen/RenderMachineFunction.h
parent56129bd62f91e231b35c2db6416cf228fadc2988 (diff)
downloadllvm-716b184108e2a1f045b8e708ac767793c3502549.zip
llvm-716b184108e2a1f045b8e708ac767793c3502549.tar.gz
llvm-716b184108e2a1f045b8e708ac767793c3502549.tar.bz2
Added support for turning HTML indentation on and off (indentation off by default).
Reduces output file size ~20% on my test cases. llvm-svn: 108822
Diffstat (limited to 'llvm/lib/CodeGen/RenderMachineFunction.h')
-rw-r--r--llvm/lib/CodeGen/RenderMachineFunction.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/RenderMachineFunction.h b/llvm/lib/CodeGen/RenderMachineFunction.h
index 743938d..1e604da 100644
--- a/llvm/lib/CodeGen/RenderMachineFunction.h
+++ b/llvm/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.