Skip to main content

Module segment

Module segment 

Source
Expand description

Token-segment rendering of instructions for rich (colored, clickable) display.

instruction_segments produces the same bytes as an instruction’s Display (InstructionStatement) — concatenating every returned Token’s text reproduces the canonical textual IR exactly — while additionally tagging each run with a semantic TokenKind (for coloring) and an optional Link (for click-through to the referenced value, function, or block). The textual format stays the single source of truth: a test asserts concat(segments) == format!("{insn}") for every mnemonic, so the two can never drift.

Structs§

Token
One contiguous run of rendered text with its semantic kind and optional link.

Enums§

Link
A click-through target carried by a token, when it names something navigable.
TokenKind
What a token is, semantically — drives syntax coloring in a viewer.

Functions§

instruction_segments
Render an instruction as colored, linkable tokens. Concatenating the tokens’ text equals the instruction’s Display (as_statement()) output.
literal_atom
The rendered atom (no <ty> prefix) of the literal id, resolved against the whole &Context so symbolic block/function literals show their target name. This is the full-context twin of LiteralRef’s Display (which, being &Shared-backed, cannot reach body/interface names and falls back to the numeric form). Used by the instruction renderer and the dataflow graph. Concatenating with the type prefix reproduces the pre-narrowing rendering byte-for-byte (context-split stage 5b-ii item #1).
value_tokens
The token stream for a single value operand. Concatenating the token text equals ValueRef’s Display — which is implemented by writing these.
value_tokens_shared
The token stream for a shared-leaf value operand (literal, bytes, varnode), rendered from only the module’s Shared IR state. The &Shared twin of value_tokens for the operands a &Shared-backed ValueRef can hold; symbolic block/function literals fall back to the numeric form (their names live in bodies/interfaces, out of a &Shared’s reach). Panics on arena-cluster ids, which a shared-leaf ref never carries.
value_tokens_view
Provider-generic value rendering used by immutable arena-cluster refs.