From 5f487a349de62613d7fa429bcbfbeeafbfc94f3a Mon Sep 17 00:00:00 2001 From: Li Jia He Date: Mon, 16 Sep 2019 14:21:20 +0000 Subject: Auto-generate maybe_fold_and/or_comparisons from match.pd 2019-09-16 Li Jia He Martin Liska * gimple-fold.c (and_comparisons_1): Add type as first argument. (and_var_with_comparison): Likewise. (and_var_with_comparison_1): Likewise. (or_comparisons_1): Likewise. (or_var_with_comparison): Likewise. (or_var_with_comparison_1): Likewise. (maybe_fold_and_comparisons): Call maybe_fold_comparisons_from_match_pd. (maybe_fold_or_comparisons): Likewise. (maybe_fold_comparisons_from_match_pd): New. * gimple-fold.h (maybe_fold_and_comparisons): Add type argument. (maybe_fold_or_comparisons): Likewise. * gimple.c (gimple_size): Make it public and add num_ops argument. (gimple_init): New function. (gimple_alloc): Call gimple_init. * gimple.h (gimple_size): New. (gimple_init): Likewise. * tree-if-conv.c (fold_or_predicates): Pass type. * tree-ssa-ifcombine.c (ifcombine_ifandif): Likewise. * tree-ssa-reassoc.c (eliminate_redundant_comparison): Likewise. (optimize_vec_cond_expr): Likewise. (ovce_extract_ops): Return type of conditional expression. * tree-ssanames.c (init_ssa_name_imm_use): New. (make_ssa_name_fn): Use init_ssa_name_imm_use. * tree-ssanames.h (init_ssa_name_imm_use): New. Co-Authored-By: Martin Liska From-SVN: r275748 --- gcc/gimple.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'gcc/gimple.c') diff --git a/gcc/gimple.c b/gcc/gimple.c index 633ef512a19..88250cad16b 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -110,10 +110,27 @@ gimple_set_code (gimple *g, enum gimple_code code) /* Return the number of bytes needed to hold a GIMPLE statement with code CODE. */ -static inline size_t -gimple_size (enum gimple_code code) +size_t +gimple_size (enum gimple_code code, unsigned num_ops) { - return gsstruct_code_size[gss_for_code (code)]; + size_t size = gsstruct_code_size[gss_for_code (code)]; + if (num_ops > 0) + size += (sizeof (tree) * (num_ops - 1)); + return size; +} + +/* Initialize GIMPLE statement G with CODE and NUM_OPS. */ + +void +gimple_init (gimple *g, enum gimple_code code, unsigned num_ops) +{ + gimple_set_code (g, code); + gimple_set_num_ops (g, num_ops); + + /* Do not call gimple_set_modified here as it has other side + effects and this tuple is still not completely built. */ + g->modified = 1; + gimple_init_singleton (g); } /* Allocate memory for a GIMPLE statement with code CODE and NUM_OPS @@ -125,10 +142,7 @@ gimple_alloc (enum gimple_code code, unsigned num_ops MEM_STAT_DECL) size_t size; gimple *stmt; - size = gimple_size (code); - if (num_ops > 0) - size += sizeof (tree) * (num_ops - 1); - + size = gimple_size (code, num_ops); if (GATHER_STATISTICS) { enum gimple_alloc_kind kind = gimple_alloc_kind (code); @@ -137,14 +151,7 @@ gimple_alloc (enum gimple_code code, unsigned num_ops MEM_STAT_DECL) } stmt = ggc_alloc_cleared_gimple_statement_stat (size PASS_MEM_STAT); - gimple_set_code (stmt, code); - gimple_set_num_ops (stmt, num_ops); - - /* Do not call gimple_set_modified here as it has other side - effects and this tuple is still not completely built. */ - stmt->modified = 1; - gimple_init_singleton (stmt); - + gimple_init (stmt, code, num_ops); return stmt; } -- cgit v1.2.1