public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] middle-end: Remove PROP_no_crit_edges [PR116114]
@ 2024-07-28  4:40 Andrew Pinski
  2024-07-28  4:40 ` [PATCH 2/2] middle-end: Move the function current properties over to a .def file [PR116118] Andrew Pinski
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pinski @ 2024-07-28  4:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andrew Pinski

PROP_no_crit_edges was made checked by r8-2993-ga7976089dba5e2 by
doing an explict splitting critical edges directly in PRE.
So let's remove it.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Note this depends on https://gcc.gnu.org/pipermail/gcc-patches/2024-July/658447.html .

gcc/ChangeLog:

	PR middle-end/116114
	* function.h (PROP_no_crit_edges): Delete.
	* passes.cc (dump_properties): Remove testing of PROP_no_crit_edges
	* tree-cfg.cc (pass_data_split_crit_edges): Don't set PROP_no_crit_edges
	for properties provided.
	* tree-ssa-sink.cc (pass_data_sink_code): Remove comment about
	PROP_no_crit_edges.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/function.h       | 2 +-
 gcc/passes.cc        | 2 --
 gcc/tree-cfg.cc      | 2 +-
 gcc/tree-ssa-sink.cc | 2 --
 4 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/gcc/function.h b/gcc/function.h
index c2c1b808eb1..f0f48648504 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -251,7 +251,7 @@ public:
 #define PROP_cfg		(1 << 3)
 #define PROP_objsz		(1 << 4)	/* object sizes computed */
 #define PROP_ssa		(1 << 5)
-#define PROP_no_crit_edges      (1 << 6)
+/* UNUSED			(1 << 6) */
 #define PROP_rtl		(1 << 7)
 #define PROP_gimple_lomp	(1 << 8)	/* lowered OpenMP directives */
 #define PROP_cfglayout	 	(1 << 9)	/* cfglayout mode on RTL */
diff --git a/gcc/passes.cc b/gcc/passes.cc
index bf91befe074..c494c76808b 100644
--- a/gcc/passes.cc
+++ b/gcc/passes.cc
@@ -3178,8 +3178,6 @@ dump_properties (FILE *dump, unsigned int props)
     fprintf (dump, "PROP_cfg\n");
   if (props & PROP_ssa)
     fprintf (dump, "PROP_ssa\n");
-  if (props & PROP_no_crit_edges)
-    fprintf (dump, "PROP_no_crit_edges\n");
   if (props & PROP_rtl)
     fprintf (dump, "PROP_rtl\n");
   if (props & PROP_gimple_lomp)
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index 32b0d3b356e..3b0c7c4ba53 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -9495,7 +9495,7 @@ const pass_data pass_data_split_crit_edges =
   OPTGROUP_NONE, /* optinfo_flags */
   TV_TREE_SPLIT_EDGES, /* tv_id */
   PROP_cfg, /* properties_required */
-  PROP_no_crit_edges, /* properties_provided */
+  0, /* properties_provided */
   0, /* properties_destroyed */
   0, /* todo_flags_start */
   0, /* todo_flags_finish */
diff --git a/gcc/tree-ssa-sink.cc b/gcc/tree-ssa-sink.cc
index 737638591db..ad5dd83e43d 100644
--- a/gcc/tree-ssa-sink.cc
+++ b/gcc/tree-ssa-sink.cc
@@ -799,8 +799,6 @@ const pass_data pass_data_sink_code =
   "sink", /* name */
   OPTGROUP_NONE, /* optinfo_flags */
   TV_TREE_SINK, /* tv_id */
-  /* PROP_no_crit_edges is ensured by running split_edges_for_insertion in
-     pass_data_sink_code::execute ().  */
   ( PROP_cfg | PROP_ssa ), /* properties_required */
   0, /* properties_provided */
   0, /* properties_destroyed */
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] middle-end: Move the function current properties over to a .def file [PR116118]
  2024-07-28  4:40 [PATCH 1/2] middle-end: Remove PROP_no_crit_edges [PR116114] Andrew Pinski
@ 2024-07-28  4:40 ` Andrew Pinski
  2024-07-28  6:27   ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pinski @ 2024-07-28  4:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andrew Pinski

While doing some other cleanups with the properties I noticed that debug_properties
was not updated for some of the new properties. So instead of just updating the function,
this moves the properties over to its own .def file so we don't need to update this nor will
have a conflict in the bit ordering either.

For now I just used an `enum class` for the enum that holds the bit number of each property.
Later on this might be changed to a normal enum and only use that instead. But that won't be
until we require C++17 since `folding expressions` make this code much simplier.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

	PR middle-end/116118
	* function.h (PROP_bitnum): New enum class.
	(function_prop_type): New typedef.
	(PROP_gimple_any): Remove.
	(PROP_gimple_lcf): Remove.
	(PROP_gimple_leh): Remove.
	(PROP_cfg): Remove.
	(PROP_objsz): Remove.
	(PROP_ssa): Remove.
	(PROP_rtl): Remove.
	(PROP_gimple_lomp): Remove.
	(PROP_cfglayout): Remove.
	(PROP_gimple_lcx): Remove.
	(PROP_loops): Remove.
	(PROP_gimple_lvec): Remove.
	(PROP_gimple_eomp): Remove.
	(PROP_gimple_lva): Remove.
	(PROP_gimple_opt_math): Remove.
	(PROP_gimple_lomp_dev): Remove.
	(PROP_rtl_split_insns): Remove.
	(PROP_loop_opts_done): Remove.
	(PROP_assumptions_done): Remove.
	(PROP_gimple_lbitint): Remove.
	(enum PROP_bit): New.
	(struct function): Use function_prop_type instead of `unsigned int`
	for the properties.
	* passes.cc (debug_properties): Update to use function_prop_type.
	(dump_properties): Likewise. Also don't directly print the properties,
	use an array.
	* ir-prop.def: New file.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/function.h  | 47 ++++++++++++++++++++---------------------------
 gcc/ir-prop.def | 45 +++++++++++++++++++++++++++++++++++++++++++++
 gcc/passes.cc   | 45 +++++++++++++++++++--------------------------
 3 files changed, 84 insertions(+), 53 deletions(-)
 create mode 100644 gcc/ir-prop.def

diff --git a/gcc/function.h b/gcc/function.h
index f0f48648504..9a678741f6c 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -243,34 +243,27 @@ public:
   (current_function_dynamic_stack_size != 0               \
    || current_function_has_unbounded_dynamic_stack_size)
 
+/* Pass properties set on function::curr_properties.  */
+enum class PROP_bitnum
+{
+#define PROP(a) PROP_BIT_##a ,
+#include "ir-prop.def"
+PROP_BIT_end
+};
+
+typedef unsigned int function_prop_type;
+/* Make sure current_properties has enough bits for the properties. */
+static_assert ((size_t)PROP_bitnum::PROP_BIT_end
+		<= (sizeof(function_prop_type) * CHAR_BIT),
+	       "too many properties for prop type");
 
 /* Pass properties set on function::curr_properties.  */
-#define PROP_gimple_any		(1 << 0)	/* entire gimple grammar */
-#define PROP_gimple_lcf		(1 << 1)	/* lowered control flow */
-#define PROP_gimple_leh		(1 << 2)	/* lowered eh */
-#define PROP_cfg		(1 << 3)
-#define PROP_objsz		(1 << 4)	/* object sizes computed */
-#define PROP_ssa		(1 << 5)
-/* UNUSED			(1 << 6) */
-#define PROP_rtl		(1 << 7)
-#define PROP_gimple_lomp	(1 << 8)	/* lowered OpenMP directives */
-#define PROP_cfglayout	 	(1 << 9)	/* cfglayout mode on RTL */
-#define PROP_gimple_lcx		(1 << 10)       /* lowered complex */
-#define PROP_loops		(1 << 11)	/* preserve loop structures */
-#define PROP_gimple_lvec	(1 << 12)       /* lowered vector */
-#define PROP_gimple_eomp	(1 << 13)       /* no OpenMP directives */
-#define PROP_gimple_lva		(1 << 14)       /* No va_arg internal function.  */
-#define PROP_gimple_opt_math	(1 << 15)	/* Disable canonicalization
-						   of math functions; the
-						   current choices have
-						   been optimized.  */
-#define PROP_gimple_lomp_dev	(1 << 16)	/* done omp_device_lower */
-#define PROP_rtl_split_insns	(1 << 17)	/* RTL has insns split.  */
-#define PROP_loop_opts_done	(1 << 18)	/* SSA loop optimizations
-						   have completed.  */
-#define PROP_assumptions_done	(1 << 19)	/* Assume function kept
-						   around.  */
-#define PROP_gimple_lbitint	(1 << 20)       /* lowered large _BitInt */
+enum PROP_bit : function_prop_type
+{
+#define PROP(a) PROP_##a = \
+	((function_prop_type)1) << (function_prop_type)PROP_bitnum::PROP_BIT_##a,
+#include "ir-prop.def"
+};
 
 #define PROP_gimple \
   (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
@@ -364,7 +357,7 @@ struct GTY(()) function {
   location_t function_end_locus;
 
   /* Properties used by the pass manager.  */
-  unsigned int curr_properties;
+  function_prop_type curr_properties;
   unsigned int last_verified;
 
   /* Different from normal TODO_flags which are handled right at the
diff --git a/gcc/ir-prop.def b/gcc/ir-prop.def
new file mode 100644
index 00000000000..7ec6d135a4e
--- /dev/null
+++ b/gcc/ir-prop.def
@@ -0,0 +1,45 @@
+/* Pass properties set on function::curr_properties.
+   Copyright (C) 1989-2024 Free Software Foundation, Inc.
+   Copyright The GNU Toolchain Authors.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+/* PROP (name) defines the property that can be set on
+   function::curr_properties. */
+PROP (gimple_any)	/* entire gimple grammar */
+PROP (gimple_lcf)	/* lowered control flow */
+PROP (gimple_leh)	/* lowered eh */
+PROP (cfg)
+PROP (objsz)		/* object sizes computed */
+PROP (ssa)
+PROP (rtl)
+PROP (gimple_lomp)	/* lowered OpenMP directives */
+PROP (cfglayout)	/* cfglayout mode on RTL */
+PROP (gimple_lcx)	/* lowered complex */
+PROP (loops)		/* preserve loop structures */
+PROP (gimple_lvec)	/* lowered vector */
+PROP (gimple_eomp)	/* no OpenMP directives */
+PROP (gimple_lva)	/* No va_arg internal function.  */
+PROP (gimple_opt_math)	/* Disable canonicalization of math functions; the
+			   current choices have been optimized.  */
+PROP (gimple_lomp_dev)	/* done omp_device_lower */
+PROP (rtl_split_insns)	/* RTL has insns split.  */
+PROP (loop_opts_done)	/* SSA loop optimizations have completed.  */
+PROP (assumptions_done)	/* Assume function kept  around.  */
+PROP (gimple_lbitint)	/* lowered large _BitInt */
+
+#undef PROP
diff --git a/gcc/passes.cc b/gcc/passes.cc
index c494c76808b..1cfc505a24f 100644
--- a/gcc/passes.cc
+++ b/gcc/passes.cc
@@ -3161,39 +3161,32 @@ execute_all_ipa_stmt_fixups (struct cgraph_node *node, gimple **stmts)
 }
 
 
-extern void debug_properties (unsigned int);
-extern void dump_properties (FILE *, unsigned int);
+extern void debug_properties (function_prop_type);
+extern void dump_properties (FILE *, function_prop_type);
 
 DEBUG_FUNCTION void
-dump_properties (FILE *dump, unsigned int props)
+dump_properties (FILE *dump, function_prop_type props)
 {
   fprintf (dump, "Properties:\n");
-  if (props & PROP_gimple_any)
-    fprintf (dump, "PROP_gimple_any\n");
-  if (props & PROP_gimple_lcf)
-    fprintf (dump, "PROP_gimple_lcf\n");
-  if (props & PROP_gimple_leh)
-    fprintf (dump, "PROP_gimple_leh\n");
-  if (props & PROP_cfg)
-    fprintf (dump, "PROP_cfg\n");
-  if (props & PROP_ssa)
-    fprintf (dump, "PROP_ssa\n");
-  if (props & PROP_rtl)
-    fprintf (dump, "PROP_rtl\n");
-  if (props & PROP_gimple_lomp)
-    fprintf (dump, "PROP_gimple_lomp\n");
-  if (props & PROP_gimple_lomp_dev)
-    fprintf (dump, "PROP_gimple_lomp_dev\n");
-  if (props & PROP_gimple_lcx)
-    fprintf (dump, "PROP_gimple_lcx\n");
-  if (props & PROP_gimple_lvec)
-    fprintf (dump, "PROP_gimple_lvec\n");
-  if (props & PROP_cfglayout)
-    fprintf (dump, "PROP_cfglayout\n");
+  static const char *prop_name[] = {
+#define PROP(a) "PROP_" #a ,
+#include "ir-prop.def"
+  };
+  for (unsigned i = 0; i < (sizeof(function_prop_type) * CHAR_BIT); i++)
+    {
+      if ((props & (((function_prop_type)1) << i)) == 0)
+	continue;
+      if (i >= ARRAY_SIZE (prop_name))
+	{
+	  fprintf(dump, "unkown_prop: %d\n", i);
+	  continue;
+	}
+      fprintf(dump, "%s\n", prop_name[i]);
+    }
 }
 
 DEBUG_FUNCTION void
-debug_properties (unsigned int props)
+debug_properties (function_prop_type props)
 {
   dump_properties (stderr, props);
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] middle-end: Move the function current properties over to a .def file [PR116118]
  2024-07-28  4:40 ` [PATCH 2/2] middle-end: Move the function current properties over to a .def file [PR116118] Andrew Pinski
@ 2024-07-28  6:27   ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2024-07-28  6:27 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc-patches



> Am 28.07.2024 um 06:41 schrieb Andrew Pinski <quic_apinski@quicinc.com>:
> 
> While doing some other cleanups with the properties I noticed that debug_properties
> was not updated for some of the new properties. So instead of just updating the function,
> this moves the properties over to its own .def file so we don't need to update this nor will
> have a conflict in the bit ordering either.
> 
> For now I just used an `enum class` for the enum that holds the bit number of each property.
> Later on this might be changed to a normal enum and only use that instead. But that won't be
> until we require C++17 since `folding expressions` make this code much simplier.
> 
> Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Ok for both.  Can you check the internals manual if there’s any updates needed?

Thanks,
Richard 

> gcc/ChangeLog:
> 
>    PR middle-end/116118
>    * function.h (PROP_bitnum): New enum class.
>    (function_prop_type): New typedef.
>    (PROP_gimple_any): Remove.
>    (PROP_gimple_lcf): Remove.
>    (PROP_gimple_leh): Remove.
>    (PROP_cfg): Remove.
>    (PROP_objsz): Remove.
>    (PROP_ssa): Remove.
>    (PROP_rtl): Remove.
>    (PROP_gimple_lomp): Remove.
>    (PROP_cfglayout): Remove.
>    (PROP_gimple_lcx): Remove.
>    (PROP_loops): Remove.
>    (PROP_gimple_lvec): Remove.
>    (PROP_gimple_eomp): Remove.
>    (PROP_gimple_lva): Remove.
>    (PROP_gimple_opt_math): Remove.
>    (PROP_gimple_lomp_dev): Remove.
>    (PROP_rtl_split_insns): Remove.
>    (PROP_loop_opts_done): Remove.
>    (PROP_assumptions_done): Remove.
>    (PROP_gimple_lbitint): Remove.
>    (enum PROP_bit): New.
>    (struct function): Use function_prop_type instead of `unsigned int`
>    for the properties.
>    * passes.cc (debug_properties): Update to use function_prop_type.
>    (dump_properties): Likewise. Also don't directly print the properties,
>    use an array.
>    * ir-prop.def: New file.
> 
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
> gcc/function.h  | 47 ++++++++++++++++++++---------------------------
> gcc/ir-prop.def | 45 +++++++++++++++++++++++++++++++++++++++++++++
> gcc/passes.cc   | 45 +++++++++++++++++++--------------------------
> 3 files changed, 84 insertions(+), 53 deletions(-)
> create mode 100644 gcc/ir-prop.def
> 
> diff --git a/gcc/function.h b/gcc/function.h
> index f0f48648504..9a678741f6c 100644
> --- a/gcc/function.h
> +++ b/gcc/function.h
> @@ -243,34 +243,27 @@ public:
>   (current_function_dynamic_stack_size != 0               \
>    || current_function_has_unbounded_dynamic_stack_size)
> 
> +/* Pass properties set on function::curr_properties.  */
> +enum class PROP_bitnum
> +{
> +#define PROP(a) PROP_BIT_##a ,
> +#include "ir-prop.def"
> +PROP_BIT_end
> +};
> +
> +typedef unsigned int function_prop_type;
> +/* Make sure current_properties has enough bits for the properties. */
> +static_assert ((size_t)PROP_bitnum::PROP_BIT_end
> +        <= (sizeof(function_prop_type) * CHAR_BIT),
> +           "too many properties for prop type");
> 
> /* Pass properties set on function::curr_properties.  */
> -#define PROP_gimple_any        (1 << 0)    /* entire gimple grammar */
> -#define PROP_gimple_lcf        (1 << 1)    /* lowered control flow */
> -#define PROP_gimple_leh        (1 << 2)    /* lowered eh */
> -#define PROP_cfg        (1 << 3)
> -#define PROP_objsz        (1 << 4)    /* object sizes computed */
> -#define PROP_ssa        (1 << 5)
> -/* UNUSED            (1 << 6) */
> -#define PROP_rtl        (1 << 7)
> -#define PROP_gimple_lomp    (1 << 8)    /* lowered OpenMP directives */
> -#define PROP_cfglayout        (1 << 9)    /* cfglayout mode on RTL */
> -#define PROP_gimple_lcx        (1 << 10)       /* lowered complex */
> -#define PROP_loops        (1 << 11)    /* preserve loop structures */
> -#define PROP_gimple_lvec    (1 << 12)       /* lowered vector */
> -#define PROP_gimple_eomp    (1 << 13)       /* no OpenMP directives */
> -#define PROP_gimple_lva        (1 << 14)       /* No va_arg internal function.  */
> -#define PROP_gimple_opt_math    (1 << 15)    /* Disable canonicalization
> -                           of math functions; the
> -                           current choices have
> -                           been optimized.  */
> -#define PROP_gimple_lomp_dev    (1 << 16)    /* done omp_device_lower */
> -#define PROP_rtl_split_insns    (1 << 17)    /* RTL has insns split.  */
> -#define PROP_loop_opts_done    (1 << 18)    /* SSA loop optimizations
> -                           have completed.  */
> -#define PROP_assumptions_done    (1 << 19)    /* Assume function kept
> -                           around.  */
> -#define PROP_gimple_lbitint    (1 << 20)       /* lowered large _BitInt */
> +enum PROP_bit : function_prop_type
> +{
> +#define PROP(a) PROP_##a = \
> +    ((function_prop_type)1) << (function_prop_type)PROP_bitnum::PROP_BIT_##a,
> +#include "ir-prop.def"
> +};
> 
> #define PROP_gimple \
>   (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
> @@ -364,7 +357,7 @@ struct GTY(()) function {
>   location_t function_end_locus;
> 
>   /* Properties used by the pass manager.  */
> -  unsigned int curr_properties;
> +  function_prop_type curr_properties;
>   unsigned int last_verified;
> 
>   /* Different from normal TODO_flags which are handled right at the
> diff --git a/gcc/ir-prop.def b/gcc/ir-prop.def
> new file mode 100644
> index 00000000000..7ec6d135a4e
> --- /dev/null
> +++ b/gcc/ir-prop.def
> @@ -0,0 +1,45 @@
> +/* Pass properties set on function::curr_properties.
> +   Copyright (C) 1989-2024 Free Software Foundation, Inc.
> +   Copyright The GNU Toolchain Authors.
> +
> +This file is part of GCC.
> +
> +GCC is free software; you can redistribute it and/or modify it under
> +the terms of the GNU General Public License as published by the Free
> +Software Foundation; either version 3, or (at your option) any later
> +version.
> +
> +GCC is distributed in the hope that it will be useful, but WITHOUT ANY
> +WARRANTY; without even the implied warranty of MERCHANTABILITY or
> +FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
> +for more details.
> +
> +You should have received a copy of the GNU General Public License
> +along with GCC; see the file COPYING3.  If not see
> +<http://www.gnu.org/licenses/>.  */
> +
> +/* PROP (name) defines the property that can be set on
> +   function::curr_properties. */
> +PROP (gimple_any)    /* entire gimple grammar */
> +PROP (gimple_lcf)    /* lowered control flow */
> +PROP (gimple_leh)    /* lowered eh */
> +PROP (cfg)
> +PROP (objsz)        /* object sizes computed */
> +PROP (ssa)
> +PROP (rtl)
> +PROP (gimple_lomp)    /* lowered OpenMP directives */
> +PROP (cfglayout)    /* cfglayout mode on RTL */
> +PROP (gimple_lcx)    /* lowered complex */
> +PROP (loops)        /* preserve loop structures */
> +PROP (gimple_lvec)    /* lowered vector */
> +PROP (gimple_eomp)    /* no OpenMP directives */
> +PROP (gimple_lva)    /* No va_arg internal function.  */
> +PROP (gimple_opt_math)    /* Disable canonicalization of math functions; the
> +               current choices have been optimized.  */
> +PROP (gimple_lomp_dev)    /* done omp_device_lower */
> +PROP (rtl_split_insns)    /* RTL has insns split.  */
> +PROP (loop_opts_done)    /* SSA loop optimizations have completed.  */
> +PROP (assumptions_done)    /* Assume function kept  around.  */
> +PROP (gimple_lbitint)    /* lowered large _BitInt */
> +
> +#undef PROP
> diff --git a/gcc/passes.cc b/gcc/passes.cc
> index c494c76808b..1cfc505a24f 100644
> --- a/gcc/passes.cc
> +++ b/gcc/passes.cc
> @@ -3161,39 +3161,32 @@ execute_all_ipa_stmt_fixups (struct cgraph_node *node, gimple **stmts)
> }
> 
> 
> -extern void debug_properties (unsigned int);
> -extern void dump_properties (FILE *, unsigned int);
> +extern void debug_properties (function_prop_type);
> +extern void dump_properties (FILE *, function_prop_type);
> 
> DEBUG_FUNCTION void
> -dump_properties (FILE *dump, unsigned int props)
> +dump_properties (FILE *dump, function_prop_type props)
> {
>   fprintf (dump, "Properties:\n");
> -  if (props & PROP_gimple_any)
> -    fprintf (dump, "PROP_gimple_any\n");
> -  if (props & PROP_gimple_lcf)
> -    fprintf (dump, "PROP_gimple_lcf\n");
> -  if (props & PROP_gimple_leh)
> -    fprintf (dump, "PROP_gimple_leh\n");
> -  if (props & PROP_cfg)
> -    fprintf (dump, "PROP_cfg\n");
> -  if (props & PROP_ssa)
> -    fprintf (dump, "PROP_ssa\n");
> -  if (props & PROP_rtl)
> -    fprintf (dump, "PROP_rtl\n");
> -  if (props & PROP_gimple_lomp)
> -    fprintf (dump, "PROP_gimple_lomp\n");
> -  if (props & PROP_gimple_lomp_dev)
> -    fprintf (dump, "PROP_gimple_lomp_dev\n");
> -  if (props & PROP_gimple_lcx)
> -    fprintf (dump, "PROP_gimple_lcx\n");
> -  if (props & PROP_gimple_lvec)
> -    fprintf (dump, "PROP_gimple_lvec\n");
> -  if (props & PROP_cfglayout)
> -    fprintf (dump, "PROP_cfglayout\n");
> +  static const char *prop_name[] = {
> +#define PROP(a) "PROP_" #a ,
> +#include "ir-prop.def"
> +  };
> +  for (unsigned i = 0; i < (sizeof(function_prop_type) * CHAR_BIT); i++)
> +    {
> +      if ((props & (((function_prop_type)1) << i)) == 0)
> +    continue;
> +      if (i >= ARRAY_SIZE (prop_name))
> +    {
> +      fprintf(dump, "unkown_prop: %d\n", i);
> +      continue;
> +    }
> +      fprintf(dump, "%s\n", prop_name[i]);
> +    }
> }
> 
> DEBUG_FUNCTION void
> -debug_properties (unsigned int props)
> +debug_properties (function_prop_type props)
> {
>   dump_properties (stderr, props);
> }
> --
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-28  6:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-28  4:40 [PATCH 1/2] middle-end: Remove PROP_no_crit_edges [PR116114] Andrew Pinski
2024-07-28  4:40 ` [PATCH 2/2] middle-end: Move the function current properties over to a .def file [PR116118] Andrew Pinski
2024-07-28  6:27   ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).