Skip to main content

Module streaming

Module streaming 

Source
Expand description

Feeding the planner and emitter one statement at a time.

For producer implementations. A consumer of p-code lowers an owned PcodeAst with plan_instruction, emit_instruction or lower_instruction, and never needs this module. It exists for a producer — a SLEIGH decoder, say — that would rather not build that instruction-wide AST only to drop it again: the producer resolves its own source template on the fly and hands each statement to a Planner, then an Emitter, as it goes.

The lowering passes in crate::instruction walk a shape: an expression is a literal, an identifier, a load, an operator over sub-expressions, and so on. Nothing in them needs the nodes to be owned Expression values. Abstracting the shape behind ExprNode lets a producer hand the passes a view that resolves its template in place — an operand field to the constant this encoding gave it, a sub-table to what it exports — with nothing allocated to say so.

&Expression is itself an ExprNode, and StmtKind is built from an AstNode with From, so an owned AST is one such shape rather than a special case; the AST entry points above are that shape fed through the same passes.

Re-exports§

pub use crate::instruction::Emitter;
pub use crate::instruction::Planner;
pub use crate::instruction::SizeInference;

Structs§

LoadNode
*[space]:size ptr, with the pointer as a node.
RangeNode
value[start, size], with the value as a node.

Enums§

ExprKind
The shape of one expression node. See ExpressionTy for the meaning of each variant; this is the same inventory with the children abstracted.
LoadSpace
The address space a load or store names.
StmtKind
The shape of one statement. See AstNode for the meaning of each variant.
TargetNode
Where a direct branch or call goes.

Traits§

ExprNode
One p-code expression, generic over how it is stored.