misc flag_pic cleanups

Richard Henderson rth@redhat.com
Tue Jan 29 14:38:00 GMT 2002


In line with John David Anglin's fix to emit-rtl.c yesterday.

Tested alphaev56-linux, which uses pic_offset_table_rtx without flag_pic.


r~


        * expr.c (force_operand): Ignore flag_pic for detecting pic
        address loads.
        * regclass.c (init_reg_sets_1): Test fixed_regs not flag_pic
        for determining if PIC_OFFSET_TABLE_REGNUM is call-clobbered.
        * resource.c (mark_target_live_regs): Use regs_invalidated_by_call
        instead of open-coded loop.
        * doc/tm.texi (PIC_OFFSET_TABLE_REGNUM): Clarify that it must
        be fixed when in use.

Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.414
diff -c -p -d -r1.414 expr.c
*** expr.c	2002/01/24 01:16:23	1.414
--- expr.c	2002/01/29 22:31:30
*************** force_operand (value, target)
*** 5393,5400 ****
    rtx subtarget = get_subtarget (target);
  
    /* Check for a PIC address load.  */
!   if (flag_pic
!       && (GET_CODE (value) == PLUS || GET_CODE (value) == MINUS)
        && XEXP (value, 0) == pic_offset_table_rtx
        && (GET_CODE (XEXP (value, 1)) == SYMBOL_REF
  	  || GET_CODE (XEXP (value, 1)) == LABEL_REF
--- 5393,5399 ----
    rtx subtarget = get_subtarget (target);
  
    /* Check for a PIC address load.  */
!   if ((GET_CODE (value) == PLUS || GET_CODE (value) == MINUS)
        && XEXP (value, 0) == pic_offset_table_rtx
        && (GET_CODE (XEXP (value, 1)) == SYMBOL_REF
  	  || GET_CODE (XEXP (value, 1)) == LABEL_REF
Index: regclass.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regclass.c,v
retrieving revision 1.142
diff -c -p -d -r1.142 regclass.c
*** regclass.c	2002/01/15 13:37:59	1.142
--- regclass.c	2002/01/29 22:31:31
*************** init_reg_sets_1 ()
*** 470,476 ****
  	;
  #endif
  #ifndef PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
!       else if (i == PIC_OFFSET_TABLE_REGNUM && flag_pic)
  	;
  #endif
        else if (0
--- 470,476 ----
  	;
  #endif
  #ifndef PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
!       else if (i == PIC_OFFSET_TABLE_REGNUM && fixed_regs[i])
  	;
  #endif
        else if (0
Index: resource.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/resource.c,v
retrieving revision 1.48
diff -c -p -d -r1.48 resource.c
*** resource.c	2001/10/11 03:16:03	1.48
--- resource.c	2002/01/29 22:31:31
*************** mark_target_live_regs (insns, target, re
*** 1023,1043 ****
  	      /* CALL clobbers all call-used regs that aren't fixed except
  		 sp, ap, and fp.  Do this before setting the result of the
  		 call live.  */
! 	      for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
! 		if (call_used_regs[i]
! 		    && i != STACK_POINTER_REGNUM && i != FRAME_POINTER_REGNUM
! 		    && i != ARG_POINTER_REGNUM
! #if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
! 		    && i != HARD_FRAME_POINTER_REGNUM
! #endif
! #if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
! 		    && ! (i == ARG_POINTER_REGNUM && fixed_regs[i])
! #endif
! #if !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED)
! 		    && ! (i == PIC_OFFSET_TABLE_REGNUM && flag_pic)
! #endif
! 		    )
! 		  CLEAR_HARD_REG_BIT (current_live_regs, i);
  
  	      /* A CALL_INSN sets any global register live, since it may
  		 have been modified by the call.  */
--- 1023,1030 ----
  	      /* CALL clobbers all call-used regs that aren't fixed except
  		 sp, ap, and fp.  Do this before setting the result of the
  		 call live.  */
! 	      AND_COMPL_HARD_REG_SET (current_live_regs,
! 				      regs_invalidated_by_call);
  
  	      /* A CALL_INSN sets any global register live, since it may
  		 have been modified by the call.  */
Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.93
diff -c -p -d -r1.93 tm.texi
*** tm.texi	2002/01/27 04:18:12	1.93
--- tm.texi	2002/01/29 22:31:34
*************** processor's ``application binary interfa
*** 5603,5609 ****
  is defined, RTL is generated for this register once, as with the stack
  pointer and frame pointer registers.  If this macro is not defined, it
  is up to the machine-dependent files to allocate such a register (if
! necessary).
  
  @findex PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
  @item PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
--- 5603,5610 ----
  is defined, RTL is generated for this register once, as with the stack
  pointer and frame pointer registers.  If this macro is not defined, it
  is up to the machine-dependent files to allocate such a register (if
! necessary).  Note that this register must be fixed when in use (e.g.
! when @code{flag_pic} is true).
  
  @findex PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
  @item PIC_OFFSET_TABLE_REG_CALL_CLOBBERED



More information about the Gcc-patches mailing list