Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] generating a call-graph
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] generating a call-graph
> Does anyone know a way of generating a call-graph from a set of ocaml
> sources?  What I want to do is, at a minimum, get a list of all the
> functions that could be called as a result of a given function invocation.

This requires a non-trivial static analysis called "control flow
analysis" in the literature; particular instances include Shivers'
0-CFA and k-CFA, Jagannathan and Wright's "polymorphic splitting",
etc.

The difficulty is that functions are first-class values, so the
function you're applying can be a parameter to another function, or a
member of a data structure.  (Objects raise similar issues.)
Thus, the control flow cannot be determined independently of the data
flow, and "control flow analysis" is really a data flow analysis that
tracks the flow of functional values.

I don't know of any implementation of control-flow analysis for the
whole OCaml language.

- Xavier Leroy

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners