当前位置: 首页>>代码示例>>C++>>正文


C++ print_gimple_stmt函数代码示例

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


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


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