diff options
author | Alexandre Oliva <oliva@adacore.com> | 2019-07-04 15:00:00 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2019-07-04 15:00:00 +0000 |
commit | ebebc928d8b0d17676e751848892f927373b1fe5 (patch) | |
tree | 5b00c4867b3d58dc4865627ffab29da1e0baa2d0 /gcc/gimplify.c | |
parent | e57c896e86c4257741b574d99d7cacbfda219755 (diff) | |
download | gcc-ebebc928d8b0d17676e751848892f927373b1fe5.zip gcc-ebebc928d8b0d17676e751848892f927373b1fe5.tar.gz gcc-ebebc928d8b0d17676e751848892f927373b1fe5.tar.bz2 |
introduce EH_ELSE_EXPR tree and gimplifier
I found GIMPLE_EH_ELSE offered exactly the semantics I needed for some
Ada changes yet to be contributed, but GIMPLE_EH_ELSE was only built
by GIMPLE passes, and I needed to build earlier something that
eventually became GIMPLE_EH_ELSE.
This patch does that, introducing an EH_ELSE_EXPR tree, and logic to
dump it and to gimplify it.
for gcc/ChangeLog
* doc/generic.texi (Cleanups): Document EH_ELSE_EXPR.
* except.c: Likewise.
* expr.c (expand_expr_real_1): Reject it.
* gimplify.c (gimplify_expr): Gimplify it, within
TRY_FINALLY_EXPR.
* tree-dump.c (dequeue_and_dump): Dump it.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree.c (block_may_fallthru): Handle it.
* tree.def (EH_ELSE_EXPR): Introduce it.
* gimple-pretty-print.c (dump_gimple_try): Dump TRY_FINALLY
with GIMPLE_EH_ELSE as try/finally/else.
From-SVN: r273084
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 9e5e423..a3792d1 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -13079,7 +13079,22 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, input_location = UNKNOWN_LOCATION; eval = cleanup = NULL; gimplify_and_add (TREE_OPERAND (*expr_p, 0), &eval); - gimplify_and_add (TREE_OPERAND (*expr_p, 1), &cleanup); + if (TREE_CODE (*expr_p) == TRY_FINALLY_EXPR + && TREE_CODE (TREE_OPERAND (*expr_p, 1)) == EH_ELSE_EXPR) + { + gimple_seq n = NULL, e = NULL; + gimplify_and_add (TREE_OPERAND (TREE_OPERAND (*expr_p, 1), + 0), &n); + gimplify_and_add (TREE_OPERAND (TREE_OPERAND (*expr_p, 1), + 1), &e); + if (!gimple_seq_empty_p (n) && !gimple_seq_empty_p (e)) + { + geh_else *stmt = gimple_build_eh_else (n, e); + gimple_seq_add_stmt (&cleanup, stmt); + } + } + else + gimplify_and_add (TREE_OPERAND (*expr_p, 1), &cleanup); /* Don't create bogus GIMPLE_TRY with empty cleanup. */ if (gimple_seq_empty_p (cleanup)) { @@ -13637,6 +13652,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, && code != LOOP_EXPR && code != SWITCH_EXPR && code != TRY_FINALLY_EXPR + && code != EH_ELSE_EXPR && code != OACC_PARALLEL && code != OACC_KERNELS && code != OACC_DATA |