Esempio n. 1
0
static gimple
resize_phi_node (gimple phi, size_t len)
{
  size_t old_size, i;
  gimple new_phi;

  gcc_assert (len > gimple_phi_capacity (phi));

  /* The garbage collector will not look at the PHI node beyond the
     first PHI_NUM_ARGS elements.  Therefore, all we have to copy is a
     portion of the PHI node currently in use.  */
  old_size = sizeof (struct gimple_statement_phi)
	     + (gimple_phi_num_args (phi) - 1) * sizeof (struct phi_arg_d);

  new_phi = allocate_phi_node (len);

  memcpy (new_phi, phi, old_size);

  for (i = 0; i < gimple_phi_num_args (new_phi); i++)
    {
      use_operand_p imm, old_imm;
      imm = gimple_phi_arg_imm_use_ptr (new_phi, i);
      old_imm = gimple_phi_arg_imm_use_ptr (phi, i);
      imm->use = gimple_phi_arg_def_ptr (new_phi, i);
      relink_imm_use_stmt (imm, old_imm, new_phi);
    }

  new_phi->gimple_phi.capacity = len;

  for (i = gimple_phi_num_args (new_phi); i < len; i++)
    {
      use_operand_p imm;

      gimple_phi_arg_set_location (new_phi, i, UNKNOWN_LOCATION);
      imm = gimple_phi_arg_imm_use_ptr (new_phi, i);
      imm->use = gimple_phi_arg_def_ptr (new_phi, i);
      imm->prev = NULL;
      imm->next = NULL;
      imm->loc.stmt = new_phi;
    }

  return new_phi;
}
Esempio n. 2
0
static void
resize_phi_node (tree *phi, int len)
{
  int old_size, i;
  tree new_phi;

  gcc_assert (len > PHI_ARG_CAPACITY (*phi));

  /* The garbage collector will not look at the PHI node beyond the
     first PHI_NUM_ARGS elements.  Therefore, all we have to copy is a
     portion of the PHI node currently in use.  */
  old_size = (sizeof (struct tree_phi_node)
	     + (PHI_NUM_ARGS (*phi) - 1) * sizeof (struct phi_arg_d));

  new_phi = allocate_phi_node (len);

  memcpy (new_phi, *phi, old_size);

  for (i = 0; i < PHI_NUM_ARGS (new_phi); i++)
    {
      use_operand_p imm, old_imm;
      imm = &(PHI_ARG_IMM_USE_NODE (new_phi, i));
      old_imm = &(PHI_ARG_IMM_USE_NODE (*phi, i));
      imm->use = &(PHI_ARG_DEF_TREE (new_phi, i));
      relink_imm_use_stmt (imm, old_imm, new_phi);
    }

  PHI_ARG_CAPACITY (new_phi) = len;

  for (i = PHI_NUM_ARGS (new_phi); i < len; i++)
    {
      use_operand_p imm;
      imm = &(PHI_ARG_IMM_USE_NODE (new_phi, i));
      imm->use = &(PHI_ARG_DEF_TREE (new_phi, i));
      imm->prev = NULL;
      imm->next = NULL;
      imm->stmt = new_phi;
    }


  *phi = new_phi;
}