This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gimple-classes, committed 25/92] Introduce gimple_eh_must_not_throw
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Mon, 27 Oct 2014 16:40:23 -0400
- Subject: [gimple-classes, committed 25/92] Introduce gimple_eh_must_not_throw
- Authentication-results: sourceware.org; auth=none
- References: <1414442490-14841-1-git-send-email-dmalcolm at redhat dot com>
This corresponds to:
[PATCH 27/89] Introduce gimple_eh_must_not_throw
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01218.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK after fixing up the naming/const stuff as discussed for prior
> patches.
> That applies to 22-30. Make sure to take care of
> the pretty printers per Trevor's comments as well. He indicated those
> were missing in a couple of those patches.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00628.html
gcc/
* coretypes.h (gimple_eh_must_not_throw): New typedef.
(const_gimple_eh_must_not_throw): New typedef.
* gimple-pretty-print.c (dump_gimple_eh_must_not_throw): Require
a gimple_eh_must_not_throw rather than a plain gimple.
(pp_gimple_stmt_1): Add a checked cast to gimple_eh_must_not_throw
within GIMPLE_EH_MUST_NOT_THROW case of switch statement.
* gimple-streamer-in.c (input_gimple_stmt): Likewise.
* gimple-streamer-out.c (output_gimple_stmt): Likewise.
* gimple.c (gimple_build_eh_must_not_throw): Return a
gimple_eh_must_not_throw rather than a plain gimple.
* gimple.h (gimple_build_eh_must_not_throw): Return a
gimple_eh_must_not_throw rather than a plain gimple.
(gimple_eh_must_not_throw_fndecl): Require a
gimple_eh_must_not_throw rather than a plain gimple.
(gimple_eh_must_not_throw_set_fndecl): Likewise.
* tree-eh.c (lower_eh_must_not_throw): Add checked cast.
---
gcc/ChangeLog.gimple-classes | 27 +++++++++++++++++++++++++++
gcc/coretypes.h | 4 ++++
gcc/gimple-pretty-print.c | 8 +++++---
gcc/gimple-streamer-in.c | 4 +++-
gcc/gimple-streamer-out.c | 5 ++++-
gcc/gimple.c | 6 ++++--
gcc/gimple.h | 9 ++++-----
gcc/tree-eh.c | 3 ++-
8 files changed, 53 insertions(+), 13 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index e91317c..dd39ce6 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,32 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_eh_must_not_throw
+
+ * coretypes.h (gimple_eh_must_not_throw): New typedef.
+ (const_gimple_eh_must_not_throw): New typedef.
+
+ * gimple-pretty-print.c (dump_gimple_eh_must_not_throw): Require
+ a gimple_eh_must_not_throw rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_eh_must_not_throw
+ within GIMPLE_EH_MUST_NOT_THROW case of switch statement.
+
+ * gimple-streamer-in.c (input_gimple_stmt): Likewise.
+
+ * gimple-streamer-out.c (output_gimple_stmt): Likewise.
+
+ * gimple.c (gimple_build_eh_must_not_throw): Return a
+ gimple_eh_must_not_throw rather than a plain gimple.
+
+ * gimple.h (gimple_build_eh_must_not_throw): Return a
+ gimple_eh_must_not_throw rather than a plain gimple.
+ (gimple_eh_must_not_throw_fndecl): Require a
+ gimple_eh_must_not_throw rather than a plain gimple.
+ (gimple_eh_must_not_throw_set_fndecl): Likewise.
+
+ * tree-eh.c (lower_eh_must_not_throw): Add checked cast.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_eh_filter
* coretypes.h (gimple_eh_filter): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index d2d19ec..51b73f6 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -142,6 +142,10 @@ struct gimple_statement_eh_filter;
typedef struct gimple_statement_eh_filter *gimple_eh_filter;
typedef const struct gimple_statement_eh_filter *const_gimple_eh_filter;
+struct gimple_statement_eh_mnt;
+typedef struct gimple_statement_eh_mnt *gimple_eh_must_not_throw;
+typedef const struct gimple_statement_eh_mnt *const_gimple_eh_must_not_throw;
+
struct gimple_statement_phi;
typedef struct gimple_statement_phi *gimple_phi;
typedef const struct gimple_statement_phi *const_gimple_phi;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 5876a0c..42f94a3 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1021,8 +1021,8 @@ dump_gimple_eh_filter (pretty_printer *buffer, gimple_eh_filter gs, int spc,
/* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
static void
-dump_gimple_eh_must_not_throw (pretty_printer *buffer, gimple gs,
- int spc, int flags)
+dump_gimple_eh_must_not_throw (pretty_printer *buffer,
+ gimple_eh_must_not_throw gs, int spc, int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
@@ -2203,7 +2203,9 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_EH_MUST_NOT_THROW:
- dump_gimple_eh_must_not_throw (buffer, gs, spc, flags);
+ dump_gimple_eh_must_not_throw (buffer,
+ as_a <gimple_eh_must_not_throw> (gs),
+ spc, flags);
break;
case GIMPLE_EH_ELSE:
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index a4130a5..1d1ad27 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -127,7 +127,9 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
break;
case GIMPLE_EH_MUST_NOT_THROW:
- gimple_eh_must_not_throw_set_fndecl (stmt, stream_read_tree (ib, data_in));
+ gimple_eh_must_not_throw_set_fndecl (
+ as_a <gimple_eh_must_not_throw> (stmt),
+ stream_read_tree (ib, data_in));
break;
case GIMPLE_EH_DISPATCH:
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index cc87e88..41a4dc4 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -101,7 +101,10 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
break;
case GIMPLE_EH_MUST_NOT_THROW:
- stream_write_tree (ob, gimple_eh_must_not_throw_fndecl (stmt), true);
+ stream_write_tree (ob,
+ gimple_eh_must_not_throw_fndecl (
+ as_a <gimple_eh_must_not_throw> (stmt)),
+ true);
break;
case GIMPLE_EH_DISPATCH:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 3b1ff98..a52d989 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -644,10 +644,12 @@ gimple_build_eh_filter (tree types, gimple_seq failure)
/* Build a GIMPLE_EH_MUST_NOT_THROW statement. */
-gimple
+gimple_eh_must_not_throw
gimple_build_eh_must_not_throw (tree decl)
{
- gimple p = gimple_alloc (GIMPLE_EH_MUST_NOT_THROW, 0);
+ gimple_eh_must_not_throw p =
+ as_a <gimple_eh_must_not_throw> (
+ gimple_alloc (GIMPLE_EH_MUST_NOT_THROW, 0));
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
gcc_assert (flags_from_decl_or_type (decl) & ECF_NORETURN);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 0d95035..445a1c0 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1327,7 +1327,7 @@ gimple_asm gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
vec<tree, va_gc> *);
gimple_catch gimple_build_catch (tree, gimple_seq);
gimple_eh_filter gimple_build_eh_filter (tree, gimple_seq);
-gimple gimple_build_eh_must_not_throw (tree);
+gimple_eh_must_not_throw gimple_build_eh_must_not_throw (tree);
gimple gimple_build_eh_else (gimple_seq, gimple_seq);
gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
enum gimple_try_flags);
@@ -3652,18 +3652,17 @@ gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
/* Get the function decl to be called by the MUST_NOT_THROW region. */
static inline tree
-gimple_eh_must_not_throw_fndecl (gimple gs)
+gimple_eh_must_not_throw_fndecl (gimple_eh_must_not_throw eh_mnt_stmt)
{
- gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
return eh_mnt_stmt->fndecl;
}
/* Set the function decl to be called by GS to DECL. */
static inline void
-gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
+gimple_eh_must_not_throw_set_fndecl (gimple_eh_must_not_throw eh_mnt_stmt,
+ tree decl)
{
- gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
eh_mnt_stmt->fndecl = decl;
}
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 15dcf51..d22eb45 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1861,7 +1861,8 @@ lower_eh_must_not_throw (struct leh_state *state, gimple tp)
this_region = gen_eh_region_must_not_throw (state->cur_region);
this_region->u.must_not_throw.failure_decl
- = gimple_eh_must_not_throw_fndecl (inner);
+ = gimple_eh_must_not_throw_fndecl (
+ as_a <gimple_eh_must_not_throw> (inner));
this_region->u.must_not_throw.failure_loc
= LOCATION_LOCUS (gimple_location (tp));
--
1.8.5.3