summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-06-27 23:41:11 +0000
committerChris Lattner <sabre@nondot.org>2001-06-27 23:41:11 +0000
commit7fc9fe34390c66ca58646d09a87f7dbaacb6c1f8 (patch)
treefd083cad8506b9f54d19b8429dfae825f264c35b /include
parent138a124f09de272b2ab93cfd6e2a8a283d18029b (diff)
downloadllvm-7fc9fe34390c66ca58646d09a87f7dbaacb6c1f8.tar.gz
llvm-7fc9fe34390c66ca58646d09a87f7dbaacb6c1f8.tar.bz2
llvm-7fc9fe34390c66ca58646d09a87f7dbaacb6c1f8.tar.xz
Miscellaneous cleanups:
* Convert post to pre-increment for for loops * Use generic programming more * Use new Value::cast* instructions * Use new Module, Method, & BasicBlock forwarding methods * Use new facilities in STLExtras.h * Use new Instruction::isPHINode() method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CFG.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/include/llvm/CFG.h b/include/llvm/CFG.h
index e313e16fa6..5f207b5cfe 100644
--- a/include/llvm/CFG.h
+++ b/include/llvm/CFG.h
@@ -48,12 +48,15 @@ public:
typedef PredIterator<_Ptr,_USE_iterator> _Self;
typedef bidirectional_iterator_tag iterator_category;
+ typedef _Ptr &reference;
+ typedef unsigned difference_type;
+ typedef _Ptr value_type;
typedef _Ptr pointer;
inline void advancePastConstPool() {
// Loop to ignore constant pool references
while (It != BB->use_end() &&
- (((*It)->getValueType() != Value::InstructionVal) ||
+ ((!(*It)->isInstruction()) ||
!(((Instruction*)(*It))->isTerminator())))
++It;
}
@@ -67,8 +70,7 @@ public:
inline bool operator!=(const _Self& x) const { return !operator==(x); }
inline pointer operator*() const {
- assert ((*It)->getValueType() == Value::InstructionVal);
- return ((Instruction *)(*It))->getParent();
+ return (*It)->castInstructionAsserting()->getParent();
}
inline pointer *operator->() const { return &(operator*()); }
@@ -113,6 +115,9 @@ public:
typedef SuccIterator<_Term, _BB> _Self;
// TODO: This can be random access iterator, need operator+ and stuff tho
typedef bidirectional_iterator_tag iterator_category;
+ typedef _BB &reference;
+ typedef unsigned difference_type;
+ typedef _BB value_type;
typedef _BB pointer;
inline SuccIterator(_Term T) : Term(T), idx(0) {} // begin iterator
@@ -242,11 +247,11 @@ public:
};
inline df_iterator df_begin(Method *M, bool Reverse = false) {
- return df_iterator(M->getBasicBlocks().front(), Reverse);
+ return df_iterator(M->front(), Reverse);
}
inline df_const_iterator df_begin(const Method *M, bool Reverse = false) {
- return df_const_iterator(M->getBasicBlocks().front(), Reverse);
+ return df_const_iterator(M->front(), Reverse);
}
inline df_iterator df_end(Method*) {
return df_iterator();
@@ -334,10 +339,10 @@ public:
};
inline po_iterator po_begin( Method *M) {
- return po_iterator(M->getBasicBlocks().front());
+ return po_iterator(M->front());
}
inline po_const_iterator po_begin(const Method *M) {
- return po_const_iterator(M->getBasicBlocks().front());
+ return po_const_iterator(M->front());
}
inline po_iterator po_end ( Method *M) {
return po_iterator();
@@ -371,7 +376,7 @@ class ReversePostOrderTraversal {
}
public:
inline ReversePostOrderTraversal(Method *M) {
- Initialize(M->getBasicBlocks().front());
+ Initialize(M->front());
}
inline ReversePostOrderTraversal(BasicBlock *BB) {
Initialize(BB);