/* Calculate branch probabilities, and basic block execution counts.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
based on some ideas from Dain Samples of UC Berkeley.
Further mangling by Bob Manson, Cygnus Support.
tree tmp1 = create_tmp_var (gcov_type_node, "PROF");
tree tmp2 = create_tmp_var (gcov_type_node, "PROF");
tree ref = tree_coverage_counter_ref (GCOV_COUNTER_ARCS, edgeno);
- tree stmt1 = build2 (GIMPLE_MODIFY_STMT, gcov_type_node, tmp1, ref);
- tree stmt2 = build2 (GIMPLE_MODIFY_STMT, gcov_type_node, tmp2,
- build2 (PLUS_EXPR, gcov_type_node,
- tmp1, integer_one_node));
- tree stmt3 = build2 (GIMPLE_MODIFY_STMT, gcov_type_node, ref, tmp2);
+ tree one = build_int_cst (gcov_type_node, 1);
+ tree stmt1 = build_gimple_modify_stmt (tmp1, ref);
+ tree stmt2 = build_gimple_modify_stmt (tmp2,
+ build2 (PLUS_EXPR, gcov_type_node,
+ tmp1, one));
+ tree stmt3 = build_gimple_modify_stmt (ref, tmp2);
bsi_insert_on_edge (e, stmt1);
bsi_insert_on_edge (e, stmt2);
bsi_insert_on_edge (e, stmt3);
{
tree val = value->hvalue.value;
return force_gimple_operand_bsi (bsi, fold_convert (gcov_type_node, val),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
}
/* Output instructions as GIMPLE trees to increment the interval histogram
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
val = prepare_instrumented_value (&bsi, value);
call = build_call_expr (tree_interval_profiler_fn, 4,
ref_ptr, val, start, steps);
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
val = prepare_instrumented_value (&bsi, value);
call = build_call_expr (tree_pow2_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
val = prepare_instrumented_value (&bsi, value);
call = build_call_expr (tree_one_value_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
/* Insert code:
*/
tmp1 = create_tmp_var (ptr_void, "PROF");
- stmt1 = build2 (GIMPLE_MODIFY_STMT,
- build_pointer_type (get_gcov_type ()),
- ic_gcov_type_ptr_var, ref_ptr);
- stmt2 = build2 (GIMPLE_MODIFY_STMT, ptr_void, tmp1,
- unshare_expr (value->hvalue.value));
- stmt3 = build2 (GIMPLE_MODIFY_STMT, ptr_void,
- ic_void_ptr_var, tmp1);
+ stmt1 = build_gimple_modify_stmt (ic_gcov_type_ptr_var, ref_ptr);
+ stmt2 = build_gimple_modify_stmt (tmp1, unshare_expr (value->hvalue.value));
+ stmt3 = build_gimple_modify_stmt (ic_void_ptr_var, tmp1);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
cur_func = force_gimple_operand_bsi (&bsi,
build_addr (current_function_decl,
current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE,
+ true, BSI_SAME_STMT);
tree_uid = build_int_cst (gcov_type_node, c_node->pid);
stmt1 = build_call_expr (tree_indirect_call_profiler_fn, 4,
ic_gcov_type_ptr_var,
tree_uid,
cur_func,
ic_void_ptr_var);
- bsi_insert_after (&bsi, stmt1, BSI_SAME_STMT);
+ bsi_insert_after (&bsi, stmt1, BSI_NEW_STMT);
}
}
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE,
+ true, BSI_SAME_STMT);
val = prepare_instrumented_value (&bsi, value);
call = build_call_expr (tree_average_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
val = prepare_instrumented_value (&bsi, value);
call = build_call_expr (tree_ior_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);