IA MCU psABI support: changes to libraries
[gcc.git] / gcc / gimple-walk.c
index 48fa05d7789e832b890cde4d02acfb85dd79e15a..05ea179e09ffa7efd92361f725d5a528422a66cf 100644 (file)
@@ -1,6 +1,6 @@
 /* Gimple walk support.
 
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
+   Copyright (C) 2007-2015 Free Software Foundation, Inc.
    Contributed by Aldy Hernandez <aldyh@redhat.com>
 
 This file is part of GCC.
@@ -23,26 +23,20 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "alias.h"
+#include "symtab.h"
 #include "tree.h"
-#include "stmt.h"
 #include "predict.h"
-#include "vec.h"
-#include "hashtab.h"
-#include "hash-set.h"
-#include "machmode.h"
 #include "hard-reg-set.h"
-#include "input.h"
 #include "function.h"
-#include "basic-block.h"
-#include "tree-ssa-alias.h"
-#include "internal-fn.h"
 #include "gimple-expr.h"
-#include "is-a.h"
+#include "tree-ssa-alias.h"
+#include "basic-block.h"
+#include "fold-const.h"
 #include "gimple.h"
 #include "gimple-iterator.h"
 #include "gimple-walk.h"
-#include "gimple-walk.h"
-#include "demangle.h"
+#include "stmt.h"
 
 /* Walk all the statements in the sequence *PSEQ calling walk_gimple_stmt
    on each one.  WI is as in walk_gimple_stmt.
@@ -123,10 +117,12 @@ walk_gimple_asm (gasm *stmt, walk_tree_fn callback_op,
       op = gimple_asm_output_op (stmt, i);
       constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
       oconstraints[i] = constraint;
-      parse_output_constraint (&constraint, i, 0, 0, &allows_mem, &allows_reg,
-                              &is_inout);
       if (wi)
-       wi->val_only = (allows_reg || !allows_mem);
+       {
+         if (parse_output_constraint (&constraint, i, 0, 0, &allows_mem,
+                                      &allows_reg, &is_inout))
+           wi->val_only = (allows_reg || !allows_mem);
+       }
       ret = walk_tree (&TREE_VALUE (op), callback_op, wi, NULL);
       if (ret)
        return ret;
@@ -137,13 +133,16 @@ walk_gimple_asm (gasm *stmt, walk_tree_fn callback_op,
     {
       op = gimple_asm_input_op (stmt, i);
       constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
-      parse_input_constraint (&constraint, 0, 0, noutputs, 0,
-                             oconstraints, &allows_mem, &allows_reg);
+
       if (wi)
        {
-         wi->val_only = (allows_reg || !allows_mem);
-          /* Although input "m" is not really a LHS, we need a lvalue.  */
-         wi->is_lhs = !wi->val_only;
+         if (parse_input_constraint (&constraint, 0, 0, noutputs, 0,
+                                     oconstraints, &allows_mem, &allows_reg))
+           {
+             wi->val_only = (allows_reg || !allows_mem);
+             /* Although input "m" is not really a LHS, we need a lvalue.  */
+             wi->is_lhs = !wi->val_only;
+           }
        }
       ret = walk_tree (&TREE_VALUE (op), callback_op, wi, NULL);
       if (ret)
@@ -321,11 +320,13 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
       break;
 
     case GIMPLE_OMP_CRITICAL:
-      ret = walk_tree (gimple_omp_critical_name_ptr (
-                        as_a <gomp_critical *> (stmt)),
-                      callback_op, wi, pset);
-      if (ret)
-       return ret;
+      {
+       gomp_critical *omp_stmt = as_a <gomp_critical *> (stmt);
+       ret = walk_tree (gimple_omp_critical_name_ptr (omp_stmt),
+                        callback_op, wi, pset);
+       if (ret)
+         return ret;
+      }
       break;
 
     case GIMPLE_OMP_FOR:
@@ -349,9 +350,9 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
            return ret;
          ret = walk_tree (gimple_omp_for_incr_ptr (stmt, i), callback_op,
                           wi, pset);
+         if (ret)
+           return ret;
        }
-      if (ret)
-       return ret;
       break;
 
     case GIMPLE_OMP_PARALLEL:
@@ -404,7 +405,6 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
                       wi, pset);
       if (ret)
        return ret;
-
       ret = walk_tree (gimple_omp_sections_control_ptr (stmt), callback_op,
                       wi, pset);
       if (ret)
@@ -420,10 +420,21 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
       break;
 
     case GIMPLE_OMP_TARGET:
-      ret = walk_tree (gimple_omp_target_clauses_ptr (stmt), callback_op, wi,
-                      pset);
-      if (ret)
-       return ret;
+      {
+       gomp_target *omp_stmt = as_a <gomp_target *> (stmt);
+       ret = walk_tree (gimple_omp_target_clauses_ptr (omp_stmt),
+                        callback_op, wi, pset);
+       if (ret)
+         return ret;
+       ret = walk_tree (gimple_omp_target_child_fn_ptr (omp_stmt),
+                        callback_op, wi, pset);
+       if (ret)
+         return ret;
+       ret = walk_tree (gimple_omp_target_data_arg_ptr (omp_stmt),
+                        callback_op, wi, pset);
+       if (ret)
+         return ret;
+      }
       break;
 
     case GIMPLE_OMP_TEAMS:
@@ -440,7 +451,6 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
                         callback_op, wi, pset);
        if (ret)
          return ret;
-
        ret = walk_tree (gimple_omp_atomic_load_rhs_ptr (omp_stmt),
                         callback_op, wi, pset);
        if (ret)
@@ -449,11 +459,13 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
       break;
 
     case GIMPLE_OMP_ATOMIC_STORE:
-      ret = walk_tree (gimple_omp_atomic_store_val_ptr (
-                        as_a <gomp_atomic_store *> (stmt)),
-                      callback_op, wi, pset);
-      if (ret)
-       return ret;
+      {
+       gomp_atomic_store *omp_stmt = as_a <gomp_atomic_store *> (stmt);
+       ret = walk_tree (gimple_omp_atomic_store_val_ptr (omp_stmt),
+                        callback_op, wi, pset);
+       if (ret)
+         return ret;
+      }
       break;
 
     case GIMPLE_TRANSACTION: