pub struct PartialGraph<'tcx> {
pub(crate) nodes: FxHashSet<DepNode<'tcx>>,
pub(crate) edges: FxHashSet<(DepNode<'tcx>, DepNode<'tcx>, DepEdge)>,
pub(crate) generics: GenericArgsRef<'tcx>,
def_id: DefId,
arg_count: usize,
local_decls: IndexVec<Local, LocalDecl<'tcx>>,
}
Fields§
§nodes: FxHashSet<DepNode<'tcx>>
§edges: FxHashSet<(DepNode<'tcx>, DepNode<'tcx>, DepEdge)>
§generics: GenericArgsRef<'tcx>
§def_id: DefId
§arg_count: usize
§local_decls: IndexVec<Local, LocalDecl<'tcx>>
Implementations§
Source§impl<'tcx> PartialGraph<'tcx>
impl<'tcx> PartialGraph<'tcx>
fn modular_mutation_visitor<'a, 'mir>( &'a mut self, results: &'a Results<'tcx, &'mir LocalAnalysis<'tcx, 'mir>>, state: &'a InstructionState<'tcx>, ) -> ModularMutationVisitor<'a, 'tcx, impl FnMut(Location, Mutation<'tcx>) + use<'a, 'tcx, 'mir>>
Sourcefn handle_as_inline<'a>(
&mut self,
results: &Results<'tcx, &'a LocalAnalysis<'tcx, 'a>>,
state: &InstructionState<'tcx>,
terminator: &Terminator<'tcx>,
location: Location,
) -> bool
fn handle_as_inline<'a>( &mut self, results: &Results<'tcx, &'a LocalAnalysis<'tcx, 'a>>, state: &InstructionState<'tcx>, terminator: &Terminator<'tcx>, location: Location, ) -> bool
returns whether we were able to successfully handle this as inline
Source§impl<'tcx> PartialGraph<'tcx>
impl<'tcx> PartialGraph<'tcx>
fn register_mutation( &mut self, results: &Results<'tcx, &'_ LocalAnalysis<'tcx, '_>>, state: &InstructionState<'tcx>, inputs: Inputs<'tcx>, mutated: Either<Place<'tcx>, DepNode<'tcx>>, location: Location, target_use: TargetUse, )
Source§impl<'tcx> PartialGraph<'tcx>
impl<'tcx> PartialGraph<'tcx>
pub fn to_petgraph(&self) -> DepGraph<'tcx>
fn check_invariants(&self)
Source§impl<'tcx> PartialGraph<'tcx>
impl<'tcx> PartialGraph<'tcx>
pub fn mentioned_call_string<'a>( &'a self, ) -> impl Iterator<Item = CallString> + Captures<'tcx> + 'a
pub fn new( generics: GenericArgsRef<'tcx>, def_id: DefId, arg_count: usize, local_decls: &LocalDecls<'tcx>, ) -> Self
Sourcepub(crate) fn parentable_srcs<'a>(
&'a self,
is_at_root: impl Fn(CallString) -> bool,
) -> FxHashSet<(DepNode<'tcx>, Option<u8>)>
pub(crate) fn parentable_srcs<'a>( &'a self, is_at_root: impl Fn(CallString) -> bool, ) -> FxHashSet<(DepNode<'tcx>, Option<u8>)>
Returns the set of source places that the parent can access (write to)
Parameterized by a is_at_root
function which returns whether a given
call string refers to a location in the outermost function. This is
necessary, because consumers of PartialGraph
manipulate the call
string and as such we cannot assume that .len() == 1
necessarily refers
to a root location. (TODO we probably should maintain that invariant)
Sourcepub(crate) fn parentable_dsts<'a>(
&'a self,
is_at_root: impl Fn(CallString) -> bool,
) -> FxHashSet<(DepNode<'tcx>, Option<u8>)>
pub(crate) fn parentable_dsts<'a>( &'a self, is_at_root: impl Fn(CallString) -> bool, ) -> FxHashSet<(DepNode<'tcx>, Option<u8>)>
Returns the set of destination places that the parent can access (read from)
Parameterized by a is_at_root
function which returns whether a given
call string refers to a location in the outermost function. This is
necessary, because consumers of PartialGraph
manipulate the call
string and as such we cannot assume that .len() == 1
necessarily refers
to a root location. (TODO we probably should maintain that invariant)
Trait Implementations§
Source§impl<'tcx> Clone for PartialGraph<'tcx>
impl<'tcx> Clone for PartialGraph<'tcx>
Source§fn clone(&self) -> PartialGraph<'tcx>
fn clone(&self) -> PartialGraph<'tcx>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'tcx> Debug for PartialGraph<'tcx>
impl<'tcx> Debug for PartialGraph<'tcx>
Source§impl<'tcx> HasLocalDecls<'tcx> for PartialGraph<'tcx>
impl<'tcx> HasLocalDecls<'tcx> for PartialGraph<'tcx>
fn local_decls(&self) -> &LocalDecls<'tcx>
Source§impl<'mir, 'tcx> ResultsVisitor<'mir, 'tcx, &'mir LocalAnalysis<'tcx, 'mir>> for PartialGraph<'tcx>
impl<'mir, 'tcx> ResultsVisitor<'mir, 'tcx, &'mir LocalAnalysis<'tcx, 'mir>> for PartialGraph<'tcx>
Source§fn visit_after_early_terminator_effect(
&mut self,
results: &mut Results<'tcx, &'mir LocalAnalysis<'tcx, 'mir>>,
state: &InstructionState<'tcx>,
terminator: &'mir Terminator<'tcx>,
location: Location,
)
fn visit_after_early_terminator_effect( &mut self, results: &mut Results<'tcx, &'mir LocalAnalysis<'tcx, 'mir>>, state: &InstructionState<'tcx>, terminator: &'mir Terminator<'tcx>, location: Location, )
We handle terminators during graph construction generally in the before state, because we’re interested in what the dependencies of our read places are before the modification pass overwrites the read places from any mutable arguments.
There is one exception which is that non-inlined function calls are handled in two steps. Before the primary effects we generate edges from the dependencies to the input arguments. After the primary effect we insert edges from each argument to each modified location. It is cleaner to do this afterwards, because the logic that resolves a place to a graph node assumes that you are reading all of your inputs from the “last_modification”. In the “before” state that map contains the “original” dependencies of each argument, e.g. we haven’t combined them with the reachable places yet. So this ordering means we can reuse the same logic but just have to run it twice for every non-inlined function call site.
Source§fn visit_after_early_statement_effect(
&mut self,
results: &mut Results<'tcx, &'mir LocalAnalysis<'tcx, 'mir>>,
state: &InstructionState<'tcx>,
statement: &'mir Statement<'tcx>,
location: Location,
)
fn visit_after_early_statement_effect( &mut self, results: &mut Results<'tcx, &'mir LocalAnalysis<'tcx, 'mir>>, state: &InstructionState<'tcx>, statement: &'mir Statement<'tcx>, location: Location, )
state
.Source§fn visit_after_primary_terminator_effect(
&mut self,
results: &mut Results<'tcx, &'mir LocalAnalysis<'tcx, 'mir>>,
state: &InstructionState<'tcx>,
terminator: &'mir Terminator<'tcx>,
location: Location,
)
fn visit_after_primary_terminator_effect( &mut self, results: &mut Results<'tcx, &'mir LocalAnalysis<'tcx, 'mir>>, state: &InstructionState<'tcx>, terminator: &'mir Terminator<'tcx>, location: Location, )
state
. Read morefn visit_block_start(&mut self, _state: &<A as Analysis<'tcx>>::Domain)
§fn visit_after_primary_statement_effect(
&mut self,
_results: &mut Results<'tcx, A>,
_state: &<A as Analysis<'tcx>>::Domain,
_statement: &'mir Statement<'tcx>,
_location: Location,
)
fn visit_after_primary_statement_effect( &mut self, _results: &mut Results<'tcx, A>, _state: &<A as Analysis<'tcx>>::Domain, _statement: &'mir Statement<'tcx>, _location: Location, )
state
.fn visit_block_end(&mut self, _state: &<A as Analysis<'tcx>>::Domain)
Source§impl<'tcx> TransformCallString for PartialGraph<'tcx>
impl<'tcx> TransformCallString for PartialGraph<'tcx>
fn transform_call_string(&self, f: impl Fn(CallString) -> CallString) -> Self
Auto Trait Implementations§
impl<'tcx> Freeze for PartialGraph<'tcx>
impl<'tcx> !RefUnwindSafe for PartialGraph<'tcx>
impl<'tcx> Send for PartialGraph<'tcx>
impl<'tcx> Sync for PartialGraph<'tcx>
impl<'tcx> Unpin for PartialGraph<'tcx>
impl<'tcx> !UnwindSafe for PartialGraph<'tcx>
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> 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