Skip to content
Snippets Groups Projects
Commit 559bba46 authored by Patrick Palka's avatar Patrick Palka
Browse files

gengtype: remove "tree_exp" special attribute

The function comment for adjust_field_tree_exp says this attribute is
for handling expression trees whose operands may contain pointers to RTL
instead of to trees.  But ever since r0-59671-gac45df5dba5804, which
fixed/removed the last two tree codes for which this was possible
(WITH_CLEANUP_EXPR and GOTO_SUBROUTINE_EXPR), this special attribute is
mostly a no-op.

This patch removes it and instead just annotates struct tree_exp
with the "length" attribute directly.  Not sure it makes a difference,
but I use %h instead of %0 in the attribute string to be consistent with
the other uses of the "length" attribute within tree-core.h.

This changes the code generated for TS_EXP handling in gt-cp-tree.h from:

  case TS_EXP:
    gt_ggc_m_9tree_node ((*x).generic.exp.typed.type);
    switch ((int) (TREE_CODE ((tree) &(*x))))
      {
      default:
	{
	  size_t i3;
	  size_t l3 = (size_t)(TREE_OPERAND_LENGTH ((tree) &(*x)));
	  for (i3 = 0; i3 != l3; i3++) {
	    gt_ggc_m_9tree_node ((*x).generic.exp.operands[i3]);
	  }
	}
	break;
      }
    break;

to:

  case TS_EXP:
    {
      size_t l3 = (size_t)(TREE_OPERAND_LENGTH ((tree)&((*x).generic.exp)));
      gt_ggc_m_9tree_node ((*x).generic.exp.typed.type);
      {
	size_t i3;
	for (i3 = 0; i3 != l3; i3++) {
	  gt_ggc_m_9tree_node ((*x).generic.exp.operands[i3]);
	}
      }
    }

which seems equivalent and simpler.

gcc/ChangeLog:

	* gengtype.cc (adjust_field_tree_exp): Remove.
	(adjust_field_type): Don't handle the "tree_exp" special attribute.
	* tree-core.h (struct tree_exp): Remove "special" and "desc"
	attributes.  Add "length" attribute.
parent 0aa277bf
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment