*** empty log message ***

llvm-svn: 3065
This commit is contained in:
Chris Lattner 2002-07-24 22:08:53 +00:00
parent 889cddf52c
commit a82ee2df46
12 changed files with 40 additions and 41 deletions

View File

@ -11,11 +11,10 @@
#include "llvm/Support/InstIterator.h"
#include "llvm/Instruction.h"
#include <iterator>
#include <Support/iterator>
class Constant;
class constant_iterator
: public std::forward_iterator<const Constant, ptrdiff_t> {
class constant_iterator : public forward_iterator<const Constant, ptrdiff_t> {
const_inst_iterator InstI; // Method instruction iterator
unsigned OpIdx; // Operand index

View File

@ -12,18 +12,20 @@
#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
#include "llvm/InstrTypes.h"
#include <iterator>
#include "Support/iterator"
//===--------------------------------------------------------------------===//
// BasicBlock pred_iterator definition
//===--------------------------------------------------------------------===//
template <class _Ptr, class _USE_iterator> // Predecessor Iterator
class PredIterator : public std::bidirectional_iterator<_Ptr, ptrdiff_t> {
class PredIterator : public bidirectional_iterator<_Ptr, ptrdiff_t> {
typedef bidirectional_iterator<_Ptr, ptrdiff_t> super;
_Ptr *BB;
_USE_iterator It;
public:
typedef PredIterator<_Ptr,_USE_iterator> _Self;
typedef typename super::pointer pointer;
inline void advancePastConstants() {
// TODO: This is bad
@ -82,11 +84,13 @@ inline pred_const_iterator pred_end(const BasicBlock *BB) {
//===--------------------------------------------------------------------===//
template <class _Term, class _BB> // Successor Iterator
class SuccIterator : public std::bidirectional_iterator<_BB, ptrdiff_t> {
class SuccIterator : public bidirectional_iterator<_BB, ptrdiff_t> {
const _Term Term;
unsigned idx;
typedef bidirectional_iterator<_BB, ptrdiff_t> super;
public:
typedef SuccIterator<_Term, _BB> _Self;
typedef typename super::pointer pointer;
// TODO: This can be random access iterator, need operator+ and stuff tho
inline SuccIterator(_Term T) : Term(T), idx(0) { // begin iterator

View File

@ -255,7 +255,7 @@ struct ValueMap {
map<ConstHashKey, ConstantClass *> Map;
inline ConstantClass *get(const Type *Ty, ValType V) {
map<ConstHashKey,ConstantClass *>::iterator I =
typename map<ConstHashKey,ConstantClass *>::iterator I =
Map.find(ConstHashKey(Ty, V));
return (I != Map.end()) ? I->second : 0;
}
@ -265,7 +265,7 @@ struct ValueMap {
}
inline void remove(ConstantClass *CP) {
for (map<ConstHashKey,ConstantClass *>::iterator I = Map.begin(),
for (typename map<ConstHashKey,ConstantClass *>::iterator I = Map.begin(),
E = Map.end(); I != E;++I)
if (I->second == CP) {
Map.erase(I);

View File

@ -136,8 +136,8 @@ void Function::dropAllReferences() {
//===----------------------------------------------------------------------===//
GlobalVariable::GlobalVariable(const Type *Ty, bool constant, bool isIntern,
Constant *Initializer = 0,
const std::string &Name = "")
Constant *Initializer,
const std::string &Name)
: GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, isIntern, Name),
isConstantGlobal(constant) {
if (Initializer) Operands.push_back(Use((Value*)Initializer, this));

View File

@ -20,7 +20,7 @@ TerminatorInst::TerminatorInst(Instruction::TermOps iType)
}
TerminatorInst::TerminatorInst(const Type *Ty, Instruction::TermOps iType,
const std::string &Name = "")
const std::string &Name)
: Instruction(Ty, iType, Name) {
}

View File

@ -199,7 +199,7 @@ void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
}
// dumpPassStructure - Implement the -debug-passes=Structure option
void Pass::dumpPassStructure(unsigned Offset = 0) {
void Pass::dumpPassStructure(unsigned Offset) {
std::cerr << std::string(Offset*2, ' ') << getPassName() << "\n";
}

View File

@ -105,8 +105,8 @@ public:
PassManagerT(ParentClass *Par = 0) : Parent(Par), Batcher(0) {}
~PassManagerT() {
// Delete all of the contained passes...
for (std::vector<PassClass*>::iterator I = Passes.begin(), E = Passes.end();
I != E; ++I)
for (typename std::vector<PassClass*>::iterator
I = Passes.begin(), E = Passes.end(); I != E; ++I)
delete *I;
}
@ -205,8 +205,8 @@ public:
virtual void dumpPassStructure(unsigned Offset = 0) {
std::cerr << std::string(Offset*2, ' ') << Traits::getPMName()
<< " Pass Manager\n";
for (std::vector<PassClass*>::iterator I = Passes.begin(), E = Passes.end();
I != E; ++I) {
for (typename std::vector<PassClass*>::iterator
I = Passes.begin(), E = Passes.end(); I != E; ++I) {
PassClass *P = *I;
P->dumpPassStructure(Offset+1);

View File

@ -250,7 +250,7 @@ int SlotCalculator::insertValue(const Value *D) {
}
int SlotCalculator::insertVal(const Value *D, bool dontIgnore = false) {
int SlotCalculator::insertVal(const Value *D, bool dontIgnore) {
assert(D && "Can't insert a null value!");
assert(getValSlot(D) == -1 && "Value is already in the table!");

View File

@ -21,7 +21,8 @@ void SymbolTableListTraits<ValueSubClass,ItemParentClass,SymTabClass,SubClass>
// Remove all of the items from the old symtab..
if (SymTabObject && !List.empty()) {
SymbolTable *SymTab = SymTabObject->getSymbolTable();
for (iplist<ValueSubClass>::iterator I = List.begin(); I != List.end(); ++I)
for (typename iplist<ValueSubClass>::iterator I = List.begin();
I != List.end(); ++I)
if (I->hasName()) SymTab->remove(I);
}
@ -30,7 +31,8 @@ void SymbolTableListTraits<ValueSubClass,ItemParentClass,SymTabClass,SubClass>
// Add all of the items to the new symtab...
if (SymTabObject && !List.empty()) {
SymbolTable *SymTab = SymTabObject->getSymbolTableSure();
for (iplist<ValueSubClass>::iterator I = List.begin(); I != List.end(); ++I)
for (typename iplist<ValueSubClass>::iterator I = List.begin();
I != List.end(); ++I)
if (I->hasName()) SymTab->insert(I);
}
}

View File

@ -431,7 +431,7 @@ public:
~TypeMap() { print("ON EXIT"); }
inline TypeClass *get(const ValType &V) {
map<ValType, PATypeHandle<TypeClass> >::iterator I = Map.find(V);
typename map<ValType, PATypeHandle<TypeClass> >::iterator I = Map.find(V);
// TODO: FIXME: When Types are not CONST.
return (I != Map.end()) ? (TypeClass*)I->second.get() : 0;
}
@ -445,7 +445,7 @@ public:
// structurally equivalent to the specified type.
//
inline const TypeClass *containsEquivalent(const TypeClass *Ty) {
for (MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I)
for (typename MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I)
if (I->second.get() != Ty && TypesEqual(Ty, I->second.get()))
return (TypeClass*)I->second.get(); // FIXME TODO when types not const
return 0;
@ -462,7 +462,7 @@ public:
<< OldTy->getDescription() << " replacement == " << (void*)NewTy
<< ", " << NewTy->getDescription() << endl;
#endif
for (MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I)
for (typename MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I)
if (I->second == OldTy) {
// Check to see if the type just became concrete. If so, remove self
// from user list.
@ -472,7 +472,7 @@ public:
}
void remove(const ValType &OldVal) {
MapTy::iterator I = Map.find(OldVal);
typename MapTy::iterator I = Map.find(OldVal);
assert(I != Map.end() && "TypeMap::remove, element not found!");
Map.erase(I);
}

View File

@ -18,7 +18,7 @@ static inline const Type *checkType(const Type *Ty) {
return Ty;
}
Value::Value(const Type *ty, ValueTy vty, const std::string &name = "")
Value::Value(const Type *ty, ValueTy vty, const std::string &name)
: Name(name), Ty(checkType(ty), this) {
VTy = vty;
}
@ -33,11 +33,9 @@ Value::~Value() {
//
if (Uses.begin() != Uses.end()) {
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";
}
for (use_const_iterator I = Uses.begin(); I != Uses.end(); ++I)
std::cerr << "Use still stuck around after Def is destroyed:"
<< **I << "\n";
}
#endif
assert(Uses.begin() == Uses.end());
@ -56,12 +54,8 @@ void Value::replaceAllUsesWith(Value *D) {
Use->replaceUsesOfWith(this, D);
#ifndef NDEBUG // only in -g mode...
if (Uses.size() == NumUses) {
std::cerr << "Use: ";
Use->dump();
std::cerr << "replace with: ";
D->dump();
}
if (Uses.size() == NumUses)
std::cerr << "Use: " << *Use << "replace with: " << *D;
#endif
assert(Uses.size() != NumUses && "Didn't remove definition!");
}
@ -73,7 +67,7 @@ void Value::replaceAllUsesWith(Value *D) {
// change Ty to point to the right type. :)
//
void Value::refineAbstractType(const DerivedType *OldTy, const Type *NewTy) {
assert(Ty.get() == OldTy &&"Can't refine anything but my type!");
assert(Ty.get() == OldTy && "Can't refine anything but my type!");
if (OldTy == NewTy && !OldTy->isAbstract())
Ty.removeUserFromConcrete();
Ty = NewTy;

View File

@ -14,7 +14,7 @@ static inline const Type *checkType(const Type *Ty) {
}
AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
const std::string &Name = "")
const std::string &Name)
: Instruction(Ty, iTy, Name) {
assert(isa<PointerType>(Ty) && "Can't allocate a non pointer type!");
@ -50,7 +50,7 @@ const Type *AllocationInst::getAllocatedType() const {
//
const Type* MemAccessInst::getIndexedType(const Type *Ptr,
const std::vector<Value*> &Idx,
bool AllowCompositeLeaf = false) {
bool AllowCompositeLeaf) {
if (!isa<PointerType>(Ptr)) return 0; // Type isn't a pointer type!
// Handle the special case of the empty set index set...
@ -76,7 +76,7 @@ const Type* MemAccessInst::getIndexedType(const Type *Ptr,
//===----------------------------------------------------------------------===//
LoadInst::LoadInst(Value *Ptr, const std::vector<Value*> &Idx,
const std::string &Name = "")
const std::string &Name)
: MemAccessInst(checkType(getIndexedType(Ptr->getType(), Idx)), Load, Name) {
assert(getIndexedType(Ptr->getType(), Idx) && "Load operands invalid!");
Operands.reserve(1+Idx.size());
@ -87,7 +87,7 @@ LoadInst::LoadInst(Value *Ptr, const std::vector<Value*> &Idx,
}
LoadInst::LoadInst(Value *Ptr, const std::string &Name = "")
LoadInst::LoadInst(Value *Ptr, const std::string &Name)
: MemAccessInst(cast<PointerType>(Ptr->getType())->getElementType(),
Load, Name) {
Operands.reserve(1);
@ -125,7 +125,7 @@ StoreInst::StoreInst(Value *Val, Value *Ptr)
//===----------------------------------------------------------------------===//
GetElementPtrInst::GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
const std::string &Name = "")
const std::string &Name)
: MemAccessInst(PointerType::get(checkType(getIndexedType(Ptr->getType(),
Idx, true))),
GetElementPtr, Name) {