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 /include | |
parent | 753bfecb77f908aa45d58cab7107a2730cc38d65 (diff) | |
download | external_llvm-bbcfc51f3b2c483a8212205dbfae3b59400b306d.zip external_llvm-bbcfc51f3b2c483a8212205dbfae3b59400b306d.tar.gz external_llvm-bbcfc51f3b2c483a8212205dbfae3b59400b306d.tar.bz2 |
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 'include')
-rw-r--r-- | include/llvm/BasicBlock.h | 19 | ||||
-rw-r--r-- | include/llvm/Value.h | 2 | ||||
-rw-r--r-- | include/llvm/ValueHolder.h | 12 | ||||
-rw-r--r-- | include/llvm/iOther.h | 5 |
4 files changed, 23 insertions, 15 deletions
diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h index 6873ef2..5230e87 100644 --- a/include/llvm/BasicBlock.h +++ b/include/llvm/BasicBlock.h @@ -148,7 +148,16 @@ public: typedef bidirectional_iterator_tag iterator_category; typedef _Ptr pointer; - inline PredIterator(_Ptr BB) : ThisBB(BB), It(BB->use_begin()) {} + inline void advancePastConstPool() { + // Loop to ignore constant pool references + while (It != ThisBB->use_end() && + ((*It)->getValueType() != Value::InstructionVal)) + ++It; + } + + inline PredIterator(_Ptr BB) : ThisBB(BB), It(BB->use_begin()) { + advancePastConstPool(); + } inline PredIterator(_Ptr BB, bool) : ThisBB(BB), It(BB->use_end()) {} inline bool operator==(const _Self& x) const { return It == x.It; } @@ -161,13 +170,7 @@ public: inline pointer *operator->() const { return &(operator*()); } inline _Self& operator++() { // Preincrement - do { // Loop to ignore constant pool references - ++It; - } while (It != ThisBB->use_end() && - ((*It)->getValueType() != Value::ConstantVal)); - - // DOES THIS WORK??? - //((*It)->getValueType() != Value::BasicBlockVal)); + ++It; advancePastConstPool(); return *this; } diff --git a/include/llvm/Value.h b/include/llvm/Value.h index d751eb1..b10ea95 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -65,7 +65,7 @@ public: typedef list<User*>::iterator use_iterator; typedef list<User*>::const_iterator use_const_iterator; - inline bool use_size() const { return Uses.size(); } + inline unsigned use_size() const { return Uses.size(); } inline bool use_empty() const { return Uses.empty(); } inline use_iterator use_begin() { return Uses.begin(); } inline use_const_iterator use_begin() const { return Uses.begin(); } diff --git a/include/llvm/ValueHolder.h b/include/llvm/ValueHolder.h index 318419f..8e18fc7 100644 --- a/include/llvm/ValueHolder.h +++ b/include/llvm/ValueHolder.h @@ -65,10 +65,9 @@ public: inline const_iterator end() const { return ValueList.end(); } void delete_all() { // Delete all removes and deletes all elements - // TODO: REMOVE FROM END OF VECTOR!!! - while (begin() != end()) { - iterator I = begin(); - delete remove(I); // Delete all instructions... + while (!empty()) { + iterator it = end(); + delete remove(--it); // Delete all instructions... } } @@ -76,8 +75,9 @@ public: // specified by the iterator, and leaves the iterator pointing to the element // that used to follow the element deleted. // - ValueSubclass *remove(iterator &DI); // Defined in ValueHolderImpl.h - void remove(ValueSubclass *D); // Defined in ValueHolderImpl.h + ValueSubclass *remove(iterator &DI); // Defined in ValueHolderImpl.h + ValueSubclass *remove(const iterator &DI); // Defined in ValueHolderImpl.h + void remove(ValueSubclass *D); // Defined in ValueHolderImpl.h inline void push_front(ValueSubclass *Inst); // Defined in ValueHolderImpl.h inline void push_back(ValueSubclass *Inst); // Defined in ValueHolderImpl.h diff --git a/include/llvm/iOther.h b/include/llvm/iOther.h index 4c06b4f..b66e4d4 100644 --- a/include/llvm/iOther.h +++ b/include/llvm/iOther.h @@ -50,7 +50,12 @@ public: virtual bool setOperand(unsigned i, Value *Val); virtual string getOpcode() const { return "phi"; } + // addIncoming - Add an incoming value to the end of the PHI list void addIncoming(Value *D); + + // removeIncomingValue - Remove an incoming value. This is useful if a + // predecessor basic block is deleted. The value removed is returned. + Value *removeIncomingValue(unsigned idx); }; |