Pass vec_perm_indices by reference

This patch makes functions take vec_perm_indices by reference rather
than value, since a later patch will turn vec_perm_indices into a class
that would be more expensive to copy.

2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* optabs-query.h (can_vec_perm_p): Take a const vec_perm_indices *.
	* optabs-query.c (can_vec_perm_p): Likewise.
	* fold-const.c (fold_vec_perm): Take a const vec_perm_indices &
	instead of vec_perm_indices.
	* tree-vectorizer.h (vect_gen_perm_mask_any): Likewise,
	(vect_gen_perm_mask_checked): Likewise,
	* tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise,
	(vect_gen_perm_mask_checked): Likewise,

From-SVN: r256090
This commit is contained in:
Richard Sandiford
2018-01-02 18:25:57 +00:00
committed by Richard Sandiford
parent 3ea109a347
commit 4aae3cb355
6 changed files with 18 additions and 7 deletions
+11
View File
@@ -1,3 +1,14 @@
2018-01-02 Richard Sandiford <richard.sandiford@linaro.org>
* optabs-query.h (can_vec_perm_p): Take a const vec_perm_indices *.
* optabs-query.c (can_vec_perm_p): Likewise.
* fold-const.c (fold_vec_perm): Take a const vec_perm_indices &
instead of vec_perm_indices.
* tree-vectorizer.h (vect_gen_perm_mask_any): Likewise,
(vect_gen_perm_mask_checked): Likewise,
* tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise,
(vect_gen_perm_mask_checked): Likewise,
2018-01-02 Richard Sandiford <richard.sandiford@linaro.org>
* optabs-query.h (qimode_for_vec_perm): Declare.
+1 -1
View File
@@ -8923,7 +8923,7 @@ vec_cst_ctor_to_array (tree arg, unsigned int nelts, tree *elts)
NULL_TREE otherwise. */
static tree
fold_vec_perm (tree type, tree arg0, tree arg1, vec_perm_indices sel)
fold_vec_perm (tree type, tree arg0, tree arg1, const vec_perm_indices &sel)
{
unsigned int i;
bool need_ctor = false;
+1 -1
View File
@@ -369,7 +369,7 @@ qimode_for_vec_perm (machine_mode mode)
zeroes; this case is not dealt with here. */
bool
can_vec_perm_p (machine_mode mode, bool variable, vec_perm_indices *sel)
can_vec_perm_p (machine_mode mode, bool variable, const vec_perm_indices *sel)
{
machine_mode qimode;
+1 -1
View File
@@ -175,7 +175,7 @@ enum insn_code can_float_p (machine_mode, machine_mode, int);
enum insn_code can_fix_p (machine_mode, machine_mode, int, bool *);
bool can_conditionally_move_p (machine_mode mode);
opt_machine_mode qimode_for_vec_perm (machine_mode);
bool can_vec_perm_p (machine_mode, bool, vec_perm_indices *);
bool can_vec_perm_p (machine_mode, bool, const vec_perm_indices *);
/* Find a widening optab even if it doesn't widen as much as we want. */
#define find_widening_optab_handler(A, B, C) \
find_widening_optab_handler_and_mode (A, B, C, NULL)
+2 -2
View File
@@ -6523,7 +6523,7 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
vect_gen_perm_mask_checked. */
tree
vect_gen_perm_mask_any (tree vectype, vec_perm_indices sel)
vect_gen_perm_mask_any (tree vectype, const vec_perm_indices &sel)
{
tree mask_elt_type, mask_type;
@@ -6544,7 +6544,7 @@ vect_gen_perm_mask_any (tree vectype, vec_perm_indices sel)
i.e. that the target supports the pattern _for arbitrary input vectors_. */
tree
vect_gen_perm_mask_checked (tree vectype, vec_perm_indices sel)
vect_gen_perm_mask_checked (tree vectype, const vec_perm_indices &sel)
{
gcc_assert (can_vec_perm_p (TYPE_MODE (vectype), false, &sel));
return vect_gen_perm_mask_any (vectype, sel);
+2 -2
View File
@@ -1212,8 +1212,8 @@ extern void vect_get_load_cost (struct data_reference *, int, bool,
extern void vect_get_store_cost (struct data_reference *, int,
unsigned int *, stmt_vector_for_cost *);
extern bool vect_supportable_shift (enum tree_code, tree);
extern tree vect_gen_perm_mask_any (tree, vec_perm_indices);
extern tree vect_gen_perm_mask_checked (tree, vec_perm_indices);
extern tree vect_gen_perm_mask_any (tree, const vec_perm_indices &);
extern tree vect_gen_perm_mask_checked (tree, const vec_perm_indices &);
extern void optimize_mask_stores (struct loop*);
/* In tree-vect-data-refs.c. */