[Soot-list] How to determine whether there exists a use for a variable definition later on in the cfg

Phil Pratt-Szeliga pcpratts at syr.edu
Fri Jul 27 12:57:54 EDT 2012


John,

You could try to use code from here [1] to detect loops and then do
equality comparisons.

Phil Pratt-Szeliga
Syracuse University

[1] https://bitbucket.org/pcpratts/cfg_array/src/72bf281c1adf/version4/Analyzer/src/edu/syr/pcpratts/useproto/analyzer/loops

On Fri, Jul 27, 2012 at 12:50 PM, John Dean <jdean4 at kc.rr.com> wrote:
> Thanks, Cheng!
>
>
>
> Anyone (including Cheng, of course),
>
> If I use SimpleLocalUses.getUsesOf(unit), according to the api, it retrieves
> a list of units that use the definition in the unit arg, but I need to know
> where the retrieved units come from (specifically, I need to know if any of
> them come from outside the loop that contains the variable's definition). I
> know the blocks and statements that are inside the loop, but I don't know
> how to tell whether the units retrieved from SimpleLocalUses.getUsesOf(unit)
> are in the loop's blocks or in outside blocks.
>
>
>
> Suggestions?
>
>
>
> Thanks,
>
> John
>
>
>
> From: Cheng Zhang [mailto:cheng.zhang.stap at gmail.com]
> Sent: Friday, July 27, 2012 10:38 AM
> To: john.dean at park.edu
> Cc: soot-list at sable.mcgill.ca
> Subject: Re: [Soot-list] How to determine whether there exists a use for a
> variable definition later on in the cfg
>
>
>
> Hi John,
>
>
>
> You may use the existing classes, like SimpleLocalDefs or SmartLocalDefs, to
> do your work.
>
>
>
> Best,
>
> Cheng
>
>
>
> On Fri, Jul 27, 2012 at 11:16 PM, John Dean <jdean4 at kc.rr.com> wrote:
>
> Hi all,
>
> For a given instruction's definition within a loop, I need to determine
> whether there exists a use for that definition outside of the loop. By
> "definition," I mean a variable is assigned a value. By "use," I mean the
> variable is accessed at some later point in the flow of the method's CFG.
> I've already been able to gather the instructions in a loop, so I don't need
> help with that.
>
> I've looked through the soot api, and the only strategy I can come up with
> is to find all the instructions in the cfg that might follow the variable
> definition's instruction (while ignoring the instructions in the loop, of
> course). And to do that, I would call cfg.getSuccsOf(unit) recursively and
> avoid infinite recursive loops by storing all the found instructions in a
> list and only adding new instructions if they're not in the list already.
>
> That seems like a lot of work on my part, and I don't want to reinvent the
> wheel if there's a better way. Any suggestions?
>
> Thanks,
> john
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>


More information about the Soot-list mailing list