|Finding loops in a disassembly firstname.lastname@example.org (Max Domeika) (1995-07-22)|
|finding loops in disassembly email@example.com (Nicolas Gloy) (1995-07-27)|
|From:||Nicolas Gloy <firstname.lastname@example.org>|
|Keywords:||analysis, optimize, assembler|
|Date:||Thu, 27 Jul 1995 02:28:50 GMT|
Max Domeika <email@example.com> writes:
I'm trying to write a program to find loops in a disassembly
listing. My program is able to form the CFG for a disassembly
and I am now ready to attempt to find loops. I'm intending
to use Algorithm 10.1 (pg. 604) in the Dragon book. Question(s):
Are there any foreseeable problems in this besides indirect jumps?
Is there a more efficient and reliable way to do this?
If you want your program to work on code generated from constructs
like "switch" in C, you have to add the edges between the indirect
jump and the targets of the switch. Otherwise, you would be left
with a whole bunch of missing edges, which would probably break the
loop -- assuming something like this:
case 0: bar(); break;
case 1: qux(); break;
Typically (at least in the Alpha code I have looked at) the target
for the indirect jump is obtained by loading a value from a table
for that switch construct and adding it to some base value.
So you have to figure out the address of the table, read it from
the object file, and figure out the base address.
Maybe in the code that you're dealing with, the value loaded from
the table is the jump target (which makes things easier).
Good Luck !
Nicolas Gloy Harvard University Division of Applied Sciences
firstname.lastname@example.org Computer Architecture + Compilers
Return to the
Search the comp.compilers archives again.