[CST-2] Optimising Compilers Questions

Andy Wilson adw28@cam.ac.uk
Thu, 30 May 2002 13:38:30 +0100 (BST)


On Tue, 28 May 2002, Andy Wilson wrote:

> > b) Standard definition of call graphs, but for any possible execution of the
> > lambda term?
>
> When our supervisor talked about this question, he drew arrows everywhere,
> i.e. from the first function to the second function and back, from the
> first to itself, and the second to itself.  I think he argued that the
> compiler couldn't tell which function "id" could refer to -- I guess
> that's the whole point of the question: the flow-variables tell you which
> function(s) it could refer to.
>
> Hmmm... thinking about it, I'm not sure why our supervisor drew arrows
> _from_ the "lambda x . x" function, because it doesn't call anything.
> Any thoughts anyone?

My supervisor has given the following clarification:

> I meant the "arrows everywhere" version to be a safe approximation to
> the dynamic call graph: that is, if you don't do any analysis of the
> code, drawing a arc from every function to every other function is
> bound to be safe.
>
> Of course, there are lots of trivial analyses that will improve on it --
> as you say, spotting that the "lambda x.x" function does not contain any
> calls will remove one of the arcs, and spotting that the "lambda z...."
> one is never bound to an identifier or on the left hand side of a
> function call node will remove another arc.

HTH,

Andy.