CIRCT 23.0.0git
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
esiaccel.codegen.CppTypePlanner Class Reference

Public Member Functions

None __init__ (self, type_table)
 

Public Attributes

 has_cycle
 
 ordered_types
 

Protected Member Functions

None _prepare_types (self, type_table)
 
str _sanitize_name (self, str name)
 
str _reserve_name (self, str base, bool is_alias)
 
str _auto_struct_name (self, types.StructType struct_type)
 
List[types.ESIType_iter_type_children (self, types.ESIType t)
 
None _visit_types (self, types.ESIType t, Set[str] visited, visit_fn)
 
None _collect_aliases (self, types.ESIType t, Set[str] visited)
 
None _collect_structs (self, types.ESIType t, Set[str] visited)
 
Set[types.ESIType_collect_decls_from_type (self, types.ESIType wrapped)
 
Tuple[List[types.ESIType], bool] _ordered_emit_types (self)
 

Detailed Description

Plan C++ type naming and ordering from an ESI manifest.

Definition at line 84 of file codegen.py.

Constructor & Destructor Documentation

◆ __init__()

None esiaccel.codegen.CppTypePlanner.__init__ (   self,
  type_table 
)

Member Function Documentation

◆ _auto_struct_name()

str esiaccel.codegen.CppTypePlanner._auto_struct_name (   self,
types.StructType  struct_type 
)
protected
Derive a deterministic name for anonymous structs from their fields.

Definition at line 145 of file codegen.py.

References esiaccel.codegen.CppTypePlanner._reserve_name(), and esiaccel.codegen.CppTypePlanner._sanitize_name().

Referenced by esiaccel.codegen.CppTypePlanner._collect_structs().

◆ _collect_aliases()

None esiaccel.codegen.CppTypePlanner._collect_aliases (   self,
types.ESIType  t,
Set[str]  visited 
)
protected

◆ _collect_decls_from_type()

Set[types.ESIType] esiaccel.codegen.CppTypePlanner._collect_decls_from_type (   self,
types.ESIType  wrapped 
)
protected
Collect types that require top-level declarations for a given type.

Definition at line 207 of file codegen.py.

References esiaccel.codegen.CppTypePlanner._visit_types().

Referenced by esiaccel.codegen.CppTypePlanner._ordered_emit_types().

◆ _collect_structs()

None esiaccel.codegen.CppTypePlanner._collect_structs (   self,
types.ESIType  t,
Set[str]  visited 
)
protected
Scan for structs needing auto-names and reserve them (recursive).

Definition at line 193 of file codegen.py.

References esiaccel.codegen.CppTypePlanner._auto_struct_name(), esiaccel.codegen.CppTypePlanner._visit_types(), and esiaccel.codegen.CppTypeEmitter.type_id_map.

Referenced by esiaccel.codegen.CppTypePlanner._prepare_types().

◆ _iter_type_children()

List[types.ESIType] esiaccel.codegen.CppTypePlanner._iter_type_children (   self,
types.ESIType  t 
)
protected
Return child types in a stable order for traversal.

Definition at line 153 of file codegen.py.

Referenced by esiaccel.codegen.CppTypePlanner._visit_types().

◆ _ordered_emit_types()

Tuple[List[types.ESIType], bool] esiaccel.codegen.CppTypePlanner._ordered_emit_types (   self)
protected
Collect and order types for deterministic emission.

Definition at line 226 of file codegen.py.

References esiaccel.codegen.CppTypePlanner._collect_decls_from_type(), and esiaccel.codegen.CppTypeEmitter.type_id_map.

◆ _prepare_types()

None esiaccel.codegen.CppTypePlanner._prepare_types (   self,
  type_table 
)
protected
Name the types and prepare for emission by registering all reachable
types and assigning.

Definition at line 99 of file codegen.py.

References esiaccel.codegen.CppTypePlanner._collect_aliases(), and esiaccel.codegen.CppTypePlanner._collect_structs().

◆ _reserve_name()

str esiaccel.codegen.CppTypePlanner._reserve_name (   self,
str  base,
bool  is_alias 
)
protected
Reserve a globally unique identifier using the sanitized base name.

Definition at line 129 of file codegen.py.

References esiaccel.codegen.CppTypePlanner._sanitize_name().

Referenced by esiaccel.codegen.CppTypePlanner._auto_struct_name(), and esiaccel.codegen.CppTypePlanner._collect_aliases().

◆ _sanitize_name()

str esiaccel.codegen.CppTypePlanner._sanitize_name (   self,
str  name 
)
protected
Create a C++-safe identifier from the manifest-provided name.

Definition at line 112 of file codegen.py.

References isdigit.

Referenced by esiaccel.codegen.CppTypePlanner._auto_struct_name(), and esiaccel.codegen.CppTypePlanner._reserve_name().

◆ _visit_types()

None esiaccel.codegen.CppTypePlanner._visit_types (   self,
types.ESIType  t,
Set[str]  visited,
  visit_fn 
)
protected

Member Data Documentation

◆ has_cycle

esiaccel.codegen.CppTypePlanner.has_cycle

Definition at line 96 of file codegen.py.

Referenced by esiaccel.codegen.CppTypeEmitter.write_header().

◆ ordered_types

esiaccel.codegen.CppTypePlanner.ordered_types

The documentation for this class was generated from the following file: