Skip to content

Commit

Permalink
some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm committed Jan 29, 2025
1 parent 4a05a1c commit bd2b4e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ impl BrilligGlobals {
self.entry_point_globals_map = entry_point_globals_map;
}

/// Fetch the global allocations that can possibly be accessed
/// by any given Brillig function (non-entry point or entry point).
/// The allocations available to a function are determined by its entry point.
/// For a given function id input, this function will search for that function's
/// entry point (or multiple entry points) and fetch the global allocations
/// associated with those entry points.
/// These allocations can then be used when compiling the Brillig function
/// and resolving global variables.
pub(crate) fn get_brillig_globals(
&self,
brillig_function_id: FunctionId,
Expand Down
3 changes: 2 additions & 1 deletion compiler/noirc_evaluator/src/brillig/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ impl Ssa {
let mut brillig_globals =
BrilligGlobals::new(&self.functions, used_globals_map, self.main_id);

// Globals are computed once at compile time and shared across all functions,
// SSA Globals are computed once at compile time and shared across all functions,
// thus we can just fetch globals from the main function.
// This same globals graph will then be used to declare Brillig globals for the respective entry points.
let globals = (*self.functions[&self.main_id].dfg.globals).clone();
let globals_dfg = DataFlowGraph::from(globals);
brillig_globals.declare_globals(&globals_dfg, &mut brillig, enable_debug_trace);
Expand Down

0 comments on commit bd2b4e7

Please sign in to comment.