summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-12-27 12:00:56 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-12-27 12:00:56 +0000
commit3edd52c1d04968daaae289c77f47c6a6cd00ca28 (patch)
treebb3a15542579d640db2c949f559184b2f7ac7352
parenta3c0d67d5b7386ca608f625da821646f19db577f (diff)
downloadbcm5719-llvm-3edd52c1d04968daaae289c77f47c6a6cd00ca28.tar.gz
bcm5719-llvm-3edd52c1d04968daaae289c77f47c6a6cd00ca28.zip
Add support to BasicBlocks for iterating backwards over the
instructions. This just exposes the already present reverse iterators of the instruction ilist. llvm-svn: 171159
-rw-r--r--llvm/include/llvm/BasicBlock.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/include/llvm/BasicBlock.h b/llvm/include/llvm/BasicBlock.h
index ba8406e3974..e9001021f52 100644
--- a/llvm/include/llvm/BasicBlock.h
+++ b/llvm/include/llvm/BasicBlock.h
@@ -93,8 +93,10 @@ public:
LLVMContext &getContext() const;
/// Instruction iterators...
- typedef InstListType::iterator iterator;
- typedef InstListType::const_iterator const_iterator;
+ typedef InstListType::iterator iterator;
+ typedef InstListType::const_iterator const_iterator;
+ typedef InstListType::reverse_iterator reverse_iterator;
+ typedef InstListType::const_reverse_iterator const_reverse_iterator;
/// Create - Creates a new BasicBlock. If the Parent parameter is specified,
/// the basic block is automatically inserted at either the end of the
@@ -191,6 +193,11 @@ public:
inline iterator end () { return InstList.end(); }
inline const_iterator end () const { return InstList.end(); }
+ inline reverse_iterator rbegin() { return InstList.rbegin(); }
+ inline const_reverse_iterator rbegin() const { return InstList.rbegin(); }
+ inline reverse_iterator rend () { return InstList.rend(); }
+ inline const_reverse_iterator rend () const { return InstList.rend(); }
+
inline size_t size() const { return InstList.size(); }
inline bool empty() const { return InstList.empty(); }
inline const Instruction &front() const { return InstList.front(); }
OpenPOWER on IntegriCloud