diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2024-08-07 10:58:45 -0700 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2024-08-08 06:53:37 -0700 |
commit | ad7d4843d452b97686bcc30da11b933759f09a12 (patch) | |
tree | 6e8db414b49579d71ece6eecede2da971cf6e8ea /gcc/tree-vect-patterns.cc | |
parent | ecdf7a4ed82bd95f8058914c9f92ad2c2f924033 (diff) | |
download | gcc-ad7d4843d452b97686bcc30da11b933759f09a12.zip gcc-ad7d4843d452b97686bcc30da11b933759f09a12.tar.gz gcc-ad7d4843d452b97686bcc30da11b933759f09a12.tar.bz2 |
vect: Small C++11-ification of vect_vect_recog_func_ptrs
This is a small C++11-ificiation for the use of vect_vect_recog_func_ptrs.
Changes the loop into a range based loop which then we can remove the variable
definition of NUM_PATTERNS. Also uses const reference instead of a pointer.
Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* tree-vect-patterns.cc (NUM_PATTERNS): Delete.
(vect_pattern_recog_1): Constify and change
recog_func to a reference.
(vect_pattern_recog): Use range-based loop over
vect_vect_recog_func_ptrs.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'gcc/tree-vect-patterns.cc')
-rw-r--r-- | gcc/tree-vect-patterns.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index 87b3dc4..f52de2b 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -7362,8 +7362,6 @@ static vect_recog_func vect_vect_recog_func_ptrs[] = { /* These must come after the double widening ones. */ }; -const unsigned int NUM_PATTERNS = ARRAY_SIZE (vect_vect_recog_func_ptrs); - /* Mark statements that are involved in a pattern. */ void @@ -7518,7 +7516,7 @@ vect_mark_pattern_stmts (vec_info *vinfo, static void vect_pattern_recog_1 (vec_info *vinfo, - vect_recog_func *recog_func, stmt_vec_info stmt_info) + const vect_recog_func &recog_func, stmt_vec_info stmt_info) { gimple *pattern_stmt; tree pattern_vectype; @@ -7538,7 +7536,7 @@ vect_pattern_recog_1 (vec_info *vinfo, } gcc_assert (!STMT_VINFO_PATTERN_DEF_SEQ (stmt_info)); - pattern_stmt = recog_func->fn (vinfo, stmt_info, &pattern_vectype); + pattern_stmt = recog_func.fn (vinfo, stmt_info, &pattern_vectype); if (!pattern_stmt) { /* Clear any half-formed pattern definition sequence. */ @@ -7550,7 +7548,7 @@ vect_pattern_recog_1 (vec_info *vinfo, if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "%s pattern recognized: %G", - recog_func->name, pattern_stmt); + recog_func.name, pattern_stmt); /* Mark the stmts that are involved in the pattern. */ vect_mark_pattern_stmts (vinfo, stmt_info, pattern_stmt, pattern_vectype); @@ -7658,8 +7656,8 @@ vect_pattern_recog (vec_info *vinfo) continue; /* Scan over all generic vect_recog_xxx_pattern functions. */ - for (unsigned j = 0; j < NUM_PATTERNS; j++) - vect_pattern_recog_1 (vinfo, &vect_vect_recog_func_ptrs[j], + for (const auto &func_ptr : vect_vect_recog_func_ptrs) + vect_pattern_recog_1 (vinfo, func_ptr, stmt_info); } } |