/* Transformations based on profile information for values.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of GCC.
#include "system.h"
#include "coretypes.h"
#include "tm.h"
+#include "alias.h"
+#include "symtab.h"
#include "tree.h"
+#include "fold-const.h"
#include "tree-nested.h"
#include "calls.h"
#include "rtl.h"
-#include "expr.h"
#include "hard-reg-set.h"
-#include "predict.h"
-#include "vec.h"
-#include "hashtab.h"
-#include "hash-set.h"
-#include "machmode.h"
-#include "input.h"
#include "function.h"
+#include "flags.h"
+#include "insn-config.h"
+#include "expmed.h"
+#include "dojump.h"
+#include "explow.h"
+#include "emit-rtl.h"
+#include "varasm.h"
+#include "stmt.h"
+#include "expr.h"
+#include "predict.h"
#include "dominance.h"
#include "cfg.h"
#include "basic-block.h"
#include "value-prof.h"
-#include "flags.h"
-#include "insn-config.h"
#include "recog.h"
#include "insn-codes.h"
#include "optabs.h"
#include "internal-fn.h"
#include "tree-eh.h"
#include "gimple-expr.h"
-#include "is-a.h"
#include "gimple.h"
#include "gimplify.h"
#include "gimple-iterator.h"
#include "diagnostic.h"
#include "gimple-pretty-print.h"
#include "coverage.h"
-#include "tree.h"
#include "gcov-io.h"
#include "timevar.h"
#include "dumpfile.h"
#include "profile.h"
-#include "hash-map.h"
-#include "plugin-api.h"
-#include "ipa-ref.h"
#include "cgraph.h"
#include "data-streamer.h"
#include "builtins.h"
-#include "tree-nested.h"
#include "params.h"
#include "tree-chkp.h"
unsigned int i;
fprintf (dump_file, " [");
for (i = 0; i < hist->hdata.intvl.steps; i++)
- fprintf (dump_file, " %d:%"PRId64,
+ fprintf (dump_file, " %d:%" PRId64,
hist->hdata.intvl.int_start + i,
(int64_t) hist->hvalue.counters[i]);
- fprintf (dump_file, " ] outside range:%"PRId64,
+ fprintf (dump_file, " ] outside range:%" PRId64,
(int64_t) hist->hvalue.counters[i]);
}
fprintf (dump_file, ".\n");
fprintf (dump_file, "Pow2 counter ");
if (hist->hvalue.counters)
{
- fprintf (dump_file, "pow2:%"PRId64
- " nonpow2:%"PRId64,
+ fprintf (dump_file, "pow2:%" PRId64
+ " nonpow2:%" PRId64,
(int64_t) hist->hvalue.counters[0],
(int64_t) hist->hvalue.counters[1]);
}
fprintf (dump_file, "Single value ");
if (hist->hvalue.counters)
{
- fprintf (dump_file, "value:%"PRId64
- " match:%"PRId64
- " wrong:%"PRId64,
+ fprintf (dump_file, "value:%" PRId64
+ " match:%" PRId64
+ " wrong:%" PRId64,
(int64_t) hist->hvalue.counters[0],
(int64_t) hist->hvalue.counters[1],
(int64_t) hist->hvalue.counters[2]);
fprintf (dump_file, "Average value ");
if (hist->hvalue.counters)
{
- fprintf (dump_file, "sum:%"PRId64
- " times:%"PRId64,
+ fprintf (dump_file, "sum:%" PRId64
+ " times:%" PRId64,
(int64_t) hist->hvalue.counters[0],
(int64_t) hist->hvalue.counters[1]);
}
fprintf (dump_file, "IOR value ");
if (hist->hvalue.counters)
{
- fprintf (dump_file, "ior:%"PRId64,
+ fprintf (dump_file, "ior:%" PRId64,
(int64_t) hist->hvalue.counters[0]);
}
fprintf (dump_file, ".\n");
fprintf (dump_file, "Constant delta ");
if (hist->hvalue.counters)
{
- fprintf (dump_file, "value:%"PRId64
- " match:%"PRId64
- " wrong:%"PRId64,
+ fprintf (dump_file, "value:%" PRId64
+ " match:%" PRId64
+ " wrong:%" PRId64,
(int64_t) hist->hvalue.counters[0],
(int64_t) hist->hvalue.counters[1],
(int64_t) hist->hvalue.counters[2]);
fprintf (dump_file, "Indirect call ");
if (hist->hvalue.counters)
{
- fprintf (dump_file, "value:%"PRId64
- " match:%"PRId64
- " all:%"PRId64,
+ fprintf (dump_file, "value:%" PRId64
+ " match:%" PRId64
+ " all:%" PRId64,
(int64_t) hist->hvalue.counters[0],
(int64_t) hist->hvalue.counters[1],
(int64_t) hist->hvalue.counters[2]);
fprintf (dump_file, "Time profile ");
if (hist->hvalue.counters)
{
- fprintf (dump_file, "time:%"PRId64,
+ fprintf (dump_file, "time:%" PRId64,
(int64_t) hist->hvalue.counters[0]);
}
fprintf (dump_file, ".\n");
{
int i;
- fprintf (dump_file, "accu:%"PRId64, hist->hvalue.counters[0]);
+ fprintf (dump_file, "accu:%" PRId64, hist->hvalue.counters[0]);
for (i = 1; i < (GCOV_ICALL_TOPN_VAL << 2); i += 2)
{
- fprintf (dump_file, " target:%"PRId64 " value:%"PRId64,
+ fprintf (dump_file, " target:%" PRId64 " value:%" PRId64,
(int64_t) hist->hvalue.counters[i],
(int64_t) hist->hvalue.counters[i+1]);
}
bb1end = stmt3;
tmp2 = create_tmp_reg (optype, "PROF");
- stmt1 = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt), tmp2,
- op1, tmp0);
+ stmt1 = gimple_build_assign (tmp2, gimple_assign_rhs_code (stmt), op1, tmp0);
gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb2end = stmt1;
- stmt1 = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt), tmp2,
- op1, op2);
+ stmt1 = gimple_build_assign (tmp2, gimple_assign_rhs_code (stmt), op1, op2);
gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb3end = stmt1;
result = create_tmp_reg (optype, "PROF");
tmp2 = make_temp_ssa_name (optype, NULL, "PROF");
tmp3 = make_temp_ssa_name (optype, NULL, "PROF");
- stmt2 = gimple_build_assign_with_ops (PLUS_EXPR, tmp2, op2,
- build_int_cst (optype, -1));
- stmt3 = gimple_build_assign_with_ops (BIT_AND_EXPR, tmp3, tmp2, op2);
+ stmt2 = gimple_build_assign (tmp2, PLUS_EXPR, op2,
+ build_int_cst (optype, -1));
+ stmt3 = gimple_build_assign (tmp3, BIT_AND_EXPR, tmp2, op2);
stmt4 = gimple_build_cond (NE_EXPR, tmp3, build_int_cst (optype, 0),
NULL_TREE, NULL_TREE);
gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
bb1end = stmt4;
/* tmp2 == op2-1 inherited from previous block. */
- stmt1 = gimple_build_assign_with_ops (BIT_AND_EXPR, result, op1, tmp2);
+ stmt1 = gimple_build_assign (result, BIT_AND_EXPR, op1, tmp2);
gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb2end = stmt1;
- stmt1 = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt), result,
- op1, op2);
+ stmt1 = gimple_build_assign (result, gimple_assign_rhs_code (stmt),
+ op1, op2);
gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb3end = stmt1;
if (ncounts) /* Assumed to be 0 or 1 */
{
- stmt1 = gimple_build_assign_with_ops (MINUS_EXPR, result, result, tmp1);
+ stmt1 = gimple_build_assign (result, MINUS_EXPR, result, tmp1);
stmt2 = gimple_build_cond (LT_EXPR, result, tmp1, NULL_TREE, NULL_TREE);
gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
}
/* Fallback case. */
- stmt1 = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt), result,
- result, tmp1);
+ stmt1 = gimple_build_assign (result, gimple_assign_rhs_code (stmt),
+ result, tmp1);
gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
bb3end = stmt1;
return true;
}
-struct profile_id_traits : default_hashmap_traits
-{
- template<typename T>
- static bool
- is_deleted (T &e)
- {
- return e.m_key == UINT_MAX;
- }
-
- template<typename T> static bool is_empty (T &e) { return e.m_key == 0; }
- template<typename T> static void mark_deleted (T &e) { e.m_key = UINT_MAX; }
- template<typename T> static void mark_empty (T &e) { e.m_key = 0; }
-};
+typedef int_hash <unsigned int, 0, UINT_MAX> profile_id_hash;
-static hash_map<unsigned int, cgraph_node *, profile_id_traits> *
-cgraph_node_map = 0;
+static hash_map<profile_id_hash, cgraph_node *> *cgraph_node_map = 0;
/* Returns true if node graph is initialized. This
is used to test if profile_id has been created
init_node_map (bool local)
{
struct cgraph_node *n;
- cgraph_node_map
- = new hash_map<unsigned int, cgraph_node *, profile_id_traits>;
+ cgraph_node_map = new hash_map<profile_id_hash, cgraph_node *>;
FOR_EACH_DEFINED_FUNCTION (n)
if (n->has_gimple_body_p ())
PHI_ARG_DEF_FROM_EDGE (phi, e_eh));
}
}
+ if (!stmt_could_throw_p (dcall_stmt))
+ gimple_purge_dead_eh_edges (dcall_bb);
return dcall_stmt;
}
print_generic_expr (dump_file, direct_call->decl, TDF_SLIM);
fprintf (dump_file, " transformation on insn postponned to ipa-profile");
print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
- fprintf (dump_file, "hist->count %"PRId64
- " hist->all %"PRId64"\n", count, all);
+ fprintf (dump_file, "hist->count %" PRId64
+ " hist->all %" PRId64"\n", count, all);
}
return true;