public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* rtl slot lies
@ 1998-05-08 19:52 Richard Henderson
  1998-05-09  5:27 ` John Carr
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 1998-05-08 19:52 UTC (permalink / raw)
  To: egcs

While working on a garbage collector, I discovered that the
INLINE_HEADER rtl was lying about the types of some of its slots.

The following patch corrects this, and gets rid of wome ugly casts.


r~



Fri May  8 13:54:20 1998  Richard Henderson  <rth@cygnus.com>

	* rtl.h (ORIGINAL_DECL_INITIAL): Correct the type stored.
	(INLINE_REGNO_REG_RTX, PARMREG_STACK_LOC): Likewise.
	(gen_inline_header_rtx): Correct prototype.
	* rtl.def (INLINE_HEADER): Correct element type string.
	* emit-rtl.c (gen_inline_header_rtx): Fix argument types.
	* integrate.c (initialize_for_inline): Remove spurious casts.


Index: rtl.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/rtl.h,v
retrieving revision 1.29
diff -c -p -d -r1.29 rtl.h
*** rtl.h	1998/05/06 08:36:01	1.29
--- rtl.h	1998/05/08 20:51:13
*************** extern char *note_insn_name[];
*** 627,637 ****
  #define FUNCTION_FLAGS(RTX) ((RTX)->fld[12].rtint)
  #define OUTGOING_ARGS_SIZE(RTX) ((RTX)->fld[13].rtint)
  #define ORIGINAL_ARG_VECTOR(RTX) ((RTX)->fld[14].rtvec)
! #define ORIGINAL_DECL_INITIAL(RTX) ((RTX)->fld[15].rtx)
! #define INLINE_REGNO_REG_RTX(RTX) ((RTX)->fld[16].rtvec)
  #define INLINE_REGNO_POINTER_FLAG(RTX) ((RTX)->fld[17].rtstr)
  #define INLINE_REGNO_POINTER_ALIGN(RTX) ((RTX)->fld[18].rtstr)
! #define PARMREG_STACK_LOC(RTX) ((RTX)->fld[19].rtvec)
  
  /* In FUNCTION_FLAGS we save some variables computed when emitting the code
     for the function and which must be `or'ed into the current flag values when
--- 632,642 ----
  #define FUNCTION_FLAGS(RTX) ((RTX)->fld[12].rtint)
  #define OUTGOING_ARGS_SIZE(RTX) ((RTX)->fld[13].rtint)
  #define ORIGINAL_ARG_VECTOR(RTX) ((RTX)->fld[14].rtvec)
! #define ORIGINAL_DECL_INITIAL(RTX) (*(tree *) &(RTX)->fld[15].rtx)
! #define INLINE_REGNO_REG_RTX(RTX) (*(rtx **) &(RTX)->fld[16].rtx)
  #define INLINE_REGNO_POINTER_FLAG(RTX) ((RTX)->fld[17].rtstr)
  #define INLINE_REGNO_POINTER_ALIGN(RTX) ((RTX)->fld[18].rtstr)
! #define PARMREG_STACK_LOC(RTX) (*(rtx **) &(RTX)->fld[19].rtx)
  
  /* In FUNCTION_FLAGS we save some variables computed when emitting the code
     for the function and which must be `or'ed into the current flag values when
*************** extern rtx gen_reg_rtx			PROTO((enum mac
*** 723,730 ****
  extern rtx gen_label_rtx		PROTO((void));
  extern rtx gen_inline_header_rtx	PROTO((rtx, rtx, int, int, int, int,
  					       int, int, rtx, rtx, int, int,
! 					       rtvec, rtx,
! 					       rtvec, char *, char *, rtvec));
  extern rtx gen_lowpart_common		PROTO((enum machine_mode, rtx));
  extern rtx gen_lowpart			PROTO((enum machine_mode, rtx));
  extern rtx gen_lowpart_if_possible	PROTO((enum machine_mode, rtx));
--- 728,735 ----
  extern rtx gen_label_rtx		PROTO((void));
  extern rtx gen_inline_header_rtx	PROTO((rtx, rtx, int, int, int, int,
  					       int, int, rtx, rtx, int, int,
! 					       rtvec, union tree_node *,
! 					       rtx *, char *, char *, rtx *));
  extern rtx gen_lowpart_common		PROTO((enum machine_mode, rtx));
  extern rtx gen_lowpart			PROTO((enum machine_mode, rtx));
  extern rtx gen_lowpart_if_possible	PROTO((enum machine_mode, rtx));
Index: rtl.def
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/rtl.def,v
retrieving revision 1.7
diff -c -p -d -r1.7 rtl.def
*** rtl.def	1998/04/22 14:20:26	1.7
--- rtl.def	1998/05/08 20:51:13
*************** DEF_RTL_EXPR(NOTE, "note", "iuusn", 'x')
*** 396,402 ****
     it contains helps to build the mapping function between the rtx's of
     the function to be inlined and the current function being expanded.  */
  
! DEF_RTL_EXPR(INLINE_HEADER, "inline_header", "iuuuiiiiiieeiiEeEssE", 'x')
  
  /* ----------------------------------------------------------------------
     Top level constituents of INSN, JUMP_INSN and CALL_INSN.
--- 396,402 ----
     it contains helps to build the mapping function between the rtx's of
     the function to be inlined and the current function being expanded.  */
  
! DEF_RTL_EXPR(INLINE_HEADER, "inline_header", "iuuuiiiiiieeiiE00000", 'x')
  
  /* ----------------------------------------------------------------------
     Top level constituents of INSN, JUMP_INSN and CALL_INSN.
Index: integrate.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/integrate.c,v
retrieving revision 1.28
diff -c -p -d -r1.28 integrate.c
*** integrate.c	1998/04/04 17:38:10	1.28
--- integrate.c	1998/05/08 20:51:13
*************** initialize_for_inline (fndecl, min_label
*** 389,398 ****
  				current_function_pops_args,
  				stack_slot_list, forced_labels, function_flags,
  				current_function_outgoing_args_size,
! 				arg_vector, (rtx) DECL_INITIAL (fndecl),
! 				(rtvec) regno_reg_rtx, regno_pointer_flag,
! 				regno_pointer_align,
! 				(rtvec) parm_reg_stack_loc);
  }
  
  /* Subroutine for `save_for_inline{copying,nocopy}'.  Finishes up the
--- 389,397 ----
  				current_function_pops_args,
  				stack_slot_list, forced_labels, function_flags,
  				current_function_outgoing_args_size,
! 				arg_vector, DECL_INITIAL (fndecl),
! 				regno_reg_rtx, regno_pointer_flag,
! 				regno_pointer_align, parm_reg_stack_loc);
  }
  
  /* Subroutine for `save_for_inline{copying,nocopy}'.  Finishes up the
Index: emit-rtl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/emit-rtl.c,v
retrieving revision 1.28
diff -c -p -d -r1.28 emit-rtl.c
*** emit-rtl.c	1998/04/22 12:57:02	1.28
--- emit-rtl.c	1998/05/08 20:51:13
*************** gen_inline_header_rtx (first_insn, first
*** 1511,1521 ****
       int function_flags;
       int outgoing_args_size;
       rtvec original_arg_vector;
!      rtx original_decl_initial;
!      rtvec regno_rtx;
       char *regno_flag;
       char *regno_align;
!      rtvec parm_reg_stack_loc;
  {
    rtx header = gen_rtx_INLINE_HEADER (VOIDmode,
  				      cur_insn_uid++, NULL_RTX,
--- 1493,1503 ----
       int function_flags;
       int outgoing_args_size;
       rtvec original_arg_vector;
!      tree original_decl_initial;
!      rtx *regno_rtx;
       char *regno_flag;
       char *regno_align;
!      rtx *parm_reg_stack_loc;
  {
    rtx header = gen_rtx_INLINE_HEADER (VOIDmode,
  				      cur_insn_uid++, NULL_RTX,
*************** gen_inline_header_rtx (first_insn, first
*** 1524,1533 ****
  				      max_parm_regnum, max_regnum, args_size,
  				      pops_args, stack_slots, forced_labels,
  				      function_flags, outgoing_args_size,
! 				      original_arg_vector,
! 				      original_decl_initial,
! 				      regno_rtx, regno_flag, regno_align,
! 				      parm_reg_stack_loc);
    return header;
  }
  
--- 1506,1518 ----
  				      max_parm_regnum, max_regnum, args_size,
  				      pops_args, stack_slots, forced_labels,
  				      function_flags, outgoing_args_size,
! 				      original_arg_vector);
!   ORIGINAL_DECL_INITIAL (header) = original_decl_initial;
!   INLINE_REGNO_REG_RTX (header) = regno_rtx;
!   INLINE_REGNO_POINTER_FLAG (header) = regno_flag;
!   INLINE_REGNO_POINTER_ALIGN (header) = regno_align;
!   PARMREG_STACK_LOC (header) = parm_reg_stack_loc;
! 
    return header;
  }
  

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: rtl slot lies
  1998-05-08 19:52 rtl slot lies Richard Henderson
@ 1998-05-09  5:27 ` John Carr
  0 siblings, 0 replies; 2+ messages in thread
From: John Carr @ 1998-05-09  5:27 UTC (permalink / raw)
  To: Richard Henderson; +Cc: egcs

> While working on a garbage collector, I discovered that the
> INLINE_HEADER rtl was lying about the types of some of its slots.
> 
> The following patch corrects this, and gets rid of wome ugly casts.

The rtl.h patch adds more ugly casts and is worse than the original code.
That kind of pointer cast is never valid C, unlike direct pointer casts
which can be valid depending on alignment.  If you want to store odd types
in, add a new generic pointer member (char/void *) and format code.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-05-09  5:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-08 19:52 rtl slot lies Richard Henderson
1998-05-09  5:27 ` John Carr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).