From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA18793; Fri, 2 Jan 2004 17:14:25 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA18127 for ; Fri, 2 Jan 2004 17:14:24 +0100 (MET) Received: from mail3.tpgi.com.au (mail.tpgi.com.au [203.12.160.59]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i02FsUv03604 for ; Fri, 2 Jan 2004 16:56:39 +0100 (MET) Received: from 203-213-127-17-syd-ts20-2600.tpgi.com.au (203-213-127-17-syd-ts20-2600.tpgi.com.au [203.213.127.17]) by mail3.tpgi.com.au (8.11.6/8.11.6) with ESMTP id i02FsPW21442 for ; Sat, 3 Jan 2004 02:54:26 +1100 Subject: [Caml-list] flow optimisation q From: skaller Reply-To: skaller@ozemail.com.au To: caml-list Content-Type: text/plain Message-Id: <1072936720.4626.18.camel@pelican> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 03 Jan 2004 13:54:23 +1100 Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; ozemail:01 recursion:01 elided:01 inlined:01 inlined:01 recursion:01 ocaml:01 discarded:02 algorithm:03 inline:03 inline:03 constructor:03 suppose:03 proc:05 proc:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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