flowistry_pdg_construction::graph

Struct PartialGraph

Source
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>

Source

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>>

Source

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>

Source

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>

Source

pub fn to_petgraph(&self) -> DepGraph<'tcx>

Source

fn check_invariants(&self)

Source§

impl<'tcx> PartialGraph<'tcx>

Source

pub fn mentioned_call_string<'a>( &'a self, ) -> impl Iterator<Item = CallString> + Captures<'tcx> + 'a

Source

pub fn new( generics: GenericArgsRef<'tcx>, def_id: DefId, arg_count: usize, local_decls: &LocalDecls<'tcx>, ) -> Self

Source

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)

Source

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>

Source§

fn clone(&self) -> PartialGraph<'tcx>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'tcx> Debug for PartialGraph<'tcx>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'tcx> HasLocalDecls<'tcx> for PartialGraph<'tcx>

Source§

fn local_decls(&self) -> &LocalDecls<'tcx>

Source§

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, )

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, )

// njn: grep for “before”, “primary”, etc. Called after the “early” effect of the given statement is applied to 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, )

Called after the “primary” effect of the given terminator is applied to state. Read more
§

fn 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, )

Called after the “primary” effect of the given statement is applied to state.
§

fn visit_block_end(&mut self, _state: &<A as Analysis<'tcx>>::Domain)

Source§

impl<'tcx> TransformCallString for PartialGraph<'tcx>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Captures<'_> for T
where T: ?Sized,