summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2009-07-09 18:27:23 +0000
committerDavid Greene <greened@obbligato.org>2009-07-09 18:27:23 +0000
commit67cde99e90d6e734dbd24d751fee4e3c2875b737 (patch)
treea0015c9d8d4f45703814b5a020677a0521ac688c /llvm/lib/CodeGen
parentf3b8609c6f9806a58a5fe0a13344951547d2272e (diff)
downloadbcm5719-llvm-67cde99e90d6e734dbd24d751fee4e3c2875b737.tar.gz
bcm5719-llvm-67cde99e90d6e734dbd24d751fee4e3c2875b737.zip
Add some classes to produce pretty-printed asm. We'll use these
shortly to provide nicely printed comments and other goodies in asm files. llvm-svn: 75156
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmStream.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmStream.cpp b/llvm/lib/CodeGen/AsmStream.cpp
new file mode 100644
index 00000000000..8a9ded7ee5d
--- /dev/null
+++ b/llvm/lib/CodeGen/AsmStream.cpp
@@ -0,0 +1,47 @@
+//===-- llvm/CodeGen/AsmStream.cpp - AsmStream Framework --------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains instantiations of "standard" AsmOStreams.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/CodeGen/AsmStream.h"
+
+#include <unistd.h>
+
+namespace llvm {
+ AsmStreambuf asmoutbuf(STDOUT_FILENO);
+ AsmStreambuf asmerrbuf(STDERR_FILENO);
+
+ //===----------------------------------------------------------------------===//
+ // raw_asm_ostream
+ //===----------------------------------------------------------------------===//
+
+ raw_asm_ostream::~raw_asm_ostream() {
+ flush();
+ }
+
+ /// flush_impl - The is the piece of the class that is implemented by
+ /// subclasses. This outputs the currently buffered data and resets the
+ /// buffer to empty.
+ void raw_asm_ostream::flush_impl() {
+ if (OutBufCur-OutBufStart)
+ OS.write(OutBufStart, OutBufCur-OutBufStart);
+
+ HandleFlush();
+ }
+
+ namespace {
+ AsmOStream AsmOut(&asmoutbuf);
+ AsmOStream AsmErr(&asmerrbuf);
+ }
+
+ raw_asm_ostream asmout(AsmOut);
+ raw_asm_ostream asmerr(AsmErr);
+}
OpenPOWER on IntegriCloud