Beispiel #1
0
void
reorder_basic_blocks (void)
{
  int n_traces;
  int i;
  struct trace *traces;

  if (n_basic_blocks <= 1)
    return;

  if ((* targetm.cannot_modify_jumps_p) ())
    return;

  timevar_push (TV_REORDER_BLOCKS);

  cfg_layout_initialize ();

  set_edge_can_fallthru_flag ();
  mark_dfs_back_edges ();

  /* We are estimating the length of uncond jump insn only once since the code
     for getting the insn length always returns the minimal length now.  */
  if (uncond_jump_length == 0)
    uncond_jump_length = get_uncond_jump_length ();

  /* We need to know some information for each basic block.  */
  array_size = GET_ARRAY_SIZE (last_basic_block);
  bbd = xmalloc (array_size * sizeof (bbro_basic_block_data));
  for (i = 0; i < array_size; i++)
    {
      bbd[i].start_of_trace = -1;
      bbd[i].end_of_trace = -1;
      bbd[i].heap = NULL;
      bbd[i].node = NULL;
    }

  traces = xmalloc (n_basic_blocks * sizeof (struct trace));
  n_traces = 0;
  find_traces (&n_traces, traces);
  connect_traces (n_traces, traces);
  FREE (traces);
  FREE (bbd);

  if (rtl_dump_file)
    dump_flow_info (rtl_dump_file);

  cfg_layout_finalize ();

  timevar_pop (TV_REORDER_BLOCKS);
}
Beispiel #2
0
void display(){
	glClear(GL_COLOR_BUFFER_BIT);


	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(
		60,
		1,
		0.1,
		100);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluLookAt(
		width / 2, 0, 70,//GLdouble eyex,eyey,eyez,
		width / 2, 0, 0,//GLdouble centerx,centery,centerz,
		0, 1, 0);//GLdouble upx,upy, upz
	static unsigned char indices[] = { 0, 1, 2, 1, 3, 2 };
	for (int i = 0; i < height; i++){
		for (int n = 0; n < width; n++){
			if (map[i*width+n]!=0){
				float v[] = {
					-quadsR + n, quadsR - i,
					-quadsR + n, -quadsR - i,
					quadsR + n, quadsR - i,
					quadsR + n, -quadsR - i
				};

				glEnableClientState(GL_VERTEX_ARRAY);	// GLenum array
				glVertexPointer(
					2,
					GL_FLOAT,
					0,
					v);//GLint size, GLenum type, GLsizei stride, const GLvoid *pointer


				glDrawElements(
					GL_TRIANGLES,
					GET_ARRAY_SIZE(indices),
					GL_UNSIGNED_BYTE,
					indices);
			}
		}
	}
	

	glFlush();

}
Beispiel #3
0
static basic_block
copy_bb (basic_block old_bb, edge e, basic_block bb, int trace)
{
  basic_block new_bb;

  new_bb = cfg_layout_duplicate_bb (old_bb, e);
  if (e->dest != new_bb)
    abort ();
  if (e->dest->rbi->visited)
    abort ();
  if (rtl_dump_file)
    fprintf (rtl_dump_file,
	     "Duplicated bb %d (created bb %d)\n",
	     old_bb->index, new_bb->index);
  new_bb->rbi->visited = trace;
  new_bb->rbi->next = bb->rbi->next;
  bb->rbi->next = new_bb;

  if (new_bb->index >= array_size || last_basic_block > array_size)
    {
      int i;
      int new_size;

      new_size = MAX (last_basic_block, new_bb->index + 1);
      new_size = GET_ARRAY_SIZE (new_size);
      bbd = xrealloc (bbd, new_size * sizeof (bbro_basic_block_data));
      for (i = array_size; i < new_size; i++)
	{
	  bbd[i].start_of_trace = -1;
	  bbd[i].end_of_trace = -1;
	  bbd[i].heap = NULL;
	  bbd[i].node = NULL;
	}
      array_size = new_size;

      if (rtl_dump_file)
	{
	  fprintf (rtl_dump_file,
		   "Growing the dynamic array to %d elements.\n",
		   array_size);
	}
    }

  return new_bb;
}