vect: Use generalised accessors to build SLP nodes
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 30 Nov 2021 09:52:28 +0000 (09:52 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 30 Nov 2021 09:52:28 +0000 (09:52 +0000)
commit6f798618c070e2ca505e39c3fcc0c3ca478ac81b
tree868d81e39387ac14d9b90c36a68ae530c235bd1b
parent8de7958fbd126528c5a5a95a068c0692f6a643cc
vect: Use generalised accessors to build SLP nodes

This patch adds:

- gimple_num_args
- gimple_arg
- gimple_arg_ptr

for accessing rhs operands of an assignment, call or PHI.  This is
similar to the existing gimple_get_lhs.

I guess there's a danger that these routines could be overused,
such as in cases where gimple_assign_rhs1 etc. would be more
appropriate.  I think the routines are still worth having though.
These days, most new operations are added as internal functions rather
than tree codes, so it's useful to be able to handle assignments and
calls in a consistent way.

The patch also generalises the way that SLP child nodes map
to gimple stmt operands.  This is useful for later patches.

gcc/
* gimple.h (gimple_num_args, gimple_arg, gimple_arg_ptr): New
functions.
* tree-vect-slp.c (cond_expr_maps, arg2_map): New variables.
(vect_get_operand_map): New function.
(vect_get_and_check_slp_defs): Fix outdated comment.
Use vect_get_operand_map and new gimple argument accessors.
(vect_build_slp_tree_2): Likewise.
gcc/gimple.h
gcc/tree-vect-slp.c