/* Transformations based on profile information for values.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
int write;
histogram_value hist;
- if (!INSN_P (insn))
+ /* It only makes sense to look for memory references in ordinary insns. */
+ if (GET_CODE (insn) != INSN)
return false;
if (!find_mem_reference (insn, &mem, &write))
rtl_find_values_to_profile (histogram_values *values)
{
rtx insn;
- unsigned i;
+ unsigned i, libcall_level;
life_analysis (NULL, PROP_DEATH_NOTES);
*values = VEC_alloc (histogram_value, 0);
+ libcall_level = 0;
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- insn_values_to_profile (insn, values);
+ {
+ if (find_reg_note (insn, REG_LIBCALL, NULL_RTX))
+ libcall_level++;
+
+ /* Do not instrument values inside libcalls (we are going to split block
+ due to instrumentation, and libcall blocks should be local to a single
+ basic block). */
+ if (!libcall_level)
+ insn_values_to_profile (insn, values);
+
+ if (find_reg_note (insn, REG_RETVAL, NULL_RTX))
+ {
+ gcc_assert (libcall_level > 0);
+ libcall_level--;
+ }
+ }
+ gcc_assert (libcall_level == 0);
for (i = 0; i < VEC_length (histogram_value, *values); i++)
{
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
allocate_reg_info (max_reg_num (), FALSE, FALSE);
static bool
mod_subtract_transform (rtx insn)
{
- rtx set, set_src, set_dest, op1, op2, value, histogram;
+ rtx set, set_src, set_dest, op1, op2, histogram;
enum rtx_code code;
enum machine_mode mode;
gcov_type wrong_values, counts[2], count, all;
return false;
histogram = XEXP (XEXP (histogram, 0), 1);
- value = XEXP (histogram, 0);
histogram = XEXP (histogram, 1);
all = 0;
rtl_register_value_prof_hooks (void)
{
value_prof_hooks = &rtl_value_prof_hooks;
- if (ir_type ())
- abort ();
+ gcc_assert (!ir_type ());
}
\f
/* Tree-based versions are stubs for now. */
static void
tree_find_values_to_profile (histogram_values *values ATTRIBUTE_UNUSED)
{
- abort ();
+ gcc_unreachable ();
}
static bool
tree_value_profile_transformations (void)
{
- abort ();
+ gcc_unreachable ();
}
static struct value_prof_hooks tree_value_prof_hooks = {
tree_register_value_prof_hooks (void)
{
value_prof_hooks = &tree_value_prof_hooks;
- if (!ir_type ())
- abort ();
+ gcc_assert (ir_type ());
}
\f
/* IR-independent entry points. */