m2isar.transforms.encode_instructions.planner
Deterministic, non-mutating planning for 32-bit custom instruction encodings.
The prototype conservatively allocates one namespace across all model containers. It never widens logical operands or infers operand attributes from their names.
Exceptions
An encoding request cannot be satisfied without changing its contract. |
Classes
Functions
|
|
|
|
|
|
|
|
|
Search discriminator bits, pruning subtrees covered by a reservation. |
|
Plan an iterable of unencoded instructions. Optional manifest pins assignments. |
|
Return encoded copies by default; validate everything before in-place updates. |
|
Collect shared instructions once, giving them stable qualified names. |
|
|
|
Apply to a complete model copy, preserving aliases and updating containers. |
Module Contents
- exception EncodingError[source]
Bases:
ValueErrorAn encoding request cannot be satisfied without changing its contract.
- class EncodingPlan[source]
- assignments: Tuple[Assignment, ...][source]
- available_codes(mask, opcodes, occupied, required=(0, 0))[source]
Search discriminator bits, pruning subtrees covered by a reservation.
- plan_encodings(instructions, policy=None, existing=(), assignments=None)[source]
Plan an iterable of unencoded instructions. Optional manifest pins assignments.
Names must be unique. Existing encodings are (code, mask) pairs in this domain. Errors are collected and prevent application of the entire plan.
- apply_encoding_plan(instructions, plan, copy=True)[source]
Return encoded copies by default; validate everything before in-place updates.