From: skaller <skaller@ozemail.com.au>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] flow optimisation q
Date: 03 Jan 2004 13:54:23 +1100 [thread overview]
Message-ID: <1072936720.4626.18.camel@pelican> (raw)
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
next reply other threads:[~2004-01-02 16:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-03 2:54 skaller [this message]
2004-01-02 21:42 ` Jean-Baptiste Rouquier
2004-01-03 18:02 ` Damien Doligez
2004-01-03 18:16 ` skaller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1072936720.4626.18.camel@pelican \
--to=skaller@ozemail.com.au \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox