This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix -fnew-ra for regs live across calls





The following patch fixes a problem introduced back in June with some
changes to df.c that resulted in new-ra keeping values in registers that
are killed across calls.

Bootstrapped/regtested on powerpc64-unknown-linux-gnu.

OK for mainline?

-Pat


2004-07-30  Pat Haugen  <pthaugen@us.ibm.com>

      * ra-build.c (conflicts_between_webs): For webs that cross a call add
      conflicts to regs_invalidated_by_call.

Index: gcc/ra-build.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/ra-build.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 ra-build.c
*** gcc/ra-build.c      9 Jul 2004 03:29:34 -0000     1.31
--- gcc/ra-build.c      29 Jul 2004 19:22:56 -0000
*************** static void
*** 2176,2184 ****
  conflicts_between_webs (struct df *df)
  {
    unsigned int i;
- #ifdef STACK_REGS
    struct dlist *d;
- #endif
    bitmap ignore_defs = BITMAP_XMALLOC ();
    unsigned int have_ignored;
    unsigned int *pass_cache = xcalloc (num_webs, sizeof (int));
--- 2176,2182 ----
*************** conflicts_between_webs (struct df *df)
*** 2253,2270 ****
    free (pass_cache);
    BITMAP_XFREE (ignore_defs);

- #ifdef STACK_REGS
-   /* Pseudos can't go in stack regs if they are live at the beginning of
-      a block that is reached by an abnormal edge.  */
    for (d = WEBS(INITIAL); d; d = d->next)
      {
        struct web *web = DLIST_WEB (d);
        int j;
        if (web->live_over_abnormal)
      for (j = FIRST_STACK_REG; j <= LAST_STACK_REG; j++)
        record_conflict (web, hardreg2web[j]);
-     }
  #endif
  }

  /* Remember that a web was spilled, and change some characteristics
--- 2251,2272 ----
    free (pass_cache);
    BITMAP_XFREE (ignore_defs);

    for (d = WEBS(INITIAL); d; d = d->next)
      {
        struct web *web = DLIST_WEB (d);
        int j;
+       if (web->crosses_call)
+     for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
+       if (TEST_HARD_REG_BIT (regs_invalidated_by_call, j))
+         record_conflict (web, hardreg2web[j]);
+ #ifdef STACK_REGS
+       /* Pseudos can't go in stack regs if they are live at the beginning of
+      a block that is reached by an abnormal edge.  */
        if (web->live_over_abnormal)
      for (j = FIRST_STACK_REG; j <= LAST_STACK_REG; j++)
        record_conflict (web, hardreg2web[j]);
  #endif
+     }
  }

  /* Remember that a web was spilled, and change some characteristics


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]