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]

Fix dwarf2out wrt very large datstructures


> > I was trying to do the same on hammer branch and it did hit problems
> > with unwind code not being able to realize that (plus (rsp) (reg2))
> > is (plus (rsp) (big_constant)), so I had to create new pattern
> > pro_epilogue_adjust_stack_rex64_2.  DOes this problem still remain in
> > mainline or it has been fixed?
> 
> What was the difference in the unwind info?
> Here is an updated patch which uses pro_epilogue_adjust_stack_rex64_2
> from hammer-3_3-branch (fixed up a little bit and simplified),
> but it generates identical assembly as when it was using just _rex64.

Looking into the code in question, there is yet another 32bit cast in
the cross-compilation.  I attempted to catch all cases where
HOST_WIDE_INT is casted to long, as a result there are not very many
longs in dwarf2out anymore.  Does this look OK?

2003-10-24  Jan Hubicka  <jh@suse.cz>
	* dwarf2out.c (dw_cfi_oprnd_struct): Offset is HOST_WIDE_INT.
	(cfa_loc): Likewise.
	(reg_save, stack_adjust_offset, queue_reg_save): Replace long by
	HOST_WIDE_INT.
	(args_size, old_args_size): change type to HOST_WIDE_INT.
	(dwarf2out_def_cfa, dwarf2out_args_size,
	dwarf2out_reg_save, new_loc_descr): offset is HOST_WIDE_INT.
	(dw_val_struct): integers, unsigneds and offsets are HOST_WIDE_INT.
	(add_AT_int, add_AT_unsigned, att_AT_offset, AT_int, AT_unsigned,
	AT_offset): Use HOST_WIDE_INT.
	(based_loc_descr): offset is HOST_WIDE_INT.
	(add_data_member): Likewise.
	(add_const_value_attribute): Simplify.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.459
diff -c -3 -p -r1.459 dwarf2out.c
*** dwarf2out.c	22 Oct 2003 20:20:19 -0000	1.459
--- dwarf2out.c	24 Oct 2003 08:56:19 -0000
*************** enum dw_cfi_oprnd_type {
*** 204,210 ****
  typedef union dw_cfi_oprnd_struct GTY(())
  {
    unsigned long GTY ((tag ("dw_cfi_oprnd_reg_num"))) dw_cfi_reg_num;
!   long int GTY ((tag ("dw_cfi_oprnd_offset"))) dw_cfi_offset;
    const char * GTY ((tag ("dw_cfi_oprnd_addr"))) dw_cfi_addr;
    struct dw_loc_descr_struct * GTY ((tag ("dw_cfi_oprnd_loc"))) dw_cfi_loc;
  }
--- 204,210 ----
  typedef union dw_cfi_oprnd_struct GTY(())
  {
    unsigned long GTY ((tag ("dw_cfi_oprnd_reg_num"))) dw_cfi_reg_num;
!   HOST_WIDE_INT int GTY ((tag ("dw_cfi_oprnd_offset"))) dw_cfi_offset;
    const char * GTY ((tag ("dw_cfi_oprnd_addr"))) dw_cfi_addr;
    struct dw_loc_descr_struct * GTY ((tag ("dw_cfi_oprnd_loc"))) dw_cfi_loc;
  }
*************** dw_cfi_node;
*** 229,236 ****
  typedef struct cfa_loc GTY(())
  {
    unsigned long reg;
!   long offset;
!   long base_offset;
    int indirect;            /* 1 if CFA is accessed via a dereference.  */
  } dw_cfa_location;
  
--- 229,236 ----
  typedef struct cfa_loc GTY(())
  {
    unsigned long reg;
!   HOST_WIDE_INT offset;
!   HOST_WIDE_INT base_offset;
    int indirect;            /* 1 if CFA is accessed via a dereference.  */
  } dw_cfa_location;
  
*************** static void add_cfi (dw_cfi_ref *, dw_cf
*** 350,362 ****
  static void add_fde_cfi (const char *, dw_cfi_ref);
  static void lookup_cfa_1 (dw_cfi_ref, dw_cfa_location *);
  static void lookup_cfa (dw_cfa_location *);
! static void reg_save (const char *, unsigned, unsigned, long);
  static void initial_return_save (rtx);
! static long stack_adjust_offset (rtx);
  static void output_cfi (dw_cfi_ref, dw_fde_ref, int);
  static void output_call_frame_info (int);
  static void dwarf2out_stack_adjust (rtx);
! static void queue_reg_save (const char *, rtx, long);
  static void flush_queued_reg_saves (void);
  static bool clobbers_queued_reg_save (rtx);
  static void dwarf2out_frame_debug_expr (rtx, const char *);
--- 350,362 ----
  static void add_fde_cfi (const char *, dw_cfi_ref);
  static void lookup_cfa_1 (dw_cfi_ref, dw_cfa_location *);
  static void lookup_cfa (dw_cfa_location *);
! static void reg_save (const char *, unsigned, unsigned, HOST_WIDE_INT);
  static void initial_return_save (rtx);
! static HOST_WIDE_INT stack_adjust_offset (rtx);
  static void output_cfi (dw_cfi_ref, dw_fde_ref, int);
  static void output_call_frame_info (int);
  static void dwarf2out_stack_adjust (rtx);
! static void queue_reg_save (const char *, rtx, HOST_WIDE_INT);
  static void flush_queued_reg_saves (void);
  static bool clobbers_queued_reg_save (rtx);
  static void dwarf2out_frame_debug_expr (rtx, const char *);
*************** static dw_cfa_location cfa;
*** 705,721 ****
  static dw_cfa_location cfa_store;
  
  /* The running total of the size of arguments pushed onto the stack.  */
! static long args_size;
  
  /* The last args_size we actually output.  */
! static long old_args_size;
  
  /* Entry point to update the canonical frame address (CFA).
     LABEL is passed to add_fde_cfi.  The value of CFA is now to be
     calculated from REG+OFFSET.  */
  
  void
! dwarf2out_def_cfa (const char *label, unsigned int reg, long int offset)
  {
    dw_cfa_location loc;
    loc.indirect = 0;
--- 705,721 ----
  static dw_cfa_location cfa_store;
  
  /* The running total of the size of arguments pushed onto the stack.  */
! static HOST_WIDE_INT args_size;
  
  /* The last args_size we actually output.  */
! static HOST_WIDE_INT old_args_size;
  
  /* Entry point to update the canonical frame address (CFA).
     LABEL is passed to add_fde_cfi.  The value of CFA is now to be
     calculated from REG+OFFSET.  */
  
  void
! dwarf2out_def_cfa (const char *label, unsigned int reg, HOST_WIDE_INT offset)
  {
    dw_cfa_location loc;
    loc.indirect = 0;
*************** def_cfa_1 (const char *label, dw_cfa_loc
*** 802,808 ****
     otherwise it is saved in SREG.  */
  
  static void
! reg_save (const char *label, unsigned int reg, unsigned int sreg, long int offset)
  {
    dw_cfi_ref cfi = new_cfi ();
  
--- 802,808 ----
     otherwise it is saved in SREG.  */
  
  static void
! reg_save (const char *label, unsigned int reg, unsigned int sreg, HOST_WIDE_INT offset)
  {
    dw_cfi_ref cfi = new_cfi ();
  
*************** reg_save (const char *label, unsigned in
*** 825,831 ****
  	   DWARF_CIE_DATA_ALIGNMENT, there is either a bug in the
  	   definition of DWARF_CIE_DATA_ALIGNMENT, or a bug in the machine
  	   description.  */
! 	long check_offset = offset / DWARF_CIE_DATA_ALIGNMENT;
  
  	if (check_offset * DWARF_CIE_DATA_ALIGNMENT != offset)
  	  abort ();
--- 825,831 ----
  	   DWARF_CIE_DATA_ALIGNMENT, there is either a bug in the
  	   definition of DWARF_CIE_DATA_ALIGNMENT, or a bug in the machine
  	   description.  */
! 	HOST_WIDE_INT check_offset = offset / DWARF_CIE_DATA_ALIGNMENT;
  
  	if (check_offset * DWARF_CIE_DATA_ALIGNMENT != offset)
  	  abort ();
*************** dwarf2out_window_save (const char *label
*** 869,875 ****
     pushed onto the stack.  */
  
  void
! dwarf2out_args_size (const char *label, long int size)
  {
    dw_cfi_ref cfi;
  
--- 869,875 ----
     pushed onto the stack.  */
  
  void
! dwarf2out_args_size (const char *label, HOST_WIDE_INT size)
  {
    dw_cfi_ref cfi;
  
*************** dwarf2out_args_size (const char *label, 
*** 888,894 ****
     number.  LABEL and OFFSET are passed to reg_save.  */
  
  void
! dwarf2out_reg_save (const char *label, unsigned int reg, long int offset)
  {
    reg_save (label, DWARF_FRAME_REGNUM (reg), -1, offset);
  }
--- 888,894 ----
     number.  LABEL and OFFSET are passed to reg_save.  */
  
  void
! dwarf2out_reg_save (const char *label, unsigned int reg, HOST_WIDE_INT offset)
  {
    reg_save (label, DWARF_FRAME_REGNUM (reg), -1, offset);
  }
*************** dwarf2out_reg_save (const char *label, u
*** 897,903 ****
     LABEL and OFFSET are passed to reg_save.  */
  
  void
! dwarf2out_return_save (const char *label, long int offset)
  {
    reg_save (label, DWARF_FRAME_RETURN_COLUMN, -1, offset);
  }
--- 897,903 ----
     LABEL and OFFSET are passed to reg_save.  */
  
  void
! dwarf2out_return_save (const char *label, HOST_WIDE_INT offset)
  {
    reg_save (label, DWARF_FRAME_RETURN_COLUMN, -1, offset);
  }
*************** initial_return_save (rtx rtl)
*** 975,981 ****
  /* Given a SET, calculate the amount of stack adjustment it
     contains.  */
  
! static long
  stack_adjust_offset (rtx pattern)
  {
    rtx src = SET_SRC (pattern);
--- 975,981 ----
  /* Given a SET, calculate the amount of stack adjustment it
     contains.  */
  
! static HOST_WIDE_INT
  stack_adjust_offset (rtx pattern)
  {
    rtx src = SET_SRC (pattern);
*************** struct queued_reg_save GTY(())
*** 1131,1137 ****
  {
    struct queued_reg_save *next;
    rtx reg;
!   long cfa_offset;
  };
  
  static GTY(()) struct queued_reg_save *queued_reg_saves;
--- 1131,1137 ----
  {
    struct queued_reg_save *next;
    rtx reg;
!   HOST_WIDE_INT cfa_offset;
  };
  
  static GTY(()) struct queued_reg_save *queued_reg_saves;
*************** static GTY(()) struct queued_reg_save *q
*** 1140,1146 ****
  static const char *last_reg_save_label;
  
  static void
! queue_reg_save (const char *label, rtx reg, long int offset)
  {
    struct queued_reg_save *q = ggc_alloc (sizeof (*q));
  
--- 1140,1146 ----
  static const char *last_reg_save_label;
  
  static void
! queue_reg_save (const char *label, rtx reg, HOST_WIDE_INT offset)
  {
    struct queued_reg_save *q = ggc_alloc (sizeof (*q));
  
*************** typedef struct dw_val_struct GTY(())
*** 2365,2375 ****
    union dw_val_struct_union
      {
        rtx GTY ((tag ("dw_val_class_addr"))) val_addr;
!       long unsigned GTY ((tag ("dw_val_class_offset"))) val_offset;
        dw_loc_list_ref GTY ((tag ("dw_val_class_loc_list"))) val_loc_list;
        dw_loc_descr_ref GTY ((tag ("dw_val_class_loc"))) val_loc;
!       long int GTY ((default (""))) val_int;
!       long unsigned GTY ((tag ("dw_val_class_unsigned_const"))) val_unsigned;
        dw_long_long_const GTY ((tag ("dw_val_class_long_long"))) val_long_long;
        dw_float_const GTY ((tag ("dw_val_class_float"))) val_float;
        struct dw_val_die_union
--- 2365,2375 ----
    union dw_val_struct_union
      {
        rtx GTY ((tag ("dw_val_class_addr"))) val_addr;
!       unsigned HOST_WIDE_INT GTY ((tag ("dw_val_class_offset"))) val_offset;
        dw_loc_list_ref GTY ((tag ("dw_val_class_loc_list"))) val_loc_list;
        dw_loc_descr_ref GTY ((tag ("dw_val_class_loc"))) val_loc;
!       HOST_WIDE_INT int GTY ((default (""))) val_int;
!       unsigned HOST_WIDE_INT GTY ((tag ("dw_val_class_unsigned_const"))) val_unsigned;
        dw_long_long_const GTY ((tag ("dw_val_class_long_long"))) val_long_long;
        dw_float_const GTY ((tag ("dw_val_class_float"))) val_float;
        struct dw_val_die_union
*************** typedef struct dw_loc_list_struct GTY(()
*** 2417,2423 ****
  
  static const char *dwarf_stack_op_name (unsigned);
  static dw_loc_descr_ref new_loc_descr (enum dwarf_location_atom,
! 				       unsigned long, unsigned long);
  static void add_loc_descr (dw_loc_descr_ref *, dw_loc_descr_ref);
  static unsigned long size_of_loc_descr (dw_loc_descr_ref);
  static unsigned long size_of_locs (dw_loc_descr_ref);
--- 2417,2423 ----
  
  static const char *dwarf_stack_op_name (unsigned);
  static dw_loc_descr_ref new_loc_descr (enum dwarf_location_atom,
! 				       unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT);
  static void add_loc_descr (dw_loc_descr_ref *, dw_loc_descr_ref);
  static unsigned long size_of_loc_descr (dw_loc_descr_ref);
  static unsigned long size_of_locs (dw_loc_descr_ref);
*************** dwarf_stack_op_name (unsigned int op)
*** 2742,2749 ****
     together to form more complicated location (address) descriptions.  */
  
  static inline dw_loc_descr_ref
! new_loc_descr (enum dwarf_location_atom op, long unsigned int oprnd1,
! 	       long unsigned int oprnd2)
  {
    dw_loc_descr_ref descr = ggc_alloc_cleared (sizeof (dw_loc_descr_node));
  
--- 2742,2749 ----
     together to form more complicated location (address) descriptions.  */
  
  static inline dw_loc_descr_ref
! new_loc_descr (enum dwarf_location_atom op, unsigned HOST_WIDE_INT oprnd1,
! 	       unsigned HOST_WIDE_INT oprnd2)
  {
    dw_loc_descr_ref descr = ggc_alloc_cleared (sizeof (dw_loc_descr_node));
  
*************** static void add_dwarf_attr (dw_die_ref, 
*** 3586,3595 ****
  static inline enum dw_val_class AT_class (dw_attr_ref);
  static void add_AT_flag (dw_die_ref, enum dwarf_attribute, unsigned);
  static inline unsigned AT_flag (dw_attr_ref);
! static void add_AT_int (dw_die_ref, enum dwarf_attribute, long);
! static inline long int AT_int (dw_attr_ref);
! static void add_AT_unsigned (dw_die_ref, enum dwarf_attribute, unsigned long);
! static inline unsigned long AT_unsigned (dw_attr_ref);
  static void add_AT_long_long (dw_die_ref, enum dwarf_attribute, unsigned long,
  			      unsigned long);
  static void add_AT_float (dw_die_ref, enum dwarf_attribute, unsigned, long *);
--- 3586,3595 ----
  static inline enum dw_val_class AT_class (dw_attr_ref);
  static void add_AT_flag (dw_die_ref, enum dwarf_attribute, unsigned);
  static inline unsigned AT_flag (dw_attr_ref);
! static void add_AT_int (dw_die_ref, enum dwarf_attribute, HOST_WIDE_INT);
! static inline HOST_WIDE_INT AT_int (dw_attr_ref);
! static void add_AT_unsigned (dw_die_ref, enum dwarf_attribute, unsigned HOST_WIDE_INT);
! static inline unsigned HOST_WIDE_INT AT_unsigned (dw_attr_ref);
  static void add_AT_long_long (dw_die_ref, enum dwarf_attribute, unsigned long,
  			      unsigned long);
  static void add_AT_float (dw_die_ref, enum dwarf_attribute, unsigned, long *);
*************** static void add_AT_addr (dw_die_ref, enu
*** 3612,3618 ****
  static inline rtx AT_addr (dw_attr_ref);
  static void add_AT_lbl_id (dw_die_ref, enum dwarf_attribute, const char *);
  static void add_AT_lbl_offset (dw_die_ref, enum dwarf_attribute, const char *);
! static void add_AT_offset (dw_die_ref, enum dwarf_attribute, unsigned long);
  static void add_AT_range_list (dw_die_ref, enum dwarf_attribute,
  			       unsigned long);
  static inline const char *AT_lbl (dw_attr_ref);
--- 3612,3619 ----
  static inline rtx AT_addr (dw_attr_ref);
  static void add_AT_lbl_id (dw_die_ref, enum dwarf_attribute, const char *);
  static void add_AT_lbl_offset (dw_die_ref, enum dwarf_attribute, const char *);
! static void add_AT_offset (dw_die_ref, enum dwarf_attribute,
! 			   unsigned HOST_WIDE_INT);
  static void add_AT_range_list (dw_die_ref, enum dwarf_attribute,
  			       unsigned long);
  static inline const char *AT_lbl (dw_attr_ref);
*************** static dw_loc_descr_ref reg_loc_descript
*** 3702,3708 ****
  static dw_loc_descr_ref one_reg_loc_descriptor (unsigned int);
  static dw_loc_descr_ref multiple_reg_loc_descriptor (rtx, rtx);
  static dw_loc_descr_ref int_loc_descriptor (HOST_WIDE_INT);
! static dw_loc_descr_ref based_loc_descr (unsigned, long);
  static int is_based_loc (rtx);
  static dw_loc_descr_ref mem_loc_descriptor (rtx, enum machine_mode mode);
  static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx);
--- 3703,3709 ----
  static dw_loc_descr_ref one_reg_loc_descriptor (unsigned int);
  static dw_loc_descr_ref multiple_reg_loc_descriptor (rtx, rtx);
  static dw_loc_descr_ref int_loc_descriptor (HOST_WIDE_INT);
! static dw_loc_descr_ref based_loc_descr (unsigned, HOST_WIDE_INT);
  static int is_based_loc (rtx);
  static dw_loc_descr_ref mem_loc_descriptor (rtx, enum machine_mode mode);
  static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx);
*************** AT_flag (dw_attr_ref a)
*** 4480,4486 ****
  /* Add a signed integer attribute value to a DIE.  */
  
  static inline void
! add_AT_int (dw_die_ref die, enum dwarf_attribute attr_kind, long int int_val)
  {
    dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
  
--- 4481,4487 ----
  /* Add a signed integer attribute value to a DIE.  */
  
  static inline void
! add_AT_int (dw_die_ref die, enum dwarf_attribute attr_kind, HOST_WIDE_INT int_val)
  {
    dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
  
*************** add_AT_int (dw_die_ref die, enum dwarf_a
*** 4491,4497 ****
    add_dwarf_attr (die, attr);
  }
  
! static inline long int
  AT_int (dw_attr_ref a)
  {
    if (a && AT_class (a) == dw_val_class_const)
--- 4492,4498 ----
    add_dwarf_attr (die, attr);
  }
  
! static inline HOST_WIDE_INT
  AT_int (dw_attr_ref a)
  {
    if (a && AT_class (a) == dw_val_class_const)
*************** AT_int (dw_attr_ref a)
*** 4504,4510 ****
  
  static inline void
  add_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind,
! 		 long unsigned int unsigned_val)
  {
    dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
  
--- 4505,4511 ----
  
  static inline void
  add_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind,
! 		 unsigned HOST_WIDE_INT int unsigned_val)
  {
    dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
  
*************** add_AT_unsigned (dw_die_ref die, enum dw
*** 4515,4521 ****
    add_dwarf_attr (die, attr);
  }
  
! static inline unsigned long
  AT_unsigned (dw_attr_ref a)
  {
    if (a && AT_class (a) == dw_val_class_unsigned_const)
--- 4516,4522 ----
    add_dwarf_attr (die, attr);
  }
  
! static inline unsigned HOST_WIDE_INT
  AT_unsigned (dw_attr_ref a)
  {
    if (a && AT_class (a) == dw_val_class_unsigned_const)
*************** add_AT_lbl_offset (dw_die_ref die, enum 
*** 4803,4809 ****
  /* Add an offset attribute value to a DIE.  */
  
  static inline void
! add_AT_offset (dw_die_ref die, enum dwarf_attribute attr_kind, long unsigned int offset)
  {
    dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
  
--- 4804,4811 ----
  /* Add an offset attribute value to a DIE.  */
  
  static inline void
! add_AT_offset (dw_die_ref die, enum dwarf_attribute attr_kind,
! 	       unsigned HOST_WIDE_INT offset)
  {
    dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
  
*************** int_loc_descriptor (HOST_WIDE_INT i)
*** 8106,8112 ****
  /* Return a location descriptor that designates a base+offset location.  */
  
  static dw_loc_descr_ref
! based_loc_descr (unsigned int reg, long int offset)
  {
    dw_loc_descr_ref loc_result;
    /* For the "frame base", we use the frame pointer or stack pointer
--- 8108,8114 ----
  /* Return a location descriptor that designates a base+offset location.  */
  
  static dw_loc_descr_ref
! based_loc_descr (unsigned int reg, HOST_WIDE_INT offset)
  {
    dw_loc_descr_ref loc_result;
    /* For the "frame base", we use the frame pointer or stack pointer
*************** add_AT_location_description (dw_die_ref 
*** 9000,9006 ****
  static void
  add_data_member_location_attribute (dw_die_ref die, tree decl)
  {
!   long offset;
    dw_loc_descr_ref loc_descr = 0;
  
    if (TREE_CODE (decl) == TREE_VEC)
--- 9002,9008 ----
  static void
  add_data_member_location_attribute (dw_die_ref die, tree decl)
  {
!   HOST_WIDE_INT offset;
    dw_loc_descr_ref loc_descr = 0;
  
    if (TREE_CODE (decl) == TREE_VEC)
*************** add_const_value_attribute (dw_die_ref di
*** 9094,9113 ****
        {
  	HOST_WIDE_INT val = INTVAL (rtl);
  
! 	/* ??? We really should be using HOST_WIDE_INT throughout.  */
! 	if (val < 0 && (long) val == val)
! 	  add_AT_int (die, DW_AT_const_value, (long) val);
! 	else if ((unsigned long) val == (unsigned HOST_WIDE_INT) val)
! 	  add_AT_unsigned (die, DW_AT_const_value, (unsigned long) val);
! 	else
! 	  {
! #if HOST_BITS_PER_LONG * 2 == HOST_BITS_PER_WIDE_INT
! 	    add_AT_long_long (die, DW_AT_const_value,
! 			      val >> HOST_BITS_PER_LONG, val);
! #else
! 	    abort ();
! #endif
! 	  }
        }
        break;
  
--- 9096,9105 ----
        {
  	HOST_WIDE_INT val = INTVAL (rtl);
  
! 	if (val < 0)
! 	  add_AT_int (die, DW_AT_const_value, val);
! 	else 
! 	  add_AT_unsigned (die, DW_AT_const_value, (unsigned HOST_WIDE_INT) val);
        }
        break;
  


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