pub struct Loop {
pub header: BlockId,
pub blocks: HashSet<BlockId, FxBuildHasher>,
pub back_edges: SmallVec<[BlockId; 2]>,
pub exit_blocks: SmallVec<[BlockId; 2]>,
pub preheader: Option<BlockId>,
pub induction_vars: Vec<InductionVariable>,
pub invariant_insts: HashSet<InstId, FxBuildHasher>,
pub trip_count: Option<u64>,
pub trip_guard_is_header: bool,
}Expand description
A natural loop in the control flow graph.
Fields§
§header: BlockIdThe header block (entry point with back edge).
blocks: HashSet<BlockId, FxBuildHasher>All blocks in the loop body (including header).
back_edges: SmallVec<[BlockId; 2]>Back edges: blocks that jump back to the header.
exit_blocks: SmallVec<[BlockId; 2]>Exit blocks: blocks outside the loop that are successors of loop blocks.
preheader: Option<BlockId>Preheader block (if exists): unique predecessor of header outside the loop.
induction_vars: Vec<InductionVariable>Loop induction variables.
invariant_insts: HashSet<InstId, FxBuildHasher>Instructions that are invariant (don’t change within the loop).
trip_count: Option<u64>Optional: constant trip count if statically known.
trip_guard_is_header: boolWhether the guard that produced Self::trip_count is the header’s
terminator. Control enters every iteration at the header, so when this
holds, non-header blocks only execute after that iteration’s bound
check passed and observe the induction variable strictly below the
bound; header instructions (and any guard placed deeper in the body)
still run once more in the exiting partial iteration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Loop
impl RefUnwindSafe for Loop
impl Send for Loop
impl Sync for Loop
impl Unpin for Loop
impl UnsafeUnpin for Loop
impl UnwindSafe for Loop
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more