diff options
author | Chris Lattner <sabre@nondot.org> | 2001-06-07 16:58:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-06-07 16:58:36 +0000 |
commit | bbcfc51f3b2c483a8212205dbfae3b59400b306d (patch) | |
tree | 958fd67decec4388fbedac48dd590991327ac9cd /lib/VMCore | |
parent | 753bfecb77f908aa45d58cab7107a2730cc38d65 (diff) | |
download | llvm-bbcfc51f3b2c483a8212205dbfae3b59400b306d.tar.gz llvm-bbcfc51f3b2c483a8212205dbfae3b59400b306d.tar.bz2 llvm-bbcfc51f3b2c483a8212205dbfae3b59400b306d.tar.xz |
Fixes for BB iterators, additional methods added for DCE pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/ValueHolderImpl.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/VMCore/ValueHolderImpl.h b/lib/VMCore/ValueHolderImpl.h index ecafd470f1..9ca5d94926 100644 --- a/lib/VMCore/ValueHolderImpl.h +++ b/lib/VMCore/ValueHolderImpl.h @@ -38,9 +38,9 @@ void ValueHolder<ValueSubclass,ItemParentType>::remove(ValueSubclass *D) { remove(I); } -// ValueHolder::remove(iterator &) this removes the element at the location specified -// by the iterator, and leaves the iterator pointing to the element that used to follow -// the element deleted. +// ValueHolder::remove(iterator &) this removes the element at the location +// specified by the iterator, and leaves the iterator pointing to the element +// that used to follow the element deleted. // template<class ValueSubclass, class ItemParentType> ValueSubclass *ValueHolder<ValueSubclass,ItemParentType>::remove(iterator &DI) { @@ -60,6 +60,24 @@ ValueSubclass *ValueHolder<ValueSubclass,ItemParentType>::remove(iterator &DI) { } template<class ValueSubclass, class ItemParentType> +ValueSubclass *ValueHolder<ValueSubclass,ItemParentType> +::remove(const iterator &DI) { + assert(DI != ValueList.end() && + "Trying to remove the end of the def list!!!"); + + ValueSubclass *i = *DI; + ValueList.erase(DI); + + i->setParent(0); // I don't own you anymore... byebye... + + // You don't get to be in the symbol table anymore... byebye + if (i->hasName() && Parent) + Parent->getSymbolTable()->remove(i); + + return i; +} + +template<class ValueSubclass, class ItemParentType> void ValueHolder<ValueSubclass,ItemParentType>::push_front(ValueSubclass *Inst) { assert(Inst->getParent() == 0 && "Value already has parent!"); Inst->setParent(ItemParent); |