Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Simplifying branches


  • Subject: [Frama-c-discuss] Simplifying branches
  • From: djs at adelard.com (Daniel Sheridan)
  • Date: Wed, 31 Aug 2011 10:09:04 +0100
  • In-reply-to: <4E5248F7.7040202@cea.fr>
  • References: <1313591386.20010.50.camel@coquet> <4E5248F7.7040202@cea.fr>

On Mon, 2011-08-22 at 14:17 +0200, Julien Signoles wrote:
> Hello,
> 
> Le 17/08/2011 16:29, Daniel Sheridan a ?crit :
> > I am working on a plugin which eliminates branches of code under certain
> > circumstances. Using a combination of constant propagation and spare
> > code analysis, I end up with code of the form
> >
> >   if (1) {
> >      ...
> >   }
> >
> > which is technically correct, but would be more useful if it were
> > simplified. I notice that saving the code to disk and loading it in to
> > Frama-C is enough to eliminate the unnecessary "if".
> 
> If I well understand what you are saying, you pretty print the generated 
> code into a C file by using options "-print" and "-ocode", then you 
> re-execute Frama-c on this file. Is it correct?

Basically, yes, though it's all done in a plugin.

> > Is it possible to access this simplification step from a plugin, or do I
> > need to write my own visitor-based implementation of it?
> 
> In the next Frama-C version, there will be a function 
> File.create_rebuilt_project_from_visitor which will do the job [*].

That's exactly what I'm looking for. Thanks.

Would it be possible to access the Frama-C Subversion so that I can try
this out?

	Dan.