mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-22 10:33:23 +00:00
Remove the dead CachedWriter class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32271 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e53883837d
commit
82c4bc7153
@ -1,74 +0,0 @@
|
||||
//===-- llvm/Assembly/CachedWriter.h - Printer Accellerator -----*- 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 defines a 'CachedWriter' 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_CACHEDWRITER_H
|
||||
#define LLVM_ASSEMBLY_CACHEDWRITER_H
|
||||
|
||||
#include "llvm/Value.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Module;
|
||||
class PointerType;
|
||||
class AssemblyWriter; // Internal private class
|
||||
class SlotMachine;
|
||||
|
||||
class CachedWriter {
|
||||
AssemblyWriter *AW;
|
||||
SlotMachine *SC;
|
||||
bool SymbolicTypes;
|
||||
std::ostream &Out;
|
||||
|
||||
public:
|
||||
enum TypeWriter {
|
||||
SymTypeOn,
|
||||
SymTypeOff
|
||||
};
|
||||
|
||||
CachedWriter(std::ostream &O = std::cout)
|
||||
: AW(0), SC(0), SymbolicTypes(false), Out(O) { }
|
||||
CachedWriter(const Module *M, std::ostream &O = std::cout)
|
||||
: AW(0), SC(0), SymbolicTypes(false), Out(O) {
|
||||
setModule(M);
|
||||
}
|
||||
~CachedWriter();
|
||||
|
||||
// setModule - Invalidate internal state, use the new module instead.
|
||||
void setModule(const Module *M);
|
||||
|
||||
CachedWriter &operator<<(const Value &V);
|
||||
|
||||
CachedWriter &operator<<(const Type &X);
|
||||
|
||||
inline CachedWriter &operator<<(std::ostream &(&Manip)(std::ostream &)) {
|
||||
Out << Manip; return *this;
|
||||
}
|
||||
|
||||
inline CachedWriter& operator<<(const char *X) {
|
||||
Out << X;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline CachedWriter &operator<<(enum TypeWriter tw) {
|
||||
SymbolicTypes = (tw == SymTypeOn);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
@ -14,7 +14,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Assembly/CachedWriter.h"
|
||||
#include "llvm/Assembly/Writer.h"
|
||||
#include "llvm/Assembly/PrintModulePass.h"
|
||||
#include "llvm/Assembly/AsmAnnotationWriter.h"
|
||||
@ -32,6 +31,7 @@
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
@ -322,10 +322,10 @@ static void calcTypeName(const Type *Ty,
|
||||
break;
|
||||
default:
|
||||
Result += "<unrecognized-type>";
|
||||
break;
|
||||
}
|
||||
|
||||
TypeStack.pop_back(); // Remove self from stack...
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -364,16 +364,14 @@ std::ostream &llvm::WriteTypeSymbolic(std::ostream &Out, const Type *Ty,
|
||||
const Module *M) {
|
||||
Out << ' ';
|
||||
|
||||
// If they want us to print out a type, attempt to make it symbolic if there
|
||||
// is a symbol table in the module...
|
||||
if (M) {
|
||||
std::map<const Type *, std::string> TypeNames;
|
||||
fillTypeNameTable(M, TypeNames);
|
||||
|
||||
return printTypeInt(Out, Ty, TypeNames);
|
||||
} else {
|
||||
// If they want us to print out a type, but there is no context, we can't
|
||||
// print it symbolically.
|
||||
if (!M)
|
||||
return Out << Ty->getDescription();
|
||||
}
|
||||
|
||||
std::map<const Type *, std::string> TypeNames;
|
||||
fillTypeNameTable(M, TypeNames);
|
||||
return printTypeInt(Out, Ty, TypeNames);
|
||||
}
|
||||
|
||||
// PrintEscapedString - Print each character of the specified string, escaping
|
||||
@ -391,7 +389,7 @@ static void PrintEscapedString(const std::string &Str, std::ostream &Out) {
|
||||
}
|
||||
}
|
||||
|
||||
static const char * getPredicateText(unsigned predicate) {
|
||||
static const char *getPredicateText(unsigned predicate) {
|
||||
const char * pred = "unknown";
|
||||
switch (predicate) {
|
||||
case FCmpInst::FCMP_FALSE: pred = "false"; break;
|
||||
@ -1337,51 +1335,7 @@ void Value::dump() const { print(std::cerr); llvm_cerr << '\n'; }
|
||||
void Type::dump() const { print(std::cerr); llvm_cerr << '\n'; }
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// CachedWriter Class Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void CachedWriter::setModule(const Module *M) {
|
||||
delete SC; delete AW;
|
||||
if (M) {
|
||||
SC = new SlotMachine(M);
|
||||
AW = new AssemblyWriter(Out, *SC, M, 0);
|
||||
} else {
|
||||
SC = 0; AW = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CachedWriter::~CachedWriter() {
|
||||
delete AW;
|
||||
delete SC;
|
||||
}
|
||||
|
||||
CachedWriter &CachedWriter::operator<<(const Value &V) {
|
||||
assert(AW && SC && "CachedWriter does not have a current module!");
|
||||
if (const Instruction *I = dyn_cast<Instruction>(&V))
|
||||
AW->write(I);
|
||||
else if (const BasicBlock *BB = dyn_cast<BasicBlock>(&V))
|
||||
AW->write(BB);
|
||||
else if (const Function *F = dyn_cast<Function>(&V))
|
||||
AW->write(F);
|
||||
else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(&V))
|
||||
AW->write(GV);
|
||||
else
|
||||
AW->writeOperand(&V, true);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CachedWriter& CachedWriter::operator<<(const Type &Ty) {
|
||||
if (SymbolicTypes) {
|
||||
const Module *M = AW->getModule();
|
||||
if (M) WriteTypeSymbolic(Out, &Ty, M);
|
||||
} else {
|
||||
AW->write(&Ty);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//===-- SlotMachine Implementation
|
||||
// SlotMachine Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user