struct CfgInfo<'a> {
pub cfg: DiGraphMap<BlockId, ()>,
pub fwd_cfg: DiGraphMap<BlockId, ()>,
pub loop_entries: HashSet<BlockId>,
pub switch_blocks: HashSet<BlockId>,
pub dominator_tree: Dominators<BlockId>,
pub block_data: IndexVec<BlockId, BlockData<'a>>,
}Expand description
Information precomputed about a function’s CFG.
Fields§
§cfg: DiGraphMap<BlockId, ()>The CFG
fwd_cfg: DiGraphMap<BlockId, ()>The CFG where all the backward edges have been removed. Aka “forward CFG”.
loop_entries: HashSet<BlockId>We consider the destination of the backward edges to be loop entries and store them here.
switch_blocks: HashSet<BlockId>The blocks whose terminators are a switch are stored here.
dominator_tree: Dominators<BlockId>Tree of which nodes dominates which other nodes.
block_data: IndexVec<BlockId, BlockData<'a>>Computed data about each block.
Implementations§
Source§impl<'a> CfgInfo<'a>
impl<'a> CfgInfo<'a>
Sourcefn build(
ctx: &TransformCtx,
body: &'a BodyContents,
) -> Result<Self, Irreducible>
fn build( ctx: &TransformCtx, body: &'a BodyContents, ) -> Result<Self, Irreducible>
Build the CFGs (the “regular” CFG and the CFG without backward edges) and precompute a bunch of graph information about the CFG.
fn block_data(&self, block_id: BlockId) -> &BlockData<'a>
fn topo_rank(&self, block_id: BlockId) -> u32
fn is_backward_edge(&self, src: BlockId, tgt: BlockId) -> bool
Sourcefn is_within_loop(&self, loop_header: BlockId, block_id: BlockId) -> bool
fn is_within_loop(&self, loop_header: BlockId, block_id: BlockId) -> bool
Check if the node is within the given loop.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for CfgInfo<'a>
impl<'a> RefUnwindSafe for CfgInfo<'a>
impl<'a> Send for CfgInfo<'a>
impl<'a> Sync for CfgInfo<'a>
impl<'a> Unpin for CfgInfo<'a>
impl<'a> UnwindSafe for CfgInfo<'a>
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
Mutably borrows from an owned value. Read more
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more