//===-- Value.cpp - Implement the Value class -----------------------------===//
//
-// This file implements the Value, User, and SymTabValue classes.
+// This file implements the Value and User classes.
//
//===----------------------------------------------------------------------===//
-#include "llvm/ValueHolderImpl.h"
#include "llvm/InstrTypes.h"
#include "llvm/SymbolTable.h"
-#include "llvm/SymTabValue.h"
#include "llvm/DerivedTypes.h"
-#ifndef NDEBUG // Only in -g mode...
-#include "llvm/Assembly/Writer.h"
-#include <iostream>
-using std::cerr;
-#endif
#include <algorithm>
//===----------------------------------------------------------------------===//
// a <badref>
//
if (Uses.begin() != Uses.end()) {
- cerr << "While deleting: " << this;
- for (use_const_iterator I = Uses.begin(); I != Uses.end(); ++I)
- cerr << "Use still stuck around after Def is destroyed:" << *I << "\n";
+ std::cerr << "While deleting: " << Ty << "%" << Name << "\n";
+ for (use_const_iterator I = Uses.begin(); I != Uses.end(); ++I) {
+ std::cerr << "Use still stuck around after Def is destroyed:";
+ (*I)->dump();
+ std::cerr << "\n";
+ }
}
#endif
assert(Uses.begin() == Uses.end());
Use->replaceUsesOfWith(this, D);
#ifndef NDEBUG // only in -g mode...
- if (Uses.size() == NumUses)
- cerr << "Use: " << Use << "replace with: " << D;
+ if (Uses.size() == NumUses) {
+ std::cerr << "Use: ";
+ Use->dump();
+ std::cerr << "replace with: ";
+ D->dump();
+ }
#endif
assert(Uses.size() != NumUses && "Didn't remove definition!");
}
return i;
}
-void Value::dump() const {
- cerr << this;
-}
-
//===----------------------------------------------------------------------===//
// User Class
//===----------------------------------------------------------------------===//
}
-//===----------------------------------------------------------------------===//
-// SymTabValue Class
-//===----------------------------------------------------------------------===//
-
-SymTabValue::SymTabValue(Value *p) : ValueParent(p) {
- assert(ValueParent && "SymTavValue without parent!?!");
- ParentSymTab = SymTab = 0;
-}
-
-
-SymTabValue::~SymTabValue() {
- delete SymTab;
-}
-
-void SymTabValue::setParentSymTab(SymbolTable *ST) {
- ParentSymTab = ST;
- if (SymTab)
- SymTab->setParentSymTab(ST);
-}
-
-SymbolTable *SymTabValue::getSymbolTableSure() {
- if (!SymTab) SymTab = new SymbolTable(ParentSymTab);
- return SymTab;
-}
-
-// hasSymbolTable() - Returns true if there is a symbol table allocated to
-// this object AND if there is at least one name in it!
-//
-bool SymTabValue::hasSymbolTable() const {
- if (!SymTab) return false;
-
- for (SymbolTable::const_iterator I = SymTab->begin();
- I != SymTab->end(); ++I) {
- if (I->second.begin() != I->second.end())
- return true; // Found nonempty type plane!
- }
-
- return false;
-}