Deleted Added
full compact
RegionInfo.h (234353) RegionInfo.h (239462)
1//===- RegionInfo.h - SESE region analysis ----------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 459 unchanged lines hidden (view full) ---

468
469 iterator begin() { return children.begin(); }
470 iterator end() { return children.end(); }
471
472 const_iterator begin() const { return children.begin(); }
473 const_iterator end() const { return children.end(); }
474 //@}
475
1//===- RegionInfo.h - SESE region analysis ----------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 459 unchanged lines hidden (view full) ---

468
469 iterator begin() { return children.begin(); }
470 iterator end() { return children.end(); }
471
472 const_iterator begin() const { return children.begin(); }
473 const_iterator end() const { return children.end(); }
474 //@}
475
476 /// @name BasicBlock Iterators
476 /// @name BasicBlock Node Iterators
477 ///
478 /// These iterators iterate over all BasicBlock RegionNodes that are
477 ///
478 /// These iterators iterate over all BasicBlock RegionNodes that are
479 /// contained in this Region. The iterator also iterates over BasicBlocks
480 /// that are elements of a subregion of this Region. It is therefore called a
481 /// flat iterator.
479 /// contained in this Region. The iterator also iterates over BasicBlock
480 /// RegionNodes that are elements of a subregion of this Region. It is
481 /// therefore called a flat iterator.
482 //@{
483 typedef df_iterator<RegionNode*, SmallPtrSet<RegionNode*, 8>, false,
482 //@{
483 typedef df_iterator<RegionNode*, SmallPtrSet<RegionNode*, 8>, false,
484 GraphTraits > > block_iterator;
484 GraphTraits<FlatIt<RegionNode*> > > block_node_iterator;
485
486 typedef df_iterator<const RegionNode*, SmallPtrSet<const RegionNode*, 8>,
487 false, GraphTraits<FlatIt<const RegionNode*> > >
485
486 typedef df_iterator<const RegionNode*, SmallPtrSet<const RegionNode*, 8>,
487 false, GraphTraits<FlatIt<const RegionNode*> > >
488 const_block_iterator;
488 const_block_node_iterator;
489
489
490 block_iterator block_begin();
491 block_iterator block_end();
490 block_node_iterator block_node_begin();
491 block_node_iterator block_node_end();
492
492
493 const_block_iterator block_begin() const;
494 const_block_iterator block_end() const;
493 const_block_node_iterator block_node_begin() const;
494 const_block_node_iterator block_node_end() const;
495 //@}
496
495 //@}
496
497 /// @name BasicBlock Iterators
498 ///
499 /// These iterators iterate over all BasicBlocks that are contained in this
500 /// Region. The iterator also iterates over BasicBlocks that are elements of
501 /// a subregion of this Region. It is therefore called a flat iterator.
502 //@{
503 template <bool IsConst>
504 class block_iterator_wrapper
505 : public df_iterator<typename conditional<IsConst,
506 const BasicBlock,
507 BasicBlock>::type*> {
508 typedef df_iterator<typename conditional<IsConst,
509 const BasicBlock,
510 BasicBlock>::type*>
511 super;
512 public:
513 typedef block_iterator_wrapper<IsConst> Self;
514 typedef typename super::pointer pointer;
515
516 // Construct the begin iterator.
517 block_iterator_wrapper(pointer Entry, pointer Exit) : super(df_begin(Entry))
518 {
519 // Mark the exit of the region as visited, so that the children of the
520 // exit and the exit itself, i.e. the block outside the region will never
521 // be visited.
522 super::Visited.insert(Exit);
523 }
524
525 // Construct the end iterator.
526 block_iterator_wrapper() : super(df_end<pointer>((BasicBlock *)0)) {}
527
528 /*implicit*/ block_iterator_wrapper(super I) : super(I) {}
529
530 // FIXME: Even a const_iterator returns a non-const BasicBlock pointer.
531 // This was introduced for backwards compatibility, but should
532 // be removed as soon as all users are fixed.
533 BasicBlock *operator*() const {
534 return const_cast<BasicBlock*>(super::operator*());
535 }
536 };
537
538 typedef block_iterator_wrapper<false> block_iterator;
539 typedef block_iterator_wrapper<true> const_block_iterator;
540
541 block_iterator block_begin() {
542 return block_iterator(getEntry(), getExit());
543 }
544
545 block_iterator block_end() {
546 return block_iterator();
547 }
548
549 const_block_iterator block_begin() const {
550 return const_block_iterator(getEntry(), getExit());
551 }
552 const_block_iterator block_end() const {
553 return const_block_iterator();
554 }
555 //@}
556
497 /// @name Element Iterators
498 ///
499 /// These iterators iterate over all BasicBlock and subregion RegionNodes that
500 /// are direct children of this Region. It does not iterate over any
501 /// RegionNodes that are also element of a subregion of this Region.
502 //@{
503 typedef df_iterator<RegionNode*, SmallPtrSet<RegionNode*, 8>, false,
504 GraphTraits<RegionNode*> > element_iterator;

--- 184 unchanged lines hidden ---
557 /// @name Element Iterators
558 ///
559 /// These iterators iterate over all BasicBlock and subregion RegionNodes that
560 /// are direct children of this Region. It does not iterate over any
561 /// RegionNodes that are also element of a subregion of this Region.
562 //@{
563 typedef df_iterator<RegionNode*, SmallPtrSet<RegionNode*, 8>, false,
564 GraphTraits<RegionNode*> > element_iterator;

--- 184 unchanged lines hidden ---