Trait moore_svlog::QueryDatabase[][src]

pub trait QueryDatabase<'a> {
    type Context: Context<'a>;
Show 69 methods fn context(&self) -> &Self::Context;
fn storage(&self) -> &QueryStorage<'a>; fn handle_cycle(&self) -> ! { ... }
fn before_query(&self, tag: &QueryTag<'a>) { ... }
fn after_query(&self, tag: &QueryTag<'a>) { ... }
fn hir_of(&self, node_id: NodeId) -> Result<HirNode<'a>> { ... }
fn hir_of_module(&self, ast: &'a Module<'a>) -> Result<&'a Module<'a>> { ... }
fn hir_of_interface(
        &self,
        ast: &'a Interface<'a>
    ) -> Result<&'a Interface<'a>> { ... }
fn hir_of_expr(&self, arg0: Ref<'a, Expr<'a>>) -> Result<&'a Expr<'a>> { ... }
fn accessed_nodes(
        &self,
        node_id: NodeId,
        env: ParamEnv
    ) -> Result<Arc<AccessTable>> { ... }
fn inst_details(
        &self,
        arg0: Ref<'a, Inst<'a>>,
        env: ParamEnv
    ) -> Result<Arc<InstDetails<'a>>> { ... }
fn inst_target_details(
        &self,
        arg0: Ref<'a, InstTarget<'a>>,
        env: ParamEnv
    ) -> Result<Arc<InstTargetDetails<'a>>> { ... }
fn mir_assignment_from_procedural(
        &self,
        origin: NodeId,
        lhs: NodeId,
        rhs: NodeId,
        env: ParamEnv,
        span: Span,
        kind: AssignKind
    ) -> &'a Assignment<'a> { ... }
fn mir_assignment_from_concurrent(
        &self,
        arg0: Ref<'a, Assign>,
        env: ParamEnv
    ) -> &'a Assignment<'a> { ... }
fn mir_simplify_assignment(
        &self,
        arg0: Ref<'a, Assignment<'a>>
    ) -> Vec<&'a Assignment<'a>>
Notable traits for Vec<u8, A>
impl<A> Write for Vec<u8, A> where
    A: Allocator
{ ... }
fn mir_lvalue(&self, expr_id: NodeId, env: ParamEnv) -> &'a Lvalue<'a> { ... }
fn mir_rvalue(&self, expr_id: NodeId, env: ParamEnv) -> &'a Rvalue<'a> { ... }
fn param_env(&self, src: ParamEnvSource<'a>) -> Result<ParamEnv> { ... }
fn map_pattern(
        &self,
        arg0: Ref<'a, Expr<'a>>,
        env: ParamEnv
    ) -> Result<Arc<PatternMapping<'a>>> { ... }
fn canonicalize_ports(
        &self,
        node: &'a dyn PortedNode<'a>
    ) -> &'a PortList<'a> { ... }
fn port_mapping(
        &self,
        node: &'a dyn PortedNode<'a>,
        outer_env: ParamEnv,
        inner_env: ParamEnv,
        arg3: Ref<'a, InstName<'a>>,
        pos: &'a [PosParam],
        named: &'a [NamedParam],
        has_wildcard_port: bool
    ) -> Result<Arc<PortMapping<'a>>> { ... }
fn local_rib(&self, node_id: NodeId) -> Result<&'a Rib> { ... }
fn hierarchical_rib(&self, node_id: NodeId) -> Result<&'a Rib> { ... }
fn resolve_upwards(
        &self,
        name: Name,
        start_at: NodeId
    ) -> Result<Option<NodeId>> { ... }
fn resolve_downwards(
        &self,
        name: Name,
        start_at: NodeId
    ) -> Result<Option<NodeId>> { ... }
fn resolve_node(&self, node_id: NodeId, env: ParamEnv) -> Result<NodeId> { ... }
fn struct_def(&self, node_id: NodeId) -> Result<Arc<StructDef>> { ... }
fn resolve_field_access(
        &self,
        node_id: NodeId,
        env: ParamEnv
    ) -> Result<(usize, &'a StructMember<'a>)> { ... }
fn generated_scope(&self, node: &'a dyn ScopedNode<'a>) -> &'a Scope<'a> { ... }
fn scope_location(&self, node: &'a dyn AnyNode<'a>) -> ScopeLocation<'a> { ... }
fn resolve_local(
        &self,
        name: Name,
        at: ScopeLocation<'a>,
        skip_imports: bool
    ) -> Result<Option<&'a Def<'a>>> { ... }
fn resolve_local_or_error(
        &self,
        name: Spanned<Name>,
        at: ScopeLocation<'a>,
        skip_imports: bool
    ) -> Result<&'a Def<'a>> { ... }
fn resolve_namespace(
        &self,
        name: Name,
        inside: &'a dyn ScopedNode<'a>
    ) -> Option<&'a Def<'a>> { ... }
fn resolve_namespace_or_error(
        &self,
        name: Spanned<Name>,
        inside: &'a dyn ScopedNode<'a>
    ) -> Result<&'a Def<'a>> { ... }
fn resolve_hierarchical(
        &self,
        name: Name,
        inside: &'a dyn ScopedNode<'a>
    ) -> Option<&'a Def<'a>> { ... }
fn resolve_hierarchical_or_error(
        &self,
        name: Spanned<Name>,
        inside: &'a dyn ScopedNode<'a>
    ) -> Result<&'a Def<'a>> { ... }
fn resolve_imported_scope(
        &self,
        node: &'a ImportItem<'a>
    ) -> Result<&'a dyn ScopedNode<'a>> { ... }
fn nameck(&self, node: &'a dyn AnyNode<'a>) -> bool { ... }
fn resolve_inst_target(&self, inst: &'a Inst<'a>) -> Result<InstTarget<'a>> { ... }
fn disamb_kind(&self, arg0: Ref<'a, dyn AnyNode<'a>>) -> Kind { ... }
fn disamb_type_or_expr(
        &self,
        arg0: Ref<'a, TypeOrExpr<'a>>
    ) -> Result<&'a TypeOrExpr<'a>> { ... }
fn type_of(
        &self,
        node_id: NodeId,
        env: ParamEnv
    ) -> Result<&'a UnpackedType<'a>> { ... }
fn type_of_int_port(
        &self,
        arg0: Ref<'a, IntPort<'a>>,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn type_of_ext_port(
        &self,
        arg0: Ref<'a, ExtPort<'a>>,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn type_of_port_decl(
        &self,
        arg0: Ref<'a, VarDeclName<'a>>,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn type_of_var_decl(
        &self,
        arg0: Ref<'a, VarDeclName<'a>>,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn type_of_net_decl(
        &self,
        arg0: Ref<'a, VarDeclName<'a>>,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn type_of_struct_member(
        &self,
        arg0: Ref<'a, VarDeclName<'a>>,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn type_of_value_param(
        &self,
        arg0: Ref<'a, ParamValueDecl<'a>>,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn type_of_inst(
        &self,
        arg0: Ref<'a, Inst<'a>>,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn map_to_type(
        &self,
        arg0: Ref<'a, dyn AnyNode<'a>>,
        env: ParamEnv
    ) -> Option<&'a UnpackedType<'a>> { ... }
fn map_to_type_or_error(
        &self,
        ast: Ref<'a, dyn AnyNode<'a>>,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn packed_type_from_ast(
        &self,
        ast: Ref<'a, Type<'a>>,
        env: ParamEnv,
        implicit_default: Option<PackedCore<'a>>
    ) -> &'a UnpackedType<'a> { ... }
fn unpacked_type_from_ast(
        &self,
        ast_type: Ref<'a, Type<'a>>,
        arg1: Ref<'a, [TypeDim<'a>]>,
        env: ParamEnv,
        implicit_default: Option<PackedCore<'a>>
    ) -> &'a UnpackedType<'a> { ... }
fn type_of_expr(
        &self,
        expr: Ref<'a, Expr<'a>>,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn cast_type(&self, node_id: NodeId, env: ParamEnv) -> Option<CastType<'a>> { ... }
fn cast_expr_type(
        &self,
        arg0: Ref<'a, Expr<'a>>,
        env: ParamEnv
    ) -> CastType<'a> { ... }
fn self_determined_type(
        &self,
        node_id: NodeId,
        env: ParamEnv
    ) -> Option<&'a UnpackedType<'a>> { ... }
fn need_self_determined_type(
        &self,
        node_id: NodeId,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn operation_type(
        &self,
        node_id: NodeId,
        env: ParamEnv
    ) -> Option<&'a UnpackedType<'a>> { ... }
fn need_operation_type(
        &self,
        node_id: NodeId,
        env: ParamEnv
    ) -> &'a UnpackedType<'a> { ... }
fn type_context(
        &self,
        onto: NodeId,
        env: ParamEnv
    ) -> Option<TypeContext<'a>> { ... }
fn need_type_context(
        &self,
        node_id: NodeId,
        env: ParamEnv
    ) -> TypeContext<'a> { ... }
fn constant_value_of(&self, node_id: NodeId, env: ParamEnv) -> Value<'a> { ... }
fn const_mir_rvalue_int(
        &self,
        mir: Ref<'a, Rvalue<'a>>
    ) -> Result<&'a BigInt> { ... }
fn const_mir_rvalue_string(
        &self,
        mir: Ref<'a, Rvalue<'a>>
    ) -> Result<&'a Vec<u8>> { ... }
fn const_mir_rvalue(&self, arg0: Ref<'a, Rvalue<'a>>) -> Value<'a> { ... }
fn is_constant(&self, node_id: NodeId) -> Result<bool> { ... }
fn type_default_value(&self, ty: &'a UnpackedType<'a>) -> Value<'a> { ... }
}
Expand description

A collection of compiler queries.

Associated Types

The type passed as first argument to compiler query implementations.

Required methods

Get the context that is passed to compiler query implementations.

Get the query caches and runtime data.

Provided methods

Called when a query cycle is detected.

Called before a query is executed.

Called after a query is executed.

Lower an AST node to HIR.

Lower a module to HIR.

Lower an interface to HIR.

Lower an AST expression to HIR.

Determine the nodes accessed by another node.

Compute the details of an instantiation.

Compute the details of an instantiated module or interface.

Lower a procedural assign statement.

Lower a concurrent assign statement.

Simplify an MIR assignment to potentially multiple simple MIR assignments.

This eliminates assignments to compound Lvalue objects, for example concatenations, and replaces them with multiple assignments to each of the individual concatenation fields.

Lower an expression to an lvalue in the MIR.

Lower an expression to an rvalue in the MIR.

Compute the parameter bindings for an instantiation.

Determine the mapping of a named or positional '{...} pattern.

Resolve the ports of a module or interface to a canonical list.

This is a fairly complex process due to the many degrees of freedom in SV. Mainly we identify if the item uses an ANSI or non-ANSI style and then go ahead and create the external and internal views of the ports.

Compute the port assignments for an instantiation.

Determine the local rib that applies to a node.

This will return either the rib the node itself generates, or the next rib up the hierarchy.

Determine the hierarchical rib of a node.

This will return a rib containing the hierarchical names exposed by a node.

Resolve a name upwards through the ribs.

This is equivalent to performing regular scoped namespace lookup.

Resolve a name downwards.

This is equivalent to performing a hierarchical name lookup.

Resolve a node to its target.

Obtain the details of a struct definition.

Resolve the field name in a field access expression.

Returns the index of the field that is actually being accessed, and a reference to the member itself.

Determine the scope generated by a node.

Determine the location of a node within its enclosing scope.

Resolve a local name in a scope.

This traverses up the scope tree until a definition with visibility LOCAL is found. Returns None if no such name exists.

Resolve a local name in a scope or emit an error.

Calls resolve_local. Either returns Ok if a node was found, or Err after emitting a diagnostic error message.

Resolve a name in a scope as a namespace lookup.

This checks if the scope contains a definition with visibility NAMESPACE. Returns None if no such name exists.

Resolve a name in a scope as a namespace lookup or emit an error.

Calls resolve_namespace. Either returns Ok if a node was found, or Err after emitting a diagnostic error message.

Resolve a name in a scope as a hierarchical lookup.

This checks if the scope contains a definition with visibility HIERARCHICAL. Returns None if no such name exists.

Resolve a name in a scope as a hierarchical lookup or emit an error.

Calls resolve_hierarchical. Either returns Ok if a node was found, or Err after emitting a diagnostic error message.

Resolve an import to the scope it imports.

This function emits a diagnostic if the target of the import has no scope. Being a query, this ensures that the error is only produced once.

Recursively resolves names throughout the AST.

Returns true if all names resolved successfully, false otherwise. This function helps in triggering name resolution errors at a defined point in the compilation.

Resolve the target of an instantiation.

Determine the kind of a node.

Disambiguate a type or expression.

Determine the type of a node.

Determine the type of an internal port.

Determine the type of an external port.

Determine the type of a port declaration.

Determine the type of a variable declaration.

Determine the type of a net declaration.

Determine the type of a struct member.

Determine the type of a value parameter.

Determine the type of an instance.

Map an AST node to the type it represents.

Returns None if the given AST node does not evaluate to a type.

Map an AST node to the type it represents.

Returns None if the given AST node does not evaluate to a type.

Map a type node in the AST to an packed type.

This is the first half of type computation, and is concerned with the type information that is usually carried on the left of a declaration name. In a separate step, the declarations extend this packed type with the unpacked dimensions provided on the right of the declaration name.

Note that this function nevertheless returns an UnpackedType, since the AST can contain types like string and event, which don’t map to the PackedType struct.

If an implicit default is present, implicit types are expanded to that core type. Otherwise the mapping fails with a diagnostic.

Map a type node and unpacked dimensions in the AST to an unpacked type.

This is the second half of type computation. Maps the given type to a packed type first, then applies the given dimensions as unpacked dimensions.

If an implicit default is present, implicit types are expanded to that core type. Otherwise the mapping fails with a diagnostic.

Determine the type of an expression.

Get the cast type of a node.

Get the cast type of an expression.

Get the self-determined type of a node.

Require a node to have a self-determined type.

Emits an error if the node has no self-determined type.

Get the operation type of an expression.

Require a node to have an operation type.

Emits an error if the node has no operation type.

Get the type context of a node.

Get the type context of a node.

Determine the constant value of a node.

Determine the constant integer value of an MIR rvalue.

Emits a diagnostic if the value is not an integer.

Determine the constant string value of an MIR rvalue.

Emits a diagnostic if the value is not a string.

Determine the constant value of an MIR rvalue.

Check if a node has a constant value.

Determine the default value of a type.

Implementors