Re: while loop code generation

n8tm@aol.com (N8TM)
15 Dec 1997 21:56:25 -0500

          From comp.compilers

Related articles
while loop code generation ast@halcyon.com (1997-12-14)
Re: while loop code generation gclind01@spd.louisville.edu (1997-12-15)
Re: while loop code generation burley@cygnus.com (Craig Burley) (1997-12-15)
Re: while loop code generation tgl@netcom.com (Tom Lane) (1997-12-15)
Re: while loop code generation n8tm@aol.com (1997-12-15)
Re: while loop code generation tim@franck.Princeton.EDU.composers (1997-12-29)
Re: while loop code generation preston@tera.tera.com (1998-01-03)
| List of all articles for this month |

From: n8tm@aol.com (N8TM)
Newsgroups: comp.compilers
Date: 15 Dec 1997 21:56:25 -0500
Organization: AOL http://www.aol.com
References: 97-12-112
Keywords: code, optimize

The conversion of while() to if()do...while() replace n unconditional
branches plus n conditional not taken and one conditional taken branch
with n+1 conditional branches, 2 of them not taken. This replacement
seems to be a de facto standard for C compilers, but not for FORTRAN
compilers unless they are based on a C compiler.


With some compilers, including g77, writing source code thus:


logical done
...
done = .false.
do while(.not. done)
....
done = ( .. )
if(done)exit
enddo


will avoid generation of code for testing at the top of the loop.


Tim
--


Post a followup to this message

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