ia64 regrename fix

Richard Henderson rth@cygnus.com
Fri Oct 27 14:28:00 GMT 2000


My 10-23 change was misguided.  Here's a better fix.  Plus we
also have to watch out for the other registers obsconded by 
the prologue code.


r~

        * config/ia64/ia64.c: Revert 10-23 patch.
        (ia64_hard_regno_rename_ok): New.
        * config/ia64/ia64-protos.h: Declare it.
        * config/ia64/ia64.h (HARD_REGNO_RENAME_OK): Use it.

Index: config/ia64/ia64-protos.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/ia64/ia64-protos.h,v
retrieving revision 1.23
diff -c -p -d -r1.23 ia64-protos.h
*** ia64-protos.h	2000/09/24 23:58:24	1.23
--- ia64-protos.h	2000/10/27 21:24:48
*************** extern void ia64_function_epilogue PARAM
*** 82,87 ****
--- 82,88 ----
  
  extern int ia64_direct_return PARAMS((void));
  extern void ia64_expand_load_address PARAMS((rtx, rtx));
+ extern int ia64_hard_regno_rename_ok PARAMS((int, int));
  
  extern void ia64_initialize_trampoline PARAMS((rtx, rtx, rtx));
  extern void ia64_print_operand_address PARAMS((FILE *, rtx));
Index: config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/ia64/ia64.c,v
retrieving revision 1.56
diff -c -p -d -r1.56 ia64.c
*** ia64.c	2000/10/24 00:26:12	1.56
--- ia64.c	2000/10/27 21:24:48
*************** ia64_expand_prologue ()
*** 1852,1863 ****
  	reg_names[OUT_REG (i)] = ia64_reg_numbers[inputs + locals + i];
      }
  
-   /* ??? Temporarily mark the remaining output registers fixed, so
-      that the register renaming pass does not try to used them after
-      we've fixed the size of the register frame.  */
-   for (i = current_frame_info.n_output_regs; i < 8; ++i)
-     fixed_regs[OUT_REG (i)] = 1;
- 
    /* Set the frame pointer register name.  The regnum is logically loc79,
       but of course we'll not have allocated that many locals.  Rather than
       worrying about renumbering the existing rtxs, we adjust the name.  */
--- 1852,1857 ----
*************** ia64_direct_return ()
*** 2393,2398 ****
--- 2387,2417 ----
    return 0;
  }
  
+ int
+ ia64_hard_regno_rename_ok (from, to)
+      int from;
+      int to;
+ {
+   /* Don't clobber any of the registers we reserved for the prologue.  */
+   if (to == current_frame_info.reg_fp
+       || to == current_frame_info.reg_save_b0
+       || to == current_frame_info.reg_save_pr
+       || to == current_frame_info.reg_save_ar_pfs
+       || to == current_frame_info.reg_save_ar_unat
+       || to == current_frame_info.reg_save_ar_lc)
+     return 0;
+ 
+   /* Don't use output registers outside the register frame.  */
+   if (OUT_REGNO_P (to) && to >= OUT_REG (current_frame_info.n_output_regs))
+     return 0;
+ 
+   /* Retain even/oddness on predicate register pairs.  */
+   if (PR_REGNO_P (from) && PR_REGNO_P (to))
+     return (from & 1) == (to & 1);
+ 
+   return 1;
+ }
+ 
  /* Emit the function prologue.  */
  
  void
*************** ia64_function_epilogue (file, size)
*** 2502,2510 ****
        for (i = 0; i < current_frame_info.n_output_regs; i++)
  	reg_names[OUT_REG (i)] = ia64_output_reg_names[i];
      }
- 
-   for (i = 0; i < 8; ++i)
-     fixed_regs[OUT_REG (i)] = 0;
  
    current_frame_info.initialized = 0;
  }
--- 2521,2526 ----
Index: config/ia64/ia64.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/ia64/ia64.h,v
retrieving revision 1.50
diff -c -p -d -r1.50 ia64.h
*** ia64.h	2000/10/26 23:05:17	1.50
--- ia64.h	2000/10/27 21:24:48
*************** do {									\
*** 2643,2653 ****
     considered for use as a rename register for REGNO1 */
  
  #define HARD_REGNO_RENAME_OK(REGNO1,REGNO2) \
!   ((! PR_REGNO_P (REGNO1) && ! PR_REGNO_P (REGNO2)) 			\
!     ? (!call_fixed_regs [REGNO1] && !call_fixed_regs [REGNO2])		\
!       ? 1 : 0    							\
!     : ((REGNO2) > 256 && ((REGNO2 & 1) == 0))				\
!       ? 1 : 0)
  
  /* Define this macro if the compiler should use extended basic blocks
     when renaming registers.  Define this macro if the target has predicate
--- 2643,2649 ----
     considered for use as a rename register for REGNO1 */
  
  #define HARD_REGNO_RENAME_OK(REGNO1,REGNO2) \
!   ia64_hard_regno_rename_ok((REGNO1), (REGNO2))
  
  /* Define this macro if the compiler should use extended basic blocks
     when renaming registers.  Define this macro if the target has predicate


More information about the Gcc-patches mailing list