From 4aae3cb3559802faee3b5cb58d9315dcc5000bc8 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 2 Jan 2018 18:25:57 +0000 Subject: [PATCH] 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 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 --- gcc/ChangeLog | 11 +++++++++++ gcc/fold-const.c | 2 +- gcc/optabs-query.c | 2 +- gcc/optabs-query.h | 2 +- gcc/tree-vect-stmts.c | 4 ++-- gcc/tree-vectorizer.h | 4 ++-- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 60bbfbf4253..be819e2a71c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2018-01-02 Richard Sandiford + + * 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 * optabs-query.h (qimode_for_vec_perm): Declare. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e776108c411..224c0854bdd 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -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; diff --git a/gcc/optabs-query.c b/gcc/optabs-query.c index 02a583fa8a5..b8e7e314b0f 100644 --- a/gcc/optabs-query.c +++ b/gcc/optabs-query.c @@ -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; diff --git a/gcc/optabs-query.h b/gcc/optabs-query.h index ce0c401a9d5..392429645cd 100644 --- a/gcc/optabs-query.h +++ b/gcc/optabs-query.h @@ -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) diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 0c343d4e7d9..b0df11b930f 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -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); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 8291a71a057..6b75afc7c11 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -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. */ -- 2.30.2