GCC questions

Mike Stump mrs@wrs.com
Tue Aug 31 23:20:00 GMT 1999


> Date: Wed, 4 Aug 1999 10:51:28 -0700 (PDT)
> From: Radu Cornea <radu@ics.uci.edu>

> gcc generates something like this:

>          |
>         <a>
>         /  \
>        /   <b>      This is what we call
>        |  /   \     "unstructured code"
>        [x]    [y]
>          \   /
>           \ /
> 	   |
>           [z]
>            |


> We want to get a code like this:

>          |
>         <a>
>         /  \
>        /   <b>
>       /    / \     This is what we call
>     [x]  [x] [y]   "structured code"
>       \   |  /     i.e. can be viewed
>        \  | /      as an if inside 
>         \ |/       another if.
> 	   \|
>           |       
>          [z]
>           |

> So, the [x] statement must be duplicated.

Well, I suspect you will find it best to work at the rtl level, write
a new pass that restructures the code in the form you want, and then
run your code on it.  I suspect that something like copy_rtx is what
you want.

Your code then can also work on things like:

if (a)
   goto b;
if (b)
   goto b;
y;
goto z;
b: b;
z: z;

with no extra effort.



More information about the Gcc mailing list