OSDN Git Service

* config/i386/i386.md (fmodxf3): Change sequence of move instructions.
[pf3gnuchains/gcc-fork.git] / gcc / tree-flow-inline.h
index a5441fe..c84964c 100644 (file)
@@ -1,5 +1,6 @@
 /* Inline functions for tree-flow.h
-   Copyright (C) 2001, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2005, 2006, 2007, 2008 Free Software
+   Foundation, Inc.
    Contributed by Diego Novillo <dnovillo@redhat.com>
 
 This file is part of GCC.
@@ -91,14 +92,6 @@ gimple_nonlocal_all (const struct function *fun)
   return fun->gimple_df->nonlocal_all;
 }
 
-/* Hashtable of variables annotations.  Used for static variables only;
-   local variables have direct pointer in the tree node.  */
-static inline htab_t
-gimple_var_anns (const struct function *fun)
-{
-  return fun->gimple_df->var_anns;
-}
-
 /* Initialize the hashtable iterator HTI to point to hashtable TABLE */
 
 static inline void *
@@ -151,13 +144,8 @@ next_htab_element (htab_iterator *hti)
 static inline tree
 first_referenced_var (referenced_var_iterator *iter)
 {
-  struct int_tree_map *itm;
-  itm = (struct int_tree_map *) first_htab_element (&iter->hti,
-                                                    gimple_referenced_vars
-                                                   (cfun));
-  if (!itm) 
-    return NULL;
-  return itm->to;
+  return (tree) first_htab_element (&iter->hti,
+                                   gimple_referenced_vars (cfun));
 }
 
 /* Return true if we have hit the end of the referenced variables ITER is
@@ -175,11 +163,7 @@ end_referenced_vars_p (const referenced_var_iterator *iter)
 static inline tree
 next_referenced_var (referenced_var_iterator *iter)
 {
-  struct int_tree_map *itm;
-  itm = (struct int_tree_map *) next_htab_element (&iter->hti);
-  if (!itm) 
-    return NULL;
-  return itm->to;
+  return (tree) next_htab_element (&iter->hti);
 } 
 
 /* Fill up VEC with the variables in the referenced vars hashtable.  */
@@ -199,23 +183,15 @@ fill_referenced_var_vec (VEC (tree, heap) **vec)
 static inline var_ann_t
 var_ann (const_tree t)
 {
-  gcc_assert (t);
-  gcc_assert (DECL_P (t));
-  gcc_assert (TREE_CODE (t) != FUNCTION_DECL);
-  if (!MTAG_P (t) && (TREE_STATIC (t) || DECL_EXTERNAL (t)))
-    {
-      struct static_var_ann_d *sann
-        = ((struct static_var_ann_d *)
-          htab_find_with_hash (gimple_var_anns (cfun), t, DECL_UID (t)));
-      if (!sann)
-       return NULL;
-      gcc_assert (sann->ann.common.type == VAR_ANN);
-      return &sann->ann;
-    }
-  gcc_assert (!t->base.ann
-             || t->base.ann->common.type == VAR_ANN);
+  var_ann_t ann;
+
+  if (!t->base.ann)
+    return NULL;
+  ann = (var_ann_t) t->base.ann;
+
+  gcc_assert (ann->common.type == VAR_ANN);
 
-  return (var_ann_t) t->base.ann;
+  return ann;
 }
 
 /* Return the variable annotation for T, which must be a _DECL node.
@@ -282,6 +258,41 @@ get_stmt_ann (tree stmt)
   return (ann) ? ann : create_stmt_ann (stmt);
 }
 
+/* Set the uid of all non phi function statements.  */
+static inline void
+set_gimple_stmt_uid (tree stmt, unsigned int uid)
+{
+  get_stmt_ann (stmt)->uid = uid;
+}
+
+/* Get the uid of all non phi function statements.  */
+static inline unsigned int
+gimple_stmt_uid (tree stmt)
+{
+  return get_stmt_ann (stmt)->uid;
+}
+
+/* Get the number of the next statement uid to be allocated.  */
+static inline unsigned int
+gimple_stmt_max_uid (struct function *fn)
+{
+  return fn->last_stmt_uid;
+}
+
+/* Set the number of the next statement uid to be allocated.  */
+static inline void
+set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
+{
+  fn->last_stmt_uid = maxid;
+}
+
+/* Set the number of the next statement uid to be allocated.  */
+static inline unsigned int
+inc_gimple_stmt_max_uid (struct function *fn)
+{
+  return fn->last_stmt_uid++;
+}
+
 /* Return the annotation type for annotation ANN.  */
 static inline enum tree_ann_type
 ann_type (tree_ann_t ann)
@@ -313,7 +324,7 @@ may_aliases (const_tree var)
 /* Return the line number for EXPR, or return -1 if we have no line
    number information for it.  */
 static inline int
-get_lineno (tree expr)
+get_lineno (const_tree expr)
 {
   if (expr == NULL_TREE)
     return -1;
@@ -506,8 +517,8 @@ next_readonly_imm_use (imm_use_iterator *imm)
   use_operand_p old = imm->imm_use;
 
 #ifdef ENABLE_CHECKING
-  /* If this assertion fails, it indicates the 'next' pointer has changed 
-     since we the last bump.  This indicates that the list is being modified
+  /* If this assertion fails, it indicates the 'next' pointer has changed
+     since the last bump.  This indicates that the list is being modified
      via stmt changes, or SET_USE, or somesuch thing, and you need to be
      using the SAFE version of the iterator.  */
   gcc_assert (imm->iter_node.next == old->next);
@@ -516,7 +527,7 @@ next_readonly_imm_use (imm_use_iterator *imm)
 
   imm->imm_use = old->next;
   if (end_readonly_imm_use_p (imm))
-    return old;
+    return NULL_USE_OPERAND_P;
   return imm->imm_use;
 }
 
@@ -688,7 +699,7 @@ static inline bool
 is_global_var (const_tree t)
 {
   if (MTAG_P (t))
-    return (TREE_STATIC (t) || MTAG_GLOBAL (t));
+    return MTAG_GLOBAL (t);
   else
     return (TREE_STATIC (t) || DECL_EXTERNAL (t));
 }
@@ -745,21 +756,6 @@ bsi_start (basic_block bb)
   return bsi;
 }
 
-static inline const_block_stmt_iterator
-cbsi_start (const_basic_block bb)
-{
-  const_block_stmt_iterator bsi;
-  if (bb->index < NUM_FIXED_BLOCKS)
-    {
-      bsi.tsi.ptr = NULL;
-      bsi.tsi.container = NULL;
-    }
-  else
-    bsi.tsi = ctsi_start (bb_stmt_list (bb));
-  bsi.bb = bb;
-  return bsi;
-}
-
 /* Return a block statement iterator that points to the first non-label
    statement in block BB.  */
 
@@ -792,22 +788,6 @@ bsi_last (basic_block bb)
   return bsi;
 }
 
-static inline const_block_stmt_iterator
-cbsi_last (const_basic_block bb)
-{
-  const_block_stmt_iterator bsi;
-
-  if (bb->index < NUM_FIXED_BLOCKS)
-    {
-      bsi.tsi.ptr = NULL;
-      bsi.tsi.container = NULL;
-    }
-  else
-    bsi.tsi = ctsi_last (bb_stmt_list (bb));
-  bsi.bb = bb;
-  return bsi;
-}
-
 /* Return true if block statement iterator I has reached the end of
    the basic block.  */
 static inline bool
@@ -816,12 +796,6 @@ bsi_end_p (block_stmt_iterator i)
   return tsi_end_p (i.tsi);
 }
 
-static inline bool
-cbsi_end_p (const_block_stmt_iterator i)
-{
-  return ctsi_end_p (i.tsi);
-}
-
 /* Modify block statement iterator I so that it is at the next
    statement in the basic block.  */
 static inline void
@@ -830,12 +804,6 @@ bsi_next (block_stmt_iterator *i)
   tsi_next (&i->tsi);
 }
 
-static inline void
-cbsi_next (const_block_stmt_iterator *i)
-{
-  ctsi_next (&i->tsi);
-}
-
 /* Modify block statement iterator I so that it is at the previous
    statement in the basic block.  */
 static inline void
@@ -844,12 +812,6 @@ bsi_prev (block_stmt_iterator *i)
   tsi_prev (&i->tsi);
 }
 
-static inline void
-cbsi_prev (const_block_stmt_iterator *i)
-{
-  ctsi_prev (&i->tsi);
-}
-
 /* Return the statement that block statement iterator I is currently
    at.  */
 static inline tree
@@ -858,12 +820,6 @@ bsi_stmt (block_stmt_iterator i)
   return tsi_stmt (i.tsi);
 }
 
-static inline const_tree
-cbsi_stmt (const_block_stmt_iterator i)
-{
-  return ctsi_stmt (i.tsi);
-}
-
 /* Return a pointer to the statement that block statement iterator I
    is currently at.  */
 static inline tree *
@@ -920,10 +876,7 @@ factoring_name_p (const_tree name)
 static inline bool
 is_call_clobbered (const_tree var)
 {
-  if (!MTAG_P (var))
-    return var_ann (var)->call_clobbered;
-  else
-    return bitmap_bit_p (gimple_call_clobbered_vars (cfun), DECL_UID (var)); 
+  return var_ann (var)->call_clobbered;
 }
 
 /* Mark variable VAR as being clobbered by function calls.  */
@@ -931,8 +884,7 @@ static inline void
 mark_call_clobbered (tree var, unsigned int escape_type)
 {
   var_ann (var)->escape_mask |= escape_type;
-  if (!MTAG_P (var))
-    var_ann (var)->call_clobbered = true;
+  var_ann (var)->call_clobbered = true;
   bitmap_set_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var));
 }
 
@@ -942,10 +894,9 @@ clear_call_clobbered (tree var)
 {
   var_ann_t ann = var_ann (var);
   ann->escape_mask = 0;
-  if (MTAG_P (var) && TREE_CODE (var) != STRUCT_FIELD_TAG)
+  if (MTAG_P (var))
     MTAG_GLOBAL (var) = 0;
-  if (!MTAG_P (var))
-    var_ann (var)->call_clobbered = false;
+  var_ann (var)->call_clobbered = false;
   bitmap_clear_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var));
 }
 
@@ -1513,7 +1464,7 @@ link_use_stmts_after (use_operand_p head, imm_use_iterator *imm)
        if (USE_FROM_PTR (use_p) == use)
          last_p = move_use_after_head (use_p, head, last_p);
     }
-  /* LInk iter node in after last_p.  */
+  /* Link iter node in after last_p.  */
   if (imm->iter_node.prev != NULL)
     delink_imm_use (&imm->iter_node);
   link_imm_use_to_list (&(imm->iter_node), last_p);
@@ -1604,7 +1555,7 @@ unmodifiable_var_p (const_tree var)
     var = SSA_NAME_VAR (var);
 
   if (MTAG_P (var))
-    return TREE_READONLY (var) && (TREE_STATIC (var) || MTAG_GLOBAL (var));
+    return false;
 
   return TREE_READONLY (var) && (TREE_STATIC (var) || DECL_EXTERNAL (var));
 }
@@ -1640,123 +1591,28 @@ ref_contains_array_ref (const_tree ref)
   return false;
 }
 
-/* Given a variable VAR, lookup and return a pointer to the list of
-   subvariables for it.  */
-
-static inline subvar_t *
-lookup_subvars_for_var (const_tree var)
-{
-  var_ann_t ann = var_ann (var);
-  gcc_assert (ann);
-  return &ann->subvars;
-}
-
-/* Given a variable VAR, return a linked list of subvariables for VAR, or
-   NULL, if there are no subvariables.  */
-
-static inline subvar_t
-get_subvars_for_var (tree var)
-{
-  subvar_t subvars;
-
-  gcc_assert (SSA_VAR_P (var));  
-  
-  if (TREE_CODE (var) == SSA_NAME)
-    subvars = *(lookup_subvars_for_var (SSA_NAME_VAR (var)));
-  else
-    subvars = *(lookup_subvars_for_var (var));
-  return subvars;
-}
-
-/* Return the subvariable of VAR at offset OFFSET.  */
-
-static inline tree
-get_subvar_at (tree var, unsigned HOST_WIDE_INT offset)
-{
-  subvar_t sv;
-
-  for (sv = get_subvars_for_var (var); sv; sv = sv->next)
-    if (SFT_OFFSET (sv->var) == offset)
-      return sv->var;
-
-  return NULL_TREE;
-}
-
-/* Return true if V is a tree that we can have subvars for.
-   Normally, this is any aggregate type.  Also complex
-   types which are not gimple registers can have subvars.  */
+/* Return true, if the two ranges [POS1, SIZE1] and [POS2, SIZE2]
+   overlap.  SIZE1 and/or SIZE2 can be (unsigned)-1 in which case the
+   range is open-ended.  Otherwise return false.  */
 
 static inline bool
-var_can_have_subvars (const_tree v)
-{
-  /* Volatile variables should never have subvars.  */
-  if (TREE_THIS_VOLATILE (v))
-    return false;
-
-  /* Non decls or memory tags can never have subvars.  */
-  if (!DECL_P (v) || MTAG_P (v))
-    return false;
-
-  /* Aggregates can have subvars.  */
-  if (AGGREGATE_TYPE_P (TREE_TYPE (v)))
+ranges_overlap_p (unsigned HOST_WIDE_INT pos1,
+                 unsigned HOST_WIDE_INT size1,
+                 unsigned HOST_WIDE_INT pos2,
+                 unsigned HOST_WIDE_INT size2)
+{
+  if (pos1 >= pos2
+      && (size2 == (unsigned HOST_WIDE_INT)-1
+         || pos1 < (pos2 + size2)))
     return true;
-
-  /* Complex types variables which are not also a gimple register can
-    have subvars. */
-  if (TREE_CODE (TREE_TYPE (v)) == COMPLEX_TYPE
-      && !DECL_GIMPLE_REG_P (v))
+  if (pos2 >= pos1
+      && (size1 == (unsigned HOST_WIDE_INT)-1
+         || pos2 < (pos1 + size1)))
     return true;
 
   return false;
 }
 
-  
-/* Return true if OFFSET and SIZE define a range that overlaps with some
-   portion of the range of SV, a subvar.  If there was an exact overlap,
-   *EXACT will be set to true upon return. */
-
-static inline bool
-overlap_subvar (unsigned HOST_WIDE_INT offset, unsigned HOST_WIDE_INT size,
-               const_tree sv,  bool *exact)
-{
-  /* There are three possible cases of overlap.
-     1. We can have an exact overlap, like so:   
-     |offset, offset + size             |
-     |sv->offset, sv->offset + sv->size |
-     
-     2. We can have offset starting after sv->offset, like so:
-     
-           |offset, offset + size              |
-     |sv->offset, sv->offset + sv->size  |
-
-     3. We can have offset starting before sv->offset, like so:
-     
-     |offset, offset + size    |
-       |sv->offset, sv->offset + sv->size|
-  */
-
-  if (exact)
-    *exact = false;
-  if (offset == SFT_OFFSET (sv) && size == SFT_SIZE (sv))
-    {
-      if (exact)
-       *exact = true;
-      return true;
-    }
-  else if (offset >= SFT_OFFSET (sv) 
-          && offset < (SFT_OFFSET (sv) + SFT_SIZE (sv)))
-    {
-      return true;
-    }
-  else if (offset < SFT_OFFSET (sv) 
-          && (size > SFT_OFFSET (sv) - offset))
-    {
-      return true;
-    }
-  return false;
-
-}
-
 /* Return the memory tag associated with symbol SYM.  */
 
 static inline tree
@@ -1827,4 +1683,31 @@ gimple_mem_ref_stats (const struct function *fn)
 {
   return &fn->gimple_df->mem_ref_stats;
 }
+
+/* Given an edge_var_map V, return the PHI arg definition.  */
+
+static inline tree
+redirect_edge_var_map_def (edge_var_map *v)
+{
+  return v->def;
+}
+
+/* Given an edge_var_map V, return the PHI result.  */
+
+static inline tree
+redirect_edge_var_map_result (edge_var_map *v)
+{
+  return v->result;
+}
+
+
+/* Return an SSA_NAME node for variable VAR defined in statement STMT
+   in function cfun.  */
+
+static inline tree
+make_ssa_name (tree var, tree stmt)
+{
+  return make_ssa_name_fn (cfun, var, stmt);
+}
+
 #endif /* _TREE_FLOW_INLINE_H  */