Ejemplo n.º 1
0
static void
cfg_blocks_add (basic_block bb)
{
    gcc_assert (bb != ENTRY_BLOCK_PTR && bb != EXIT_BLOCK_PTR);
    gcc_assert (!TEST_BIT (bb_in_list, bb->index));

    if (cfg_blocks_empty_p ())
    {
        cfg_blocks_tail = cfg_blocks_head = 0;
        cfg_blocks_num = 1;
    }
    else
    {
        cfg_blocks_num++;
        if (cfg_blocks_num > VARRAY_SIZE (cfg_blocks))
        {
            /* We have to grow the array now.  Adjust to queue to occupy the
               full space of the original array.  */
            cfg_blocks_tail = VARRAY_SIZE (cfg_blocks);
            cfg_blocks_head = 0;
            VARRAY_GROW (cfg_blocks, 2 * VARRAY_SIZE (cfg_blocks));
        }
        else
            cfg_blocks_tail = (cfg_blocks_tail + 1) % VARRAY_SIZE (cfg_blocks);
    }

    VARRAY_BB (cfg_blocks, cfg_blocks_tail) = bb;
    SET_BIT (bb_in_list, bb->index);
}
Ejemplo n.º 2
0
static void
cfg_blocks_add (basic_block bb)
{
    /* APPLE LOCAL begin mainline */
    bool head = false;

    gcc_assert (bb != ENTRY_BLOCK_PTR && bb != EXIT_BLOCK_PTR);
    gcc_assert (!TEST_BIT (bb_in_list, bb->index));

    if (cfg_blocks_empty_p ())
    {
        cfg_blocks_tail = cfg_blocks_head = 0;
        cfg_blocks_num = 1;
    }
    else
    {
        cfg_blocks_num++;
        if (cfg_blocks_num > VEC_length (basic_block, cfg_blocks))
        {
            /* We have to grow the array now.  Adjust to queue to occupy
               the full space of the original array.  We do not need to
               initialize the newly allocated portion of the array
               because we keep track of CFG_BLOCKS_HEAD and
               CFG_BLOCKS_HEAD.  */
            cfg_blocks_tail = VEC_length (basic_block, cfg_blocks);
            cfg_blocks_head = 0;
            VEC_safe_grow (basic_block, heap, cfg_blocks, 2 * cfg_blocks_tail);
        }
        /* Minor optimization: we prefer to see blocks with more
        predecessors later, because there is more of a chance that
         the incoming edges will be executable.  */
        else if (EDGE_COUNT (bb->preds)
                 >= EDGE_COUNT (VEC_index (basic_block, cfg_blocks,
                                           cfg_blocks_head)->preds))
            cfg_blocks_tail = ((cfg_blocks_tail + 1)
                               % VEC_length (basic_block, cfg_blocks));
        else
        {
            if (cfg_blocks_head == 0)
                cfg_blocks_head = VEC_length (basic_block, cfg_blocks);
            --cfg_blocks_head;
            head = true;
        }
    }

    VEC_replace (basic_block, cfg_blocks,
                 head ? cfg_blocks_head : cfg_blocks_tail,
                 bb);
    /* APPLE LOCAL end mainline */
    SET_BIT (bb_in_list, bb->index);
}
Ejemplo n.º 3
0
static basic_block
cfg_blocks_get (void)
{
  basic_block bb;

  bb = cfg_blocks[cfg_blocks_head];

  gcc_assert (!cfg_blocks_empty_p ());
  gcc_assert (bb);

  cfg_blocks_head = ((cfg_blocks_head + 1) % cfg_blocks.length ());
  --cfg_blocks_num;
  bitmap_clear_bit (bb_in_list, bb->index);

  return bb;
}
Ejemplo n.º 4
0
static basic_block
cfg_blocks_get (void)
{
    basic_block bb;

    bb = VARRAY_BB (cfg_blocks, cfg_blocks_head);

    gcc_assert (!cfg_blocks_empty_p ());
    gcc_assert (bb);

    cfg_blocks_head = (cfg_blocks_head + 1) % VARRAY_SIZE (cfg_blocks);
    --cfg_blocks_num;
    RESET_BIT (bb_in_list, bb->index);

    return bb;
}
Ejemplo n.º 5
0
static basic_block
cfg_blocks_get (void)
{
  basic_block bb;

  bb = VEC_index (basic_block, cfg_blocks, cfg_blocks_head);

  gcc_assert (!cfg_blocks_empty_p ());
  gcc_assert (bb);

  cfg_blocks_head = ((cfg_blocks_head + 1)
		     % VEC_length (basic_block, cfg_blocks));
  --cfg_blocks_num;
  RESET_BIT (bb_in_list, bb->index);

  return bb;
}
Ejemplo n.º 6
0
static void
cfg_blocks_add (basic_block bb)
{
  bool head = false;

  gcc_assert (bb != ENTRY_BLOCK_PTR_FOR_FN (cfun)
	      && bb != EXIT_BLOCK_PTR_FOR_FN (cfun));
  gcc_assert (!bitmap_bit_p (bb_in_list, bb->index));

  if (cfg_blocks_empty_p ())
    {
      cfg_blocks_tail = cfg_blocks_head = 0;
      cfg_blocks_num = 1;
    }
  else
    {
      cfg_blocks_num++;
      if (cfg_blocks_num > cfg_blocks.length ())
	{
	  /* We have to grow the array now.  Adjust to queue to occupy
	     the full space of the original array.  We do not need to
	     initialize the newly allocated portion of the array
	     because we keep track of CFG_BLOCKS_HEAD and
	     CFG_BLOCKS_HEAD.  */
	  cfg_blocks_tail = cfg_blocks.length ();
	  cfg_blocks_head = 0;
	  cfg_blocks.safe_grow (2 * cfg_blocks_tail);
	}
      /* Minor optimization: we prefer to see blocks with more
	 predecessors later, because there is more of a chance that
	 the incoming edges will be executable.  */
      else if (EDGE_COUNT (bb->preds)
	       >= EDGE_COUNT (cfg_blocks[cfg_blocks_head]->preds))
	cfg_blocks_tail = ((cfg_blocks_tail + 1) % cfg_blocks.length ());
      else
	{
	  if (cfg_blocks_head == 0)
	    cfg_blocks_head = cfg_blocks.length ();
	  --cfg_blocks_head;
	  head = true;
	}
    }

  cfg_blocks[head ? cfg_blocks_head : cfg_blocks_tail] = bb;
  bitmap_set_bit (bb_in_list, bb->index);
}