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