ivory-opts-0.1.0.6: Ivory compiler optimizations.

Safe HaskellNone
LanguageHaskell2010

Ivory.Opts.CFG

Contents

Synopsis

Documentation

callGraphDot :: CallNm -> FilePath -> [Module] -> IO CFG Source #

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 :: SizeMap Source #

Maps everything to being size 1. Useful for testing.

hasLoop :: CFG -> Bool Source #

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
Functor WithTop Source # 
Instance details

Defined in Ivory.Opts.CFG

Methods

fmap :: (a -> b) -> WithTop a -> WithTop b #

(<$) :: a -> WithTop b -> WithTop a #

Applicative WithTop Source # 
Instance details

Defined in Ivory.Opts.CFG

Methods

pure :: a -> WithTop a #

(<*>) :: WithTop (a -> b) -> WithTop a -> WithTop b #

liftA2 :: (a -> b -> c) -> WithTop a -> WithTop b -> WithTop c #

(*>) :: WithTop a -> WithTop b -> WithTop b #

(<*) :: WithTop a -> WithTop b -> WithTop a #

Eq a => Eq (WithTop a) Source # 
Instance details

Defined in Ivory.Opts.CFG

Methods

(==) :: WithTop a -> WithTop a -> Bool #

(/=) :: WithTop a -> WithTop a -> Bool #

Ord a => Ord (WithTop a) Source # 
Instance details

Defined in Ivory.Opts.CFG

Methods

compare :: WithTop a -> WithTop a -> Ordering #

(<) :: WithTop a -> WithTop a -> Bool #

(<=) :: WithTop a -> WithTop a -> Bool #

(>) :: WithTop a -> WithTop a -> Bool #

(>=) :: WithTop a -> WithTop a -> Bool #

max :: WithTop a -> WithTop a -> WithTop a #

min :: WithTop a -> WithTop a -> WithTop a #

Show a => Show (WithTop a) Source # 
Instance details

Defined in Ivory.Opts.CFG

Methods

showsPrec :: Int -> WithTop a -> ShowS #

show :: WithTop a -> String #

showList :: [WithTop a] -> ShowS #

maxStack :: CallNm -> CFG -> SizeMap -> WithTop Size Source #

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?