On Wed, Jul 17, 2013 at 03:32:51PM +0800, tsuletgo wrote: > 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)
> Am i misunderstand the use of "considerVariableDef" variable ? You misread it indeed: as you can see, this variable is "always true" by default, so it only lets you ignore some definitions, not add more. Your initial request does not make a lot of sense in fact: you cannot consider a function definition as a "def" for its parameters, because in practice, the variable is redefined at every call point. In practice, the use/def module does nothing special about variable declaration (either local variables or function parameters): it only analyzes statements. And the statement which really sets a function parameter is the "Call" in the caller function. > In fact i intend to compute interprocedural def/use associations. Now this makes more sense, and the usedef module can probably help you: you need to redefine "getUseDefFunctionRef" to return non-empty sets. I'm not an expert of use/def, so take the following with a grain of salt, but I think it does what you are asking for (entirely untested, no idea if it makes sense): let findFuncArgs = function | Lval(Var vi, NoOffset) -> List.fold_left (fun s v -> VS.add v s) VS.empty vi.sformals | _ -> VS.empty (* function call through a pointer --- cannot guess *) ;; Usedef.getUseDefFunctionRef := fun func args -> (* variables marked as use at call point *) VS.empty, (* variables marked as def at call point *) findFuncArgs func (* you probably should not change this *) args ;; Best, -- Gabriel ------------------------------------------------------------------------------ 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