Hi, CIL world
I have a question on the usedef module in CIL. Maybe someone could give me some 
help.

I want to consider the formal parameters of a function as a variable definition 
when finding use/def associations through the reaching definition module.
But i find CIL does not consider it as a definition as default.
Luckily, i find there is a variable in usedef.ml which may treat some variable 
as a definition:

(** Say if you want to consider a variable def *)
let considerVariableDef: (varinfo -> bool) ref = 
  ref (fun _ -> true)

After i use it to treat formal parameters of a function as definitions, it 
still fails to compute correct reaching definitions.

The following is my code snippet:
 (* treat its formal vars as defs *)
List.iter
  begin fun formal_var ->
    if (!UD.considerVariableDef) formal_var then begin
       UD.varDefs := UD.VS.add formal_var !UD.varDefs;
     Format.printf "add defs : %s\n" formal_var.vname
         end
       end
     func.sformals;

An illustrating example:
int foo(int x){
    x = x+1;   // here, formal parameter x should be considered as a def. and x 
in x+1 should be considered as a use.
}

Am i misunderstand the use of "considerVariableDef" variable ?
In fact i intend to compute interprocedural def/use associations. 
Any help is appreciated :)

Best Regards!
Ting



Ting SU,software institute,East China Normal University
tsule...@gmail.com (Email,MSN)
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to