示例#1
0
void
redirect_edge_var_map_add (edge e, tree result, tree def)
{
  void **slot;
  edge_var_map_vector old_head, head;
  edge_var_map new_node;

  if (edge_var_maps == NULL)
    edge_var_maps = pointer_map_create ();

  slot = pointer_map_insert (edge_var_maps, e);
  old_head = head = (edge_var_map_vector) *slot;
  if (!head)
    {
      head = VEC_alloc (edge_var_map, heap, 5);
      *slot = head;
    }
  new_node.def = def;
  new_node.result = result;

  VEC_safe_push (edge_var_map, heap, head, &new_node);
  if (old_head != head)
    {
      /* The push did some reallocation.  Update the pointer map.  */
      *slot = head;
    }
}
void
tree_to_aff_combination_expand (tree expr, tree type, aff_tree *comb,
				struct pointer_map_t **cache)
{
  unsigned i;
  aff_tree to_add, current, curre;
  tree e, def, rhs;
  double_int scale;
  void **slot;
  struct name_expansion *exp;

  tree_to_aff_combination (expr, type, comb);
  aff_combination_zero (&to_add, type);
  for (i = 0; i < comb->n; i++)
    {
      e = comb->elts[i].val;
      if (TREE_CODE (e) != SSA_NAME)
	continue;
      def = SSA_NAME_DEF_STMT (e);
      if (TREE_CODE (def) != GIMPLE_MODIFY_STMT
	  || GIMPLE_STMT_OPERAND (def, 0) != e)
	continue;

      rhs = GIMPLE_STMT_OPERAND (def, 1);
      if (TREE_CODE (rhs) != SSA_NAME
	  && !EXPR_P (rhs)
	  && !is_gimple_min_invariant (rhs))
	continue;

      /* We do not know whether the reference retains its value at the
	 place where the expansion is used.  */
      if (REFERENCE_CLASS_P (rhs))
	continue;

      if (!*cache)
	*cache = pointer_map_create ();
      slot = pointer_map_insert (*cache, e);
      exp = *slot;

      if (!exp)
	{
	  exp = XNEW (struct name_expansion);
	  exp->in_progress = 1;
	  *slot = exp;
	  tree_to_aff_combination_expand (rhs, type, &current, cache);
	  exp->expansion = current;
	  exp->in_progress = 0;
	}
      else
	{
static bool
streamer_tree_cache_insert_1 (struct streamer_tree_cache_d *cache,
			      tree t, unsigned *ix_p,
			      bool insert_at_next_slot_p)
{
  void **slot;
  unsigned ix;
  bool existed_p;

  gcc_assert (t);

  slot = pointer_map_insert (cache->node_map, t);
  if (!*slot)
    {
      /* Determine the next slot to use in the cache.  */
      if (insert_at_next_slot_p)
	ix = VEC_length (tree, cache->nodes);
      else
	ix = *ix_p;
       *slot = (void *)(size_t) (ix + 1);

      streamer_tree_cache_add_to_node_array (cache, ix, t);

      /* Indicate that the item was not present in the cache.  */
      existed_p = false;
    }
  else
    {
      ix = (size_t) *slot - 1;

      if (!insert_at_next_slot_p && ix != *ix_p)
	{
	  /* If the caller wants to insert T at a specific slot
	     location, and ENTRY->TO does not match *IX_P, add T to
	     the requested location slot.  */
	  ix = *ix_p;
	  streamer_tree_cache_add_to_node_array (cache, ix, t);
	}

      /* Indicate that T was already in the cache.  */
      existed_p = true;
    }

  if (ix_p)
    *ix_p = ix;

  return existed_p;
}
示例#4
0
void
redirect_edge_var_map_dup (edge newe, edge olde)
{
  void **new_slot, **old_slot;
  edge_var_map_vector head;

  if (!edge_var_maps)
    return;

  new_slot = pointer_map_insert (edge_var_maps, newe);
  old_slot = pointer_map_contains (edge_var_maps, olde);
  if (!old_slot)
    return;
  head = (edge_var_map_vector) *old_slot;

  if (head)
    *new_slot = VEC_copy (edge_var_map, heap, head);
  else
    *new_slot = VEC_alloc (edge_var_map, heap, 5);
}
示例#5
0
void
redirect_edge_var_map_add (edge e, tree result, tree def, source_location locus)
{
  void **slot;
  edge_var_map_vector *head;
  edge_var_map new_node;

  if (edge_var_maps == NULL)
    edge_var_maps = pointer_map_create ();

  slot = pointer_map_insert (edge_var_maps, e);
  head = (edge_var_map_vector *) *slot;
  if (!head)
    vec_safe_reserve (head, 5);
  new_node.def = def;
  new_node.result = result;
  new_node.locus = locus;

  vec_safe_push (head, new_node);
  *slot = head;
}
示例#6
0
void
redirect_edge_var_map_dup (edge newe, edge olde)
{
  void **new_slot, **old_slot;
  edge_var_map_vector *head;

  if (!edge_var_maps)
    return;

  new_slot = pointer_map_insert (edge_var_maps, newe);
  old_slot = pointer_map_contains (edge_var_maps, olde);
  if (!old_slot)
    return;
  head = (edge_var_map_vector *) *old_slot;

  edge_var_map_vector *new_head = NULL;
  if (head)
    new_head = vec_safe_copy (head);
  else
    vec_safe_reserve (new_head, 5);
  *new_slot = new_head;
}