aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.h
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-07-20 12:37:14 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-07-20 12:37:14 +0000
commit3fa4fad4974c7c1e39ca387b9e55ffb3607879a3 (patch)
tree057d05e0ccff4798133bb024656d689b2fda464f /gcc/gimple.h
parent73c4b4df26d90486debc267cd61c55ab350de4e0 (diff)
downloadgcc-3fa4fad4974c7c1e39ca387b9e55ffb3607879a3.zip
gcc-3fa4fad4974c7c1e39ca387b9e55ffb3607879a3.tar.gz
gcc-3fa4fad4974c7c1e39ca387b9e55ffb3607879a3.tar.bz2
gimple.h (gimple_phi_result): Add gphi * overload.
2017-07-20 Richard Biener <rguenther@suse.de> * gimple.h (gimple_phi_result): Add gphi * overload. (gimple_phi_result_ptr): Likewise. (gimple_phi_arg): Likewise. Adjust index assert to only allow actual argument accesses rather than all slots available by capacity. (gimple_phi_arg_def): Add gphi * overload. * tree-phinodes.c (make_phi_node): Initialize only actual arguments. (resize_phi_node): Clear memory not covered by old node, do not initialize excess argument slots. (reserve_phi_args_for_new_edge): Initialize new argument slot completely. From-SVN: r250385
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r--gcc/gimple.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h
index aba7167..2d81eed 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -4308,19 +4308,31 @@ gimple_phi_num_args (const gimple *gs)
/* Return the SSA name created by GIMPLE_PHI GS. */
static inline tree
+gimple_phi_result (const gphi *gs)
+{
+ return gs->result;
+}
+
+static inline tree
gimple_phi_result (const gimple *gs)
{
const gphi *phi_stmt = as_a <const gphi *> (gs);
- return phi_stmt->result;
+ return gimple_phi_result (phi_stmt);
}
/* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
static inline tree *
+gimple_phi_result_ptr (gphi *gs)
+{
+ return &gs->result;
+}
+
+static inline tree *
gimple_phi_result_ptr (gimple *gs)
{
gphi *phi_stmt = as_a <gphi *> (gs);
- return &phi_stmt->result;
+ return gimple_phi_result_ptr (phi_stmt);
}
/* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
@@ -4338,11 +4350,17 @@ gimple_phi_set_result (gphi *phi, tree result)
GIMPLE_PHI GS. */
static inline struct phi_arg_d *
+gimple_phi_arg (gphi *gs, unsigned index)
+{
+ gcc_gimple_checking_assert (index < gs->nargs);
+ return &(gs->args[index]);
+}
+
+static inline struct phi_arg_d *
gimple_phi_arg (gimple *gs, unsigned index)
{
gphi *phi_stmt = as_a <gphi *> (gs);
- gcc_gimple_checking_assert (index < phi_stmt->capacity);
- return &(phi_stmt->args[index]);
+ return gimple_phi_arg (phi_stmt, index);
}
/* Set PHIARG to be the argument corresponding to incoming edge INDEX
@@ -4377,6 +4395,12 @@ phi_nodes_ptr (basic_block bb)
/* Return the tree operand for argument I of PHI node GS. */
static inline tree
+gimple_phi_arg_def (gphi *gs, size_t index)
+{
+ return gimple_phi_arg (gs, index)->def;
+}
+
+static inline tree
gimple_phi_arg_def (gimple *gs, size_t index)
{
return gimple_phi_arg (gs, index)->def;