Re: [abc-users] unconditional branch in jimple

From: Eric Bodden <eric.bodden_at_mail.mcgill.ca>
Date: Wed, 17 Sep 2008 09:35:51 -0400

2008/9/17 Amjad Nusayr <anusayr_at_cs.nmsu.edu>:
> Hi Eric
> I'm doing some analysis to determine the start and end of a loop (if
> possible).

See, that's what I was thinking ;-) There are predefined classes for
that in Soot, like soot.toolkits.graph.MHGDominatorsFinder
(establishes the dominator relationship) and
soot.jimple.toolkits.annotation.logic.LoopFinder (finds all reducible
loops). Maybe you will find these helpful.

> I have another question. In what cases does jimple generate unconditional
> goto stmts? I know that it does it for loops, do you know any another case?

IIRC then you need one for if/then/else

  if(!cond) goto /*else-branch*/
  //if-branch
  goto end;
else-branch:
  //else-branch
end:
  //rest of the program

But in general optimizations etc. could introduce (or remove) them
anywhere. That's why one actually should usually not rely on the
presence or absence of goto stmts but should rather work on
abstractions of those, like a control flow graph.

> I will try to see what I can get from body.getUnits() I hope it works for
> me.

It may be more useful to think about your problem in terms of a
control flow graph.

Eric

-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
Received on Wed Sep 17 2008 - 14:35:55 BST

This archive was generated by hypermail 2.2.0 : Wed Sep 17 2008 - 15:10:11 BST