[CST-2] Optimising Compilers Questions
Andy Wilson
adw28@cam.ac.uk
Tue, 28 May 2002 21:06:46 +0100 (BST)
On Mon, 27 May 2002, Chris North wrote:
> In 98/P9/Q7 what is the second/third bit going on about?
This is a slightly confusing question because it brings in flowgraphs from
the beginning of the course, whilst talking about flow-variables which are
something completely different -- that really confused me to begin with.
This is especially confusing because he never talks about flowgraphs for
functional languages in the lectures...
> is it something along the lines of
>
> a) for each labeled lambda term we can consider the sequence of instructions
> executed during the execution of each instantiation of the lambda term?
Basically, yes, but not for each instantiation, instead for each
definition. This is, give as examples the "flowgraphs" (basically one
basic block in each case) for "lambda z . ..." and "lambda x . x". For
the first of these, remember that "let ... in" is only a binding
construct, so will not be involved in the flowgraph, instead it will
simply call the "lambda x . x" function twice.
> 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?
HTH,
Andy.
--
\ Andy Wilson adw28@cam.ac.uk Mobile: 07880 500409 ICQ: 94415551
\-- College: Room 38D, Churchill College, CAMBRIDGE CB3 0DS, 01223 331555