Thanks for quick response

I am quiet a beginner in CIL. Although i am comfortable with using
visitors, finding statements and making changes.
   But i am not able to create a call statement along with parameters
(arguments) any simple example would be helpful.



> Hi,
>
> On SatteFunc, Mar 02, 2013 at 11:52:50AM +0530, son...@iitk.ac.in wrote:
>>  I would like to get a basic idea on how to insert call to a function
>> defined in some other C file to the input file before a particular kind
>> of statement lets say before all "loop" statements in the input file.
>
> First, use Cil.findOrCreateFunc to locate the varinfo corresponding to the
> function (it also creates a prototype if it's not in your headers
> already).
> Then, write a visitor with a vstmt method which locates every Loop
> statement,
> and replaces them *in-place* with a block containing your function call
> (Instr
> [Call(...)]) followed by the original loop.
>
> You might find my recent email "Re: [CIL users] interprocedural CFG"
> useful to
> get the idea of "adding a Block in-place":
> http://sourceforge.net/mailarchive/message.php?msg_id=30545332
>
>> Also, one simple question how can i convert varinfo to an expression
>> type.
>
> let convert v = Lval (Var v, NoOffset)
>
> Make sure to read the section about "Lvalues" in the CIL API
> documentation:
> http://kerneis.github.com/cil/doc/html/cil/api/Cil.html
>
> --
> Gabriel
>


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to