[llvm-commits] [llvm] r171159 - /llvm/trunk/include/llvm/BasicBlock.h

Chandler Carruth chandlerc at gmail.com
Thu Dec 27 04:00:57 PST 2012


Author: chandlerc
Date: Thu Dec 27 06:00:56 2012
New Revision: 171159

URL: http://llvm.org/viewvc/llvm-project?rev=171159&view=rev
Log:
Add support to BasicBlocks for iterating backwards over the
instructions. This just exposes the already present reverse iterators of
the instruction ilist.

Modified:
    llvm/trunk/include/llvm/BasicBlock.h

Modified: llvm/trunk/include/llvm/BasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BasicBlock.h?rev=171159&r1=171158&r2=171159&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BasicBlock.h (original)
+++ llvm/trunk/include/llvm/BasicBlock.h Thu Dec 27 06:00:56 2012
@@ -93,8 +93,10 @@
   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 @@
   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(); }





More information about the llvm-commits mailing list