• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ print_gimple_stmt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中print_gimple_stmt函数的典型用法代码示例。如果您正苦于以下问题:C++ print_gimple_stmt函数的具体用法?C++ print_gimple_stmt怎么用?C++ print_gimple_stmt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了print_gimple_stmt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: dump_immediate_uses_for

void
dump_immediate_uses_for (FILE *file, tree var)
{
  imm_use_iterator iter;
  use_operand_p use_p;

  gcc_assert (var && TREE_CODE (var) == SSA_NAME);

  print_generic_expr (file, var, TDF_SLIM);
  fprintf (file, " : -->");
  if (has_zero_uses (var))
    fprintf (file, " no uses.\n");
  else
    if (has_single_use (var))
      fprintf (file, " single use.\n");
    else
      fprintf (file, "%d uses.\n", num_imm_uses (var));

  FOR_EACH_IMM_USE_FAST (use_p, iter, var)
    {
      if (use_p->loc.stmt == NULL && use_p->use == NULL)
        fprintf (file, "***end of stmt iterator marker***\n");
      else
	if (!is_gimple_reg (USE_FROM_PTR (use_p)))
	  print_gimple_stmt (file, USE_STMT (use_p), 0, TDF_VOPS|TDF_MEMSYMS);
	else
	  print_gimple_stmt (file, USE_STMT (use_p), 0, TDF_SLIM);
    }
  fprintf(file, "\n");
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:30,代码来源:tree-ssa-operands.c


示例2: chkp_use_outer_bounds_if_possible

/* For bounds used in CI check if bounds are produced by
   intersection and we may use outer bounds instead.  If
   transformation is possible then fix check statement and
   recompute its info.  */
static void
chkp_use_outer_bounds_if_possible (struct check_info *ci)
{
    gimple *bnd_def;
    tree bnd1, bnd2, bnd_res = NULL;
    int check_res1, check_res2;

    if (TREE_CODE (ci->bounds) != SSA_NAME)
        return;

    bnd_def = SSA_NAME_DEF_STMT (ci->bounds);
    if (gimple_code (bnd_def) != GIMPLE_CALL
            || gimple_call_fndecl (bnd_def) != chkp_intersect_fndecl)
        return;

    if (dump_file && (dump_flags & TDF_DETAILS))
    {
        fprintf (dump_file, "Check if bounds intersection is redundant: \n");
        fprintf (dump_file, "  check: ");
        print_gimple_stmt (dump_file, ci->stmt, 0, 0);
        fprintf (dump_file, "  intersection: ");
        print_gimple_stmt (dump_file, bnd_def, 0, 0);
        fprintf (dump_file, "\n");
    }

    bnd1 = gimple_call_arg (bnd_def, 0);
    bnd2 = gimple_call_arg (bnd_def, 1);

    check_res1 = chkp_get_check_result (ci, bnd1);
    check_res2 = chkp_get_check_result (ci, bnd2);
    if (check_res1 == 1)
        bnd_res = bnd2;
    else if (check_res1 == -1)
        bnd_res = bnd1;
    else if (check_res2 == 1)
        bnd_res = bnd1;
    else if (check_res2 == -1)
        bnd_res = bnd2;

    if (bnd_res)
    {
        if (dump_file && (dump_flags & TDF_DETAILS))
        {
            fprintf (dump_file, "  action: use ");
            print_generic_expr (dump_file, bnd2, 0);
            fprintf (dump_file, " instead of ");
            print_generic_expr (dump_file, ci->bounds, 0);
            fprintf (dump_file, "\n");
        }

        ci->bounds = bnd_res;
        gimple_call_set_arg (ci->stmt, 1, bnd_res);
        update_stmt (ci->stmt);
        chkp_fill_check_info (ci->stmt, ci);
    }
}
开发者ID:paranoiacblack,项目名称:gcc,代码行数:60,代码来源:tree-chkp-opt.c


示例3: remove_exits_and_undefined_stmts

static bool
remove_exits_and_undefined_stmts (struct loop *loop, unsigned int npeeled)
{
  struct nb_iter_bound *elt;
  bool changed = false;

  for (elt = loop->bounds; elt; elt = elt->next)
    {
      /* If statement is known to be undefined after peeling, turn it
	 into unreachable (or trap when debugging experience is supposed
	 to be good).  */
      if (!elt->is_exit
	  && wi::ltu_p (elt->bound, npeeled))
	{
	  gimple_stmt_iterator gsi = gsi_for_stmt (elt->stmt);
	  gcall *stmt = gimple_build_call
	      (builtin_decl_implicit (BUILT_IN_UNREACHABLE), 0);
	  gimple_set_location (stmt, gimple_location (elt->stmt));
	  gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
	  split_block (gimple_bb (stmt), stmt);
	  changed = true;
	  if (dump_file && (dump_flags & TDF_DETAILS))
	    {
	      fprintf (dump_file, "Forced statement unreachable: ");
	      print_gimple_stmt (dump_file, elt->stmt, 0, 0);
	    }
	}
      /* If we know the exit will be taken after peeling, update.  */
      else if (elt->is_exit
	       && wi::leu_p (elt->bound, npeeled))
	{
	  basic_block bb = gimple_bb (elt->stmt);
	  edge exit_edge = EDGE_SUCC (bb, 0);

	  if (dump_file && (dump_flags & TDF_DETAILS))
	    {
	      fprintf (dump_file, "Forced exit to be taken: ");
	      print_gimple_stmt (dump_file, elt->stmt, 0, 0);
	    }
	  if (!loop_exit_edge_p (loop, exit_edge))
	    exit_edge = EDGE_SUCC (bb, 1);
	  gcc_checking_assert (loop_exit_edge_p (loop, exit_edge));
	  gcond *cond_stmt = as_a <gcond *> (elt->stmt);
	  if (exit_edge->flags & EDGE_TRUE_VALUE)
	    gimple_cond_make_true (cond_stmt);
	  else
	    gimple_cond_make_false (cond_stmt);
	  update_stmt (cond_stmt);
	  changed = true;
	}
    }
  return changed;
}
开发者ID:0day-ci,项目名称:gcc,代码行数:53,代码来源:tree-ssa-loop-ivcanon.c


示例4: copy_prop_visit_cond_stmt

static enum ssa_prop_result
copy_prop_visit_cond_stmt (gimple *stmt, edge *taken_edge_p)
{
  enum ssa_prop_result retval = SSA_PROP_VARYING;
  location_t loc = gimple_location (stmt);

  tree op0 = valueize_val (gimple_cond_lhs (stmt));
  tree op1 = valueize_val (gimple_cond_rhs (stmt));

  /* See if we can determine the predicate's value.  */
  if (dump_file && (dump_flags & TDF_DETAILS))
    {
      fprintf (dump_file, "Trying to determine truth value of ");
      fprintf (dump_file, "predicate ");
      print_gimple_stmt (dump_file, stmt, 0, 0);
    }

  /* Fold COND and see whether we get a useful result.  */
  tree folded_cond = fold_binary_loc (loc, gimple_cond_code (stmt),
				      boolean_type_node, op0, op1);
  if (folded_cond)
    {
      basic_block bb = gimple_bb (stmt);
      *taken_edge_p = find_taken_edge (bb, folded_cond);
      if (*taken_edge_p)
	retval = SSA_PROP_INTERESTING;
    }

  if (dump_file && (dump_flags & TDF_DETAILS) && *taken_edge_p)
    fprintf (dump_file, "\nConditional will always take edge %d->%d\n",
	     (*taken_edge_p)->src->index, (*taken_edge_p)->dest->index);

  return retval;
}
开发者ID:hemantjain95,项目名称:gcc,代码行数:34,代码来源:tree-ssa-copy.c


示例5: pass_verbose

unsigned int pass_verbose()
{
    warning(0, "%<%s%>", context);

    basic_block bb;
    gimple_stmt_iterator gsi;

    fprintf( stderr, "* MYPROOF on %s()\n", IDENTIFIER_POINTER(DECL_NAME(cfun->decl)) );

    FOR_EACH_BB( bb )
    {
	fprintf( stderr, "  ** BB %d\n", bb->index );

	for ( gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi) )
	    {
		print_gimple_stmt ( stdout, gsi_stmt(gsi), 0, 0 );
		read_stmt( gsi_stmt(gsi) );
	    }

    }

    /* recursively read loops */
    if ( cfun->x_current_loops != NULL )
	{
	    read_loop( cfun->x_current_loops->tree_root );
	}

    return 0;
}
开发者ID:canercandan,项目名称:myproof,代码行数:29,代码来源:pass_verbose.c


示例6: optimize_tail_call

static bool
optimize_tail_call (struct tailcall *t, bool opt_tailcalls)
{
  if (t->tail_recursion)
    {
      eliminate_tail_call (t);
      return true;
    }

  if (opt_tailcalls)
    {
      gimple stmt = gsi_stmt (t->call_gsi);

      gimple_call_set_tail (stmt, true);
      cfun->tail_call_marked = true;
      if (dump_file && (dump_flags & TDF_DETAILS))
        {
	  fprintf (dump_file, "Found tail call ");
	  print_gimple_stmt (dump_file, stmt, 0, dump_flags);
	  fprintf (dump_file, " in bb %i\n", (gsi_bb (t->call_gsi))->index);
	}
    }

  return false;
}
开发者ID:CookieChen,项目名称:gcc,代码行数:25,代码来源:tree-tailcall.c


示例7: dump_var_info

static void
dump_var_info (tree var, usage_info *info, const char *intro)
{
  fprintf (dump_file, "[DEF] %s for ", intro);
  print_gimple_stmt (dump_file, SSA_NAME_DEF_STMT (var), 0, TDF_SLIM);
  if (info)
    dump_usage_info (dump_file, var, info);
}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:8,代码来源:gimple-ssa-backprop.c


示例8: note_replacement

static void
note_replacement (gimple *stmt, tree old_rhs, tree new_rhs)
{
  fprintf (dump_file, "Replacing use of ");
  print_generic_expr (dump_file, old_rhs, 0);
  fprintf (dump_file, " with ");
  print_generic_expr (dump_file, new_rhs, 0);
  fprintf (dump_file, " in ");
  print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:10,代码来源:gimple-ssa-backprop.c


示例9: remove_unused_var

static void
remove_unused_var (tree var)
{
  gimple *stmt = SSA_NAME_DEF_STMT (var);
  if (dump_file && (dump_flags & TDF_DETAILS))
    {
      fprintf (dump_file, "Deleting ");
      print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
    }
  gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
  gsi_remove (&gsi, true);
  release_defs (stmt);
}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:13,代码来源:gimple-ssa-backprop.c


示例10: gsi_for_stmt

void
backprop::complete_change (gimple *stmt)
{
  gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
  if (fold_stmt (&gsi))
    {
      if (dump_file && (dump_flags & TDF_DETAILS))
	{
	  fprintf (dump_file, "  which folds to: ");
	  print_gimple_stmt (dump_file, gsi_stmt (gsi), 0, TDF_SLIM);
	}
    }
  update_stmt (gsi_stmt (gsi));
}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:14,代码来源:gimple-ssa-backprop.c


示例11: remove_redundant_iv_tests

static bool
remove_redundant_iv_tests (struct loop *loop)
{
  struct nb_iter_bound *elt;
  bool changed = false;

  if (!loop->any_upper_bound)
    return false;
  for (elt = loop->bounds; elt; elt = elt->next)
    {
      /* Exit is pointless if it won't be taken before loop reaches
	 upper bound.  */
      if (elt->is_exit && loop->any_upper_bound
          && wi::ltu_p (loop->nb_iterations_upper_bound, elt->bound))
	{
	  basic_block bb = gimple_bb (elt->stmt);
	  edge exit_edge = EDGE_SUCC (bb, 0);
	  struct tree_niter_desc niter;

	  if (!loop_exit_edge_p (loop, exit_edge))
	    exit_edge = EDGE_SUCC (bb, 1);

	  /* Only when we know the actual number of iterations, not
	     just a bound, we can remove the exit.  */
	  if (!number_of_iterations_exit (loop, exit_edge,
					  &niter, false, false)
	      || !integer_onep (niter.assumptions)
	      || !integer_zerop (niter.may_be_zero)
	      || !niter.niter
	      || TREE_CODE (niter.niter) != INTEGER_CST
	      || !wi::ltu_p (loop->nb_iterations_upper_bound,
			     wi::to_widest (niter.niter)))
	    continue;
	  
	  if (dump_file && (dump_flags & TDF_DETAILS))
	    {
	      fprintf (dump_file, "Removed pointless exit: ");
	      print_gimple_stmt (dump_file, elt->stmt, 0, 0);
	    }
	  gcond *cond_stmt = as_a <gcond *> (elt->stmt);
	  if (exit_edge->flags & EDGE_TRUE_VALUE)
	    gimple_cond_make_false (cond_stmt);
	  else
	    gimple_cond_make_true (cond_stmt);
	  update_stmt (cond_stmt);
	  changed = true;
	}
    }
  return changed;
}
开发者ID:0day-ci,项目名称:gcc,代码行数:50,代码来源:tree-ssa-loop-ivcanon.c


示例12: instrument_assignments_plugin_exec

static unsigned int instrument_assignments_plugin_exec(void)
{
#ifdef DEBUG
    fprintf(stderr, "* Inspecting function `%s'\n", FN_NAME);
#endif

    basic_block bb;
    FOR_EACH_BB(bb) {
        gimple_stmt_iterator gsi;
        for (gsi = gsi_start_bb(bb) ; !gsi_end_p(gsi) ; gsi_next(&gsi)) {
            gimple curr_stmt = gsi_stmt(gsi);
            tree lhs = gimple_get_lhs(curr_stmt);

            // We only care about assignments to “real” variables – i.e. not
            // variable versions that were created as part of the transformation
            // to SSA form.
            if (gimple_code(curr_stmt) == GIMPLE_ASSIGN
                    && lhs != NULL_TREE && TREE_CODE(lhs) != SSA_NAME && DECL_P(lhs)) {

                tree attrlist = DECL_ATTRIBUTES(lhs);
                tree attr = lookup_attribute("instrument", attrlist);

                // the princess is in another castle
                if (attr == NULL_TREE) continue;

                // read the variable id that was passed to the `instrument'
                // attribute
                const_tree arg = TREE_VALUE(TREE_VALUE(attr));
                tree var_id = build_int_cst(NULL_TREE, tree_low_cst (arg, 1));

#ifdef DEBUG
                fprintf(stderr, "  > found assignment to instrumented variable `%s': \n\t", get_name(lhs));
                print_gimple_stmt(stderr, curr_stmt, 0, 0);
                fprintf(stderr, "\tbase address of `%s' is %p\n", get_name(lhs), get_base_address(lhs));
#endif

                // insert our instrumentation function before the current
                // statement and pass along the rhs (i.e. the new value)
                tree rhs = gimple_op(curr_stmt, 1);
                insert_instrumentation_fn(curr_stmt, var_id, rhs);
            }
        }
    }
#ifdef DEBUG
    fprintf(stderr, "\n");
#endif

    return 0;
}
开发者ID:GaloisInc,项目名称:ivory-rtverification,代码行数:49,代码来源:instrument_plugin.c


示例13: tree_call_cdce

static unsigned int
tree_call_cdce (void)
{
    basic_block bb;
    gimple_stmt_iterator i;
    bool something_changed = false;
    vec<gimple> cond_dead_built_in_calls = vNULL;
    FOR_EACH_BB (bb)
    {
        /* Collect dead call candidates.  */
        for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
        {
            gimple stmt = gsi_stmt (i);
            if (is_gimple_call (stmt)
                    && is_call_dce_candidate (stmt))
            {
                if (dump_file && (dump_flags & TDF_DETAILS))
                {
                    fprintf (dump_file, "Found conditional dead call: ");
                    print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
                    fprintf (dump_file, "\n");
                }
                if (!cond_dead_built_in_calls.exists ())
                    cond_dead_built_in_calls.create (64);
                cond_dead_built_in_calls.safe_push (stmt);
            }
        }
    }

    if (!cond_dead_built_in_calls.exists ())
        return 0;

    something_changed
        = shrink_wrap_conditional_dead_built_in_calls (cond_dead_built_in_calls);

    cond_dead_built_in_calls.release ();

    if (something_changed)
    {
        free_dominance_info (CDI_DOMINATORS);
        free_dominance_info (CDI_POST_DOMINATORS);
        /* As we introduced new control-flow we need to insert PHI-nodes
           for the call-clobbers of the remaining call.  */
        mark_virtual_operands_for_renaming (cfun);
        return TODO_update_ssa;
    }

    return 0;
}
开发者ID:tj90241,项目名称:mips-baremetal,代码行数:49,代码来源:tree-call-cdce.c


示例14: chkp_gather_checks_info

/* Find all checks in current function and store info about them
   in check_infos.  */
static void
chkp_gather_checks_info (void)
{
    basic_block bb;
    gimple_stmt_iterator i;

    if (dump_file && (dump_flags & TDF_DETAILS))
        fprintf (dump_file, "Gathering information about checks...\n");

    chkp_init_check_info ();

    FOR_EACH_BB_FN (bb, cfun)
    {
        struct bb_checks *bbc = &check_infos[bb->index];

        if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "Searching checks in BB%d...\n", bb->index);

        for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
        {
            gimple *stmt = gsi_stmt (i);

            if (gimple_code (stmt) != GIMPLE_CALL)
                continue;

            if (gimple_call_fndecl (stmt) == chkp_checkl_fndecl
                    || gimple_call_fndecl (stmt) == chkp_checku_fndecl)
            {
                struct check_info ci;

                chkp_fill_check_info (stmt, &ci);
                bbc->checks.safe_push (ci);

                if (dump_file && (dump_flags & TDF_DETAILS))
                {
                    fprintf (dump_file, "Adding check information:\n");
                    fprintf (dump_file, "  bounds: ");
                    print_generic_expr (dump_file, ci.bounds, 0);
                    fprintf (dump_file, "\n  address: ");
                    chkp_print_addr (ci.addr);
                    fprintf (dump_file, "\n  check: ");
                    print_gimple_stmt (dump_file, stmt, 0, 0);
                }
            }
        }
    }
}
开发者ID:paranoiacblack,项目名称:gcc,代码行数:49,代码来源:tree-chkp-opt.c


示例15: print_ssa_operands

void print_ssa_operands() {
    tree var;
    ssa_op_iter iter;
    gimple_stmt_iterator gsi;
    basic_block bb;

    fprintf (stdout, "Print all SSA operands\n");
    FOR_ALL_BB_FN(bb, cfun) {
        for (gsi = gsi_start_bb (bb);  !(gsi_end_p (gsi)); gsi_next(&gsi)) {
            gimple *stmt = gsi_stmt(gsi);
            FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_ALL_OPERANDS) {
                print_gimple_stmt(stdout, stmt,1, 1);
                print_generic_expr (stdout, var, TDF_SLIM);
                printf("\n");
                tree ref = get_inner_ref (var);
                if (ref)
                    printf ("Inner reference: %s\n", get_name(ref));
            }
        }
    }
开发者ID:cristina2689,项目名称:gcc,代码行数:20,代码来源:utils.c


示例16: chkp_remove_check_if_pass

/* Try to compare bounds value and address value
   used in the check CI.  If we can prove that check
   always pass then remove it.  */
static void
chkp_remove_check_if_pass (struct check_info *ci)
{
    int result = 0;

    if (dump_file && (dump_flags & TDF_DETAILS))
    {
        fprintf (dump_file, "Trying to remove check: ");
        print_gimple_stmt (dump_file, ci->stmt, 0, 0);
    }

    result = chkp_get_check_result (ci, ci->bounds);

    if (result == 1)
    {
        gimple_stmt_iterator i = gsi_for_stmt (ci->stmt);

        if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "  action: delete check (always pass)\n");

        gsi_remove (&i, true);
        unlink_stmt_vdef (ci->stmt);
        release_defs (ci->stmt);
        ci->stmt = NULL;
    }
    else if (result == -1)
    {
        if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "  action: keep check (always fail)\n");
        warning_at (gimple_location (ci->stmt), OPT_Wchkp,
                    "memory access check always fail");
    }
    else if (result == 0)
    {
        if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "  action: keep check (cannot compute result)\n");
    }
}
开发者ID:paranoiacblack,项目名称:gcc,代码行数:41,代码来源:tree-chkp-opt.c


示例17: dump_rdg_vertex

static void
dump_rdg_vertex (FILE *file, struct graph *rdg, int i)
{
  struct vertex *v = &(rdg->vertices[i]);
  struct graph_edge *e;

  fprintf (file, "(vertex %d: (%s%s) (in:", i,
	   RDG_MEM_WRITE_STMT (rdg, i) ? "w" : "",
	   RDG_MEM_READS_STMT (rdg, i) ? "r" : "");

  if (v->pred)
    for (e = v->pred; e; e = e->pred_next)
      fprintf (file, " %d", e->src);

  fprintf (file, ") (out:");

  if (v->succ)
    for (e = v->succ; e; e = e->succ_next)
      fprintf (file, " %d", e->dest);

  fprintf (file, ")\n");
  print_gimple_stmt (file, RDGV_STMT (v), 0, TDF_VOPS|TDF_MEMSYMS);
  fprintf (file, ")\n");
}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:24,代码来源:tree-loop-distribution.c


示例18: tree_estimate_loop_size

static bool
tree_estimate_loop_size (struct loop *loop, edge exit, edge edge_to_cancel, struct loop_size *size,
			 int upper_bound)
{
  basic_block *body = get_loop_body (loop);
  gimple_stmt_iterator gsi;
  unsigned int i;
  bool after_exit;
  vec<basic_block> path = get_loop_hot_path (loop);

  size->overall = 0;
  size->eliminated_by_peeling = 0;
  size->last_iteration = 0;
  size->last_iteration_eliminated_by_peeling = 0;
  size->num_pure_calls_on_hot_path = 0;
  size->num_non_pure_calls_on_hot_path = 0;
  size->non_call_stmts_on_hot_path = 0;
  size->num_branches_on_hot_path = 0;
  size->constant_iv = 0;

  if (dump_file && (dump_flags & TDF_DETAILS))
    fprintf (dump_file, "Estimating sizes for loop %i\n", loop->num);
  for (i = 0; i < loop->num_nodes; i++)
    {
      if (edge_to_cancel && body[i] != edge_to_cancel->src
	  && dominated_by_p (CDI_DOMINATORS, body[i], edge_to_cancel->src))
	after_exit = true;
      else
	after_exit = false;
      if (dump_file && (dump_flags & TDF_DETAILS))
	fprintf (dump_file, " BB: %i, after_exit: %i\n", body[i]->index, after_exit);

      for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi); gsi_next (&gsi))
	{
	  gimple *stmt = gsi_stmt (gsi);
	  int num = estimate_num_insns (stmt, &eni_size_weights);
	  bool likely_eliminated = false;
	  bool likely_eliminated_last = false;
	  bool likely_eliminated_peeled = false;

	  if (dump_file && (dump_flags & TDF_DETAILS))
	    {
	      fprintf (dump_file, "  size: %3i ", num);
	      print_gimple_stmt (dump_file, gsi_stmt (gsi), 0, 0);
	    }

	  /* Look for reasons why we might optimize this stmt away. */

	  if (gimple_has_side_effects (stmt))
	    ;
	  /* Exit conditional.  */
	  else if (exit && body[i] == exit->src
		   && stmt == last_stmt (exit->src))
	    {
	      if (dump_file && (dump_flags & TDF_DETAILS))
	        fprintf (dump_file, "   Exit condition will be eliminated "
			 "in peeled copies.\n");
	      likely_eliminated_peeled = true;
	    }
	  else if (edge_to_cancel && body[i] == edge_to_cancel->src
		   && stmt == last_stmt (edge_to_cancel->src))
	    {
	      if (dump_file && (dump_flags & TDF_DETAILS))
	        fprintf (dump_file, "   Exit condition will be eliminated "
			 "in last copy.\n");
	      likely_eliminated_last = true;
	    }
	  /* Sets of IV variables  */
	  else if (gimple_code (stmt) == GIMPLE_ASSIGN
	      && constant_after_peeling (gimple_assign_lhs (stmt), stmt, loop))
	    {
	      if (dump_file && (dump_flags & TDF_DETAILS))
	        fprintf (dump_file, "   Induction variable computation will"
			 " be folded away.\n");
	      likely_eliminated = true;
	    }
	  /* Assignments of IV variables.  */
	  else if (gimple_code (stmt) == GIMPLE_ASSIGN
		   && TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME
		   && constant_after_peeling (gimple_assign_rhs1 (stmt), stmt, loop)
		   && (gimple_assign_rhs_class (stmt) != GIMPLE_BINARY_RHS
		       || constant_after_peeling (gimple_assign_rhs2 (stmt),
		       				  stmt, loop)))
	    {
	      size->constant_iv = true;
	      if (dump_file && (dump_flags & TDF_DETAILS))
	        fprintf (dump_file, "   Constant expression will be folded away.\n");
	      likely_eliminated = true;
	    }
	  /* Conditionals.  */
	  else if ((gimple_code (stmt) == GIMPLE_COND
		    && constant_after_peeling (gimple_cond_lhs (stmt), stmt, loop)
		    && constant_after_peeling (gimple_cond_rhs (stmt), stmt, loop)
		    /* We don't simplify all constant compares so make sure
		       they are not both constant already.  See PR70288.  */
		    && (! is_gimple_min_invariant (gimple_cond_lhs (stmt))
			|| ! is_gimple_min_invariant (gimple_cond_rhs (stmt))))
		   || (gimple_code (stmt) == GIMPLE_SWITCH
		       && constant_after_peeling (gimple_switch_index (
						    as_a <gswitch *> (stmt)),
//.........这里部分代码省略.........
开发者ID:0day-ci,项目名称:gcc,代码行数:101,代码来源:tree-ssa-loop-ivcanon.c


示例19: my_dump_gimple


//.........这里部分代码省略.........
                            NULL, NULL);

                    /*
                     * Second wrap ARRAY_REF with ADDR_EXPR
                     */
                    ptr_desc_node = build1(ADDR_EXPR, 
                            const_char_restrict_ptr_type_node,
                            t);

                    /*
                     * I'm not sure why we need to use fold_convert()
                     * here, but if we do not, we cannot make the 
                     * compiling successful.
                     */
                    ptr_desc_node = fold_convert(
                            const_char_restrict_ptr_type_node, 
                            ptr_desc_node);

                    /*
                     * If is_gimple_min_invariant(ptr_desc_node)
                     * is true, we build a corrent argument, otherwise
                     * the argument is not suitable for gimple call
                     */
                    if(!is_gimple_min_invariant(ptr_desc_node))
                    {
                        printf("Something wrong with is_gimple_min_invariant\n");
                        return ;
                    }

                    /*
                     * This applies for a temporary variable
                     */
                    tmp_var = make_rename_temp(
                            const_char_restrict_ptr_type_node,
                            "plugin_var");

                    /*
                     * Build a gimple statement. Still remember that?
                     * <D.XXX> = (const char * restrict) "Hello, GCC!\n"
                     */
                    tmp_gstmt = gimple_build_assign(tmp_var, 
                                                    ptr_desc_node);

                    /*
                     * Check if the gimple statment is corrent
                     */
                    if(!is_gimple_assign(tmp_gstmt))
                    {
                        printf("tmp_gstmt is invalid\n");
                    }

                    printf("Insert gimple statment:");
                    print_gimple_stmt(stdout, tmp_gstmt, 0,
                                TDF_DETAILS | TDF_VERBOSE | TDF_TREE);
                    /*
                     * Insert the gimple statment into the basic block
                     */
                    gsi_insert_after(ptrgsi, tmp_gstmt, 
                            GSI_NEW_STMT);

                    if(is_gimple_operand(tmp_var))
                    {

                        printf("begin to insert printf\n");
                        yes = 1;
                        printf("Insert gimple statment:");
                        /*
                         * Insert the gimple statment printf 
                         * into the basic block
                         */
                        new_gnode = gimple_build_call(
                                funcdecl, 1, tmp_var);
                        print_gimple_stmt(stdout, new_gnode, 0, 0);
                        gsi_insert_after(ptrgsi, new_gnode, 
                                GSI_NEW_STMT); 
                    }
                    else
                    {
                        print_generic_stmt(stdout, ptr_desc_node, 
                                TDF_DETAILS | TDF_VERBOSE | TDF_TREE);
                        printf("Not Gimple Operands\n");
                    }

                    /*
                     * Since we have more than one consecutive statements 
                     * to insert, we can actually use build a gimple 
                     * sequence, insert all statement into the sequence, 
                     * and then insert the sequence into the basic block. 
                     * This seems to be a better method.
                     */
                }
            }
            else
            {
            }
            break;
        default:
            break;
    }
}
开发者ID:hopecream,项目名称:repo-codes,代码行数:101,代码来源:plugin.c


示例20: chkp_get_check_result

/* Return 1 if check CI against BOUNDS always pass,
   -1 if check CI against BOUNDS always fails and
   0 if we cannot compute check result.  */
static int
chkp_get_check_result (struct check_info *ci, tree bounds)
{
    gimple *bnd_def;
    address_t bound_val;
    int sign, res = 0;

    if (dump_file && (dump_flags & TDF_DETAILS))
    {
        fprintf (dump_file, "Trying to compute result of the check\n");
        fprintf (dump_file, "  check: ");
        print_gimple_stmt (dump_file, ci->stmt, 0, 0);
        fprintf (dump_file, "  address: ");
        chkp_print_addr (ci->addr);
        fprintf (dump_file, "\n  bounds: ");
        print_generic_expr (dump_file, bounds, 0);
        fprintf (dump_file, "\n");
    }

    if (TREE_CODE (bounds) != SSA_NAME)
    {
        if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "  result: bounds tree code is not ssa_name\n");
        return 0;
    }

    bnd_def = SSA_NAME_DEF_STMT (bounds);
    /* Currently we handle cases when bounds are result of bndmk
       or loaded static bounds var.  */
    if (gimple_code (bnd_def) == GIMPLE_CALL
            && gimple_call_fndecl (bnd_def) == chkp_bndmk_fndecl)
    {
        bound_val.pol.create (0);
        chkp_collect_value (gimple_call_arg (bnd_def, 0), bound_val);
        if (ci->type == CHECK_UPPER_BOUND)
        {
            address_t size_val;
            size_val.pol.create (0);
            chkp_collect_value (gimple_call_arg (bnd_def, 1), size_val);
            chkp_add_addr_addr (bound_val, size_val);
            size_val.pol.release ();
            chkp_add_addr_item (bound_val, integer_minus_one_node, NULL);
        }
    }
    else if (gimple_code (bnd_def) == GIMPLE_ASSIGN
             && gimple_assign_rhs1 (bnd_def) == chkp_get_zero_bounds_var ())
    {
        if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "  result: always pass with zero bounds\n");
        return 1;
    }
    else if (gimple_code (bnd_def) == GIMPLE_ASSIGN
             && gimple_assign_rhs1 (bnd_def) == chkp_get_none_bounds_var ())
    {
        if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "  result: always fails with none bounds\n");
        return -1;
    }
    else if (gimple_code (bnd_def) == GIMPLE_ASSIGN
             && TREE_CODE (gimple_assign_rhs1 (bnd_def)) == VAR_DECL)
    {
        tree bnd_var = gimple_assign_rhs1 (bnd_def);
        tree var;
        tree size;

        if (!DECL_INITIAL (bnd_var)
                || DECL_INITIAL (bnd_var) == error_mark_node)
        {
            if (dump_file && (dump_flags & TDF_DETAILS))
                fprintf (dump_file, "  result: cannot compute bounds\n");
            return 0;
        }

        gcc_assert (TREE_CODE (DECL_INITIAL (bnd_var)) == ADDR_EXPR);
        var = TREE_OPERAND (DECL_INITIAL (bnd_var), 0);

        bound_val.pol.create (0);
        chkp_collect_value (DECL_INITIAL (bnd_var), bound_val);
        if (ci->type == CHECK_UPPER_BOUND)
        {
            if (TREE_CODE (var) == VAR_DECL)
            {
                if (DECL_SIZE (var)
                        && !chkp_variable_size_type (TREE_TYPE (var)))
                    size = DECL_SIZE_UNIT (var);
                else
                {
                    if (dump_file && (dump_flags & TDF_DETAILS))
                        fprintf (dump_file, "  result: cannot compute bounds\n");
                    return 0;
                }
            }
            else
            {
                gcc_assert (TREE_CODE (var) == STRING_CST);
                size = build_int_cst (size_type_node,
                                      TREE_STRING_LENGTH (var));
//.........这里部分代码省略.........
开发者ID:paranoiacblack,项目名称:gcc,代码行数:101,代码来源:tree-chkp-opt.c



注:本文中的print_gimple_stmt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ print_graph函数代码示例发布时间:2022-05-30
下一篇:
C++ print_generic_expr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap