Struct moore_svlog::GlobalContext [−][src]
pub struct GlobalContext<'gcx> {
pub sess: &'gcx Session,
pub arena: &'gcx GlobalArenas<'gcx>,
// some fields omitted
}
Expand description
The central data structure of the compiler. It stores references to various arenas and tables that store the results of the various computations that have been performed.
Fields
sess: &'gcx Session
The global compiler session.
arena: &'gcx GlobalArenas<'gcx>
The arena that owns all references.
Implementations
Create a new global context.
Add an AST root to the context for processing.
Use the find_global_item
function afterwards to look up the id of
modules that were added.
Add an AST root with a series of source files to the context for processing.
Find a module in the AST.
Get an iterator over all modules in the AST.
Find a package in the AST.
Trait Implementations
Get the global context.
Access the arena into which values are to be allocated.
Access the tables.
Emit an internal compiler error that a node is not implemented.
Emit an internal compiler error and message that a node is not
implemented. Same as [unimp
], but the caller can provide a message
prefix. Read more
Allocate a node id for an AST node and associate that id with the node.
Call [map_ast
] and [set_parent
].
Obtain the AST node associated with a node id.
Register an ast::AnyNode
for later retrieval by ID.
Obtain an ast::AnyNode
associated with a node id.
Internalize an HIR node.
Internalize an HIR node.
Lookup an internalized HIR node.
Lookup an internalized HIR node.
Internalize a value.
Internalize a parameter environment.
Get the ParamEnvData
associated with a ParamEnv
.
Get the default parameter environment. Read more
Associate a context with a param env. Read more
Get the contexts associated with a parameter environment. Read more
Associate a parent with a node. Read more
Find the parent node of a node. Read more
Check if a node is the parent of another.
Resolve a name upwards or emit a diagnostic if nothing is found.
Resolve a name downwards or emit a diagnostic if nothing is found.
Set a lowering hint on a node.
Get a lowering hint on a node.
Emit a diagnostic message.
Get the type storage.
Get the context that is passed to compiler query implementations. Read more
Get the query caches and runtime data.
Called when a query cycle is detected.
Called before a query is executed.
Called after a query is executed.
Lower a module to HIR.
Lower an interface to HIR.
Lower an AST expression to HIR.
Determine the nodes accessed by another node.
fn inst_details(
&self,
arg0: Ref<'a, Inst<'a>>,
env: ParamEnv
) -> Result<Arc<InstDetails<'a>>>
fn inst_details(
&self,
arg0: Ref<'a, Inst<'a>>,
env: ParamEnv
) -> Result<Arc<InstDetails<'a>>>
Compute the details of an instantiation.
fn inst_target_details(
&self,
arg0: Ref<'a, InstTarget<'a>>,
env: ParamEnv
) -> Result<Arc<InstTargetDetails<'a>>>
fn inst_target_details(
&self,
arg0: Ref<'a, InstTarget<'a>>,
env: ParamEnv
) -> Result<Arc<InstTargetDetails<'a>>>
Compute the details of an instantiated module or interface.
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_procedural(
&self,
origin: NodeId,
lhs: NodeId,
rhs: NodeId,
env: ParamEnv,
span: Span,
kind: AssignKind
) -> &'a Assignment<'a>
Lower a procedural assign statement.
fn mir_assignment_from_concurrent(
&self,
arg0: Ref<'a, Assign>,
env: ParamEnv
) -> &'a Assignment<'a>
fn mir_assignment_from_concurrent(
&self,
arg0: Ref<'a, Assign>,
env: ParamEnv
) -> &'a Assignment<'a>
Lower a concurrent assign statement.
fn mir_simplify_assignment(
&self,
arg0: Ref<'a, Assignment<'a>>
) -> Vec<&'a Assignment<'a>>ⓘ
fn mir_simplify_assignment(
&self,
arg0: Ref<'a, Assignment<'a>>
) -> Vec<&'a Assignment<'a>>ⓘ
Simplify an MIR assignment to potentially multiple simple MIR assignments. Read more
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.
fn map_pattern(
&self,
arg0: Ref<'a, Expr<'a>>,
env: ParamEnv
) -> Result<Arc<PatternMapping<'a>>>
fn map_pattern(
&self,
arg0: Ref<'a, Expr<'a>>,
env: ParamEnv
) -> Result<Arc<PatternMapping<'a>>>
Determine the mapping of a named or positional '{...}
pattern.
Resolve the ports of a module or interface to a canonical list. Read more
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 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>>>
Compute the port assignments for an instantiation.
Determine the local rib that applies to a node. Read more
Determine the hierarchical rib of a node. Read more
Resolve a name upwards through the ribs. Read more
Resolve a name downwards. Read more
Resolve a node to its target.
Obtain the details of a struct definition.
fn resolve_field_access(
&self,
node_id: NodeId,
env: ParamEnv
) -> Result<(usize, &'a StructMember<'a>)>
fn resolve_field_access(
&self,
node_id: NodeId,
env: ParamEnv
) -> Result<(usize, &'a StructMember<'a>)>
Resolve the field name in a field access expression. Read more
Determine the scope generated by a node.
Determine the location of a node within its enclosing scope.
fn resolve_local(
&self,
name: Name,
at: ScopeLocation<'a>,
skip_imports: bool
) -> Result<Option<&'a Def<'a>>>
fn resolve_local(
&self,
name: Name,
at: ScopeLocation<'a>,
skip_imports: bool
) -> Result<Option<&'a Def<'a>>>
Resolve a local name in a scope. Read more
fn resolve_local_or_error(
&self,
name: Spanned<Name>,
at: ScopeLocation<'a>,
skip_imports: bool
) -> Result<&'a Def<'a>>
fn resolve_local_or_error(
&self,
name: Spanned<Name>,
at: ScopeLocation<'a>,
skip_imports: bool
) -> Result<&'a Def<'a>>
Resolve a local name in a scope or emit an error. Read more
fn resolve_namespace(
&self,
name: Name,
inside: &'a dyn ScopedNode<'a>
) -> Option<&'a Def<'a>>
fn resolve_namespace(
&self,
name: Name,
inside: &'a dyn ScopedNode<'a>
) -> Option<&'a Def<'a>>
Resolve a name in a scope as a namespace lookup. Read more
fn resolve_namespace_or_error(
&self,
name: Spanned<Name>,
inside: &'a dyn ScopedNode<'a>
) -> Result<&'a Def<'a>>
fn resolve_namespace_or_error(
&self,
name: Spanned<Name>,
inside: &'a dyn ScopedNode<'a>
) -> Result<&'a Def<'a>>
Resolve a name in a scope as a namespace lookup or emit an error. Read more
fn resolve_hierarchical(
&self,
name: Name,
inside: &'a dyn ScopedNode<'a>
) -> Option<&'a Def<'a>>
fn resolve_hierarchical(
&self,
name: Name,
inside: &'a dyn ScopedNode<'a>
) -> Option<&'a Def<'a>>
Resolve a name in a scope as a hierarchical lookup. Read more
fn resolve_hierarchical_or_error(
&self,
name: Spanned<Name>,
inside: &'a dyn ScopedNode<'a>
) -> Result<&'a Def<'a>>
fn resolve_hierarchical_or_error(
&self,
name: Spanned<Name>,
inside: &'a dyn ScopedNode<'a>
) -> Result<&'a Def<'a>>
Resolve a name in a scope as a hierarchical lookup or emit an error. Read more
Resolve an import to the scope it imports. Read more
Recursively resolves names throughout the AST. Read more
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.
fn type_of_port_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_port_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of a port declaration.
fn type_of_var_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>
Determine the type of a variable declaration.
fn type_of_net_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>
Determine the type of a net declaration.
fn type_of_struct_member(
&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>
Determine the type of a struct member.
fn type_of_value_param(
&self,
arg0: Ref<'a, ParamValueDecl<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_value_param(
&self,
arg0: Ref<'a, ParamValueDecl<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of a value parameter.
Determine the type of an instance.
fn map_to_type(
&self,
arg0: Ref<'a, dyn AnyNode<'a>>,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>>
fn map_to_type(
&self,
arg0: Ref<'a, dyn AnyNode<'a>>,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>>
Map an AST node to the type it represents. Read more
fn map_to_type_or_error(
&self,
ast: Ref<'a, dyn AnyNode<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn map_to_type_or_error(
&self,
ast: Ref<'a, dyn AnyNode<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Map an AST node to the type it represents. Read more
fn packed_type_from_ast(
&self,
ast: Ref<'a, Type<'a>>,
env: ParamEnv,
implicit_default: Option<PackedCore<'a>>
) -> &'a UnpackedType<'a>
fn packed_type_from_ast(
&self,
ast: Ref<'a, Type<'a>>,
env: ParamEnv,
implicit_default: Option<PackedCore<'a>>
) -> &'a UnpackedType<'a>
Map a type node in the AST to an packed type. Read more
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 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>
Map a type node and unpacked dimensions in the AST to an unpacked type. Read more
Determine the type of an expression.
Get the cast type of a node.
Get the cast type of an expression.
fn self_determined_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>>
fn self_determined_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>>
Get the self-determined type of a node.
Require a node to have a self-determined type. Read more
Get the operation type of an expression.
Require a node to have an operation type. Read more
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. Read more
Determine the constant string value of an MIR rvalue. Read more
Determine the constant value of an MIR rvalue.
Check if a node has a constant value.
Determine the default value of a type.