[−][src]Struct rustc_middle::mir::traversal::ReversePostorder

pub struct ReversePostorder<'a, 'tcx> {
    body: &'a Body<'tcx>,
    blocks: Vec<BasicBlock>,
    idx: usize,
}

Reverse postorder traversal of a graph

Reverse postorder is the reverse order of a postorder traversal. This is different to a preorder traversal and represents a natural linearization of control-flow.


        A
       / \
      /   \
     B     C
      \   /
       \ /
        D

A reverse postorder traversal of this graph is either A B C D or A C B D Note that for a graph containing no loops (i.e., A DAG), this is equivalent to a topological sort.

Construction of a ReversePostorder traversal requires doing a full postorder traversal of the graph, therefore this traversal should be constructed as few times as possible. Use the reset method to be able to re-use the traversal

Fields

body: &'a Body<'tcx>blocks: Vec<BasicBlock>idx: usize

Implementations

impl<'a, 'tcx> ReversePostorder<'a, 'tcx>[src]

pub fn new(body: &'a Body<'tcx>, root: BasicBlock) -> ReversePostorder<'a, 'tcx>ⓘ

Notable traits for ReversePostorder<'a, 'tcx>

impl<'a, 'tcx> Iterator for ReversePostorder<'a, 'tcx> type Item = (BasicBlock, &'a BasicBlockData<'tcx>);
[src]

pub fn reset(&mut self)[src]

Trait Implementations

impl<'a, 'tcx> Clone for ReversePostorder<'a, 'tcx>[src]

impl<'a, 'tcx> ExactSizeIterator for ReversePostorder<'a, 'tcx>[src]

impl<'a, 'tcx> Iterator for ReversePostorder<'a, 'tcx>[src]

type Item = (BasicBlock, &'a BasicBlockData<'tcx>)

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, 'tcx> !RefUnwindSafe for ReversePostorder<'a, 'tcx>

impl<'a, 'tcx> !Send for ReversePostorder<'a, 'tcx>

impl<'a, 'tcx> !Sync for ReversePostorder<'a, 'tcx>

impl<'a, 'tcx> Unpin for ReversePostorder<'a, 'tcx> where
    'tcx: 'a, 

impl<'a, 'tcx> !UnwindSafe for ReversePostorder<'a, 'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator, 
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> MaybeResult<T> for T[src]

type Error = !

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]