Recovering control flow information

Andrew Sao-Chun Huang <>
Mon, 13 Apr 1992 21:00:32 GMT

          From comp.compilers

Related articles
Recovering control flow information (Andrew Sao-Chun Huang) (1992-04-13)
Re: Recovering control flow information (1992-04-14)
Re: Recovering control flow information bwilson@shasta.Stanford.EDU (1992-04-14)
Re: Recovering control flow information lins@Apple.COM (1992-04-16)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Andrew Sao-Chun Huang <>
Keywords: optimize, parallel, question
Organization: Compilers Central
Date: Mon, 13 Apr 1992 21:00:32 GMT

I'm working on a code scheduler that produces scheduled code for a
parallel architecture. The scheduler takes as its input the assembly
listing produced by a modified, sparc GCC frontend. I would like to do
some global dataflow analysis on the input file before scheduling it. But
I run into the following 2 problems when I try to reconstruct the control
flow graph:

Note: The architechture has no call instruction. Function calls are
performed by storing the return address in the register (rp) and then
branching to the function. So the first thing I do is to distinguish
branchs from calls by detecting modifications to rp. Predecessor/succ-
essor relationships are due to branches, not calls.

1) Identifying the first basic block of each function. The input file
consists of many basic blocks. I would like to partition them into
different groups such that each group contains basic blocks from one
function. I can say that any basic block without a predecessor is the
first basic block of some function. But this would be wrong since it may
be the target of a compute branch. Actually, this problem is solved once
problem 2 is resolved.

2) Computed branches. Sometimes 'switch' statements get compiled into a
computed branch where the targets are store in a table in data memory. I
need to add control flow arcs from the basic block that contains the
computed branch to each of the target basic blocks.

Has anyone worked on a similar problem? I would appreciate any advice or
pointers to books/articles that discuss this problem.

Andrew Huang
Electrical & Computer Engineering (412) 268-7101
Carnegie Mellon University
[This information is clearly available to the compiler, so I'd take the
direct approach and have the compiler put some comments into the file that
identify entry points, function boundaries, and branch tables. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.