gengtype: remove "tree_exp" special attribute
authorPatrick Palka <ppalka@redhat.com>
Sat, 30 Apr 2022 14:56:49 +0000 (10:56 -0400)
committerPatrick Palka <ppalka@redhat.com>
Sat, 30 Apr 2022 14:56:49 +0000 (10:56 -0400)
commit559bba46cdd3141576614d9bb3928e26c299a0fe
treefb0cd5096e7fbf478a7259ab13d8b989ad4c65e1
parent0aa277bf0b4b794314ab3f11bab438d17b57465d
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.
gcc/gengtype.cc
gcc/tree-core.h