ivory-opts-0.1.0.1: Ivory compiler optimizations.

Safe HaskellNone

Ivory.Opts.CFG

Contents

Synopsis

Documentation

callGraphDot :: CallNm -> FilePath -> [Module] -> IO CFGSource

Call-graph output. Takes a start function foo, a filepath, and emits the graph named foo.dot in the filepath.

Generate a dot file of the control flow for a program.

data SizeMap Source

Constructors

SizeMap 

Fields

stackElemMap :: StackType -> Size

Mapping from StackType to their implementation-dependent size.

retSize :: Size

Size of a return address.

Implementation-defined size map for stack elements.

defaultSizeMap :: SizeMapSource

Maps everything to being size 1. Useful for testing.

hasLoop :: CFG -> BoolSource

Does the program have a loop in it?

Does the control-flow graph contain a loop?

data WithTop a Source

Add Top to a type.

Instances

maxStack :: CallNm -> CFG -> SizeMap -> WithTop SizeSource

Takes a procedure name, a control-flow graph, and a SizeMap and produces the maximum stack usage starting at the procedure give. Returns Top if there is an unanalyzable loop in the program (ie., non-constant loop) and Val max otherwise.

What is the maximum stack size of the program?