From ea9637cdcdf4b66f56c19079c786927174289f59 Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Wed, 30 Oct 2013 09:09:44 +0000 Subject: tree-core.h (tree_index): Add TI_POINTER_BOUNDS_TYPE. * tree-core.h (tree_index): Add TI_POINTER_BOUNDS_TYPE. * tree.h (POINTER_BOUNDS_P): New. (BOUNDED_TYPE_P): New. (BOUNDED_P): New. (pointer_bounds_type_node): New. * tree.c (build_common_tree_nodes): Initialize pointer_bounds_type_node. * gimple.h (gimple_call_get_nobnd_arg_index): New. (gimple_call_num_nobnd_args): New. (gimple_call_nobnd_arg): New. (gimple_return_retbnd): New. (gimple_return_set_retbnd): New * gimple.c (gimple_build_return): Increase number of ops for return statement. (gimple_call_get_nobnd_arg_index): New. * gimple-pretty-print.c (dump_gimple_return): Print second op. From-SVN: r204199 --- gcc/gimple.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'gcc/gimple.h') diff --git a/gcc/gimple.h b/gcc/gimple.h index b0fb861..b34424c 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -918,6 +918,7 @@ extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *); extern tree get_formal_tmp_var (tree, gimple_seq *); extern void declare_vars (tree, gimple, bool); extern void annotate_all_with_location (gimple_seq, location_t); +extern unsigned gimple_call_get_nobnd_arg_index (const_gimple, unsigned); /* Validation of GIMPLE expressions. Note that these predicates only check the basic form of the expression, they don't recurse to make sure that @@ -2413,6 +2414,32 @@ gimple_call_arg (const_gimple gs, unsigned index) } +/* Return the number of arguments used by call statement GS + ignoring bound ones. */ + +static inline unsigned +gimple_call_num_nobnd_args (const_gimple gs) +{ + unsigned num_args = gimple_call_num_args (gs); + unsigned res = num_args; + for (unsigned n = 0; n < num_args; n++) + if (POINTER_BOUNDS_P (gimple_call_arg (gs, n))) + res--; + return res; +} + + +/* Return INDEX's call argument ignoring bound ones. */ +static inline tree +gimple_call_nobnd_arg (const_gimple gs, unsigned index) +{ + /* No bound args may exist if pointers checker is off. */ + if (!flag_check_pointer_bounds) + return gimple_call_arg (gs, index); + return gimple_call_arg (gs, gimple_call_get_nobnd_arg_index (gs, index)); +} + + /* Return a pointer to the argument at position INDEX for call statement GS. */ @@ -5219,6 +5246,26 @@ gimple_return_set_retval (gimple gs, tree retval) } +/* Return the return bounds for GIMPLE_RETURN GS. */ + +static inline tree +gimple_return_retbnd (const_gimple gs) +{ + GIMPLE_CHECK (gs, GIMPLE_RETURN); + return gimple_op (gs, 1); +} + + +/* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */ + +static inline void +gimple_return_set_retbnd (gimple gs, tree retval) +{ + GIMPLE_CHECK (gs, GIMPLE_RETURN); + gimple_set_op (gs, 1, retval); +} + + /* Returns true when the gimple statement STMT is any of the OpenMP types. */ #define CASE_GIMPLE_OMP \ -- cgit v1.1