1 //===-- llvm/Assembly/CachedWriter.h - Printer Accellerator -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines a 'CachedWriter' class that is used to accelerate printing
11 // chunks of LLVM. This is used when a module is not being changed, but random
12 // parts of it need to be printed. This can greatly speed up printing of LLVM
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_ASSEMBLY_CACHEDWRITER_H
18 #define LLVM_ASSEMBLY_CACHEDWRITER_H
20 #include "llvm/Value.h"
27 class AssemblyWriter; // Internal private class
42 CachedWriter(std::ostream &O = std::cout)
43 : AW(0), SC(0), SymbolicTypes(false), Out(O) { }
44 CachedWriter(const Module *M, std::ostream &O = std::cout)
45 : AW(0), SC(0), SymbolicTypes(false), Out(O) {
50 // setModule - Invalidate internal state, use the new module instead.
51 void setModule(const Module *M);
53 CachedWriter &operator<<(const Value &V);
55 CachedWriter &operator<<(const Type &X);
57 inline CachedWriter &operator<<(std::ostream &(&Manip)(std::ostream &)) {
58 Out << Manip; return *this;
61 inline CachedWriter& operator<<(const char *X) {
66 inline CachedWriter &operator<<(enum TypeWriter tw) {
67 SymbolicTypes = (tw == SymTypeOn);
72 } // End llvm namespace