Skip to main content

Module transform

Module transform 

Source
Expand description

Rewrites the syntax tree toward lowering.

resolve_settings folds if branches, demacroify expands macros, resolve_offsets substitutes offsets, and fold folds constants. validate checks earlier stages left nothing behind. resolve runs the demacroify, offset, and fold stages in order.

Functionsยง

demacroify
Expands every macro invocation in node.
demacroify_recording
Expands macros like demacroify, also returning label renames.
fold
Folds constant sub-expressions in node with wrapping arithmetic.
offset_keys
Collects the offset, size, and const keys node references.
resolve
Runs demacroify, then resolve_offsets, then constant-folds the result.
resolve_offsets
Substitutes each offset node in node with the integer map holds.
resolve_settings
Substitutes each Node::Setting in node per settings.
validate
Checks that expansion and offset stages already ran over node.