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]

Re: [patches] Re: PIC_OFFSET_TABLE_REGNUM cleanups


> On Mon, Feb 12, 2001 at 03:24:27PM +0100, Jan Hubicka wrote:
> > Whats about introducing INVALID_REGNUM constant (-1 casted to unsigned)
> > and use it instead of -1?
> 
> Or perhaps "#define INVALID_REGNUM UINT_MAX"?
> Yes, that'd be all right.

Hi,
I've run into trouble with UINT_MAX not being defined in all files.
Is this solution OK? If not where I sould add the limits.h?

Honza

Sat Feb 10 16:33:14 CET 2001  Jan Hubicka  <jh@suse.cz>
	* cse.c (cse_main): Converts ifdefs on PIC_OFFSET_TABLE_REGNUM to
	conditionals.
	* defaults.h (PIC_OFFSET_TABLE_REGNUM): Default to INVALID_REGNUM.
	* emit-rtl.c (init_emit_once): Convert ifdefs to conditionals.
	* flow.c (mark_regs_live_at_end): Likewise.
	(calculate_global_regs_live): Likewise.
	* gcse.c (compute_hash_table): Likewise.
	(compute_kill_rd): Likewise.
	* resource.c (mark_target_live_regs): Likewise.
	* rtl.h (INVALID_REGNUM): New macro.
Index: egcs/gcc/cse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cse.c,v
retrieving revision 1.174
diff -c -3 -p -r1.174 cse.c
*** cse.c	2001/02/06 12:55:06	1.174
--- cse.c	2001/02/13 13:10:04
*************** cse_main (f, nregs, after_loop, file)
*** 7119,7125 ****
  #if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
  	 && ! (i == ARG_POINTER_REGNUM && fixed_regs[i])
  #endif
! #if defined (PIC_OFFSET_TABLE_REGNUM) && !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED)
  	 && ! (i == PIC_OFFSET_TABLE_REGNUM && flag_pic)
  #endif
  	 )
--- 7119,7125 ----
  #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
  	 )
Index: egcs/gcc/defaults.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/defaults.h,v
retrieving revision 1.31
diff -c -3 -p -r1.31 defaults.h
*** defaults.h	2001/02/07 18:58:05	1.31
--- defaults.h	2001/02/13 13:10:04
*************** do {								\
*** 296,301 ****
--- 296,305 ----
  #define BUILD_VA_LIST_TYPE(X) ((X) = ptr_type_node)
  #endif
  
+ #ifndef PIC_OFFSET_TABLE_REGNUM
+ #define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM
+ #endif
+ 
  /* By default, the preprocessor should be invoked the same way in C++
     as in C.  */
  #ifndef CPLUSPLUS_CPP_SPEC
Index: egcs/gcc/emit-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/emit-rtl.c,v
retrieving revision 1.162
diff -c -3 -p -r1.162 emit-rtl.c
*** emit-rtl.c	2001/02/04 22:43:58	1.162
--- emit-rtl.c	2001/02/13 13:10:05
*************** init_emit_once (line_numbers)
*** 4197,4205 ****
  #endif
  #endif
  
! #ifdef PIC_OFFSET_TABLE_REGNUM
!   pic_offset_table_rtx = gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM);
! #endif
  
    ggc_add_rtx_root (&pic_offset_table_rtx, 1);
    ggc_add_rtx_root (&struct_value_rtx, 1);
--- 4197,4204 ----
  #endif
  #endif
  
!   if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM)
!     pic_offset_table_rtx = gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM);
  
    ggc_add_rtx_root (&pic_offset_table_rtx, 1);
    ggc_add_rtx_root (&struct_value_rtx, 1);
Index: egcs/gcc/flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.374
diff -c -3 -p -r1.374 flow.c
*** flow.c	2001/02/04 22:43:59	1.374
--- flow.c	2001/02/13 13:10:07
*************** mark_regs_live_at_end (set)
*** 3345,3359 ****
  #endif
      }
  
- #ifdef PIC_OFFSET_TABLE_REGNUM
  #ifndef PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
    /* Many architectures have a GP register even without flag_pic.
       Assume the pic register is not in use, or will be handled by
       other means, if it is not fixed.  */
!   if (fixed_regs[PIC_OFFSET_TABLE_REGNUM])
      SET_REGNO_REG_SET (set, PIC_OFFSET_TABLE_REGNUM);
  #endif
- #endif
  
    /* Mark all global registers, and all registers used by the epilogue
       as being live at the end of the function since they may be
--- 3345,3358 ----
  #endif
      }
  
  #ifndef PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
    /* Many architectures have a GP register even without flag_pic.
       Assume the pic register is not in use, or will be handled by
       other means, if it is not fixed.  */
!   if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
!       && fixed_regs[PIC_OFFSET_TABLE_REGNUM])
      SET_REGNO_REG_SET (set, PIC_OFFSET_TABLE_REGNUM);
  #endif
  
    /* Mark all global registers, and all registers used by the epilogue
       as being live at the end of the function since they may be
*************** calculate_global_regs_live (blocks_in, b
*** 3484,3495 ****
  	    SET_REGNO_REG_SET (new_live_at_end, ARG_POINTER_REGNUM);
  #endif
  
- #ifdef PIC_OFFSET_TABLE_REGNUM
  	  /* Any constant, or pseudo with constant equivalences, may
  	     require reloading from memory using the pic register.  */
! 	  if (fixed_regs[PIC_OFFSET_TABLE_REGNUM])
  	    SET_REGNO_REG_SET (new_live_at_end, PIC_OFFSET_TABLE_REGNUM);
- #endif
  	}
  
        /* Regs used in phi nodes are not included in
--- 3483,3493 ----
  	    SET_REGNO_REG_SET (new_live_at_end, ARG_POINTER_REGNUM);
  #endif
  
  	  /* Any constant, or pseudo with constant equivalences, may
  	     require reloading from memory using the pic register.  */
! 	  if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
! 	      && fixed_regs[PIC_OFFSET_TABLE_REGNUM])
  	    SET_REGNO_REG_SET (new_live_at_end, PIC_OFFSET_TABLE_REGNUM);
  	}
  
        /* Regs used in phi nodes are not included in
Index: egcs/gcc/gcse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcse.c,v
retrieving revision 1.113
diff -c -3 -p -r1.113 gcse.c
*** gcse.c	2001/01/02 00:58:27	1.113
--- gcse.c	2001/02/13 13:10:08
*************** compute_hash_table (set_p)
*** 2208,2214 ****
  #if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
  		     && ! (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
  #endif
! #if defined (PIC_OFFSET_TABLE_REGNUM) && !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED)
  		     && ! (regno == PIC_OFFSET_TABLE_REGNUM && flag_pic)
  #endif
  
--- 2208,2214 ----
  #if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
  		     && ! (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
  #endif
! #if !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED)
  		     && ! (regno == PIC_OFFSET_TABLE_REGNUM && flag_pic)
  #endif
  
*************** compute_kill_rd ()
*** 2641,2647 ****
  		       && ! (regno == ARG_POINTER_REGNUM
  			     && fixed_regs[regno])
  #endif
! #if defined (PIC_OFFSET_TABLE_REGNUM) && !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED)
  		       && ! (regno == PIC_OFFSET_TABLE_REGNUM && flag_pic)
  #endif
  		       && regno != FRAME_POINTER_REGNUM)
--- 2641,2647 ----
  		       && ! (regno == ARG_POINTER_REGNUM
  			     && fixed_regs[regno])
  #endif
! #if !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED)
  		       && ! (regno == PIC_OFFSET_TABLE_REGNUM && flag_pic)
  #endif
  		       && regno != FRAME_POINTER_REGNUM)
Index: egcs/gcc/resource.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/resource.c,v
retrieving revision 1.37
diff -c -3 -p -r1.37 resource.c
*** resource.c	2001/01/01 00:43:16	1.37
--- resource.c	2001/02/13 13:10:08
*************** mark_target_live_regs (insns, target, re
*** 1029,1035 ****
  #if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
  		    && ! (i == ARG_POINTER_REGNUM && fixed_regs[i])
  #endif
! #if defined (PIC_OFFSET_TABLE_REGNUM) && !defined (PIC_OFFSET_TABLE_REG_CALL_CLOBBERED)
  		    && ! (i == PIC_OFFSET_TABLE_REGNUM && flag_pic)
  #endif
  		    )
--- 1029,1035 ----
  #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
  		    )
Index: egcs/gcc/rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.240
diff -c -3 -p -r1.240 rtl.h
*** rtl.h	2001/01/07 18:39:19	1.240
--- rtl.h	2001/02/13 13:10:09
*************** extern rtx gen_rtx_MEM PARAMS ((enum mac
*** 1606,1611 ****
--- 1606,1614 ----
  
  #define LAST_VIRTUAL_REGISTER		((FIRST_VIRTUAL_REGISTER) + 4)
  
+ /* REGNUM never really appearing in the INSN stream.  */
+ #define INVALID_REGNUM			(~(unsigned int)0)
+ 
  extern rtx find_next_ref		PARAMS ((rtx, rtx));
  extern rtx *find_single_use		PARAMS ((rtx, rtx, rtx *));
  


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