cfg

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2021 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GraphViz

func GraphViz(cfg *CFG, cfgFuncs map[string]*CFG) *gographviz.Graph

Types

type CFG

type CFG struct {
	Entry *Node
	Exits []*Node
}

func New

func New(prog ast.Program) (*CFG, map[string]*CFG)

New returns the CFG of the top-level expressions and a map of FuncDecls to CFGs

func (*CFG) Visit

func (cfg *CFG) Visit(f func(*Node))

Visit runs the given closure over the CFG in DFS preorder

type Node

type Node struct {
	SuccNotTaken  *Node
	SuccTaken     *Node
	PredsNotTaken []*Node
	PredsTaken    []*Node
	FuncSucc      *Node // TODO: Fill these
	Label         int
	Expr          ast.Expr
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL