[llvm] r205603 - Add iterator_ranges for block pred/succ.
Jim Grosbach
grosbach at apple.com
Thu Apr 3 19:10:59 PDT 2014
Author: grosbach
Date: Thu Apr 3 21:10:59 2014
New Revision: 205603
URL: http://llvm.org/viewvc/llvm-project?rev=205603&view=rev
Log:
Add iterator_ranges for block pred/succ.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=205603&r1=205602&r2=205603&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Thu Apr 3 21:10:59 2014
@@ -256,7 +256,6 @@ public:
succ_reverse_iterator;
typedef std::vector<MachineBasicBlock *>::const_reverse_iterator
const_succ_reverse_iterator;
-
pred_iterator pred_begin() { return Predecessors.begin(); }
const_pred_iterator pred_begin() const { return Predecessors.begin(); }
pred_iterator pred_end() { return Predecessors.end(); }
@@ -290,6 +289,19 @@ public:
}
bool succ_empty() const { return Successors.empty(); }
+ inline iterator_range<pred_iterator> predecessors() {
+ return iterator_range<pred_iterator>(pred_begin(), pred_end());
+ }
+ inline iterator_range<const_pred_iterator> const_predecessors() const {
+ return iterator_range<const_pred_iterator>(pred_begin(), pred_end());
+ }
+ inline iterator_range<succ_iterator> succecessors() {
+ return iterator_range<succ_iterator>(succ_begin(), succ_end());
+ }
+ inline iterator_range<const_succ_iterator> const_succecessors() const {
+ return iterator_range<const_succ_iterator>(succ_begin(), succ_end());
+ }
+
// LiveIn management methods.
/// addLiveIn - Add the specified register as a live in. Note that it
More information about the llvm-commits
mailing list