[PATCH 2/6] Hand-written port of various accessors within gimple.h
David Malcolm
dmalcolm@redhat.com
Thu Oct 31 16:27:00 GMT 2013
* gimple.h (gimple_use_ops): Port from union to usage of
dyn_cast.
(gimple_set_use_ops): Port from union to usage of as_a.
(gimple_set_vuse): Likewise.
(gimple_set_vdef): Likewise.
(gimple_call_internal_fn): Port from union to a static_cast,
given that the type has already been asserted.
(gimple_omp_body_ptr): Port from unchecked union usage to
a static_cast.
(gimple_omp_set_body): Likewise.
---
gcc/gimple.h | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/gcc/gimple.h b/gcc/gimple.h
index f288e81..6ff7602 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1467,9 +1467,11 @@ gimple_has_mem_ops (const_gimple g)
static inline struct use_optype_d *
gimple_use_ops (const_gimple g)
{
- if (!gimple_has_ops (g))
+ const gimple_statement_with_ops *ops_stmt =
+ dyn_cast <const gimple_statement_with_ops> (g);
+ if (!ops_stmt)
return NULL;
- return g->gsops.opbase.use_ops;
+ return ops_stmt->use_ops;
}
@@ -1478,8 +1480,9 @@ gimple_use_ops (const_gimple g)
static inline void
gimple_set_use_ops (gimple g, struct use_optype_d *use)
{
- gcc_gimple_checking_assert (gimple_has_ops (g));
- g->gsops.opbase.use_ops = use;
+ gimple_statement_with_ops *ops_stmt =
+ as_a <gimple_statement_with_ops> (g);
+ ops_stmt->use_ops = use;
}
@@ -1528,8 +1531,9 @@ gimple_vdef_ptr (gimple g)
static inline void
gimple_set_vuse (gimple g, tree vuse)
{
- gcc_gimple_checking_assert (gimple_has_mem_ops (g));
- g->gsmembase.vuse = vuse;
+ gimple_statement_with_memory_ops *mem_ops_stmt =
+ as_a <gimple_statement_with_memory_ops> (g);
+ mem_ops_stmt->vuse = vuse;
}
/* Set the single VDEF operand of the statement G. */
@@ -1537,8 +1541,9 @@ gimple_set_vuse (gimple g, tree vuse)
static inline void
gimple_set_vdef (gimple g, tree vdef)
{
- gcc_gimple_checking_assert (gimple_has_mem_ops (g));
- g->gsmembase.vdef = vdef;
+ gimple_statement_with_memory_ops *mem_ops_stmt =
+ as_a <gimple_statement_with_memory_ops> (g);
+ mem_ops_stmt->vdef = vdef;
}
@@ -2226,7 +2231,7 @@ static inline enum internal_fn
gimple_call_internal_fn (const_gimple gs)
{
gcc_gimple_checking_assert (gimple_call_internal_p (gs));
- return gs->gimple_call.u.internal_fn;
+ return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
}
@@ -4031,7 +4036,7 @@ get_lineno (const_gimple stmt)
static inline gimple_seq *
gimple_omp_body_ptr (gimple gs)
{
- return &gs->omp.body;
+ return &static_cast <gimple_statement_omp *> (gs)->body;
}
/* Return the body for the OMP statement GS. */
@@ -4047,7 +4052,7 @@ gimple_omp_body (gimple gs)
static inline void
gimple_omp_set_body (gimple gs, gimple_seq body)
{
- gs->omp.body = body;
+ static_cast <gimple_statement_omp *> (gs)->body = body;
}
--
1.7.11.7
More information about the Gcc-patches
mailing list