caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] flow optimisation q
@ 2004-01-03  2:54 skaller
  2004-01-02 21:42 ` Jean-Baptiste Rouquier
  2004-01-03 18:02 ` Damien Doligez
  0 siblings, 2 replies; 4+ messages in thread
From: skaller @ 2004-01-03  2:54 UTC (permalink / raw)
  To: caml-list

Nothing to do with ocaml, but some people here
might know.. Suppose there is a set of
primitive procedures pr1 pr2 and a procedure constructor:

proc = proc list 

which defines a new procedure to be a list of calls
to other procedures, with mutual recursion allowed.

A special procedure is the empty 
procedure whose call list is empty.

Problem: remove all empty procedures
(and of course calls to them).

My current algorithm is functional:
make a new set of procedures which
(a) excludes empty procedures
(b) has calls to empty procedures elided

To make this solve the problem requires
repeated application until there are no
empty procedures left.

I get the feeling there should be a way to do it
a bit more efficiently :-)

A generalisation of this problem is: how to inline?
If a procedure is inlined on all uses, it can be 
discarded. However, one cannot just inline everything,
code gets too bloated. It would seem the length
of a candidate helps decide whether to inline it
or not. However the length isn't well specified,
since calls in *that* procedure might be inlined too.
For example:

proc a {b c d}
proc b {x y z}
proc c {x y z}
proc d {x y z}

If you inline into a first, you get

proc a {x y z x y z x y z}

which is too big to inline, but if you inline
a into another procedure first, you might then
inline b, c, and d, since each is small enough.
[Recursion introduces a similar problem]

Any ideas on how to think about a strategy for this?

[One idea is.. inline everything, and then remove
common code segments .. seems very general but
I don't see any easy way to recognize common
code segments]


-------------------
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-01-03 18:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-03  2:54 [Caml-list] flow optimisation q skaller
2004-01-02 21:42 ` Jean-Baptiste Rouquier
2004-01-03 18:02 ` Damien Doligez
2004-01-03 18:16   ` skaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).