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]

Re: dwarf2out tree expression expansion improvements


Hi!

On Wed, Sep 16, 2009 at 02:33:29PM +0200, Jan Hubicka wrote:
> *************** mem_loc_descriptor (rtx rtl, enum machin
> *** 11193,11198 ****
> --- 11229,11250 ----
>         VEC_safe_push (rtx, gc, used_rtx_array, rtl);
>         break;
>   
> +     case CONCAT:
> +       {
> +         rtx x0 = XEXP (rtl, 0);
> +         rtx x1 = XEXP (rtl, 1);
> +         dw_loc_descr_ref x0_ref = mem_loc_descriptor (x0, GET_MODE (x0), VAR_INIT_STATUS_INITIALIZED);
> +         dw_loc_descr_ref x1_ref = mem_loc_descriptor (x1, GET_MODE (x1), VAR_INIT_STATUS_INITIALIZED);
> + 	if (x0_ref == 0 || x1_ref == 0)
> + 	  return 0;
> + 	mem_loc_result = x0_ref;
> + 	add_loc_descr_op_piece (&mem_loc_result, GET_MODE_SIZE (GET_MODE (x0)));
> + 
> + 	add_loc_descr (&mem_loc_result, x1_ref);
> + 	add_loc_descr_op_piece (&mem_loc_result, GET_MODE_SIZE (GET_MODE (x1)));
> +       }
> +       break;
> + 
>       case PRE_MODIFY:
>         /* Extract the PLUS expression nested inside and fall into
>   	 PLUS code below.  */
> *************** mem_loc_descriptor (rtx rtl, enum machin
> *** 11327,11332 ****
> --- 11379,11397 ----
>   						   VAR_INIT_STATUS_INITIALIZED);
>         break;
>   
> +     case VAR_LOCATION:
> +       if (GET_CODE (XEXP (rtl, 1)) != PARALLEL)
> + 	{
> + 	  mem_loc_result = mem_loc_descriptor (XEXP (XEXP (rtl, 1), 0), mode, initialized);
> + 	  break;
> + 	}
> +       /* TODO: We can handle this case via OP_piece of dwarf stack machine operatoins.

s/operatoins/operations/

> + 	 It should not be common case however.  */
> +       expansion_failed (NULL_TREE, rtl,
> + 			"Multipart value can not be used in value expression.\n");
> +       return 0;
> +       break;
> + 
>       case EQ:
>         op = DW_OP_eq;
>         goto do_scompare;

The above two, especially the latter, look very dangerous to me.  The
problem is that DW_OP_{,bit_}piece (and also DW_OP_stack_value which must be
followed by one of these) must be always at the top level of the location
expression, but mem_loc_descriptor is called recursively, so if it handles
these and is surrounded by anything that adds some operations after it, we
generate invalid debug info.

That's the reason for the mem_loc_descriptor vs. loc_descriptor separation,
loc_descriptor is the toplevel one, which handles stuff that can only be
handled/appear at the toplevel, while mem_loc_descriptor recurses.
loc_descriptor already handles CONCAT, CONCATN, REG, VAR_LOCATION etc.

	Jakub


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