From 7cb3b78ef523efcdc1ef8413b2d936cadf718068 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 22 Jan 2010 07:29:22 +0000 Subject: Add the ability for MCStreamer to emit comments on the same line as directives. Switch over the asm-verbose comment for double values to use it. We now get: _x: .long 343597384 ## double 1.231200e+02 .long 1079953326 For example, note that the comment is on the same line as the .long. Woo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94166 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCStreamer.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'include/llvm/MC/MCStreamer.h') diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index 1afa6dc..6afe1bf 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -26,7 +26,9 @@ namespace llvm { class MCSection; class MCSymbol; class StringRef; + class Twine; class raw_ostream; + class formatted_raw_ostream; /// MCStreamer - Streaming machine code generation interface. This interface /// is intended to provide a programatic interface that is very similar to the @@ -79,6 +81,15 @@ namespace llvm { MCContext &getContext() const { return Context; } + /// addComment - Add a comment that can be emitted to the generated .s + /// file if applicable as a QoI issue to make the output of the compiler + /// more readable. This only affects the MCAsmStreamer, and only when + /// verbose assembly output is enabled. + /// + /// If the comment includes embedded \n's, they will each get the comment + /// prefix as appropriate. The added comment should not end with a \n. + virtual void addComment(const Twine &T) {} + /// @name Symbol & Section Management /// @{ @@ -234,7 +245,7 @@ namespace llvm { /// createAsmStreamer - Create a machine code streamer which will print out /// assembly for the native target, suitable for compiling with a native /// assembler. - MCStreamer *createAsmStreamer(MCContext &Ctx, raw_ostream &OS, + MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS, const MCAsmInfo &MAI, bool isLittleEndian, bool isVerboseAsm, MCInstPrinter *InstPrint = 0, -- cgit v1.1