[RFC] Extension of SIMPLE for Fortran 95

Daniel Berlin dberlin@dberlin.org
Mon Jun 10 09:58:00 GMT 2002


On 10 Jun 2002, Diego Novillo wrote:

> On Mon, 2002-06-10 at 12:03, Tom Tromey wrote:
> > >>>>> "Diego" == Diego Novillo <dnovillo@redhat.com> writes:
> > 
> > >> We want to lower our parse tree to SIMPLE, but we can't represent this kind
> > >> of CYCLE and EXIT statements in SIMPLE.
> > 
> > Diego> Maybe we shouldn't have to.  Couldn't the above be modelled
> > Diego> with GOTOs?  The way I'd rather handle it is to have the g95
> > Diego> simplifier deal with things like this.
> > 
> > FWIW, Java also has this feature.  I'm curious to know why it is you'd
> > prefer this be handled using GOTO.
> > 
> I want to minimize implicit behaviour.  They only create problems when
> doing language-independent transformations.
For reference, i know of two java optimizers that handle this by creating 
explicit gotos (and then they use goto elimination, but that's a side 
issue).

> 
> 
> > Or to put it another way, why not handle all continue/break using GOTO?
> >
> I can only give you one pretty weak reason: the original SIMPLE grammar
> allows them.  I wouldn't mind handling them using GOTO statements.

For a point of reference, as i showed Diego, intel's compiler transforms 
all continue/break to goto before anything gets ahold of it.
 Then again, they also transform all for loops to whiles, and then the 
whiles to if/gotos.

example:

int main(void)
{
        int i;
        for (i = 0; i < 50; i++)
        {
                continue;
        }
}

---- (proton/phase2/csi_not.c:251, List number: 1) Graph before COMPLEX_Lower_Il
0:
2       0           entry extern main_V$0  main
                    {
4       2               i_1_V$1 = 0(SI32);
4       5               while ( i_1_V$1 < 50(SI32) )
                        {
6       3                   goto L1;
8       1           L1:
4       4                   i_1_V$1 = i_1_V$1 + 1(SI32);
                        }
8       6               return ( 0(SI32) );
8       7               return ;
                    }


---- (proton/phase2/csi_not.c:259, List number: 2) Graph before Lower:
2       0           entry extern main_V$0  main
                    {
4       2               i_1_V$1 = 0(SI32);
4       5               while ( i_1_V$1 < 50(SI32) )
                        {
6       3                   goto L1;
8       1           L1:
4       4                   i_1_V$1 = i_1_V$1 + 1(SI32);
                        }
8       6               return ( 0(SI32) );
8       7               return ;
                    }


---- (proton/phase2/csi_not.c:279, List number: 3) Graph after Lower:
2       0           entry extern main_V$0  main
                    {
4       2               i_1_V$1 = 0(SI32);
4       10          L10:
4       8               if ( i_1_V$1 < 50(SI32) )
                        {
6       3                   goto L1;
8       1           L1:
4       4                   i_1_V$1 = i_1_V$1 + 1(SI32);
4       9                   goto L10;
                        }
8       6               return ( 0(SI32) );
8       7               return ;
                    }


> 
> 
> Diego.
> 
> 
> 



More information about the Gcc mailing list