While working on isel, I found that the current way of doing current_properties
in function can easily make a mistake and having to do stuff like `(a & b ) == 
0`
and `a |= b;` and `a &= ~b;` is not so obvious what was going on.
So let's add a few helper methods to function:
* set_property
* unset_property
* prop_set_p
* gimple_prop_p

and use them in the source; I didn't change of the backends which has a few 
places
which could change.

Also moves the PROP_* defines from tree-pass.h to function.h where
they should be.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

        * tree-pass.h (PROP_gimple_any): Delete.
        (PROP_gimple_lcf): Delete.
        (PROP_gimple_leh): Delete.
        (PROP_cfg): Delete.
        (PROP_objsz): Delete.
        (PROP_ssa): Delete.
        (PROP_no_crit_edges): Delete.
        (PROP_rtl): Delete.
        (PROP_gimple_lomp): Delete.
        (PROP_cfglayout): Delete.
        (PROP_gimple_lcx): Delete.
        (PROP_loops): Delete.
        (PROP_gimple_lvec): Delete.
        (PROP_gimple_eomp): Delete.
        (PROP_gimple_lva): Delete.
        (PROP_gimple_opt_math): Delete.
        (PROP_gimple_lomp_dev): Delete.
        (PROP_rtl_split_insns): Delete.
        (PROP_loop_opts_done): Delete.
        (PROP_assumptions_done): Delete.
        (PROP_gimple_lbitint): Delete.
        (PROP_gimple): Delete.
        * function.h (PROP_gimple_any): Move from tree-pass.h.
        (PROP_gimple_lcf): Move from tree-pass.h.
        (PROP_gimple_leh): Move from tree-pass.h.
        (PROP_cfg): Move from tree-pass.h.
        (PROP_objsz): Move from tree-pass.h.
        (PROP_ssa): Move from tree-pass.h.
        (PROP_no_crit_edges): Move from tree-pass.h.
        (PROP_rtl): Move from tree-pass.h.
        (PROP_gimple_lomp): Move from tree-pass.h.
        (PROP_cfglayout): Move from tree-pass.h.
        (PROP_gimple_lcx): Move from tree-pass.h. Move from tree-pass.h.
        (PROP_loops): Move from tree-pass.h.
        (PROP_gimple_lvec): Move from tree-pass.h.
        (PROP_gimple_eomp): Move from tree-pass.h.
        (PROP_gimple_lva): Move from tree-pass.h.
        (PROP_gimple_opt_math): Move from tree-pass.h.
        (PROP_gimple_lomp_dev): Move from tree-pass.h.
        (PROP_rtl_split_insns): Move from tree-pass.h.
        (PROP_loop_opts_done): Move from tree-pass.h.
        (PROP_assumptions_done): Move from tree-pass.h.
        (PROP_gimple_lbitint): Move from tree-pass.h.
        (PROP_gimple): Move from tree-pass.h.
        (struct function): Add helper methods, set_property,
        unset_property, prop_set_p, gimple_prop_p
        * cfgexpand.cc (pass_expand::execute): Use unset_property.
        * cfgrtl.cc (print_rtl_with_bb): Use prop_set_p.
        * cgraph.cc (release_function_body): Use unset_property.
        (cgraph_node::verify_node): Use prop_set_p.
        * cgraphunit.cc (symtab_node::native_rtl_p): Use prop_set_p.
        (init_lowered_empty_function): Use set_property.
        (symbol_table::compile): Use prop_set_p.
        * function.cc (free_after_compilation): Use unset_property.
        * generic-match-head.cc (canonicalize_math_p): Use prop_set_p.
        (optimize_vectors_before_lowering_p): Use prop_set_p.
        * gimple-expr.cc (gimple_has_body_p): Use prop_set_p.
        * gimple-lower-bitint.cc (pass_lower_bitint_O0::gate): Use prop_set_p.
        * gimple-match-exports.cc (build_call_internal): Use prop_set_p.
        * gimple-match-head.cc (canonicalize_math_p): Use prop_set_p.
        (canonicalize_math_after_vectorization_p): Use prop_set_p.
        (optimize_vectors_before_lowering_p): Use prop_set_p.
        * gimplify.cc: Remove tree-pass.h include and add timevar.h include.
        (gimplify_call_expr): Use prop_set_p.
        (gimplify_function_tree): Use set_property.
        (gimplify_va_arg_expr): Use unset_property.
        * loop-init.cc (loop_optimizer_init): Use prop_set_p.
        (loop_optimizer_finalize): Use prop_set_p.
        (pass_loop2::gate): Use unset_property.
        (pass_rtl_loop_done::execute): Use unset_property.
        * passes.cc (execute_function_dump): Use gimple_prop_p.
        (emergency_dump_function): Use prop_set_p.
        (execute_function_todo): Use gimple_prop_p and prop_set_p.
        (pass_init_dump_file): Use prop_set_p.
        (execute_one_ipa_transform_pass): Use gimple_prop_p.
        (execute_all_ipa_transforms): Use gimple_prop_p.
        (skip_pass): Use set_property.
        (execute_one_pass): Use prop_set_p, gimple_prop_p and set_property.
        * read-rtl-function.cc (function_reader::create_function): Use 
set_property
        * varpool.cc: Remove tree-pass.h include as PROP_* moved to function.h.
        * omp-expand.cc (expand_omp_simd): Use unset_property.
        (pass_expand_omp_ssa::gate): Use prop_set_p.
        * omp-general.cc (omp_maybe_offloaded): Use prop_set_p.
        (omp_context_selector_matches): Use prop_set_p.
        (omp_resolve_declare_variant): Use prop_set_p.
        * omp-offload.cc (pass_omp_device_lower::gate): Use prop_set_p.
        * run-rtl-passes.cc (run_rtl_passes): Use set_property.
        * tree-cfg.cc (dump_function_to_file): Use prop_set_p.
        * tree-complex.cc (pass_lower_complex_O0::gate): Use prop_set_p.
        * tree-inline.cc (expand_call_inline): Use prop_set_p.
        (tree_function_versioning): Use unset_property and set_property.
        * tree-into-ssa.cc (pass_build_ssa::gate): Use prop_set_p.
        * tree-parloops.cc (pass_parallelize_loops::execute): Use 
unset_property.
        * tree-ssa-forwprop.cc (pass_forwprop::execute): Use prop_set_p.
        * tree-ssa-loop-niter.cc (do_warn_aggressive_loop_optimizations): Use 
prop_set_p.
        * tree-ssa-sccvn.cc (copy_reference_ops_from_ref): Use prop_set_p.
        (vn_reference_lookup): Use prop_set_p.
        (vn_reference_insert): Use prop_set_p.
        * tree-ssa-sink.cc (do_not_sink): Use prop_set_p.
        * tree-ssa-threadbackward.cc 
(back_threader_profitability::profitable_path_p):
        Use prop_set_p.
        * tree-ssa.cc (maybe_optimize_var): Use prop_set_p.
        * tree-stdarg.cc (expand_ifn_va_arg): Use prop_set_p.
        (pass_lower_vaarg::gate): Use prop_set_p.
        * tree-vect-generic.cc (pass_lower_vector::gate): Use prop_set_p.
        * tree.cc (tree_builtin_call_types_compatible_p): Use gimple_prop_p.

gcc/c-family/ChangeLog:

        * c-gimplify.cc (c_gimplify_expr): Use prop_set_p.

gcc/c/ChangeLog:

        * gimple-parser.cc (c_parser_parse_gimple_body): Use prop_set_p.
        (c_parser_gimple_compound_statement): Use prop_set_p.
        (c_parser_gimple_goto_stmt): Use prop_set_p.
        (c_parser_gimple_if_stmt): Use prop_set_p.

Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>
---
 gcc/c-family/c-gimplify.cc     |  2 +-
 gcc/c/gimple-parser.cc         | 20 +++++------
 gcc/cfgexpand.cc               |  2 +-
 gcc/cfgrtl.cc                  |  4 +--
 gcc/cgraph.cc                  |  4 +--
 gcc/cgraphunit.cc              |  8 ++---
 gcc/function.cc                |  2 +-
 gcc/function.h                 | 65 ++++++++++++++++++++++++++++++++++
 gcc/generic-match-head.cc      |  4 +--
 gcc/gimple-expr.cc             |  2 +-
 gcc/gimple-lower-bitint.cc     |  2 +-
 gcc/gimple-match-exports.cc    |  2 +-
 gcc/gimple-match-head.cc       |  6 ++--
 gcc/gimplify.cc                | 10 +++---
 gcc/loop-init.cc               | 10 +++---
 gcc/omp-expand.cc              |  4 +--
 gcc/omp-general.cc             | 16 ++++-----
 gcc/omp-offload.cc             |  2 +-
 gcc/passes.cc                  | 37 ++++++++++---------
 gcc/read-rtl-function.cc       |  2 +-
 gcc/run-rtl-passes.cc          |  2 +-
 gcc/tree-cfg.cc                |  8 ++---
 gcc/tree-complex.cc            |  2 +-
 gcc/tree-inline.cc             |  6 ++--
 gcc/tree-into-ssa.cc           |  2 +-
 gcc/tree-parloops.cc           |  2 +-
 gcc/tree-pass.h                | 30 ----------------
 gcc/tree-ssa-forwprop.cc       |  2 +-
 gcc/tree-ssa-loop-niter.cc     |  2 +-
 gcc/tree-ssa-sccvn.cc          |  6 ++--
 gcc/tree-ssa-sink.cc           |  2 +-
 gcc/tree-ssa-threadbackward.cc |  4 +--
 gcc/tree-ssa.cc                |  2 +-
 gcc/tree-stdarg.cc             |  4 +--
 gcc/tree-vect-generic.cc       |  2 +-
 gcc/tree.cc                    |  2 +-
 gcc/varpool.cc                 |  1 -
 37 files changed, 158 insertions(+), 125 deletions(-)

diff --git a/gcc/c-family/c-gimplify.cc b/gcc/c-family/c-gimplify.cc
index 3e29766e092..392e2dcdba3 100644
--- a/gcc/c-family/c-gimplify.cc
+++ b/gcc/c-family/c-gimplify.cc
@@ -781,7 +781,7 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p 
ATTRIBUTE_UNUSED,
           boundaries would violate language semantics.  */
        if (SCALAR_FLOAT_TYPE_P (type)
            && flag_fp_contract_mode == FP_CONTRACT_ON
-           && cfun && !(cfun->curr_properties & PROP_gimple_any)
+           && cfun && !cfun->prop_set_p (PROP_gimple_any)
            && fma_supported_p (IFN_FMA, type))
          {
            bool neg_mul = false, neg_add = code == MINUS_EXPR;
diff --git a/gcc/c/gimple-parser.cc b/gcc/c/gimple-parser.cc
index d156d83cd37..9acdb105fc7 100644
--- a/gcc/c/gimple-parser.cc
+++ b/gcc/c/gimple-parser.cc
@@ -246,7 +246,7 @@ c_parser_parse_gimple_body (c_parser *cparser, char 
*gimple_pass,
       if (cdil == cdil_gimple_ssa)
        {
          init_ssa_operands (cfun);
-         cfun->curr_properties |= PROP_ssa;
+         cfun->set_property (PROP_ssa);
        }
     }
 
@@ -360,7 +360,7 @@ c_parser_parse_gimple_body (c_parser *cparser, char 
*gimple_pass,
       fix_loop_structure (NULL);
     }
 
-  if (cfun->curr_properties & PROP_cfg)
+  if (cfun->prop_set_p (PROP_cfg))
     {
       ENTRY_BLOCK_PTR_FOR_FN (cfun)->count = entry_bb_count;
       gcov_type t = param_gimple_fe_computed_hot_bb_threshold;
@@ -372,10 +372,10 @@ c_parser_parse_gimple_body (c_parser *cparser, char 
*gimple_pass,
 
   /* Perform IL validation and if any error is found abort compilation
      of this function by zapping its body.  */
-  if ((cfun->curr_properties & PROP_cfg)
+  if (cfun->prop_set_p (PROP_cfg)
       && verify_gimple_in_cfg (cfun, false, false))
     init_empty_tree_cfg ();
-  else if (!(cfun->curr_properties & PROP_cfg)
+  else if (!cfun->prop_set_p (PROP_cfg)
           && verify_gimple_in_seq (gimple_body (current_function_decl), false))
     gimple_set_body (current_function_decl, NULL);
 
@@ -460,7 +460,7 @@ c_parser_gimple_compound_statement (gimple_parser &parser, 
gimple_seq *seq)
              if (! c_parser_require (parser, CPP_SEMICOLON,
                                      "expected %<;%>"))
                return return_p;
-             if (cfun->curr_properties & PROP_cfg)
+             if (cfun->prop_set_p (PROP_cfg))
                parser.push_edge (parser.current_bb->index, EXIT_BLOCK, 0,
                                  profile_probability::uninitialized ());
              break;
@@ -484,7 +484,7 @@ c_parser_gimple_compound_statement (gimple_parser &parser, 
gimple_seq *seq)
            }
          /* Basic block specification.
             __BB (index, ...)  */
-         if ((cfun->curr_properties & PROP_cfg)
+         if (cfun->prop_set_p (PROP_cfg)
              && !strcmp (IDENTIFIER_POINTER
                            (c_parser_peek_token (parser)->value), "__BB"))
            {
@@ -674,7 +674,7 @@ expr_stmt:
   c_parser_consume_token (parser);
 
   /* Put stmts parsed in the current block.  */
-  if ((cfun->curr_properties & PROP_cfg)
+  if (cfun->prop_set_p (PROP_cfg)
       && !gimple_seq_empty_p (*seq))
     {
       if (!parser.current_bb)
@@ -2258,7 +2258,7 @@ static void
 c_parser_gimple_goto_stmt (gimple_parser &parser,
                           location_t loc, tree label, gimple_seq *seq)
 {
-  if (cfun->curr_properties & PROP_cfg)
+  if (cfun->prop_set_p (PROP_cfg))
     {
       int dest_index;
       profile_probability prob;
@@ -2376,7 +2376,7 @@ c_parser_gimple_if_stmt (gimple_parser &parser, 
gimple_seq *seq)
       c_parser_consume_token (parser);
       int dest_index;
       profile_probability prob;
-      if ((cfun->curr_properties & PROP_cfg)
+      if (cfun->prop_set_p (PROP_cfg)
          && c_parser_gimple_parse_bb_spec_edge_probability (label, parser,
                                                             &dest_index, 
&prob))
        parser.push_edge (parser.current_bb->index, dest_index,
@@ -2413,7 +2413,7 @@ c_parser_gimple_if_stmt (gimple_parser &parser, 
gimple_seq *seq)
       c_parser_consume_token (parser);
       int dest_index;
       profile_probability prob;
-      if ((cfun->curr_properties & PROP_cfg)
+      if (cfun->prop_set_p (PROP_cfg)
          && c_parser_gimple_parse_bb_spec_edge_probability (label, parser,
                                                             &dest_index, 
&prob))
        parser.push_edge (parser.current_bb->index, dest_index,
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index dad3ae1b7c6..ee17c428c76 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -7116,7 +7116,7 @@ pass_expand::execute (function *fun)
      ICE.  */
   if (rtl_dump_and_exit)
     {
-      cfun->curr_properties &= ~PROP_loops;
+      cfun->unset_property (PROP_loops);
       loop_optimizer_finalize ();
     }
 
diff --git a/gcc/cfgrtl.cc b/gcc/cfgrtl.cc
index a5dc3512159..a4643530904 100644
--- a/gcc/cfgrtl.cc
+++ b/gcc/cfgrtl.cc
@@ -2239,13 +2239,13 @@ print_rtl_with_bb (FILE *outf, const rtx_insn 
*rtx_first, dump_flags_t flags)
       /* After freeing the CFG, we still have BLOCK_FOR_INSN set on most
         insns, but the CFG is not maintained so the basic block info
         is not reliable.  Therefore it's omitted from the dumps.  */
-      if (! (cfun->curr_properties & PROP_cfg))
+      if (!cfun->prop_set_p (PROP_cfg))
         flags &= ~TDF_BLOCKS;
 
       if (df)
        df_dump_start (outf);
 
-      if (cfun->curr_properties & PROP_cfg)
+      if (cfun->prop_set_p (PROP_cfg))
        {
          FOR_EACH_BB_REVERSE_FN (bb, cfun)
            {
diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 473d8410bc9..adcbcc53db6 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -1800,7 +1800,7 @@ release_function_body (tree decl)
       if (fn->cfg
          && loops_for_fn (fn))
        {
-         fn->curr_properties &= ~PROP_loops;
+         fn->unset_property (PROP_loops);
          loop_optimizer_finalize (fn);
        }
       if (fn->gimple_df)
@@ -3824,7 +3824,7 @@ cgraph_node::verify_node (void)
           && (!DECL_EXTERNAL (decl) || inlined_to)
           && !flag_wpa)
     {
-      if ((this_cfun->curr_properties & PROP_assumptions_done) != 0)
+      if (this_cfun->prop_set_p (PROP_assumptions_done))
        ;
       else if (this_cfun->cfg)
        {
diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc
index 2bd0289ffba..30fca8f8f2f 100644
--- a/gcc/cgraphunit.cc
+++ b/gcc/cgraphunit.cc
@@ -230,7 +230,7 @@ symtab_node::native_rtl_p () const
     return false;
   if (!DECL_STRUCT_FUNCTION (decl))
     return false;
-  return DECL_STRUCT_FUNCTION (decl)->curr_properties & PROP_rtl;
+  return DECL_STRUCT_FUNCTION (decl)->prop_set_p (PROP_rtl);
 }
 
 /* Determine if symbol declaration is needed.  That is, visible to something
@@ -1721,7 +1721,7 @@ init_lowered_empty_function (tree decl, bool in_ssa, 
profile_count count)
     {
       init_ssa_operands (cfun);
       cfun->gimple_df->in_ssa_p = true;
-      cfun->curr_properties |= PROP_ssa;
+      cfun->set_property (PROP_ssa);
     }
 
   DECL_INITIAL (decl) = make_node (BLOCK);
@@ -2430,8 +2430,8 @@ symbol_table::compile (void)
            || gimple_has_body_p (node->decl))
          {
            if (DECL_STRUCT_FUNCTION (node->decl)
-               && (DECL_STRUCT_FUNCTION (node->decl)->curr_properties
-                   & PROP_assumptions_done) != 0)
+               && (DECL_STRUCT_FUNCTION (node->decl)
+                    ->prop_set_p (PROP_assumptions_done)))
              continue;
            error_found = true;
            node->debug ();
diff --git a/gcc/function.cc b/gcc/function.cc
index a6f6de34942..606c0a25e9e 100644
--- a/gcc/function.cc
+++ b/gcc/function.cc
@@ -215,7 +215,7 @@ free_after_compilation (struct function *f)
   f->eh = NULL;
   f->machine = NULL;
   f->cfg = NULL;
-  f->curr_properties &= ~PROP_cfg;
+  f->unset_property (PROP_cfg);
   delete f->cond_uids;
 
   regno_reg_rtx = NULL;
diff --git a/gcc/function.h b/gcc/function.h
index fbeadeaf410..c2c1b808eb1 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -243,6 +243,38 @@ public:
   (current_function_dynamic_stack_size != 0               \
    || current_function_has_unbounded_dynamic_stack_size)
 
+
+/* 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)
+#define PROP_no_crit_edges      (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 */
+
+#define PROP_gimple \
+  (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
+
 /* This structure can save all the important global and static variables
    describing the status of the current function.  */
 
@@ -449,6 +481,39 @@ struct GTY(()) function {
   /* Set for artificial function created for [[assume (cond)]].
      These should be GIMPLE optimized, but not expanded to RTL.  */
   unsigned int assume_function : 1;
+
+  /* Sets the PROP on the current curr_properties,
+     note this has to be a single property. */
+
+  void set_property (const unsigned prop)
+  {
+    gcc_checking_assert (exact_log2 (prop) != -1);
+    curr_properties |= prop;
+  }
+
+  /* Unsets the PROP on the current curr_properties,
+     note this has to be a single property. */
+
+  void unset_property (const unsigned prop)
+  {
+    gcc_checking_assert (exact_log2 (prop) != -1);
+    curr_properties &= ~prop;
+  }
+
+  /* Returns true if the PROP is set on the current curr_properties. */
+
+  bool prop_set_p (unsigned prop) const
+  {
+    gcc_checking_assert (exact_log2 (prop) != -1);
+    return (curr_properties & prop) != 0;
+  }
+
+  /* Returns true if the current properties is set to gimple. */
+
+  bool gimple_prop_p () const
+  {
+    return (curr_properties & PROP_gimple) != 0;
+  }
 };
 
 /* Add the decl D to the local_decls list of FUN.  */
diff --git a/gcc/generic-match-head.cc b/gcc/generic-match-head.cc
index 641d8e9b2de..30e0f1f3131 100644
--- a/gcc/generic-match-head.cc
+++ b/gcc/generic-match-head.cc
@@ -84,7 +84,7 @@ single_use (tree t ATTRIBUTE_UNUSED)
 static inline bool
 canonicalize_math_p ()
 {
-  return !cfun || (cfun->curr_properties & PROP_gimple_opt_math) == 0;
+  return !cfun || !cfun->prop_set_p(PROP_gimple_opt_math);
 }
 
 /* Return true if math operations that are beneficial only after
@@ -103,7 +103,7 @@ canonicalize_math_after_vectorization_p ()
 static inline bool
 optimize_vectors_before_lowering_p ()
 {
-  return !cfun || (cfun->curr_properties & PROP_gimple_lvec) == 0;
+  return !cfun || !cfun->prop_set_p (PROP_gimple_lvec);
 }
 
 /* Return true if successive divisions can be optimized.
diff --git a/gcc/gimple-expr.cc b/gcc/gimple-expr.cc
index f8d7185530c..77c99188c01 100644
--- a/gcc/gimple-expr.cc
+++ b/gcc/gimple-expr.cc
@@ -335,7 +335,7 @@ bool
 gimple_has_body_p (tree fndecl)
 {
   struct function *fn = DECL_STRUCT_FUNCTION (fndecl);
-  return (gimple_body (fndecl) || (fn && fn->cfg && !(fn->curr_properties & 
PROP_rtl)));
+  return (gimple_body (fndecl) || (fn && fn->cfg && !fn->prop_set_p 
(PROP_rtl)));
 }
 
 /* Return a printable name for symbol DECL.  */
diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc
index b10593035c3..d1831434073 100644
--- a/gcc/gimple-lower-bitint.cc
+++ b/gcc/gimple-lower-bitint.cc
@@ -7295,7 +7295,7 @@ public:
     {
       /* With errors, normal optimization passes are not run.  If we don't
         lower bitint operations at all, rtl expansion will abort.  */
-      return !(fun->curr_properties & PROP_gimple_lbitint);
+      return !fun->prop_set_p (PROP_gimple_lbitint);
     }
 
   unsigned int execute (function *) final override
diff --git a/gcc/gimple-match-exports.cc b/gcc/gimple-match-exports.cc
index aacf3ff0414..9ea4fe713cf 100644
--- a/gcc/gimple-match-exports.cc
+++ b/gcc/gimple-match-exports.cc
@@ -252,7 +252,7 @@ build_call_internal (internal_fn fn, gimple_match_op 
*res_op)
                  && (TYPE_PRECISION (TREE_TYPE (res_op->ops[0]))
                      > MAX_FIXED_MODE_SIZE)
                  && cfun
-                 && (cfun->curr_properties & PROP_gimple_lbitint) == 0)
+                 && !cfun->prop_set_p (PROP_gimple_lbitint))
                break;
              return NULL;
 
diff --git a/gcc/gimple-match-head.cc b/gcc/gimple-match-head.cc
index 924d3f1e710..b60069fcca2 100644
--- a/gcc/gimple-match-head.cc
+++ b/gcc/gimple-match-head.cc
@@ -123,7 +123,7 @@ single_use (const_tree t)
 static inline bool
 canonicalize_math_p ()
 {
-  return !cfun || (cfun->curr_properties & PROP_gimple_opt_math) == 0;
+  return !cfun || !cfun->prop_set_p (PROP_gimple_opt_math);
 }
 
 /* Return true if math operations that are beneficial only after
@@ -132,7 +132,7 @@ canonicalize_math_p ()
 static inline bool
 canonicalize_math_after_vectorization_p ()
 {
-  return !cfun || (cfun->curr_properties & PROP_gimple_lvec) != 0;
+  return !cfun || cfun->prop_set_p (PROP_gimple_lvec);
 }
 
 /* Return true if we can still perform transformations that may introduce
@@ -142,7 +142,7 @@ canonicalize_math_after_vectorization_p ()
 static inline bool
 optimize_vectors_before_lowering_p ()
 {
-  return !cfun || (cfun->curr_properties & PROP_gimple_lvec) == 0;
+  return !cfun || !cfun->prop_set_p (PROP_gimple_lvec);
 }
 
 /* Return true if pow(cst, x) should be optimized into exp(log(cst) * x).
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index ab323d764e8..9a3753a7e66 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -31,7 +31,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm_p.h"
 #include "gimple.h"
 #include "gimple-predict.h"
-#include "tree-pass.h"         /* FIXME: only for PROP_gimple_any */
 #include "ssa.h"
 #include "cgraph.h"
 #include "tree-pretty-print.h"
@@ -70,6 +69,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "omp-offload.h"
 #include "context.h"
 #include "tree-nested.h"
+#include "timevar.h"
 
 /* Identifier for a basic condition, mapping it to other basic conditions of
    its Boolean expression.  Basic conditions given the same uid (in the same
@@ -3974,7 +3974,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool 
want_value)
   if (flag_openmp
       && fndecl
       && cfun
-      && (cfun->curr_properties & PROP_gimple_any) == 0)
+      && !cfun->prop_set_p (PROP_gimple_any))
     {
       tree variant = omp_resolve_declare_variant (fndecl);
       if (variant != fndecl)
@@ -19571,7 +19571,7 @@ gimplify_function_tree (tree fndecl)
 
   /* Tentatively set PROP_gimple_lva here, and reset it in gimplify_va_arg_expr
      if necessary.  */
-  cfun->curr_properties |= PROP_gimple_lva;
+  cfun->set_property (PROP_gimple_lva);
 
   if (asan_sanitize_use_after_scope ())
     asan_poisoned_variables = new hash_set<tree> ();
@@ -19683,7 +19683,7 @@ gimplify_function_tree (tree fndecl)
     }
 
   DECL_SAVED_TREE (fndecl) = NULL_TREE;
-  cfun->curr_properties |= PROP_gimple_any;
+  cfun->set_property (PROP_gimple_any);
 
   pop_cfun ();
 
@@ -19776,7 +19776,7 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p,
 
   /* Clear the tentatively set PROP_gimple_lva, to indicate that IFN_VA_ARG
      needs to be expanded.  */
-  cfun->curr_properties &= ~PROP_gimple_lva;
+  cfun->unset_property (PROP_gimple_lva);
 
   return GS_OK;
 }
diff --git a/gcc/loop-init.cc b/gcc/loop-init.cc
index c46168252f8..5e67d2ef663 100644
--- a/gcc/loop-init.cc
+++ b/gcc/loop-init.cc
@@ -89,7 +89,7 @@ loop_optimizer_init (unsigned flags)
 
   if (!current_loops)
     {
-      gcc_assert (!(cfun->curr_properties & PROP_loops));
+      gcc_assert (!cfun->prop_set_p (PROP_loops));
 
       /* Find the loops.  */
       current_loops = flow_loops_find (NULL);
@@ -99,7 +99,7 @@ loop_optimizer_init (unsigned flags)
       bool recorded_exits = loops_state_satisfies_p 
(LOOPS_HAVE_RECORDED_EXITS);
       bool needs_fixup = loops_state_satisfies_p (LOOPS_NEED_FIXUP);
 
-      gcc_assert (cfun->curr_properties & PROP_loops);
+      gcc_assert (cfun->prop_set_p (PROP_loops));
 
       /* Ensure that the dominators are computed, like flow_loops_find does.  
*/
       calculate_dominance_info (CDI_DOMINATORS);
@@ -155,7 +155,7 @@ loop_optimizer_finalize (struct function *fn, bool 
clean_loop_closed_phi)
   /* If we should preserve loop structure, do not free it but clear
      flags that advanced properties are there as we are not preserving
      that in full.  */
-  if (fn->curr_properties & PROP_loops)
+  if (fn->prop_set_p (PROP_loops))
     {
       loops_state_clear (fn, LOOP_CLOSED_SSA
                         | LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS
@@ -374,7 +374,7 @@ pass_loop2::gate (function *fun)
   else
     {
       /* No longer preserve loops, remove them now.  */
-      fun->curr_properties &= ~PROP_loops;
+      fun->unset_property (PROP_loops);
       if (current_loops)
        loop_optimizer_finalize ();
       return false;
@@ -475,7 +475,7 @@ unsigned int
 pass_rtl_loop_done::execute (function *fun)
 {
   /* No longer preserve loops, remove them now.  */
-  fun->curr_properties &= ~PROP_loops;
+  fun->unset_property (PROP_loops);
   loop_optimizer_finalize ();
   free_dominance_info (CDI_DOMINATORS);
 
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc
index 24287826444..3c195f25827 100644
--- a/gcc/omp-expand.cc
+++ b/gcc/omp-expand.cc
@@ -6538,7 +6538,7 @@ expand_omp_simd (struct omp_region *region, struct 
omp_for_data *fd)
                                  OMP_CLAUSE__SIMT_);
   if (is_simt)
     {
-      cfun->curr_properties &= ~PROP_gimple_lomp_dev;
+      cfun->unset_property (PROP_gimple_lomp_dev);
       is_simt = safelen_int > 1;
     }
   tree simt_lane = NULL_TREE, simt_maxlane = NULL_TREE;
@@ -10959,7 +10959,7 @@ public:
   /* opt_pass methods: */
   bool gate (function *fun) final override
     {
-      return !(fun->curr_properties & PROP_gimple_eomp);
+      return !fun->prop_set_p (PROP_gimple_eomp);
     }
   unsigned int execute (function *) final override
   {
diff --git a/gcc/omp-general.cc b/gcc/omp-general.cc
index 0b61335dba4..d5113ef7c9d 100644
--- a/gcc/omp-general.cc
+++ b/gcc/omp-general.cc
@@ -1124,7 +1124,7 @@ omp_maybe_offloaded (void)
       && lookup_attribute ("omp declare target",
                           DECL_ATTRIBUTES (current_function_decl)))
     return true;
-  if (cfun && (cfun->curr_properties & PROP_gimple_any) == 0)
+  if (cfun && !cfun->prop_set_p (PROP_gimple_any))
     {
       enum tree_code construct = OMP_TARGET;
       if (omp_construct_selector_matches (&construct, 1, NULL))
@@ -1494,7 +1494,7 @@ omp_context_selector_matches (tree ctx)
                                             constructs);
            }
 
-         if (cfun && (cfun->curr_properties & PROP_gimple_any) != 0)
+         if (cfun && cfun->prop_set_p (PROP_gimple_any))
            {
              if (!cfun->after_inlining)
                {
@@ -1548,7 +1548,7 @@ omp_context_selector_matches (tree ctx)
            case OMP_TRAIT_IMPLEMENTATION_ADMO:
              if (set == OMP_TRAIT_SET_IMPLEMENTATION)
                {
-                 if (cfun && (cfun->curr_properties & PROP_gimple_any) != 0)
+                 if (cfun && cfun->prop_set_p (PROP_gimple_any))
                    break;
 
                  enum omp_memory_order omo
@@ -1626,7 +1626,7 @@ omp_context_selector_matches (tree ctx)
            case OMP_TRAIT_IMPLEMENTATION_UNIFIED_ADDRESS:
              if (set == OMP_TRAIT_SET_IMPLEMENTATION)
                {
-                 if (cfun && (cfun->curr_properties & PROP_gimple_any) != 0)
+                 if (cfun && cfun->prop_set_p (PROP_gimple_any))
                    break;
 
                  if ((omp_requires_mask & OMP_REQUIRES_UNIFIED_ADDRESS) == 0)
@@ -1641,7 +1641,7 @@ omp_context_selector_matches (tree ctx)
            case OMP_TRAIT_IMPLEMENTATION_UNIFIED_SHARED_MEMORY:
              if (set == OMP_TRAIT_SET_IMPLEMENTATION)
                {
-                 if (cfun && (cfun->curr_properties & PROP_gimple_any) != 0)
+                 if (cfun && cfun->prop_set_p (PROP_gimple_any))
                    break;
 
                  if ((omp_requires_mask
@@ -1657,7 +1657,7 @@ omp_context_selector_matches (tree ctx)
            case OMP_TRAIT_IMPLEMENTATION_DYNAMIC_ALLOCATORS:
              if (set == OMP_TRAIT_SET_IMPLEMENTATION)
                {
-                 if (cfun && (cfun->curr_properties & PROP_gimple_any) != 0)
+                 if (cfun && cfun->prop_set_p (PROP_gimple_any))
                    break;
 
                  if ((omp_requires_mask
@@ -1673,7 +1673,7 @@ omp_context_selector_matches (tree ctx)
            case OMP_TRAIT_IMPLEMENTATION_REVERSE_OFFLOAD:
              if (set == OMP_TRAIT_SET_IMPLEMENTATION)
                {
-                 if (cfun && (cfun->curr_properties & PROP_gimple_any) != 0)
+                 if (cfun && cfun->prop_set_p (PROP_gimple_any))
                    break;
 
                  if ((omp_requires_mask & OMP_REQUIRES_REVERSE_OFFLOAD) == 0)
@@ -2492,7 +2492,7 @@ tree
 omp_resolve_declare_variant (tree base)
 {
   tree variant1 = NULL_TREE, variant2 = NULL_TREE;
-  if (cfun && (cfun->curr_properties & PROP_gimple_any) != 0)
+  if (cfun && cfun->prop_set_p (PROP_gimple_any))
     return omp_resolve_late_declare_variant (base);
 
   auto_vec <tree, 16> variants;
diff --git a/gcc/omp-offload.cc b/gcc/omp-offload.cc
index 35313c2ecf3..7d0c3d3a41e 100644
--- a/gcc/omp-offload.cc
+++ b/gcc/omp-offload.cc
@@ -2823,7 +2823,7 @@ public:
 #else
       bool offload_ind_funcs_p = false;
 #endif
-      return (!(fun->curr_properties & PROP_gimple_lomp_dev)
+      return (!fun->prop_set_p (PROP_gimple_lomp_dev)
              || (flag_openmp
                  && (cgraph_node::get (fun->decl)->calls_declare_variant_alt
                      || offload_ind_funcs_p)));
diff --git a/gcc/passes.cc b/gcc/passes.cc
index d73f8ba97b6..bf91befe074 100644
--- a/gcc/passes.cc
+++ b/gcc/passes.cc
@@ -1794,7 +1794,7 @@ execute_function_dump (function *fn, void *data)
     {
       push_cfun (fn);
 
-      if (fn->curr_properties & PROP_gimple)
+      if (fn->gimple_prop_p ())
         dump_function_to_file (fn->decl, dump_file, dump_flags);
       else
        print_rtl_with_bb (dump_file, get_insns (), dump_flags);
@@ -1803,7 +1803,7 @@ execute_function_dump (function *fn, void *data)
         close the file before aborting.  */
       fflush (dump_file);
 
-      if ((fn->curr_properties & PROP_cfg)
+      if (fn->prop_set_p (PROP_cfg)
          && (dump_flags & TDF_GRAPH))
        {
          gcc::dump_manager *dumps = g->get_dumps ();
@@ -1842,7 +1842,7 @@ emergency_dump_function ()
   /* Normally the passmanager will close the graphs as a pass could be wanting
      to print multiple digraphs. But during an emergency dump there can only be
      one and we must finish the graph manually.  */
-  if ((cfun->curr_properties & PROP_cfg)
+  if (cfun->prop_set_p (PROP_cfg)
       && (dump_flags & TDF_GRAPH))
     finish_graph_dump_file (dump_file_name);
 
@@ -2081,22 +2081,22 @@ execute_function_todo (function *fn, void *data)
 
       if (flags & TODO_verify_il)
        {
-         if (cfun->curr_properties & PROP_gimple)
+         if (cfun->gimple_prop_p ())
            {
-             if (cfun->curr_properties & PROP_cfg)
+             if (cfun->prop_set_p (PROP_cfg))
                /* IPA passes leave stmts to be fixed up, so make sure to
                   not verify stmts really throw.  */
                verify_gimple_in_cfg (cfun, !from_ipa_pass);
              else
                verify_gimple_in_seq (gimple_body (cfun->decl));
            }
-         if (cfun->curr_properties & PROP_ssa)
+         if (cfun->prop_set_p (PROP_ssa))
            /* IPA passes leave stmts to be fixed up, so make sure to
               not verify SSA operands whose verifier will choke on that.  */
            verify_ssa (true, !from_ipa_pass);
          /* IPA passes leave basic-blocks unsplit, so make sure to
             not trip on that.  */
-         if ((cfun->curr_properties & PROP_cfg)
+         if (cfun->prop_set_p (PROP_cfg)
              && !from_ipa_pass)
            verify_flow_info ();
          if (current_loops
@@ -2106,7 +2106,7 @@ execute_function_todo (function *fn, void *data)
              if (loops_state_satisfies_p (LOOP_CLOSED_SSA))
                verify_loop_closed_ssa (false);
            }
-         if (cfun->curr_properties & PROP_rtl)
+         if (cfun->prop_set_p (PROP_rtl))
            verify_rtl_sharing ();
        }
 
@@ -2231,7 +2231,7 @@ pass_init_dump_file (opt_pass *pass)
         dump_function_header (dump_file, current_function_decl, dump_flags);
       if (initializing_dump
          && dump_file && (dump_flags & TDF_GRAPH)
-         && cfun && (cfun->curr_properties & PROP_cfg))
+         && cfun && cfun->prop_set_p (PROP_cfg))
        {
          clean_graph_dump_file (dump_file_name);
          struct dump_file_info *dfi
@@ -2319,7 +2319,7 @@ execute_one_ipa_transform_pass (struct cgraph_node *node,
 
   /* Note that the folders should only create gimple expressions.
      This is a hack until the new folder is ready.  */
-  in_gimple_form = (cfun && (cfun->curr_properties & PROP_gimple)) != 0;
+  in_gimple_form = (cfun && cfun->gimple_prop_p ()) != 0;
 
   pass_init_dump_file (pass);
 
@@ -2372,7 +2372,7 @@ execute_all_ipa_transforms (bool do_not_collect)
 
   int j = 0;
   gcc::pass_manager *passes = g->get_passes ();
-  bool report = profile_report && (cfun->curr_properties & PROP_gimple) != 0;
+  bool report = profile_report && cfun->gimple_prop_p ();
 
   if (report)
     push_cfun (DECL_STRUCT_FUNCTION (node->decl));
@@ -2561,12 +2561,12 @@ skip_pass (opt_pass *pass)
   if (strcmp (pass->name, "into_cfglayout") == 0)
     {
       cfg_layout_rtl_register_cfg_hooks ();
-      cfun->curr_properties |= PROP_cfglayout;
+      cfun->set_property (PROP_cfglayout);
     }
   if (strcmp (pass->name, "outof_cfglayout") == 0)
     {
       rtl_register_cfg_hooks ();
-      cfun->curr_properties &= ~PROP_cfglayout;
+      cfun->unset_property (PROP_cfglayout);
     }
 }
 
@@ -2600,7 +2600,7 @@ execute_one_pass (opt_pass *pass)
     {
       /* Run so passes selectively disabling themselves on a given function
         are not miscounted.  */
-      if (profile_report && cfun && (cfun->curr_properties & PROP_cfg)
+      if (profile_report && cfun && cfun->prop_set_p (PROP_cfg)
          && pass->type != IPA_PASS && pass->type != SIMPLE_IPA_PASS)
        {
          check_profile_consistency (pass->static_pass_number, false);
@@ -2627,7 +2627,7 @@ execute_one_pass (opt_pass *pass)
 
   /* Note that the folders should only create gimple expressions.
      This is a hack until the new folder is ready.  */
-  in_gimple_form = (cfun && (cfun->curr_properties & PROP_gimple)) != 0;
+  in_gimple_form = cfun && cfun->gimple_prop_p ();
 
   pass_init_dump_file (pass);
 
@@ -2666,7 +2666,7 @@ execute_one_pass (opt_pass *pass)
       if (cfun->assume_function)
        {
          /* For assume functions, don't release body, keep it around.  */
-         cfun->curr_properties |= PROP_assumptions_done;
+         cfun->set_property (PROP_assumptions_done);
          pop_cfun ();
          current_pass = NULL;
          return true;
@@ -2698,7 +2698,7 @@ execute_one_pass (opt_pass *pass)
        ;
       else if (pass->type == SIMPLE_IPA_PASS)
        do_per_function (account_profile_1, pass);
-      else if (cfun && (cfun->curr_properties & PROP_cfg))
+      else if (cfun && cfun->prop_set_p (PROP_cfg))
        {
          check_profile_consistency (pass->static_pass_number, true);
          account_profile (pass->static_pass_number, true);
@@ -2728,8 +2728,7 @@ execute_one_pass (opt_pass *pass)
   pass_fini_dump_file (pass);
 
   if (pass->type != SIMPLE_IPA_PASS && pass->type != IPA_PASS)
-    gcc_assert (!(cfun->curr_properties & PROP_gimple)
-               || pass->type != RTL_PASS);
+    gcc_assert (!cfun->gimple_prop_p () || pass->type != RTL_PASS);
 
   current_pass = NULL;
   redirect_edge_var_map_empty ();
diff --git a/gcc/read-rtl-function.cc b/gcc/read-rtl-function.cc
index fa1aeb53759..70873b53146 100644
--- a/gcc/read-rtl-function.cc
+++ b/gcc/read-rtl-function.cc
@@ -507,7 +507,7 @@ function_reader::create_function ()
   tree fndecl = current_function_decl;
 
   /* Mark this function as being specified as __RTL.  */
-  cfun->curr_properties |= PROP_rtl;
+  cfun->set_property (PROP_rtl);
 
   /* cc1 normally inits DECL_INITIAL (fndecl) to be error_mark_node.
      Create a dummy block for it.  */
diff --git a/gcc/run-rtl-passes.cc b/gcc/run-rtl-passes.cc
index 5a402d61ebc..fb7852d4fcf 100644
--- a/gcc/run-rtl-passes.cc
+++ b/gcc/run-rtl-passes.cc
@@ -74,6 +74,6 @@ run_rtl_passes (char *initial_pass_name)
       execute_pass_list (cfun, clean_slate);
     }
 
-  cfun->curr_properties |= PROP_rtl;
+  cfun->set_property (PROP_rtl);
   free (initial_pass_name);
 }
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index e6fd1294b95..32b0d3b356e 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -8349,8 +8349,8 @@ dump_function_to_file (tree fndecl, FILE *file, 
dump_flags_t flags)
       print_generic_expr (file, TREE_TYPE (TREE_TYPE (fndecl)),
                          dump_flags | TDF_SLIM);
       fprintf (file, " __GIMPLE (%s",
-              (fun->curr_properties & PROP_ssa) ? "ssa"
-              : (fun->curr_properties & PROP_cfg) ? "cfg"
+              fun->prop_set_p (PROP_ssa) ? "ssa"
+              : fun->prop_set_p (PROP_cfg) ? "cfg"
               : "");
 
       if (fun && fun->cfg)
@@ -8403,7 +8403,7 @@ dump_function_to_file (tree fndecl, FILE *file, 
dump_flags_t flags)
 
   /* When GIMPLE is lowered, the variables are no longer available in
      BIND_EXPRs, so display them separately.  */
-  if (fun && fun->decl == fndecl && (fun->curr_properties & PROP_gimple_lcf))
+  if (fun && fun->decl == fndecl && fun->prop_set_p (PROP_gimple_lcf))
     {
       unsigned ix;
       ignore_topmost_bind = true;
@@ -8486,7 +8486,7 @@ dump_function_to_file (tree fndecl, FILE *file, 
dump_flags_t flags)
 
       fprintf (file, "}\n");
     }
-  else if (fun && (fun->curr_properties & PROP_gimple_any))
+  else if (fun && fun->prop_set_p (PROP_gimple_any))
     {
       /* The function is now in GIMPLE form but the CFG has not been
         built yet.  Emit the single sequence of GIMPLE statements
diff --git a/gcc/tree-complex.cc b/gcc/tree-complex.cc
index dfb45b9d91c..a89d5335f78 100644
--- a/gcc/tree-complex.cc
+++ b/gcc/tree-complex.cc
@@ -2086,7 +2086,7 @@ public:
     {
       /* With errors, normal optimization passes are not run.  If we don't
         lower complex operations at all, rtl expansion will abort.  */
-      return !(fun->curr_properties & PROP_gimple_lcx);
+      return !fun->prop_set_p (PROP_gimple_lcx);
     }
 
   unsigned int execute (function *) final override
diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index f31a34ac410..9dfd370fbba 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -5014,7 +5014,7 @@ expand_call_inline (basic_block bb, gimple *stmt, 
copy_body_data *id,
      variables to be added to IFN_GOMP_SIMT_ENTER argument list.  */
   dst_cfun = DECL_STRUCT_FUNCTION (id->dst_fn);
   simtvars_save = id->dst_simt_vars;
-  if (!(dst_cfun->curr_properties & PROP_gimple_lomp_dev)
+  if (!dst_cfun->prop_set_p (PROP_gimple_lomp_dev)
       && (simduid = bb->loop_father->simduid) != NULL_TREE
       && (simduid = ssa_default_def (dst_cfun, simduid)) != NULL_TREE
       && single_imm_use (simduid, &use, &simtenter_stmt)
@@ -6424,9 +6424,9 @@ tree_function_versioning (tree old_decl, tree new_decl,
   /* Set up the destination functions loop tree.  */
   if (loops_for_fn (DECL_STRUCT_FUNCTION (old_decl)) != NULL)
     {
-      cfun->curr_properties &= ~PROP_loops;
+      cfun->unset_property (PROP_loops);
       loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
-      cfun->curr_properties |= PROP_loops;
+      cfun->set_property (PROP_loops);
     }
 
   /* Copy the Function's body.  */
diff --git a/gcc/tree-into-ssa.cc b/gcc/tree-into-ssa.cc
index 5b367c35812..f26a5da3840 100644
--- a/gcc/tree-into-ssa.cc
+++ b/gcc/tree-into-ssa.cc
@@ -2502,7 +2502,7 @@ public:
   bool gate (function *fun) final override
     {
       /* Do nothing for functions that were produced already in SSA form.  */
-      return !(fun->curr_properties & PROP_ssa);
+      return !fun->prop_set_p (PROP_ssa);
     }
 
   unsigned int execute (function *) final override;
diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc
index 888a834faf9..dc32bbf489c 100644
--- a/gcc/tree-parloops.cc
+++ b/gcc/tree-parloops.cc
@@ -4227,7 +4227,7 @@ pass_parallelize_loops::execute (function *fun)
   unsigned int todo = 0;
   if (parallelize_loops (oacc_kernels_p))
     {
-      fun->curr_properties &= ~(PROP_gimple_eomp);
+      fun->unset_property (PROP_gimple_eomp);
 
       checking_verify_loop_structure ();
 
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 3a0cf13089e..84376166fc7 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -203,36 +203,6 @@ protected:
   }
 };
 
-/* Pass 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)
-#define PROP_no_crit_edges      (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 */
-
-#define PROP_gimple \
-  (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
 
 /* To-do flags.  */
 #define TODO_do_not_ggc_collect                (1 << 1)
diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index 44a6b5d39aa..7e0fcf2e544 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -3748,7 +3748,7 @@ pass_forwprop::execute (function *fun)
                       /* After vector lowering rewrite all loads, but
                          initially do not since this conflicts with
                          vector CONSTRUCTOR to shuffle optimization.  */
-                      || (fun->curr_properties & PROP_gimple_lvec))
+                      || fun->prop_set_p (PROP_gimple_lvec))
                   && gimple_assign_load_p (stmt)
                   && !gimple_has_volatile_ops (stmt)
                   && !stmt_can_throw_internal (fun, stmt)
diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc
index f87731ef892..c127111f89d 100644
--- a/gcc/tree-ssa-loop-niter.cc
+++ b/gcc/tree-ssa-loop-niter.cc
@@ -3889,7 +3889,7 @@ do_warn_aggressive_loop_optimizations (class loop *loop,
       || !warn_aggressive_loop_optimizations
       /* To avoid warning multiple times for the same loop,
         only start warning when we preserve loops.  */
-      || (cfun->curr_properties & PROP_loops) == 0
+      || !cfun->prop_set_p (PROP_loops)
       /* Only warn once per loop.  */
       || loop->warned_aggressive_loop_optimizations
       /* Only warn if undefined behavior gives us lower estimate than the
diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index dc377fa16ce..3bcd429f620 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -986,7 +986,7 @@ copy_reference_ops_from_ref (tree ref, 
vec<vn_reference_op_s> *result)
                       __builtin_object_size had a chance to run.  */
                    if (TREE_CODE (orig) != ADDR_EXPR
                        || maybe_ne (off, 0)
-                       || (cfun->curr_properties & PROP_objsz))
+                       || cfun->prop_set_p (PROP_objsz))
                      off.to_shwi (&temp.off);
                  }
              }
@@ -4002,7 +4002,7 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind 
kind,
 
   /* Handle &MEM[ptr + 5].b[1].c as POINTER_PLUS_EXPR.  Avoid doing
      this before the pass folding __builtin_object_size had a chance to run.  
*/
-  if ((cfun->curr_properties & PROP_objsz)
+  if (cfun->prop_set_p (PROP_objsz)
       && operands[0].opcode == ADDR_EXPR
       && operands.last ().opcode == SSA_NAME)
     {
@@ -4146,7 +4146,7 @@ vn_reference_insert (tree op, tree result, tree vuse, 
tree vdef)
     = valueize_shared_reference_ops_from_ref (op, &tem);
   /* Handle &MEM[ptr + 5].b[1].c as POINTER_PLUS_EXPR.  Avoid doing this
      before the pass folding __builtin_object_size had a chance to run.  */
-  if ((cfun->curr_properties & PROP_objsz)
+  if (cfun->prop_set_p (PROP_objsz)
       && operands[0].opcode == ADDR_EXPR
       && operands.last ().opcode == SSA_NAME)
     {
diff --git a/gcc/tree-ssa-sink.cc b/gcc/tree-ssa-sink.cc
index 8c551e42a4d..737638591db 100644
--- a/gcc/tree-ssa-sink.cc
+++ b/gcc/tree-ssa-sink.cc
@@ -197,7 +197,7 @@ do_not_sink (gimple *stmt, basic_block early_bb, 
basic_block best_bb)
       && gimple_vuse (stmt)
       && !gimple_vdef (stmt)
       && flag_tree_loop_vectorize
-      && !(cfun->curr_properties & PROP_loop_opts_done)
+      && !cfun->prop_set_p (PROP_loop_opts_done)
       && dominated_by_p (CDI_DOMINATORS, best_bb->loop_father->latch, early_bb)
       && !dominated_by_p (CDI_DOMINATORS, best_bb->loop_father->latch, 
best_bb))
     return true;
diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc
index ea8d7b882d0..086d3c7016e 100644
--- a/gcc/tree-ssa-threadbackward.cc
+++ b/gcc/tree-ssa-threadbackward.cc
@@ -824,7 +824,7 @@ back_threader_profitability::profitable_path_p (const 
vec<basic_block> &m_path,
      loop optimizations if the number of copied statement is low.  */
   if (!m_threaded_multiway_branch
       && *creates_irreducible_loop
-      && (!(cfun->curr_properties & PROP_loop_opts_done)
+      && (!cfun->prop_set_p (PROP_loop_opts_done)
          || (m_n_insns * param_fsm_scale_path_stmts
              >= param_max_jump_thread_duplication_stmts)))
     {
@@ -869,7 +869,7 @@ back_threader_profitability::profitable_path_p (const 
vec<basic_block> &m_path,
      loop optimizations to fail.  Disable these threads until after
      loop optimizations have run.  */
   if ((m_threaded_through_latch || taken_edge->dest == loop->latch)
-      && !(cfun->curr_properties & PROP_loop_opts_done)
+      && !cfun->prop_set_p (PROP_loop_opts_done)
       && empty_block_p (loop->latch))
     {
       if (dump_file && (dump_flags & TDF_DETAILS))
diff --git a/gcc/tree-ssa.cc b/gcc/tree-ssa.cc
index f4fa4e98c5d..41d430c789e 100644
--- a/gcc/tree-ssa.cc
+++ b/gcc/tree-ssa.cc
@@ -1789,7 +1789,7 @@ maybe_optimize_var (tree var, bitmap addresses_taken, 
bitmap not_reg_needs,
            }
        }
       else if (TREE_CODE (TREE_TYPE (var)) == BITINT_TYPE
-              && (cfun->curr_properties & PROP_gimple_lbitint) != 0
+              && cfun->prop_set_p (PROP_gimple_lbitint)
               && TYPE_PRECISION (TREE_TYPE (var)) > MAX_FIXED_MODE_SIZE)
        {
          /* Don't rewrite large/huge _BitInt vars after _BitInt lowering
diff --git a/gcc/tree-stdarg.cc b/gcc/tree-stdarg.cc
index 1167fd9f224..c59686cfa97 100644
--- a/gcc/tree-stdarg.cc
+++ b/gcc/tree-stdarg.cc
@@ -1090,7 +1090,7 @@ expand_ifn_va_arg_1 (function *fun)
 static void
 expand_ifn_va_arg (function *fun)
 {
-  if ((fun->curr_properties & PROP_gimple_lva) == 0)
+  if (!fun->prop_set_p (PROP_gimple_lva))
     expand_ifn_va_arg_1 (fun);
 
   if (flag_checking)
@@ -1187,7 +1187,7 @@ public:
   /* opt_pass methods: */
   bool gate (function *) final override
     {
-      return (cfun->curr_properties & PROP_gimple_lva) == 0;
+      return !cfun->prop_set_p (PROP_gimple_lva);
     }
 
   unsigned int execute (function *) final override;
diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc
index 8336cbb8c73..2dc87eb66ea 100644
--- a/gcc/tree-vect-generic.cc
+++ b/gcc/tree-vect-generic.cc
@@ -2440,7 +2440,7 @@ public:
   /* opt_pass methods: */
   bool gate (function *fun) final override
     {
-      return !(fun->curr_properties & PROP_gimple_lvec);
+      return !fun->prop_set_p (PROP_gimple_lvec);
     }
 
   unsigned int execute (function *) final override
diff --git a/gcc/tree.cc b/gcc/tree.cc
index a2d431662bd..396342ff656 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -8630,7 +8630,7 @@ tree_builtin_call_types_compatible_p (const_tree call, 
tree fndecl)
     if (tree decl = builtin_decl_explicit (DECL_FUNCTION_CODE (fndecl)))
       fndecl = decl;
 
-  bool gimple_form = (cfun && (cfun->curr_properties & PROP_gimple)) != 0;
+  bool gimple_form = cfun && cfun->gimple_prop_p ();
   if (gimple_form
       ? !useless_type_conversion_p (TREE_TYPE (call),
                                    TREE_TYPE (TREE_TYPE (fndecl)))
diff --git a/gcc/varpool.cc b/gcc/varpool.cc
index e40504d1bd8..d38c52066b3 100644
--- a/gcc/varpool.cc
+++ b/gcc/varpool.cc
@@ -35,7 +35,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "context.h"
 #include "stringpool.h"
 #include "attribs.h"
-#include "tree-pass.h"
 
 const char * const tls_model_names[]={"none", "emulated",
                                      "global-dynamic", "local-dynamic",
-- 
2.43.0

Reply via email to