This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 26/89] Introduce gimple_eh_filter


On Mon, Apr 21, 2014 at 12:56:57PM -0400, David Malcolm wrote:
> gcc/
> 	* coretypes.h (gimple_eh_filter): New typedef.
> 	(const_gimple_eh_filter): New typedef.
> 
> 	* gimple.h (gimple_statement_base::as_a_gimple_eh_filter): New.
> 	(gimple_build_eh_filter): Return a gimple_eh_filter rather than a
> 	plain gimple.
> 
> 	* gimple-pretty-print.c (dump_gimple_eh_filter): Require a
> 	gimple_eh_filter rather than a plain gimple.
> 	(pp_gimple_stmt_1): Add checked cast to gimple_eh_filter within
> 	GIMPLE_EH_FILTER case of switch statement.
> 
> 	* gimple.c (gimple_build_eh_filter): Return a gimple_eh_filter
> 	rather than a plain gimple.
> ---
>  gcc/coretypes.h           | 4 ++++
>  gcc/gimple-pretty-print.c | 5 +++--

same question about pretty printers.

Trev

>  gcc/gimple.c              | 5 +++--
>  gcc/gimple.h              | 8 +++++++-
>  4 files changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/gcc/coretypes.h b/gcc/coretypes.h
> index 1dd36fb..592b9e5 100644
> --- a/gcc/coretypes.h
> +++ b/gcc/coretypes.h
> @@ -117,6 +117,10 @@ struct gimple_statement_catch;
>  typedef struct gimple_statement_catch *gimple_catch;
>  typedef const struct gimple_statement_catch *const_gimple_catch;
>  
> +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_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 ec16f13..37f28d9 100644
> --- a/gcc/gimple-pretty-print.c
> +++ b/gcc/gimple-pretty-print.c
> @@ -994,7 +994,8 @@ dump_gimple_catch (pretty_printer *buffer, gimple_catch gs, int spc, int flags)
>     dumpfile.h).  */
>  
>  static void
> -dump_gimple_eh_filter (pretty_printer *buffer, gimple gs, int spc, int flags)
> +dump_gimple_eh_filter (pretty_printer *buffer, gimple_eh_filter gs, int spc,
> +		       int flags)
>  {
>    if (flags & TDF_RAW)
>      dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs,
> @@ -2204,7 +2205,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
>        break;
>  
>      case GIMPLE_EH_FILTER:
> -      dump_gimple_eh_filter (buffer, gs, spc, flags);
> +      dump_gimple_eh_filter (buffer, gs->as_a_gimple_eh_filter (), spc, flags);
>        break;
>  
>      case GIMPLE_EH_MUST_NOT_THROW:
> diff --git a/gcc/gimple.c b/gcc/gimple.c
> index 4bc844b..42eef46 100644
> --- a/gcc/gimple.c
> +++ b/gcc/gimple.c
> @@ -626,10 +626,11 @@ gimple_build_catch (tree types, gimple_seq handler)
>     TYPES are the filter's types.
>     FAILURE is the filter's failure action.  */
>  
> -gimple
> +gimple_eh_filter
>  gimple_build_eh_filter (tree types, gimple_seq failure)
>  {
> -  gimple p = gimple_alloc (GIMPLE_EH_FILTER, 0);
> +  gimple_eh_filter p =
> +    gimple_alloc (GIMPLE_EH_FILTER, 0)->as_a_gimple_eh_filter ();
>    gimple_eh_filter_set_types (p, types);
>    if (failure)
>      gimple_eh_filter_set_failure (p, failure);
> diff --git a/gcc/gimple.h b/gcc/gimple.h
> index e12e066..38b257c 100644
> --- a/gcc/gimple.h
> +++ b/gcc/gimple.h
> @@ -294,6 +294,12 @@ public:
>      return as_a <gimple_statement_catch> (this);
>    }
>  
> +  inline gimple_eh_filter
> +  as_a_gimple_eh_filter ()
> +  {
> +    return as_a <gimple_statement_eh_filter> (this);
> +  }
> +
>    inline gimple_phi
>    as_a_gimple_phi ()
>    {
> @@ -1512,7 +1518,7 @@ gimple_asm gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
>  				 vec<tree, va_gc> *, vec<tree, va_gc> *,
>  				 vec<tree, va_gc> *);
>  gimple_catch gimple_build_catch (tree, gimple_seq);
> -gimple gimple_build_eh_filter (tree, gimple_seq);
> +gimple_eh_filter gimple_build_eh_filter (tree, gimple_seq);
>  gimple 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,
> -- 
> 1.8.5.3
> 

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]