Detecting Unrolled loops

mikesw@whiterose.net (M Sweger)
6 Jul 1999 12:01:51 -0400

          From comp.compilers

Related articles
Detecting Unrolled loops mikesw@whiterose.net (1999-07-06)
Re: Detecting Unrolled loops qjackson@wave.home.com (Quinn Tyler Jackson) (1999-07-10)
Re: Detecting Unrolled loops metzger@rsn.hp.com (Robert Metzger) (1999-07-14)
| List of all articles for this month |

From: mikesw@whiterose.net (M Sweger)
Newsgroups: comp.compilers
Date: 6 Jul 1999 12:01:51 -0400
Organization: DataHaven Project, Inc (http://www.dhp.com)
Keywords: optimize, question, comment

Hi,
      I'm wondering if during the course of parsing a program that has
code repeated multiple times (unrolled) instead of once using a For
loop whether compiler techniques can detect/find them and reduce them
down to a loop and mark in the tree structure that this is a loop. I
have such a need to do this, but without the need to reduce it down,
just tell me the beginning and end of the loop.


What compiler technique would be able to do this?


I.E.
        For 1 to 3 DO
                  A:=B; A:=B;
                                        or C:=D;
        End;


vs.


                  A:=B;
                  A:=B;
A:=B;
or
                    A:=B;
                    C:=D;
                    A:=B;
                    C:=D;
                    A:=B;
                    C:=D;


Note: the statment within the for loop or repeated is not important since
            I know depending on what it is, the compiler can optimize and minimize
            it unless I either turn optimization on, or if I wrote a compiler that
            doesn't optimize to get rid of the repeating code.
--
Mike,
mikesw@whiterose.net
[I believe I've seen compilers that reroll loops so they can unroll them
and use software piplining to make them run fast. -John]


Post a followup to this message

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