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: [PATCH][4/n] Remove BLOCK_ABSTRACT


On Fri, 28 Sep 2018, Richard Biener wrote:

> 
> It turns out that nobody sets this anymore (dwarf2out did with the
> original code of outputting abstract instances, temporarily so IIRC).
> 
> Bootstrap and regtest running on x86_64-unknown-linux-gnu.
> 
> Any objection to purge it completely like this?

It's gone now (r264868).

> DECL_ABSTRACT_P is a similar beast but I see the C++ FE still sets it
> on ctors-in-charge (or so).  Is this pure FE use or does the middle-end
> really need to care about that?  I'd possibly turn each DECL_ABSTRACT_P
> use in the middle-end into an assert but I wonder if you have any
> thoughts about this.

That question still stands.

Richard.

> Thanks,
> Richard.
> 
> 2018-09-28  Richard Biener  <rguenther@suse.de>
> 
> 	* tree-core.h (tree_block::abstract_flag): Remove.
> 	(tree_block::block_num): Make full 32bits.
> 	* tree.def (BLOCK): Remove docs about BLOCK_ABSTRACT.
> 	* tree.h (BLOCK_ABSTRACT): Remove.
> 	* dwarf2out.c (gen_lexical_block_die): Remove dead code
> 	resulting from BLOCK_ABSTRACT being always false.
> 	(gen_inlined_subroutine_die): Likewise.
> 	(gen_block_die): Likewise.
> 	* tree.c (block_ultimate_origin): Likewise.
> 	* tree-pretty-print.c (dump_block_node): Remove code dealing
> 	with BLOCK_ABSTRACT.
> 	* tree-ssa-live.c (dump_scope_block): Likewise.
> 	* tree-streamer-in.c (unpack_ts_block_value_fields): Likewise.
> 	* tree-streamer-out.c (pack_ts_block_value_fields): Likewise.
> 
> Index: gcc/dwarf2out.c
> ===================================================================
> --- gcc/dwarf2out.c	(revision 264689)
> +++ gcc/dwarf2out.c	(working copy)
> @@ -24071,25 +24071,7 @@ gen_lexical_block_die (tree stmt, dw_die
>        equate_block_to_die (stmt, stmt_die);
>      }
>  
> -  if (BLOCK_ABSTRACT (stmt))
> -    {
> -      if (old_die)
> -	{
> -	  /* This must have been generated early and it won't even
> -	     need location information since it's a DW_AT_inline
> -	     function.  */
> -	  if (flag_checking)
> -	    for (dw_die_ref c = context_die; c; c = c->die_parent)
> -	      if (c->die_tag == DW_TAG_inlined_subroutine
> -		  || c->die_tag == DW_TAG_subprogram)
> -		{
> -		  gcc_assert (get_AT (c, DW_AT_inline));
> -		  break;
> -		}
> -	  return;
> -	}
> -    }
> -  else if (BLOCK_ABSTRACT_ORIGIN (stmt))
> +  if (BLOCK_ABSTRACT_ORIGIN (stmt))
>      {
>        /* If this is an inlined or conrecte instance, create a new lexical
>  	 die for anything below to attach DW_AT_abstract_origin to.  */
> @@ -24109,7 +24091,7 @@ gen_lexical_block_die (tree stmt, dw_die
>    /* A non abstract block whose blocks have already been reordered
>       should have the instruction range for this block.  If so, set the
>       high/low attributes.  */
> -  if (!early_dwarf && !BLOCK_ABSTRACT (stmt) && TREE_ASM_WRITTEN (stmt))
> +  if (!early_dwarf && TREE_ASM_WRITTEN (stmt))
>      {
>        gcc_assert (stmt_die);
>        add_high_low_attributes (stmt, stmt_die);
> @@ -24123,48 +24105,38 @@ gen_lexical_block_die (tree stmt, dw_die
>  static void
>  gen_inlined_subroutine_die (tree stmt, dw_die_ref context_die)
>  {
> -  tree decl;
> -
> -  /* The instance of function that is effectively being inlined shall not
> -     be abstract.  */
> -  gcc_assert (! BLOCK_ABSTRACT (stmt));
> -
> -  decl = block_ultimate_origin (stmt);
> +  tree decl = block_ultimate_origin (stmt);
>  
>    /* Make sure any inlined functions are known to be inlineable.  */
>    gcc_checking_assert (DECL_ABSTRACT_P (decl)
>  		       || cgraph_function_possibly_inlined_p (decl));
>  
> -  if (! BLOCK_ABSTRACT (stmt))
> -    {
> -      dw_die_ref subr_die
> -	= new_die (DW_TAG_inlined_subroutine, context_die, stmt);
> +  dw_die_ref subr_die = new_die (DW_TAG_inlined_subroutine, context_die, stmt);
>  
> -      if (call_arg_locations || debug_inline_points)
> -	equate_block_to_die (stmt, subr_die);
> -      add_abstract_origin_attribute (subr_die, decl);
> -      if (TREE_ASM_WRITTEN (stmt))
> -        add_high_low_attributes (stmt, subr_die);
> -      add_call_src_coords_attributes (stmt, subr_die);
> -
> -      /* The inliner creates an extra BLOCK for the parameter setup,
> -         we want to merge that with the actual outermost BLOCK of the
> -	 inlined function to avoid duplicate locals in consumers.
> -	 Do that by doing the recursion to subblocks on the single subblock
> -	 of STMT.  */
> -      bool unwrap_one = false;
> -      if (BLOCK_SUBBLOCKS (stmt) && !BLOCK_CHAIN (BLOCK_SUBBLOCKS (stmt)))
> -	{
> -	  tree origin = block_ultimate_origin (BLOCK_SUBBLOCKS (stmt));
> -	  if (origin
> -	      && TREE_CODE (origin) == BLOCK
> -	      && BLOCK_SUPERCONTEXT (origin) == decl)
> -	    unwrap_one = true;
> -	}
> -      decls_for_scope (stmt, subr_die, !unwrap_one);
> -      if (unwrap_one)
> -	decls_for_scope (BLOCK_SUBBLOCKS (stmt), subr_die);
> -    }
> +  if (call_arg_locations || debug_inline_points)
> +    equate_block_to_die (stmt, subr_die);
> +  add_abstract_origin_attribute (subr_die, decl);
> +  if (TREE_ASM_WRITTEN (stmt))
> +    add_high_low_attributes (stmt, subr_die);
> +  add_call_src_coords_attributes (stmt, subr_die);
> +
> +  /* The inliner creates an extra BLOCK for the parameter setup,
> +     we want to merge that with the actual outermost BLOCK of the
> +     inlined function to avoid duplicate locals in consumers.
> +     Do that by doing the recursion to subblocks on the single subblock
> +     of STMT.  */
> +  bool unwrap_one = false;
> +  if (BLOCK_SUBBLOCKS (stmt) && !BLOCK_CHAIN (BLOCK_SUBBLOCKS (stmt)))
> +    {
> +      tree origin = block_ultimate_origin (BLOCK_SUBBLOCKS (stmt));
> +      if (origin
> +	  && TREE_CODE (origin) == BLOCK
> +	  && BLOCK_SUPERCONTEXT (origin) == decl)
> +	unwrap_one = true;
> +    }
> +  decls_for_scope (stmt, subr_die, !unwrap_one);
> +  if (unwrap_one)
> +    decls_for_scope (BLOCK_SUBBLOCKS (stmt), subr_die);
>  }
>  
>  /* Generate a DIE for a field in a record, or structure.  CTX is required: see
> @@ -25663,8 +25635,7 @@ gen_block_die (tree stmt, dw_die_ref con
>         still want to generate high/low PC attributes so output it.  */
>      must_output_die = 1;
>    else if (TREE_USED (stmt)
> -	   || TREE_ASM_WRITTEN (stmt)
> -	   || BLOCK_ABSTRACT (stmt))
> +	   || TREE_ASM_WRITTEN (stmt))
>      {
>        /* Determine if this block directly contains any "significant"
>  	 local declarations which we will need to output DIEs for.  */
> @@ -25697,23 +25668,7 @@ gen_block_die (tree stmt, dw_die_ref con
>    if (must_output_die)
>      {
>        if (inlined_func)
> -	{
> -	  /* If STMT block is abstract, that means we have been called
> -	     indirectly from dwarf2out_abstract_function.
> -	     That function rightfully marks the descendent blocks (of
> -	     the abstract function it is dealing with) as being abstract,
> -	     precisely to prevent us from emitting any
> -	     DW_TAG_inlined_subroutine DIE as a descendent
> -	     of an abstract function instance. So in that case, we should
> -	     not call gen_inlined_subroutine_die.
> -
> -	     Later though, when cgraph asks dwarf2out to emit info
> -	     for the concrete instance of the function decl into which
> -	     the concrete instance of STMT got inlined, the later will lead
> -	     to the generation of a DW_TAG_inlined_subroutine DIE.  */
> -	  if (! BLOCK_ABSTRACT (stmt))
> -	    gen_inlined_subroutine_die (stmt, context_die);
> -	}
> +	gen_inlined_subroutine_die (stmt, context_die);
>        else
>  	gen_lexical_block_die (stmt, context_die);
>      }
> Index: gcc/tree-core.h
> ===================================================================
> --- gcc/tree-core.h	(revision 264689)
> +++ gcc/tree-core.h	(working copy)
> @@ -1481,8 +1481,7 @@ struct GTY(()) tree_block {
>    struct tree_base base;
>    tree chain;
>  
> -  unsigned abstract_flag : 1;
> -  unsigned block_num : 31;
> +  unsigned block_num;
>  
>    location_t locus;
>    location_t end_locus;
> Index: gcc/tree-pretty-print.c
> ===================================================================
> --- gcc/tree-pretty-print.c	(revision 264689)
> +++ gcc/tree-pretty-print.c	(working copy)
> @@ -1124,9 +1124,6 @@ dump_block_node (pretty_printer *pp, tre
>    if (flags & TDF_ADDRESS)
>      pp_printf (pp, "[%p] ", (void *) block);
>  
> -  if (BLOCK_ABSTRACT (block))
> -    pp_string (pp, "[abstract] ");
> -
>    if (TREE_ASM_WRITTEN (block))
>      pp_string (pp, "[written] ");
>  
> Index: gcc/tree-ssa-live.c
> ===================================================================
> --- gcc/tree-ssa-live.c	(revision 264689)
> +++ gcc/tree-ssa-live.c	(working copy)
> @@ -643,9 +643,8 @@ dump_scope_block (FILE *file, int indent
>    tree var, t;
>    unsigned int i;
>  
> -  fprintf (file, "\n%*s{ Scope block #%i%s%s",indent, "" , BLOCK_NUMBER (scope),
> -  	   TREE_USED (scope) ? "" : " (unused)",
> -	   BLOCK_ABSTRACT (scope) ? " (abstract)": "");
> +  fprintf (file, "\n%*s{ Scope block #%i%s",indent, "" , BLOCK_NUMBER (scope),
> +  	   TREE_USED (scope) ? "" : " (unused)");
>    if (LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (scope)) != UNKNOWN_LOCATION)
>      {
>        expanded_location s = expand_location (BLOCK_SOURCE_LOCATION (scope));
> Index: gcc/tree-streamer-in.c
> ===================================================================
> --- gcc/tree-streamer-in.c	(revision 264689)
> +++ gcc/tree-streamer-in.c	(working copy)
> @@ -398,7 +398,6 @@ static void
>  unpack_ts_block_value_fields (struct data_in *data_in,
>  			      struct bitpack_d *bp, tree expr)
>  {
> -  BLOCK_ABSTRACT (expr) = (unsigned) bp_unpack_value (bp, 1);
>    /* BLOCK_NUMBER is recomputed.  */
>    stream_input_location (&BLOCK_SOURCE_LOCATION (expr), bp, data_in);
>  }
> Index: gcc/tree-streamer-out.c
> ===================================================================
> --- gcc/tree-streamer-out.c	(revision 264689)
> +++ gcc/tree-streamer-out.c	(working copy)
> @@ -344,7 +344,6 @@ static void
>  pack_ts_block_value_fields (struct output_block *ob,
>  			    struct bitpack_d *bp, tree expr)
>  {
> -  bp_pack_value (bp, BLOCK_ABSTRACT (expr), 1);
>    /* BLOCK_NUMBER is recomputed.  */
>    /* Stream BLOCK_SOURCE_LOCATION for the limited cases we can handle - those
>       that represent inlined function scopes.
> Index: gcc/tree.c
> ===================================================================
> --- gcc/tree.c	(revision 264689)
> +++ gcc/tree.c	(working copy)
> @@ -12135,11 +12135,6 @@ block_ultimate_origin (const_tree block)
>  {
>    tree immediate_origin = BLOCK_ABSTRACT_ORIGIN (block);
>  
> -  /* BLOCK_ABSTRACT_ORIGIN can point to itself; ignore that if
> -     we're trying to output the abstract instance of this function.  */
> -  if (BLOCK_ABSTRACT (block) && immediate_origin == block)
> -    return NULL_TREE;
> -
>    if (immediate_origin == NULL_TREE)
>      return NULL_TREE;
>    else
> Index: gcc/tree.def
> ===================================================================
> --- gcc/tree.def	(revision 264689)
> +++ gcc/tree.def	(working copy)
> @@ -70,9 +70,6 @@ DEFTREECODE (TREE_VEC, "tree_vec", tcc_e
>     could either point to another BLOCK node or it could point to a
>     FUNCTION_DECL node (e.g. in the case of a block representing the
>     outermost scope of a particular inlining of a function).
> -   BLOCK_ABSTRACT is nonzero if the block represents an abstract
> -   instance of a block (i.e. one which is nested within an abstract
> -   instance of an inline function).
>     TREE_ASM_WRITTEN is nonzero if the block was actually referenced
>     in the generated assembly.  */
>  DEFTREECODE (BLOCK, "block", tcc_exceptional, 0)
> Index: gcc/tree.h
> ===================================================================
> --- gcc/tree.h	(revision 264689)
> +++ gcc/tree.h	(working copy)
> @@ -1791,7 +1791,6 @@ extern tree maybe_wrap_with_location (tr
>  #define BLOCK_ABSTRACT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.abstract_origin)
>  #define BLOCK_ORIGIN(NODE) \
>    (BLOCK_ABSTRACT_ORIGIN(NODE) ? BLOCK_ABSTRACT_ORIGIN(NODE) : (NODE))
> -#define BLOCK_ABSTRACT(NODE) (BLOCK_CHECK (NODE)->block.abstract_flag)
>  #define BLOCK_DIE(NODE) (BLOCK_CHECK (NODE)->block.die)
>  
>  /* True if BLOCK has the same ranges as its BLOCK_SUPERCONTEXT.  */
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)


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