summaryrefslogtreecommitdiff
path: root/gcc/gimple.h
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-12 05:49:09 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-12 05:49:09 +0000
commit1fed3255be6d312b65cb2528199d81c00f85fcdd (patch)
tree16db3c5a2f68a392e7e4456ad589c93e08ae5fef /gcc/gimple.h
parentc062084803805c727269b280498615fe6353cee4 (diff)
downloadgcc-1fed3255be6d312b65cb2528199d81c00f85fcdd.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151650 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r--gcc/gimple.h47
1 files changed, 36 insertions, 11 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 6dce0b78357..8ca1f288084 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);
}