diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-12 05:49:09 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-12 05:49:09 +0000 |
commit | 1fed3255be6d312b65cb2528199d81c00f85fcdd (patch) | |
tree | 16db3c5a2f68a392e7e4456ad589c93e08ae5fef /gcc/gimple.c | |
parent | c062084803805c727269b280498615fe6353cee4 (diff) | |
download | gcc-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.c')
-rw-r--r-- | gcc/gimple.c | 144 |
1 files changed, 23 insertions, 121 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c index 9223aaa8824..3be6d843fe2 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -35,18 +35,32 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "demangle.h" -#define DEFGSCODE(SYM, NAME, STRUCT) NAME, -const char *const gimple_code_name[] = { -#include "gimple.def" -}; -#undef DEFGSCODE -/* All the tuples have their operand vector at the very bottom +/* All the tuples have their operand vector (if present) at the very bottom of the structure. Therefore, the offset required to find the operands vector the size of the structure minus the size of the 1 element tree array at the end (see gimple_ops). */ -#define DEFGSCODE(SYM, NAME, STRUCT) (sizeof (STRUCT) - sizeof (tree)), +#define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) \ + (HAS_TREE_OP ? sizeof (struct STRUCT) - sizeof (tree) : 0), EXPORTED_CONST size_t gimple_ops_offset_[] = { +#include "gsstruct.def" +}; +#undef DEFGSSTRUCT + +#define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) sizeof(struct STRUCT), +static const size_t gsstruct_code_size[] = { +#include "gsstruct.def" +}; +#undef DEFGSSTRUCT + +#define DEFGSCODE(SYM, NAME, GSSCODE) NAME, +const char *const gimple_code_name[] = { +#include "gimple.def" +}; +#undef DEFGSCODE + +#define DEFGSCODE(SYM, NAME, GSSCODE) GSSCODE, +EXPORTED_CONST enum gimple_statement_structure_enum gss_for_code_[] = { #include "gimple.def" }; #undef DEFGSCODE @@ -89,118 +103,15 @@ gimple_set_code (gimple g, enum gimple_code code) g->gsbase.code = code; } - -/* Return the GSS_* identifier for the given GIMPLE statement CODE. */ - -static enum gimple_statement_structure_enum -gss_for_code (enum gimple_code code) -{ - switch (code) - { - case GIMPLE_ASSIGN: - case GIMPLE_CALL: - case GIMPLE_RETURN: return GSS_WITH_MEM_OPS; - case GIMPLE_COND: - case GIMPLE_GOTO: - case GIMPLE_LABEL: - case GIMPLE_DEBUG: - case GIMPLE_SWITCH: return GSS_WITH_OPS; - case GIMPLE_ASM: return GSS_ASM; - case GIMPLE_BIND: return GSS_BIND; - case GIMPLE_CATCH: return GSS_CATCH; - case GIMPLE_EH_FILTER: return GSS_EH_FILTER; - case GIMPLE_NOP: return GSS_BASE; - case GIMPLE_PHI: return GSS_PHI; - case GIMPLE_RESX: return GSS_RESX; - case GIMPLE_TRY: return GSS_TRY; - case GIMPLE_WITH_CLEANUP_EXPR: return GSS_WCE; - case GIMPLE_OMP_CRITICAL: return GSS_OMP_CRITICAL; - case GIMPLE_OMP_FOR: return GSS_OMP_FOR; - case GIMPLE_OMP_MASTER: - case GIMPLE_OMP_ORDERED: - case GIMPLE_OMP_SECTION: return GSS_OMP; - case GIMPLE_OMP_RETURN: - case GIMPLE_OMP_SECTIONS_SWITCH: return GSS_BASE; - case GIMPLE_OMP_CONTINUE: return GSS_OMP_CONTINUE; - case GIMPLE_OMP_PARALLEL: return GSS_OMP_PARALLEL; - case GIMPLE_OMP_TASK: return GSS_OMP_TASK; - case GIMPLE_OMP_SECTIONS: return GSS_OMP_SECTIONS; - case GIMPLE_OMP_SINGLE: return GSS_OMP_SINGLE; - case GIMPLE_OMP_ATOMIC_LOAD: return GSS_OMP_ATOMIC_LOAD; - case GIMPLE_OMP_ATOMIC_STORE: return GSS_OMP_ATOMIC_STORE; - case GIMPLE_PREDICT: return GSS_BASE; - default: gcc_unreachable (); - } -} - - /* Return the number of bytes needed to hold a GIMPLE statement with code CODE. */ -static size_t +static inline size_t gimple_size (enum gimple_code code) { - enum gimple_statement_structure_enum gss = gss_for_code (code); - - if (gss == GSS_WITH_OPS) - return sizeof (struct gimple_statement_with_ops); - else if (gss == GSS_WITH_MEM_OPS) - return sizeof (struct gimple_statement_with_memory_ops); - - switch (code) - { - case GIMPLE_ASM: - return sizeof (struct gimple_statement_asm); - case GIMPLE_NOP: - return sizeof (struct gimple_statement_base); - case GIMPLE_BIND: - return sizeof (struct gimple_statement_bind); - case GIMPLE_CATCH: - return sizeof (struct gimple_statement_catch); - case GIMPLE_EH_FILTER: - return sizeof (struct gimple_statement_eh_filter); - case GIMPLE_TRY: - return sizeof (struct gimple_statement_try); - case GIMPLE_RESX: - return sizeof (struct gimple_statement_resx); - case GIMPLE_OMP_CRITICAL: - return sizeof (struct gimple_statement_omp_critical); - case GIMPLE_OMP_FOR: - return sizeof (struct gimple_statement_omp_for); - case GIMPLE_OMP_PARALLEL: - return sizeof (struct gimple_statement_omp_parallel); - case GIMPLE_OMP_TASK: - return sizeof (struct gimple_statement_omp_task); - case GIMPLE_OMP_SECTION: - case GIMPLE_OMP_MASTER: - case GIMPLE_OMP_ORDERED: - return sizeof (struct gimple_statement_omp); - case GIMPLE_OMP_RETURN: - return sizeof (struct gimple_statement_base); - case GIMPLE_OMP_CONTINUE: - return sizeof (struct gimple_statement_omp_continue); - case GIMPLE_OMP_SECTIONS: - return sizeof (struct gimple_statement_omp_sections); - case GIMPLE_OMP_SECTIONS_SWITCH: - return sizeof (struct gimple_statement_base); - case GIMPLE_OMP_SINGLE: - return sizeof (struct gimple_statement_omp_single); - case GIMPLE_OMP_ATOMIC_LOAD: - return sizeof (struct gimple_statement_omp_atomic_load); - case GIMPLE_OMP_ATOMIC_STORE: - return sizeof (struct gimple_statement_omp_atomic_store); - case GIMPLE_WITH_CLEANUP_EXPR: - return sizeof (struct gimple_statement_wce); - case GIMPLE_PREDICT: - return sizeof (struct gimple_statement_base); - default: - break; - } - - gcc_unreachable (); + return gsstruct_code_size[gss_for_code (code)]; } - /* Allocate memory for a GIMPLE statement with code CODE and NUM_OPS operands. */ @@ -1103,15 +1014,6 @@ gimple_build_predict (enum br_predictor predictor, enum prediction outcome) return p; } -/* Return which gimple structure is used by T. The enums here are defined - in gsstruct.def. */ - -enum gimple_statement_structure_enum -gimple_statement_structure (gimple gs) -{ - return gss_for_code (gimple_code (gs)); -} - #if defined ENABLE_GIMPLE_CHECKING /* Complain of a gimple type mismatch and die. */ |