to_blocks: Convert an ASTNode Object to Basic Blocks

View source: R/to_blocks.R

to_blocksR Documentation

Convert an ASTNode Object to Basic Blocks

Description

This function converts an ASTNode object or a quoted R expression into a list of basic blocks. When the root of the AST is a Function object, the CFG is built for its body.

Usage

to_blocks(node, in_place = FALSE, ssa = TRUE, insert_return = TRUE)

Arguments

node

A quoted R expression or an abstract syntax tree.

in_place

(logical) Operate on the node in place? If TRUE, the node will be modified.

ssa

(logical) Also convert to static single assignment form?

insert_return

(logical) Apply insert_return() to the node before generating the CFG?

Details

Each basic block contains a sequence of non-branching program instructions. Each basic block ends with an instruction that branches to one or more other basic blocks.

Value

A Function node with the control flow graph in its $cfg field.


nick-ulle/ast documentation built on May 14, 2024, 7:40 p.m.