From 130349b3fd358ab22ab46507e970edc615477be4 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 29 Oct 2014 12:49:39 -0400 Subject: [PATCH] Convert remaining gimple_omp_single_ accessors to be typesafe gcc/ChangeLog.gimple-classes: * gimple.h (gimple_omp_single_clauses): Strengthen param from const_gimple to const gomp_single *. (gimple_omp_single_clauses_ptr): Strengthen param from gimple to gomp_single *. * gimple-walk.c (walk_gimple_op): Add checked cast. * tree-inline.c (remap_gimple_stmt): Within case GIMPLE_OMP_SINGLE, introduce local "omp_single_stmt" via a checked cast and use in place of "stmt". * tree-nested.c (convert_nonlocal_reference_stmt): Likewise. (convert_local_reference_stmt): Likewise. --- gcc/ChangeLog.gimple-classes | 14 ++++++++++++++ gcc/gimple-walk.c | 5 +++-- gcc/gimple.h | 13 +++++-------- gcc/tree-inline.c | 9 ++++++--- gcc/tree-nested.c | 31 +++++++++++++++++++++---------- 5 files changed, 49 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index d85abcd8a2a..f265a257d3c 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,19 @@ 2014-10-29 David Malcolm + * gimple.h (gimple_omp_single_clauses): Strengthen param from + const_gimple to const gomp_single *. + (gimple_omp_single_clauses_ptr): Strengthen param from gimple to + gomp_single *. + + * gimple-walk.c (walk_gimple_op): Add checked cast. + * tree-inline.c (remap_gimple_stmt): Within case + GIMPLE_OMP_SINGLE, introduce local "omp_single_stmt" via a + checked cast and use in place of "stmt". + * tree-nested.c (convert_nonlocal_reference_stmt): Likewise. + (convert_local_reference_stmt): Likewise. + +2014-10-29 David Malcolm + * gimple.h (struct gimple_statement_omp_return): Rename to... (struct gomp_return): ...this. (is_a_helper ::test): Rename to... diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c index ce78bea6086..5882fe6eb11 100644 --- a/gcc/gimple-walk.c +++ b/gcc/gimple-walk.c @@ -421,8 +421,9 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op, break; case GIMPLE_OMP_SINGLE: - ret = walk_tree (gimple_omp_single_clauses_ptr (stmt), callback_op, wi, - pset); + ret = walk_tree (gimple_omp_single_clauses_ptr ( + as_a (stmt)), + callback_op, wi, pset); if (ret) return ret; break; diff --git a/gcc/gimple.h b/gcc/gimple.h index 6355d96e049..26a9c7151e4 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -4928,24 +4928,21 @@ gimple_omp_task_set_arg_align (gomp_task *omp_task_stmt, tree arg_align) } -/* Return the clauses associated with OMP_SINGLE GS. */ +/* Return the clauses associated with OMP_SINGLE OMP_SINGLE_STMT. */ static inline tree -gimple_omp_single_clauses (const_gimple gs) +gimple_omp_single_clauses (const gomp_single *omp_single_stmt) { - const gomp_single *omp_single_stmt = - as_a (gs); return omp_single_stmt->clauses; } -/* Return a pointer to the clauses associated with OMP_SINGLE GS. */ +/* Return a pointer to the clauses associated with OMP_SINGLE + OMP_SINGLE_STMT. */ static inline tree * -gimple_omp_single_clauses_ptr (gimple gs) +gimple_omp_single_clauses_ptr (gomp_single *omp_single_stmt) { - gomp_single *omp_single_stmt = - as_a (gs); return &omp_single_stmt->clauses; } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index bc19939eb94..cc5c3bbd4f9 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1464,9 +1464,12 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id) break; case GIMPLE_OMP_SINGLE: - s1 = remap_gimple_seq (gimple_omp_body (stmt), id); - copy = gimple_build_omp_single - (s1, gimple_omp_single_clauses (stmt)); + { + gomp_single *omp_single_stmt = as_a (stmt); + s1 = remap_gimple_seq (gimple_omp_body (omp_single_stmt), id); + copy = gimple_build_omp_single ( + s1, gimple_omp_single_clauses (omp_single_stmt)); + } break; case GIMPLE_OMP_TARGET: diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index f0756c14660..2ee8cfdf74d 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -1379,11 +1379,17 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, break; case GIMPLE_OMP_SINGLE: - save_suppress = info->suppress_expansion; - convert_nonlocal_omp_clauses (gimple_omp_single_clauses_ptr (stmt), wi); - walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op, - info, gimple_omp_body_ptr (stmt)); - info->suppress_expansion = save_suppress; + { + gomp_single *omp_single_stmt = as_a (stmt); + save_suppress = info->suppress_expansion; + convert_nonlocal_omp_clauses (gimple_omp_single_clauses_ptr ( + omp_single_stmt), + wi); + walk_body (convert_nonlocal_reference_stmt, + convert_nonlocal_reference_op, + info, gimple_omp_body_ptr (omp_single_stmt)); + info->suppress_expansion = save_suppress; + } break; case GIMPLE_OMP_TARGET: @@ -1963,11 +1969,16 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, break; case GIMPLE_OMP_SINGLE: - save_suppress = info->suppress_expansion; - convert_local_omp_clauses (gimple_omp_single_clauses_ptr (stmt), wi); - walk_body (convert_local_reference_stmt, convert_local_reference_op, - info, gimple_omp_body_ptr (stmt)); - info->suppress_expansion = save_suppress; + { + gomp_single *omp_single_stmt = as_a (stmt); + save_suppress = info->suppress_expansion; + convert_local_omp_clauses (gimple_omp_single_clauses_ptr ( + omp_single_stmt), + wi); + walk_body (convert_local_reference_stmt, convert_local_reference_op, + info, gimple_omp_body_ptr (omp_single_stmt)); + info->suppress_expansion = save_suppress; + } break; case GIMPLE_OMP_TARGET: -- 2.11.4.GIT