Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

This should solve the generic-match.c part of the C_MAYBE_CONST_EXPR
issues.
Richard.

2015-12-02  Richard Biener  <rguent...@suse.de>

        * tree.h (tree_invariant_p): Declare.
        * tree.c (tree_invariant_p): Export.
        * genmatch.c (dt_simplify::gen_1): For GENERIC code-gen never
        create SAVE_EXPRs but reject patterns if we would need to.

Index: gcc/tree.c
===================================================================
*** gcc/tree.c  (revision 231167)
--- gcc/tree.c  (working copy)
*************** decl_address_ip_invariant_p (const_tree
*** 3231,3238 ****
     not handle arithmetic; that's handled in skip_simple_arithmetic and
     tree_invariant_p).  */
  
- static bool tree_invariant_p (tree t);
- 
  static bool
  tree_invariant_p_1 (tree t)
  {
--- 3231,3236 ----
*************** tree_invariant_p_1 (tree t)
*** 3282,3288 ****
  
  /* Return true if T is function-invariant.  */
  
! static bool
  tree_invariant_p (tree t)
  {
    tree inner = skip_simple_arithmetic (t);
--- 3280,3286 ----
  
  /* Return true if T is function-invariant.  */
  
! bool
  tree_invariant_p (tree t)
  {
    tree inner = skip_simple_arithmetic (t);
Index: gcc/tree.h
===================================================================
*** gcc/tree.h  (revision 231167)
--- gcc/tree.h  (working copy)
*************** extern tree staticp (tree);
*** 4320,4325 ****
--- 4320,4329 ----
  
  extern tree save_expr (tree);
  
+ /* Return true if T is function-invariant.  */
+ 
+ extern bool tree_invariant_p (tree);
+ 
  /* Look inside EXPR into any simple arithmetic operations.  Return the
     outermost non-arithmetic or non-invariant node.  */
  
Index: gcc/genmatch.c
===================================================================
*** gcc/genmatch.c      (revision 231167)
--- gcc/genmatch.c      (working copy)
*************** dt_simplify::gen_1 (FILE *f, int indent,
*** 3119,3126 ****
                if (cinfo.info[i].result_use_count
                    > cinfo.info[i].match_use_count)
                  fprintf_indent (f, indent,
!                                 "captures[%d] = save_expr (captures[%d]);\n",
!                                 i, i);
              }
          for (unsigned j = 0; j < e->ops.length (); ++j)
            {
--- 3119,3126 ----
                if (cinfo.info[i].result_use_count
                    > cinfo.info[i].match_use_count)
                  fprintf_indent (f, indent,
!                                 "if (! tree_invariant_p (captures[%d])) "
!                                 "return NULL_TREE;\n", i);
              }
          for (unsigned j = 0; j < e->ops.length (); ++j)
            {

Reply via email to