|
CIRCT 23.0.0git
|
Public Member Functions | |
| None | __init__ (self, type_table) |
Public Attributes | |
| has_cycle | |
| ordered_types | |
Plan C++ type naming and ordering from an ESI manifest.
Definition at line 682 of file codegen.py.
| None esiaccel.codegen.CppTypePlanner.__init__ | ( | self, | |
| type_table | |||
| ) |
Initialize the generator with the manifest and target namespace.
Definition at line 685 of file codegen.py.
References esiaccel.codegen.CppTypePlanner.ordered_types, esiaccel.codegen.CppTypeEmitter.ordered_types, esiaccel.codegen.CppTypeEmitter.skipped_types, and esiaccel.codegen.CppTypeEmitter.type_id_map.
Referenced by synth.LongestPathCollection.drop_non_critical_paths(), and synth.LongestPathCollection.merge().
|
protected |
Derive a deterministic name for anonymous structs from their fields.
Definition at line 751 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._reserve_name(), and esiaccel.codegen.CppTypePlanner._sanitize_name().
Referenced by esiaccel.codegen.CppTypePlanner._collect_structs().
|
protected |
Derive a deterministic name for anonymous unions from their fields.
Definition at line 759 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._reserve_name(), and esiaccel.codegen.CppTypePlanner._sanitize_name().
Referenced by esiaccel.codegen.CppTypePlanner._collect_structs().
|
protected |
Derive a deterministic name for generated window helpers. Two distinct windows can wrap the same `into` struct (e.g. serial and parallel encodings of the same payload), so the helper name must be derived from BOTH the inner type's name and the window's own name/id.
Definition at line 767 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._reserve_name(), esiaccel.codegen.CppTypePlanner._sanitize_name(), esiaccel.codegen.CppTypePlanner._unwrap_aliases(), esiaccel.codegen.CppTypeEmitter._unwrap_aliases(), and esiaccel.codegen.CppTypeEmitter.type_id_map.
Referenced by esiaccel.codegen.CppTypePlanner._collect_windows().
|
protected |
Scan for aliases and reserve their names (recursive).
Definition at line 860 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._reserve_name(), esiaccel.codegen.CppTypePlanner._visit_types(), and esiaccel.codegen.CppTypeEmitter.type_id_map.
Referenced by esiaccel.codegen.CppTypePlanner._prepare_types().
|
protected |
Collect types that require top-level declarations for a given type.
Definition at line 900 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._is_supported_window(), and esiaccel.codegen.CppTypePlanner._visit_types().
Referenced by esiaccel.codegen.CppTypePlanner._collect_decls_from_window(), and esiaccel.codegen.CppTypePlanner._ordered_emit_types().
|
protected |
Collect only the declarations referenced by a generated window helper.
Definition at line 924 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._collect_decls_from_type(), esiaccel.codegen.CppTypePlanner._unwrap_aliases(), and esiaccel.codegen.CppTypeEmitter._unwrap_aliases().
Referenced by esiaccel.codegen.CppTypePlanner._ordered_emit_types().
|
protected |
Scan for structs/unions needing auto-names and reserve them.
Definition at line 873 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._auto_struct_name(), esiaccel.codegen.CppTypePlanner._auto_union_name(), esiaccel.codegen.CppTypePlanner._visit_types(), and esiaccel.codegen.CppTypeEmitter.type_id_map.
Referenced by esiaccel.codegen.CppTypePlanner._prepare_types().
|
protected |
Scan for supported window types and reserve helper names.
Definition at line 887 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._auto_window_name(), esiaccel.codegen.CppTypePlanner._is_supported_window(), esiaccel.codegen.CppTypePlanner._visit_types(), and esiaccel.codegen.CppTypeEmitter.type_id_map.
Referenced by esiaccel.codegen.CppTypePlanner._prepare_types().
|
protected |
Return True if `esi_type` is or transitively contains a type with no bounded bit width (e.g. `!esi.any`, or a list that the window helper can't wrap). A struct can't be emitted as a fixed-size raw-bytes buffer if any field's width is unbounded — there's no `std::array<uint8_t, N>` size that would match the wire layout — so the planner excludes such structs (and aliases/unions/arrays that reach one) from the emission list, the same way `_contains_window` does for nested windows.
Definition at line 959 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._contains_unbounded(), esiaccel.codegen.CppTypePlanner._unwrap_aliases(), and esiaccel.codegen.CppTypeEmitter._unwrap_aliases().
Referenced by esiaccel.codegen.CppTypePlanner._contains_unbounded(), and esiaccel.codegen.CppTypePlanner._ordered_emit_types().
|
protected |
Return True if `esi_type` is or transitively contains a WindowType. Structs (and aliases/unions that reference them) which embed a window cannot be emitted as C++ packed structs because the C++ window helper is a variable-size multi-frame container. This helper is used to exclude such types from the emission list entirely.
Definition at line 940 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._contains_window(), esiaccel.codegen.CppTypePlanner._unwrap_aliases(), and esiaccel.codegen.CppTypeEmitter._unwrap_aliases().
Referenced by esiaccel.codegen.CppTypePlanner._contains_window(), and esiaccel.codegen.CppTypePlanner._ordered_emit_types().
|
protected |
Definition at line 791 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._unwrap_aliases(), and esiaccel.codegen.CppTypeEmitter._unwrap_aliases().
Referenced by esiaccel.codegen.CppTypePlanner._collect_decls_from_type(), esiaccel.codegen.CppTypePlanner._collect_windows(), and esiaccel.codegen.CppTypePlanner._ordered_emit_types().
|
protected |
Return child types in a stable order for traversal.
Definition at line 827 of file codegen.py.
Referenced by esiaccel.codegen.CppTypePlanner._visit_types().
|
protected |
Collect and order types for deterministic emission.
Definition at line 984 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._collect_decls_from_type(), esiaccel.codegen.CppTypePlanner._collect_decls_from_window(), esiaccel.codegen.CppTypePlanner._contains_unbounded(), esiaccel.codegen.CppTypePlanner._contains_window(), esiaccel.codegen.CppTypePlanner._is_supported_window(), esiaccel.codegen.CppTypePlanner._unwrap_aliases(), esiaccel.codegen.CppTypeEmitter._unwrap_aliases(), append(), esiaccel.codegen.CppTypeEmitter.skipped_types, and esiaccel.codegen.CppTypeEmitter.type_id_map.
|
protected |
Name the types and prepare for emission by registering all reachable types and assigning.
Definition at line 701 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._collect_aliases(), esiaccel.codegen.CppTypePlanner._collect_structs(), and esiaccel.codegen.CppTypePlanner._collect_windows().
|
protected |
Reserve a globally unique identifier using the sanitized base name.
Definition at line 735 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._sanitize_name().
Referenced by esiaccel.codegen.CppTypePlanner._auto_struct_name(), esiaccel.codegen.CppTypePlanner._auto_union_name(), esiaccel.codegen.CppTypePlanner._auto_window_name(), and esiaccel.codegen.CppTypePlanner._collect_aliases().
|
protected |
Create a C++-safe identifier from the manifest-provided name.
Definition at line 718 of file codegen.py.
References isdigit.
Referenced by esiaccel.codegen.CppTypePlanner._auto_struct_name(), esiaccel.codegen.CppTypePlanner._auto_union_name(), esiaccel.codegen.CppTypePlanner._auto_window_name(), and esiaccel.codegen.CppTypePlanner._reserve_name().
|
protected |
Definition at line 786 of file codegen.py.
Referenced by esiaccel.codegen.CppTypeEmitter._analyze_window(), esiaccel.codegen.CppTypePlanner._auto_window_name(), esiaccel.codegen.CppTypePlanner._collect_decls_from_window(), esiaccel.codegen.CppTypePlanner._contains_unbounded(), esiaccel.codegen.CppTypePlanner._contains_window(), esiaccel.codegen.CppTypeEmitter._ctor_param_type(), esiaccel.codegen.CppTypeEmitter._emit_field_accessor(), esiaccel.codegen.CppTypeEmitter._format_window_ctor_param(), esiaccel.codegen.CppTypeEmitter._is_byte_packable(), esiaccel.codegen.CppTypeEmitter._is_signed_int_field(), esiaccel.codegen.CppTypePlanner._is_supported_window(), esiaccel.codegen.CppTypeEmitter._is_value_class_type(), and esiaccel.codegen.CppTypePlanner._ordered_emit_types().
|
protected |
Traverse types with alphabetical child ordering in post-order.
Definition at line 847 of file codegen.py.
References esiaccel.codegen.CppTypePlanner._iter_type_children(), and esiaccel.codegen.CppTypePlanner._visit_types().
Referenced by esiaccel.codegen.CppTypePlanner._collect_aliases(), esiaccel.codegen.CppTypePlanner._collect_decls_from_type(), esiaccel.codegen.CppTypePlanner._collect_structs(), esiaccel.codegen.CppTypePlanner._collect_windows(), and esiaccel.codegen.CppTypePlanner._visit_types().
| esiaccel.codegen.CppTypePlanner.has_cycle |
Definition at line 698 of file codegen.py.
Referenced by esiaccel.codegen.CppTypeEmitter.write_header().
| esiaccel.codegen.CppTypePlanner.ordered_types |
Definition at line 716 of file codegen.py.
Referenced by esiaccel.codegen.CppTypePlanner.__init__(), and esiaccel.codegen.CppTypeEmitter.write_header().