cairo_lang_lowering::db

Trait LoweringGroup

source
pub trait LoweringGroup:
    Database
    + HasQueryGroup<LoweringDatabase>
    + SemanticGroup
    + Upcast<dyn SemanticGroup> {
Show 54 methods // Required methods fn intern_lowering_function(&self, id: FunctionLongId) -> FunctionId; fn lookup_intern_lowering_function(&self, key: FunctionId) -> FunctionLongId; fn intern_lowering_concrete_function_with_body( &self, id: ConcreteFunctionWithBodyLongId, ) -> ConcreteFunctionWithBodyId; fn lookup_intern_lowering_concrete_function_with_body( &self, key: ConcreteFunctionWithBodyId, ) -> ConcreteFunctionWithBodyLongId; fn intern_lowering_function_with_body( &self, id: FunctionWithBodyLongId, ) -> FunctionWithBodyId; fn lookup_intern_lowering_function_with_body( &self, key: FunctionWithBodyId, ) -> FunctionWithBodyLongId; fn intern_location(&self, id: Location) -> LocationId; fn lookup_intern_location(&self, key: LocationId) -> Location; fn intern_strategy( &self, id: OptimizationStrategy, ) -> OptimizationStrategyId; fn lookup_intern_strategy( &self, key: OptimizationStrategyId, ) -> OptimizationStrategy; fn priv_function_with_body_multi_lowering( &self, function_id: FunctionWithBodyId, ) -> Maybe<Arc<MultiLowering>>; fn priv_function_with_body_lowering( &self, function_id: FunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>; fn function_with_body_lowering_with_borrow_check( &self, function_id: FunctionWithBodyId, ) -> Maybe<(Arc<FlatLowered>, Arc<PotentialDestructCalls>)>; fn function_with_body_lowering( &self, function_id: FunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>; fn priv_concrete_function_with_body_lowered_flat( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>; fn concrete_function_with_body_postpanic_lowered( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>; fn optimized_concrete_function_with_body_lowered( &self, function: ConcreteFunctionWithBodyId, optimization_strategy: OptimizationStrategyId, ) -> Maybe<Arc<FlatLowered>>; fn inlined_function_with_body_lowered( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>; fn final_concrete_function_with_body_lowered( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>; fn concrete_function_with_body_direct_callees( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<Vec<FunctionId>>; fn concrete_function_with_body_postpanic_direct_callees( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<Vec<FunctionId>>; fn concrete_function_with_body_direct_callees_with_body( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<Vec<ConcreteFunctionWithBodyId>>; fn concrete_function_with_body_postpanic_direct_callees_with_body( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<Vec<ConcreteFunctionWithBodyId>>; fn final_concrete_function_with_body_lowered_direct_callees( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<Vec<ConcreteFunctionWithBodyId>>; fn function_with_body_lowering_diagnostics( &self, function_id: FunctionWithBodyId, ) -> Maybe<Diagnostics<LoweringDiagnostic>>; fn semantic_function_with_body_lowering_diagnostics( &self, function_id: FunctionWithBodyId, ) -> Maybe<Diagnostics<LoweringDiagnostic>>; fn module_lowering_diagnostics( &self, module_id: ModuleId, ) -> Maybe<Diagnostics<LoweringDiagnostic>>; fn file_lowering_diagnostics( &self, file_id: FileId, ) -> Maybe<Diagnostics<LoweringDiagnostic>>; fn function_implicits(&self, function: FunctionId) -> Maybe<Vec<TypeId>>; fn scc_implicits( &self, function: ConcreteSCCRepresentative, ) -> Maybe<Vec<TypeId>>; fn function_may_panic(&self, function: FunctionId) -> Maybe<bool>; fn scc_may_panic(&self, scc: ConcreteSCCRepresentative) -> Maybe<bool>; fn has_direct_panic( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<bool>; fn function_with_body_direct_callees( &self, function_id: FunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<OrderedHashSet<FunctionId>>; fn function_with_body_direct_function_with_body_callees( &self, function_id: FunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<OrderedHashSet<FunctionWithBodyId>>; fn final_contains_call_cycle( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<bool>; fn in_cycle( &self, function_id: FunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<bool>; fn concrete_function_with_body_scc_representative( &self, function: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> ConcreteSCCRepresentative; fn concrete_function_with_body_scc( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Vec<ConcreteFunctionWithBodyId>; fn concrete_function_with_body_scc_postpanic_representative( &self, function: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> ConcreteSCCRepresentative; fn concrete_function_with_body_postpanic_scc( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Vec<ConcreteFunctionWithBodyId>; fn function_with_body_scc( &self, function_id: FunctionWithBodyId, dependency_type: DependencyType, ) -> Vec<FunctionWithBodyId>; fn function_with_body_feedback_set( &self, function: ConcreteFunctionWithBodyId, ) -> Maybe<OrderedHashSet<ConcreteFunctionWithBodyId>>; fn needs_withdraw_gas( &self, function: ConcreteFunctionWithBodyId, ) -> Maybe<bool>; fn priv_function_with_body_feedback_set_of_representative( &self, function: ConcreteSCCRepresentative, ) -> Maybe<OrderedHashSet<ConcreteFunctionWithBodyId>>; fn priv_movable_function_ids(&self) -> Arc<UnorderedHashSet<FunctionId>>; fn priv_const_folding_info(&self) -> Arc<ConstFoldingLibfuncInfo>; fn priv_should_inline( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<bool>; fn optimization_config(&self) -> Arc<OptimizationConfig>; fn set_optimization_config(&mut self, value__: Arc<OptimizationConfig>); fn set_optimization_config_with_durability( &mut self, value__: Arc<OptimizationConfig>, durability__: Durability, ); fn final_optimization_strategy(&self) -> OptimizationStrategyId; fn baseline_optimization_strategy(&self) -> OptimizationStrategyId; fn type_size(&self, ty: TypeId) -> usize;
}

Required Methods§

source

fn intern_lowering_function(&self, id: FunctionLongId) -> FunctionId

source

fn lookup_intern_lowering_function(&self, key: FunctionId) -> FunctionLongId

source

fn intern_lowering_concrete_function_with_body( &self, id: ConcreteFunctionWithBodyLongId, ) -> ConcreteFunctionWithBodyId

source

fn lookup_intern_lowering_concrete_function_with_body( &self, key: ConcreteFunctionWithBodyId, ) -> ConcreteFunctionWithBodyLongId

source

fn intern_lowering_function_with_body( &self, id: FunctionWithBodyLongId, ) -> FunctionWithBodyId

source

fn lookup_intern_lowering_function_with_body( &self, key: FunctionWithBodyId, ) -> FunctionWithBodyLongId

source

fn intern_location(&self, id: Location) -> LocationId

source

fn lookup_intern_location(&self, key: LocationId) -> Location

source

fn intern_strategy(&self, id: OptimizationStrategy) -> OptimizationStrategyId

source

fn lookup_intern_strategy( &self, key: OptimizationStrategyId, ) -> OptimizationStrategy

source

fn priv_function_with_body_multi_lowering( &self, function_id: FunctionWithBodyId, ) -> Maybe<Arc<MultiLowering>>

Computes the lowered representation of a function with a body, along with all it generated functions (e.g. closures, lambdas, loops, …).

source

fn priv_function_with_body_lowering( &self, function_id: FunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>

Computes the lowered representation of a function with a body before borrow checking.

source

fn function_with_body_lowering_with_borrow_check( &self, function_id: FunctionWithBodyId, ) -> Maybe<(Arc<FlatLowered>, Arc<PotentialDestructCalls>)>

Computes the lowered representation of a function with a body. Additionally applies borrow checking testing, and returns the possible calls per block.

source

fn function_with_body_lowering( &self, function_id: FunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>

Computes the lowered representation of a function with a body.

source

fn priv_concrete_function_with_body_lowered_flat( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>

A concrete version of priv_function_with_body_multi_lowering

source

fn concrete_function_with_body_postpanic_lowered( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>

Computes the lowered representation after the panic phase.

source

fn optimized_concrete_function_with_body_lowered( &self, function: ConcreteFunctionWithBodyId, optimization_strategy: OptimizationStrategyId, ) -> Maybe<Arc<FlatLowered>>

Applies optimizations to the post_panic lowering.

source

fn inlined_function_with_body_lowered( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>

Computes the lowered representation of a function to be considered for inlining.

source

fn final_concrete_function_with_body_lowered( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<Arc<FlatLowered>>

Computes the final lowered representation (after all the internal transformations).

source

fn concrete_function_with_body_direct_callees( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<Vec<FunctionId>>

Returns the set of direct callees of a concrete function with a body after the inline phase.

source

fn concrete_function_with_body_postpanic_direct_callees( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<Vec<FunctionId>>

Returns the set of direct callees of a concrete function with a body after the panic phase.

source

fn concrete_function_with_body_direct_callees_with_body( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<Vec<ConcreteFunctionWithBodyId>>

Returns the set of direct callees which are functions with body of a concrete function with a body (i.e. excluding libfunc callees), after the inline phase.

source

fn concrete_function_with_body_postpanic_direct_callees_with_body( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<Vec<ConcreteFunctionWithBodyId>>

Returns the set of direct callees which are functions with body of a concrete function with a body (i.e. excluding libfunc callees), after the panic phase.

source

fn final_concrete_function_with_body_lowered_direct_callees( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<Vec<ConcreteFunctionWithBodyId>>

Returns the set of direct callees which are functions with body of a concrete function with a body (i.e. excluding libfunc callees), after all optimization phases.

source

fn function_with_body_lowering_diagnostics( &self, function_id: FunctionWithBodyId, ) -> Maybe<Diagnostics<LoweringDiagnostic>>

Aggregates function level lowering diagnostics.

source

fn semantic_function_with_body_lowering_diagnostics( &self, function_id: FunctionWithBodyId, ) -> Maybe<Diagnostics<LoweringDiagnostic>>

Aggregates semantic function level lowering diagnostics - along with all its generated function.

source

fn module_lowering_diagnostics( &self, module_id: ModuleId, ) -> Maybe<Diagnostics<LoweringDiagnostic>>

Aggregates module level lowering diagnostics.

source

fn file_lowering_diagnostics( &self, file_id: FileId, ) -> Maybe<Diagnostics<LoweringDiagnostic>>

Aggregates file level lowering diagnostics.

source

fn function_implicits(&self, function: FunctionId) -> Maybe<Vec<TypeId>>

Returns all the implicit parameters that the function requires (according to both its signature and the functions it calls). The items in the returned vector are unique and the order is consistent, but not necessarily related to the order of the explicit implicits in the signature of the function.

source

fn scc_implicits( &self, function: ConcreteSCCRepresentative, ) -> Maybe<Vec<TypeId>>

Returns all the implicits used by a strongly connected component of functions.

source

fn function_may_panic(&self, function: FunctionId) -> Maybe<bool>

Returns whether the function may panic.

source

fn scc_may_panic(&self, scc: ConcreteSCCRepresentative) -> Maybe<bool>

Returns whether any function in the strongly connected component may panic.

source

fn has_direct_panic( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<bool>

Checks if the function has a block that ends with panic.

source

fn function_with_body_direct_callees( &self, function_id: FunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<OrderedHashSet<FunctionId>>

Returns the set of direct callees of a function with a body.

source

fn function_with_body_direct_function_with_body_callees( &self, function_id: FunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<OrderedHashSet<FunctionWithBodyId>>

Returns the set of direct callees which are functions with body of a function with a body (i.e. excluding libfunc callees).

source

fn final_contains_call_cycle( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<bool>

Returns true if the function (in its final lowering representation) calls (possibly indirectly) itself, or if it calls (possibly indirectly) such a function. For example, if f0 calls f1, f1 calls f2, f2 calls f3, and f3 calls f2, then Self::final_contains_call_cycle will return true for all of these functions.

source

fn in_cycle( &self, function_id: FunctionWithBodyId, dependency_type: DependencyType, ) -> Maybe<bool>

Returns true if the function calls (possibly indirectly) itself. For example, if f0 calls f1, f1 calls f2, f2 calls f3, and f3 calls f2, then Self::in_cycle will return true for f2 and f3, but false for f0 and f1.

source

fn concrete_function_with_body_scc_representative( &self, function: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> ConcreteSCCRepresentative

Returns the representative of the concrete function’s strongly connected component. The representative is consistently chosen for all the concrete functions in the same SCC.

source

fn concrete_function_with_body_scc( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Vec<ConcreteFunctionWithBodyId>

Returns all the concrete functions in the same strongly connected component as the given concrete function.

source

fn concrete_function_with_body_scc_postpanic_representative( &self, function: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> ConcreteSCCRepresentative

Returns the representative of the concrete function’s strongly connected component. The representative is consistently chosen for all the concrete functions in the same SCC. This is using the representation after the panic phase.

source

fn concrete_function_with_body_postpanic_scc( &self, function_id: ConcreteFunctionWithBodyId, dependency_type: DependencyType, ) -> Vec<ConcreteFunctionWithBodyId>

Returns all the concrete functions in the same strongly connected component as the given concrete function. This is using the representation after the panic phase.

source

fn function_with_body_scc( &self, function_id: FunctionWithBodyId, dependency_type: DependencyType, ) -> Vec<FunctionWithBodyId>

Returns all the functions in the same strongly connected component as the given function.

source

fn function_with_body_feedback_set( &self, function: ConcreteFunctionWithBodyId, ) -> Maybe<OrderedHashSet<ConcreteFunctionWithBodyId>>

Returns the feedback-vertex-set of the given concrete function. A feedback-vertex-set is the set of vertices whose removal leaves a graph without cycles.

source

fn needs_withdraw_gas( &self, function: ConcreteFunctionWithBodyId, ) -> Maybe<bool>

Returns whether the given function needs an additional withdraw_gas call.

source

fn priv_function_with_body_feedback_set_of_representative( &self, function: ConcreteSCCRepresentative, ) -> Maybe<OrderedHashSet<ConcreteFunctionWithBodyId>>

Returns the feedback-vertex-set of the given concrete-function SCC-representative. A feedback-vertex-set is the set of vertices whose removal leaves a graph without cycles.

source

fn priv_movable_function_ids(&self) -> Arc<UnorderedHashSet<FunctionId>>

Internal query for reorder_statements to cache the function ids that can be moved.

source

fn priv_const_folding_info(&self) -> Arc<ConstFoldingLibfuncInfo>

Internal query for the libfuncs information required for const folding.

source

fn priv_should_inline( &self, function_id: ConcreteFunctionWithBodyId, ) -> Maybe<bool>

source

fn optimization_config(&self) -> Arc<OptimizationConfig>

Returns the configuration struct that controls the behavior of the optimization passes.

source

fn set_optimization_config(&mut self, value__: Arc<OptimizationConfig>)

Set the value of the optimization_config input.

See optimization_config for details.

Note: Setting values will trigger cancellation of any ongoing queries; this method blocks until those queries have been cancelled.

source

fn set_optimization_config_with_durability( &mut self, value__: Arc<OptimizationConfig>, durability__: Durability, )

Set the value of the optimization_config input with a specific durability instead of the default of Durability::LOW. You can use Durability::MAX to promise that its value will never change again.

See optimization_config for details.

Note: Setting values will trigger cancellation of any ongoing queries; this method blocks until those queries have been cancelled.

source

fn final_optimization_strategy(&self) -> OptimizationStrategyId

Returns the final optimization strategy that is applied on top of inlined_function_optimization_strategy.

source

fn baseline_optimization_strategy(&self) -> OptimizationStrategyId

Returns the baseline optimization strategy. This strategy is used for inlining decistion and as a starting point for the final lowering.

source

fn type_size(&self, ty: TypeId) -> usize

Returns the expected size of a type.

Trait Implementations§

source§

impl<'a> DebugWithDb<dyn LoweringGroup + 'a> for FunctionLongId

source§

fn fmt(&self, f: &mut Formatter<'_>, db: &(dyn LoweringGroup + 'a)) -> Result

source§

fn debug<'me, 'db>(&'me self, db: &'me Db) -> DebugWith<'me, Db>
where Self: Sized + 'me,

source§

fn into_debug<'me, 'db>(self, db: &'me Db) -> DebugWith<'me, Db>
where Self: Sized + 'me,

source§

impl DebugWithDb<dyn LoweringGroup> for Location

source§

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

source§

fn debug<'me, 'db>(&'me self, db: &'me Db) -> DebugWith<'me, Db>
where Self: Sized + 'me,

source§

fn into_debug<'me, 'db>(self, db: &'me Db) -> DebugWith<'me, Db>
where Self: Sized + 'me,

source§

impl<'a> Intern<'a, dyn LoweringGroup + 'a, ConcreteFunctionWithBodyId> for ConcreteFunctionWithBodyLongId

source§

fn intern( self, db: &(impl Upcast<dyn LoweringGroup + 'a> + ?Sized), ) -> ConcreteFunctionWithBodyId

source§

impl<'a> Intern<'a, dyn LoweringGroup + 'a, FunctionId> for FunctionLongId

source§

fn intern( self, db: &(impl Upcast<dyn LoweringGroup + 'a> + ?Sized), ) -> FunctionId

source§

impl<'a> Intern<'a, dyn LoweringGroup + 'a, FunctionWithBodyId> for FunctionWithBodyLongId

source§

fn intern( self, db: &(impl Upcast<dyn LoweringGroup + 'a> + ?Sized), ) -> FunctionWithBodyId

source§

impl<'a> Intern<'a, dyn LoweringGroup + 'a, LocationId> for Location

source§

fn intern( self, db: &(impl Upcast<dyn LoweringGroup + 'a> + ?Sized), ) -> LocationId

source§

impl<'a> Intern<'a, dyn LoweringGroup + 'a, OptimizationStrategyId> for OptimizationStrategy

source§

fn intern( self, db: &(impl Upcast<dyn LoweringGroup + 'a> + ?Sized), ) -> OptimizationStrategyId

source§

impl<'a> LookupIntern<'a, dyn LoweringGroup + 'a, ConcreteFunctionWithBodyLongId> for ConcreteFunctionWithBodyId

source§

impl<'a> LookupIntern<'a, dyn LoweringGroup + 'a, FunctionLongId> for FunctionId

source§

fn lookup_intern( &self, db: &(impl Upcast<dyn LoweringGroup + 'a> + ?Sized), ) -> FunctionLongId

source§

impl<'a> LookupIntern<'a, dyn LoweringGroup + 'a, FunctionWithBodyLongId> for FunctionWithBodyId

source§

fn lookup_intern( &self, db: &(impl Upcast<dyn LoweringGroup + 'a> + ?Sized), ) -> FunctionWithBodyLongId

source§

impl<'a> LookupIntern<'a, dyn LoweringGroup + 'a, Location> for LocationId

source§

fn lookup_intern( &self, db: &(impl Upcast<dyn LoweringGroup + 'a> + ?Sized), ) -> Location

source§

impl<'a> LookupIntern<'a, dyn LoweringGroup + 'a, OptimizationStrategy> for OptimizationStrategyId

source§

fn lookup_intern( &self, db: &(impl Upcast<dyn LoweringGroup + 'a> + ?Sized), ) -> OptimizationStrategy

Implementors§

source§

impl<DB> LoweringGroup for DB
where DB: SemanticGroup + Upcast<dyn SemanticGroup> + Database + HasQueryGroup<LoweringDatabase>,