New class to provide high performance writing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1167 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-11-07 04:20:50 +00:00
parent 6a6791b326
commit 495d6f1933

View File

@ -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