[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp
Chris Lattner
sabre at nondot.org
Tue Dec 5 22:41:05 PST 2006
Changes in directory llvm/lib/VMCore:
AsmWriter.cpp updated: 1.225 -> 1.226
---
Log message:
Remove the dead CachedWriter class.
---
Diffs of the changes: (+11 -57)
AsmWriter.cpp | 68 +++++++++-------------------------------------------------
1 files changed, 11 insertions(+), 57 deletions(-)
Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.225 llvm/lib/VMCore/AsmWriter.cpp:1.226
--- llvm/lib/VMCore/AsmWriter.cpp:1.225 Wed Dec 6 00:24:27 2006
+++ llvm/lib/VMCore/AsmWriter.cpp Wed Dec 6 00:40:49 2006
@@ -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 @@
break;
default:
Result += "<unrecognized-type>";
+ break;
}
TypeStack.pop_back(); // Remove self from stack...
- return;
}
@@ -364,16 +364,14 @@
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 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 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
More information about the llvm-commits
mailing list