Expand description
§rust-rvsdg
This crate provides a mostly type-safe way of constructing and analyzing a RVSDG
For developer familiarity, most node kinds have been renamed.
- Gamma -> Switch
- Theta -> DoWhile
- Delta -> GlobalV
- Phi -> RecEnv
- Omega -> TranslationUnit
RecEnv nodes are created automatically when cyclic Lambda connections are made.
§Constructing an RVSDG
use rvsdg::{Context, nodes::Add};
let mut ctx = Context::new("my testing graph");
let (f_output, f_region) = ctx.add_lambda_node();
ctx.in_region(f_region, |ctx| {
let one = ctx.add_number_node(1);
let two = ctx.add_number_node(2);
let ([x, y], addition) = ctx.add_binop_node::<Add>();
ctx.connect(one, x);
ctx.connect(two, y);
let returned = ctx.add_result();
ctx.connect(addition, returned);
});
let apply_input = ctx.add_apply_node();
ctx.connect(f_output, apply_input);§Status
Currently this crate is in an highly experimental phase.
§Exporting an RVSDG
If rvsdg-viewer is installed,
you can use Context::open_rvsdg_viewer.
Re-exports§
Modules§
- id
- Raw ID types mapping to vectors in
crate::Context - nodes
- Default Node kinds and traits for declaring your own
Macros§
Structs§
- Argument
- Argument
idbelonging toregion - Context
- The context for a whole translation unit and the core struct of this crate.
- Entity
Iter - Input
- Input
idbelonging tonode - Node
Hooks - Event handlers for changes being made to the node or its contained regions.
- Output
- Output
idbelonging tonode - Result
- Result
idbelonging toregion
Enums§
- Connection
- The result of attempting to connect an origin to a user
- Origin
- An origin port
- User
- An user port