diff options
author | Chris Lattner <sabre@nondot.org> | 2001-11-07 04:20:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-11-07 04:20:50 +0000 |
commit | 0758abd126c69fa2a4c8c13b5392d4d7c79f850e (patch) | |
tree | f7ec9c3e63f9b5bda26670ab2047d60180feb1b3 | |
parent | 51862ef7778e629900f3d1677711ae5c9cc1d2d8 (diff) | |
download | bcm5719-llvm-0758abd126c69fa2a4c8c13b5392d4d7c79f850e.tar.gz bcm5719-llvm-0758abd126c69fa2a4c8c13b5392d4d7c79f850e.zip |
New class to provide high performance writing.
llvm-svn: 1167
-rw-r--r-- | llvm/include/llvm/Assembly/CachedWriter.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/llvm/include/llvm/Assembly/CachedWriter.h b/llvm/include/llvm/Assembly/CachedWriter.h new file mode 100644 index 00000000000..ab6756abcb0 --- /dev/null +++ b/llvm/include/llvm/Assembly/CachedWriter.h @@ -0,0 +1,41 @@ +//===-- llvm/Assembly/CachedWriter.h - Printer Accellerator ------*- C++ -*--=// +// +// This file defines a 'CacheWriter' class that is used to accelerate printing +// chunks of LLVM. This is used when a module is not being changed, but random +// parts of it need to be printed. This can greatly speed up printing of LLVM +// output. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ASSEMBLY_CACHED_WRITER_H +#define LLVM_ASSEMBLY_CACHED_WRITER_H + +#include "llvm/Assembly/Writer.h" + +class AssemblyWriter; // Internal private class +class SlotCalculator; + +class CachedWriter { + AssemblyWriter *AW; + SlotCalculator *SC; + ostream &Out; +public: + CachedWriter(ostream &O = cout) : AW(0), SC(0), Out(O) { } + CachedWriter(const Module *M, ostream &O = cout) : AW(0), SC(0), Out(O) { + setModule(M); + } + ~CachedWriter(); + + // setModule - Invalidate internal state, use the new module instead. + void setModule(const Module *M); + + CachedWriter &operator<<(const Value *V); + + template<class X> + inline CachedWriter &operator<<(X &v) { + Out << v; + return *this; + } +}; + +#endif |