int cse_dump = 0;
int loop_dump = 0;
int cse2_dump = 0;
+int branch_prob_dump = 0;
int flow_dump = 0;
int combine_dump = 0;
int sched_dump = 0;
int profile_block_flag;
+/* Nonzero if generating code to profile program flow graph arcs. */
+
+int profile_arc_flag = 0;
+
+/* Nonzero if generating info for gcov to calculate line test coverage. */
+
+int flag_test_coverage = 0;
+
+/* Nonzero indicates that branch taken probabilities should be calculated. */
+
+int flag_branch_probabilities = 0;
+
/* Nonzero for -pedantic switch: warn about anything
that standard spec forbids. */
{"pic", &flag_pic, 1},
{"PIC", &flag_pic, 2},
{"exceptions", &flag_exceptions, 1},
+ {"profile-arcs", &profile_arc_flag, 1},
+ {"test-coverage", &flag_test_coverage, 1},
+ {"branch-probabilities", &flag_branch_probabilities, 1},
{"fast-math", &flag_fast_math, 1},
{"common", &flag_no_common, 0},
{"inhibit-size-directive", &flag_inhibit_size_directive, 1},
FILE *cse_dump_file;
FILE *loop_dump_file;
FILE *cse2_dump_file;
+FILE *branch_prob_dump_file;
FILE *flow_dump_file;
FILE *combine_dump_file;
FILE *sched_dump_file;
int cse_time;
int loop_time;
int cse2_time;
+int branch_prob_time;
int flow_time;
int combine_time;
int sched_time;
cse_time = 0;
loop_time = 0;
cse2_time = 0;
+ branch_prob_time = 0;
flow_time = 0;
combine_time = 0;
sched_time = 0;
but the options would have to be parsed first to know that. -bson */
init_rtl ();
init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
- || debug_info_level == DINFO_LEVEL_VERBOSE);
+ || debug_info_level == DINFO_LEVEL_VERBOSE
+ || flag_test_coverage);
init_regs ();
init_decl_processing ();
init_optabs ();
if (cse2_dump)
cse2_dump_file = open_dump_file (dump_base_name, ".cse2");
+ /* If branch_prob dump desired, open the output file. */
+ if (branch_prob_dump)
+ branch_prob_dump_file = open_dump_file (dump_base_name, ".bp");
+
/* If flow dump desired, open the output file. */
if (flow_dump)
flow_dump_file = open_dump_file (dump_base_name, ".flow");
if (!output_bytecode)
init_final (main_input_filename);
+ init_branch_prob (dump_base_name);
start_time = get_run_time ();
poplevel (0, 0, 0);
}
+ output_func_start_profiler ();
+
/* Compilation is now finished except for writing
what's left of the symbol table output. */
if (!output_bytecode)
{
- end_final (main_input_filename);
+ end_final (dump_base_name);
+ end_branch_prob (branch_prob_dump_file);
#ifdef ASM_FILE_END
ASM_FILE_END (asm_out_file);
if (cse2_dump)
fclose (cse2_dump_file);
+ if (branch_prob_dump)
+ fclose (branch_prob_dump_file);
+
if (flow_dump)
fclose (flow_dump_file);
print_time ("cse", cse_time);
print_time ("loop", loop_time);
print_time ("cse2", cse2_time);
+ print_time ("branch-probabilities", branch_prob_time);
print_time ("flow", flow_time);
print_time ("combine", combine_time);
print_time ("sched", sched_time);
fflush (cse2_dump_file);
});
+ if (branch_prob_dump)
+ TIMEVAR (dump_time,
+ {
+ fprintf (branch_prob_dump_file, "\n;; Function %s\n\n",
+ IDENTIFIER_POINTER (DECL_NAME (decl)));
+ });
+
+ if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
+ TIMEVAR (branch_prob_time,
+ {
+ branch_prob (insns, branch_prob_dump_file);
+ });
+
+ if (branch_prob_dump)
+ TIMEVAR (dump_time,
+ {
+ print_rtl (branch_prob_dump_file, insns);
+ fflush (branch_prob_dump_file);
+ });
/* We are no longer anticipating cse in this function, at least. */
cse_not_expected = 1;
switch (*p++)
{
case 'a':
+ branch_prob_dump = 1;
combine_dump = 1;
dbr_sched_dump = 1;
flow_dump = 1;
sched2_dump = 1;
stack_reg_dump = 1;
break;
+ case 'b':
+ branch_prob_dump = 1;
+ break;
case 'k':
stack_reg_dump = 1;
break;