diff options
author | Richard Henderson <rth@redhat.com> | 2009-09-11 22:49:09 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2009-09-11 22:49:09 -0700 |
commit | f2c4a81cc167ed8a02d0cee69245ec2568b952a7 (patch) | |
tree | 16db3c5a2f68a392e7e4456ad589c93e08ae5fef /gcc/gimple.h | |
parent | 0a58a0248817f36f04416388f76715b92b714c13 (diff) | |
download | gcc-f2c4a81cc167ed8a02d0cee69245ec2568b952a7.zip gcc-f2c4a81cc167ed8a02d0cee69245ec2568b952a7.tar.gz gcc-f2c4a81cc167ed8a02d0cee69245ec2568b952a7.tar.bz2 |
gsstruct.def (DEFGSSTRUCT): Remove printable-name argument...
* gsstruct.def (DEFGSSTRUCT): Remove printable-name argument; add
structure-name and has-tree-operands arguments; update all entries.
* gimple.def (DEFGSCODE): Replace 3rd argument with GSS_symbol;
update all entries.
* gimple.c (gimple_ops_offset_): Use HAS_TREE_OP argument.
(gsstruct_code_size): New.
(gss_for_code_): New.
(gss_for_code): Remove.
(gimple_size): Rewrite using gsstruct_code_size.
(gimple_statement_structure): Move to gimple.h.
* gimple.h (gimple_ops_offset_, gss_for_code_): Declare.
(gss_for_code, gimple_statement_structure): New.
(gimple_ops): Use new arrays; tidy.
From-SVN: r151650
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r-- | gcc/gimple.h | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h index 6dce0b7..8ca1f28 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -714,12 +714,12 @@ struct GTY(()) gimple_statement_omp_atomic_store { tree val; }; +#define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM, enum gimple_statement_structure_enum { -#define DEFGSSTRUCT(SYM, STRING) SYM, #include "gsstruct.def" -#undef DEFGSSTRUCT LAST_GSS_ENUM }; +#undef DEFGSSTRUCT /* Define the overall contents of a gimple tuple. It may be any of the @@ -750,6 +750,14 @@ union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d { }; /* In gimple.c. */ + +/* Offset in bytes to the location of the operand vector. + Zero if there is no operand vector for this tuple structure. */ +extern size_t const gimple_ops_offset_[]; + +/* Map GIMPLE codes to GSS codes. */ +extern enum gimple_statement_structure_enum const gss_for_code_[]; + gimple gimple_build_return (tree); gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL); @@ -801,7 +809,6 @@ gimple gimple_build_cdt (tree, tree); gimple gimple_build_omp_atomic_load (tree, tree); gimple gimple_build_omp_atomic_store (tree); gimple gimple_build_predict (enum br_predictor, enum prediction); -enum gimple_statement_structure_enum gimple_statement_structure (gimple); enum gimple_statement_structure_enum gss_for_assign (enum tree_code); void sort_case_labels (VEC(tree,heap) *); void gimple_set_body (tree, gimple_seq); @@ -1023,6 +1030,25 @@ gimple_code (const_gimple g) } +/* Return the GSS code used by a GIMPLE code. */ + +static inline enum gimple_statement_structure_enum +gss_for_code (enum gimple_code code) +{ + gcc_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE); + return gss_for_code_[code]; +} + + +/* Return which GSS code is used by GS. */ + +static inline enum gimple_statement_structure_enum +gimple_statement_structure (gimple gs) +{ + return gss_for_code (gimple_code (gs)); +} + + /* Return true if statement G has sub-statements. This is only true for High GIMPLE statements. */ @@ -1557,16 +1583,15 @@ gimple_set_num_ops (gimple gs, unsigned num_ops) static inline tree * gimple_ops (gimple gs) { - /* Offset in bytes to the location of the operand vector in every - tuple structure. Defined in gimple.c */ - extern size_t const gimple_ops_offset_[]; - - if (!gimple_has_ops (gs)) - return NULL; + size_t off; /* All the tuples have their operand vector at the very bottom - of the structure. */ - return ((tree *) ((char *) gs + gimple_ops_offset_[gimple_code (gs)])); + of the structure. Note that those structures that do not + have an operand vector have a zero offset. */ + off = gimple_ops_offset_[gimple_statement_structure (gs)]; + gcc_assert (off != 0); + + return (tree *) ((char *) gs + off); } |