1 //===-- llvm/Assembly/CachedWriter.h - Printer Accellerator ------*- C++ -*--=//
3 // This file defines a 'CacheWriter' class that is used to accelerate printing
4 // chunks of LLVM. This is used when a module is not being changed, but random
5 // parts of it need to be printed. This can greatly speed up printing of LLVM
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_ASSEMBLY_CACHED_WRITER_H
11 #define LLVM_ASSEMBLY_CACHED_WRITER_H
13 #include "llvm/Assembly/Writer.h"
15 class AssemblyWriter; // Internal private class
24 CachedWriter(ostream &O = cout) : AW(0), SC(0), Out(O) { }
25 CachedWriter(const Module *M, ostream &O = cout) : AW(0), SC(0), Out(O) {
30 // setModule - Invalidate internal state, use the new module instead.
31 void setModule(const Module *M);
33 CachedWriter &operator<<(const Value *V);
35 inline CachedWriter &operator<<(Value *X) {
36 return *this << (const Value*)X;
38 inline CachedWriter &operator<<(const Module *X) {
39 return *this << (const Value*)X;
41 inline CachedWriter &operator<<(const GlobalVariable *X) {
42 return *this << (const Value*)X;
44 inline CachedWriter &operator<<(const Method *X) {
45 return *this << (const Value*)X;
47 inline CachedWriter &operator<<(const MethodArgument *X) {
48 return *this << (const Value*)X;
50 inline CachedWriter &operator<<(const BasicBlock *X) {
51 return *this << (const Value*)X;
53 inline CachedWriter &operator<<(const Instruction *X) {
54 return *this << (const Value*)X;
56 inline CachedWriter &operator<<(const ConstPoolVal *X) {
57 return *this << (const Value*)X;
59 inline CachedWriter &operator<<(const Type *X) {
60 return *this << (const Value*)X;
62 inline CachedWriter &operator<<(const PointerType *X) {
63 return *this << (const Value*)X;
68 inline CachedWriter &operator<<(CachedWriter &CW, const X &v) {