Re: [CIL users] optimizations with pointers

2009-09-09 Thread John Regehr
> On a big tangent, has anyone ever been tempted to recast Cil's > analyses and optimizations in a composable framework, a la [1]? We did a bit of work in this direction: http://www.cs.utah.edu/~regehr/papers/lctes06_1/ http://www.cs.utah.edu/~coop/research/cxprop/ John Regehr ---

Re: [CIL users] optimizations with pointers

2009-09-09 Thread Benjamin Ylvisaker
I understand that _in general_ determining what a pointer points to at compile time is undecidable. I think what I want is a conservative points-to enhanced constant propagation (followed by dead code elimination to hopefully remove the address-of expression entirely). It sounds like I ca

Re: [CIL users] optimizations with pointers

2009-09-09 Thread Gabriel Kerneis
Hello, On Wed, Sep 09, 2009 at 05:39:46PM +0100, Alastair Reid wrote: > 1) Use a visitor to identify all variables whose address is taken. Cil does it for you. Cf. type varinfo, mutable vaddrof in the doc: http://hal.cs.berkeley.edu/cil/api/Cil.html#TYPEvarinfo Regards, -- Gabriel Kerneis

Re: [CIL users] optimizations with pointers

2009-09-09 Thread Alastair Reid
e- From: Benjamin Ylvisaker [mailto:benjam...@fastmail.fm] Sent: 09 September 2009 06:34 To: CIL Mailing List Subject: [CIL users] optimizations with pointers Does anyone know if there is any existing optimization in Cil that will do the translation of int a

Re: [CIL users] optimizations with pointers

2009-09-09 Thread Stephen Magill
I haven't tried this, but I suspect a pointer analysis could help you obtain a more general solution. Take a look at ptranal.ml in the cil src/ext/pta directory. There will still be a lot of cases where this won't work though (due, as Gabriel pointed out, to the undecidability of the problem in g

Re: [CIL users] optimizations with pointers

2009-09-08 Thread Gabriel Kerneis
On Tue, Sep 08, 2009 at 10:33:46PM -0700, Benjamin Ylvisaker wrote: > Does anyone know if there is any existing optimization in Cil that > will do the translation of > >int a; >int *b = &a; >*b = 4; >... > > into > >int a; >int *b = &a; >a = 4; >... > > ? This

[CIL users] optimizations with pointers

2009-09-08 Thread Benjamin Ylvisaker
Does anyone know if there is any existing optimization in Cil that will do the translation of int a; int *b = &a; *b = 4; ... into int a; int *b = &a; a = 4; ... ? Thanks, Ben -- Let Crystal