futhark-0.25.32: An optimising compiler for a functional, array-oriented language.
Safe HaskellNone
LanguageGHC2021

Futhark.Analysis.CallGraph

Description

This module exports functionality for generating a call graph of an Futhark program.

Synopsis

Documentation

data CallGraph Source #

The call graph is a mapping from a function name, i.e., the caller, to a record of the names of functions called *directly* (not transitively!) by the function.

We keep track separately of the functions called by constants.

Instances

Instances details
Show CallGraph Source # 
Instance details

Defined in Futhark.Analysis.CallGraph

Methods

showsPrec :: Int -> CallGraph -> ShowS

show :: CallGraph -> String

showList :: [CallGraph] -> ShowS

Eq CallGraph Source # 
Instance details

Defined in Futhark.Analysis.CallGraph

Methods

(==) :: CallGraph -> CallGraph -> Bool

(/=) :: CallGraph -> CallGraph -> Bool

Ord CallGraph Source # 
Instance details

Defined in Futhark.Analysis.CallGraph

Methods

compare :: CallGraph -> CallGraph -> Ordering

(<) :: CallGraph -> CallGraph -> Bool

(<=) :: CallGraph -> CallGraph -> Bool

(>) :: CallGraph -> CallGraph -> Bool

(>=) :: CallGraph -> CallGraph -> Bool

max :: CallGraph -> CallGraph -> CallGraph

min :: CallGraph -> CallGraph -> CallGraph

Pretty CallGraph Source # 
Instance details

Defined in Futhark.Analysis.CallGraph

Methods

pretty :: CallGraph -> Doc ann Source #

prettyList :: [CallGraph] -> Doc ann Source #

buildCallGraph :: Prog SOACS -> CallGraph Source #

buildCallGraph prog build the program's call graph.

isFunInCallGraph :: Name -> CallGraph -> Bool Source #

Is the given function known to the call graph?

calls :: Name -> Name -> CallGraph -> Bool Source #

Does the first function call the second?

calledByConsts :: Name -> CallGraph -> Bool Source #

Is the function called in any of the constants?

allCalledBy :: Name -> CallGraph -> Set Name Source #

All functions called by this function.

numOccurences :: CallGraph -> Map Name Int Source #

Produce a mapping of the number of occurences in the call graph of each function. Only counts functions that are called at least once.