Patch to support mark_constant_function marking pure functions

John Wehle john@feith.com
Thu Sep 20 17:11:00 GMT 2001


Just curious where this patch:

  http://gcc.gnu.org/ml/gcc-patches/2001-08/msg01190.html

is in the queue.  It was originally posted in November and was
updated, retested with the current source tree, and reposted in
August.

The patch allows the compiler to automatically recognize static
pure functions which helps the compiler produce better code.

The long term goal is to have mark_constant_function also handle
functions with simple loops that are known to terminated.  I.e:

  static int
  subr (int a[3], int b[3])
    {
    int c;
    int i;
    int j;

    c = 0;
    for (i = 0; i < 3; i++)
      for (j = 0; j < 3; j++)
        c += a[i] * b[j];
    }

is a pure function.

-- John
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



More information about the Gcc-patches mailing list