Skip to main content

CallGraph

Struct CallGraph 

Source
pub struct CallGraph {
    pub edges: HashMap<Symbol, HashSet<Symbol>>,
    pub native_fns: HashSet<Symbol>,
    pub sccs: Vec<Vec<Symbol>>,
}
Expand description

Whole-program call graph for the LOGOS compilation pipeline.

Captures all direct and closure-embedded call edges between user-defined functions. Used by ReadonlyParams for transitive mutation detection and by liveness analysis for inter-procedural precision.

Fields§

§edges: HashMap<Symbol, HashSet<Symbol>>

Direct call edges: fn_sym → set of directly called function symbols.

§native_fns: HashSet<Symbol>

Set of native (extern) function symbols.

§sccs: Vec<Vec<Symbol>>

Strongly connected components (Kosaraju’s algorithm).

Implementations§

Source§

impl CallGraph

Source

pub fn build(stmts: &[Stmt<'_>], _interner: &Interner) -> CallGraph

Build the call graph from a program’s top-level statements.

Walks all FunctionDef bodies, collecting Stmt::Call and Expr::Call targets, including calls inside closure bodies.

Source

pub fn reachable_from(&self, fn_sym: Symbol) -> HashSet<Symbol>

Returns all functions reachable from fn_sym via the call graph.

Does not include fn_sym itself unless it is part of a cycle.

Source

pub fn is_recursive(&self, fn_sym: Symbol) -> bool

Returns true if fn_sym participates in a recursive cycle (direct self-call or mutual recursion via SCC membership).

Auto Trait Implementations§

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> 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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V