Commit Graph

128 Commits

Author SHA1 Message Date
Jan Hubicka
c4f81e4a6b predict.c (estimate_probability): Avoid duplicated predictions.
* predict.c (estimate_probability): Avoid duplicated predictions.

	* loop.c (find_and_verify_loops): Grok multiple barriers.

From-SVN: r44369
2001-07-25 22:23:09 +00:00
Diego Novillo
2b1d9dc0ef basic-block.h (tree_node): Forward declare if needed.
2001-07-09  Diego Novillo  <dnovillo@redhat.com>

	* basic-block.h (tree_node): Forward declare if needed.
	(struct basic_block_def): Add fields 'head_tree' and 'end_tree'.
	(BLOCK_HEAD_TREE): Define.
	(BLOCK_END_TREE): Define.
	(struct loops): Rename field 'tree' to 'tree_root'.
	* flow.c (entry_exit_blocks): Add initializers for 'head_tree' and
	'end_tree'.
	(flow_loops_tree_build): Rename reference to field 'tree' to
	'tree_root'.
	(flow_loops_level_compute): Ditto.
	* predict.c (estimate_bb_frequencies): Ditto.
	* tree.h (struct tree_common): Add field 'aux'.

From-SVN: r43886
2001-07-09 23:50:25 -04:00
Jan van Male
35d6d8c165 Also, fix formatting problem in previous ChangeLog commit.
2001-06-28  Jan van Male  <jan.vanmale@fenk.wau.nl>

	* predict.c (dump_prediction): Eliminate fprintf warning.

From-SVN: r43650
2001-06-29 00:46:11 -04:00
Jan Hubicka
44f498639c predict.c (block_info_def): Add nvisited.
* predict.c (block_info_def): Add nvisited.
	(propagate_freq): Count nvisited; re-queue delayed blocks; handle
	irreducible regions.

	* flow.c (dump_edge_info): Dump the probability of edge.
	(combine_predictions_for_insn): Dump the basic block.

From-SVN: r43522
2001-06-22 23:19:22 +00:00
Toshiyasu Morita
1b28186a60 predict.c: (expected_value_to_br_prob): Check for const_true_rtx instead of const1_rtx for...
* predict.c: (expected_value_to_br_prob): Check for const_true_rtx
        instead of const1_rtx for true case.

From-SVN: r43517
2001-06-22 15:08:51 -07:00
Jan Hubicka
25c3a4ef2e predict.c (estimate_bb_frequencies): Do not handle conditional jumps jumping to fallthru basic block as conditional...
* predict.c (estimate_bb_frequencies): Do not handle conditional
	jumps jumping to fallthru basic block as conditional jumps.

	* tm.texi (GCOV_TYPE_SIZE): Document.
	* basic-block.h (gcov_type): Define.
	(struct edge_def): Use gcov_type for count field.
	(struct basic_block_def): Likewise.
	* defaults.h (GCOV_TYPE_SIZE): Define.
	* final.c (end_final): Use GCOV_TYPE_SIZE.
	* flow.c (dump_edge_info, dump_flow_info, dump_bb): Print count fields
	using HOST_WIDEST_INT_PRINT_DEC.
	* gcov-io.h (__fetch_gcov_type, __store_gcov_type, __read_gcov_type,
	__write_gcov_type): New.
	(store_long): Remove.
	* gcov.c (gcov_type): Set default.
	(struct adj_list): Use gcov_type for arc_count.
	(bb_info): Use gcov_type for succ_count, pred_count and exec_count.
	(create_program_flow_graph): Read arc_count properly.
	(solve_program_flow_graph): 'total' is gcov_type.
	(output_data): Line_counts is gcov_type, print it properly.
	* libgcc2.c (struct bb): Counts is gcov_type.
	(__bb_exit_func): Use __read_gcov_type and __write_gcov_type.
	* profile.c (LONG_TYPE_SIZE, LONG_LONG_TYPE_SIZE): Set default.
	(GCOV_TYPE_SIZE): Define.
	(struct bb_info): succ_count and pred_count is gcov_type.
	(compute_branch_probabilities): Use __read_gcov_type,
	print read edges to the dump file.
	(total): Is gcov_type.
	(gen_edge_profiler): Use GCOV_TYPE_SIZE.

From-SVN: r43506
2001-06-22 17:23:14 +00:00
Jan Hubicka
86e5b1b905 * predict.c (estimate_probability): Fix loop bounds.
From-SVN: r43478
2001-06-20 19:55:43 +00:00
Jan Hubicka
861f9cd090 predict.c (estimate_loops_at_level, [...]): New functions.
* predict.c (estimate_loops_at_level, propagate_freq
	estimate_bb_frequencies, count_to_freqs): New functions.
	(estimate_probability): Call estimate_bb_frequencies.
	* basic-block.h (basic_block_def): Add field "freq".
	(BB_FREQ_MAX): New constant.

From-SVN: r43476
2001-06-20 17:10:11 +00:00
Jan Hubicka
923cbdc322 unroll.c: Include predict.h.
* unroll.c: Include predict.h.
	(unroll_loop): Drop prediction notes on preconditioning.
	* predict.def (PRED_LOOP_PRECONDITIONG, PRED_LOOP_CONDITION):
	New; add comments on the others.
	* Makefile.in: (unroll.o): Add dependancy on predict.h.
	* loop.c (strength_reduce): Fix branch prediction.

	* stmt.c (emit_case_nodes): Optimize test whether index is in given
	interval.

	* predict.c (estimate_probability): Do not bail out early
	when note is present.
	(combine_predictions_for_insn): Fix note removal code.

From-SVN: r43441
2001-06-18 15:35:47 +00:00
Jan Hubicka
0b92ff33b8 predict.def (PRED_CALL, [...]): New.
* predict.def (PRED_CALL, PRED_ERROR_RETURN): New.
	* predict.c (estimate_probability): Calculate dominance
	information; improve detection of NORETURN heuristics;
	add call/error_return heuiristics; tweak comparison heuristics
	to recognize -1.

From-SVN: r43130
2001-06-10 08:01:57 +00:00
Jan Hubicka
4db384c950 predict.def: New file.
* predict.def: New file.
	* predict.h: New file.
	* predict.c: Include predict.h.
	(predictor_info): New structure and array.
	(predict_edge, predict_insn): Rewrite; make global.
	(predict_edge_def, predict_insn_def): New global functions.
	(dump_prediction, combine_predictions_for_insns): New
	static functions.
	(estimate_probability): Change calls to predict_edge
	to predict_edge_def and calls to predict_insn to predict_insn_def;
	combine probabilities.
	(expected_value_to_br_prob): Behave as predictor.
	* rtl.h (REG_BR_PRED): Update coment.
	(invert_br_probabilities): New.
	* jump.c: Include predict.h
	(duplicate_loop_exit_test): Drop branch prediction notes.
	(invert_jump): Use invert_br_probabilities.
	* Makefile.in: Add dependancy on predict.h for jump and predict pass.
	* ifcvt.c (dead_or_predicable): Use invert_br_probabilities.
	* combine.c (distribute_notes): Handle BR_PRED.

From-SVN: r43115
2001-06-09 22:39:25 +00:00
Jan Hubicka
ee92cb46db predict.c (predict_insn, [...]): New static functions.
* predict.c (predict_insn, predict_edge): New static functions.
	(estimate_probability): Revamp to use new functions;
	fix loop header heruistics; add loop exist heruistics

From-SVN: r43109
2001-06-09 21:30:50 +00:00
Richard Henderson
5e7f4a4ab9 mkconfig.sh: Include insn-flags.h.
* mkconfig.sh: Include insn-flags.h.
	* Makefile.in (CONFIG_H): Include insn-flags.h.
	(lots of objects): Remove insn-codes.h and insn-flags.h.

	* alias.c, bb-reorder.c, calls.c, do-loop.c, flow.c, haifa-sched.c,
	integrate.c, jump.c, loop.c, predict.c, profile.c, reg-stack.c,
	regmove.c, reorg.c, a29k/a29k.c, alpha/alpha.c, arc/arc.c, arm/arm.c,
	avr/avr.c, clipper/clipper.c, convex/convex.c, d30v/d30v.c,
	dsp16xx/dsp16xx.c, fr30/fr30.c, h8300/h8300.c, i370/i370.c,
	i386/i386.c, i860/i860.c, ia64/ia64.c, m32r/m32r.c, m68hc11/m68hc11.c,
	m68k/m68k.c, m88k/m88k.c, mcore/mcore.c, mn10200/mn10200.c,
	mn10300/mn10300.c, ns32k/ns32k.c, pa/pa.c, pdp11/pdp11.c,
	pj/pj.c, romp/romp.c, rs6000/rs6000.c, sh/sh.c, sparc/sparc.c,
	v850/v850.c, vax/vax.c:
	Don't include insn-flags.h.

	* diagnostic.c, expr.h, reload.c, toplev.c:
	Don't include insn-codes.h.

	* builtins.c, combine.c, except.c, explow.c, expmed.c, expr.c,
	final.c, function.c, optabs.c, recog.c, reload1.c, stmt.c,
	c4x/c4x.c, i960/i960.c, mips/mips.c:
	Don't include insn-codes.h or insn-flags.h.

	* genemit.c, genopinit.c, genoutput.c: Don't include insn-codes.h
	or insn-flags.h in the generated code.
	* genflags.c (gen_proto): Use "struct rtx_def *" instead of "rtx".
	(main): Forward declare struct rtx_def.

From-SVN: r40754
2001-03-22 10:48:52 -08:00
Jan Hubicka
90a747032a simplify-rtx.c (cfc_args): add "unordered" field.
* simplify-rtx.c (cfc_args): add "unordered" field.
	(check_fold_consts): Set unordered field.
	(simplify_relational_operation): Simplify the unordered
	comparisons.

	* reg-stack.c (swap_rtx_condition): Ensure that the transformation
	is valid.

	* emit-rtl.c (try_split): Fix code to mark labels.
	* jump.c (mark_jump_label): Make global.
	* rtl.h (mark_jump_label): Declare.

	* predict.c (estimate_probability): Handle unordred comparisons.

From-SVN: r38711
2001-01-05 15:34:39 +00:00
John David Anglin
3502dc9cd3 function.h (emit_status): Delete member regno_pointer_flag and rename regno_pointer_flag_length to...
* function.h (emit_status): Delete member regno_pointer_flag and
	rename regno_pointer_flag_length to regno_pointer_align_length.
	Delete define for REGNO_POINTER_FLAG.
	* integrate.h (inline_remap): Delete member regno_pointer_flag.
	Add member x_regno_reg_rtx.
	* rtl.h (rtx_def): Use frame_related bit to indicate register is
	a pointer in REG expressions.  Define REG_POINTER macro.
	* alias.c (find_base_value, find_base_term): Use REG_POINTER
	instead of REGNO_POINTER_FLAG.
	* combine.c (nonzero_bits, num_sign_bit_copies): Likewise.
	* emit-rtl.c (gen_reg_rtx): Use regno_pointer_align_length instead
	of regno_pointer_flag_length.  Remove code which refers to
	regno_pointer_flag.
	(mark_reg_pointer): Use REG_POINTER.
	(free_emit_status): Remove code which refers to regno_pointer_flag.
	(init_emit, mark_emit_status): Likewise.
	* flow.c (dump_flow_info): Likewise.
	* function.c (preserve_temp_slots): Likewise.
	* integrate.c (expand_inline_function, copy_rtx_and_substitute):
	Use x_regno_reg_rtx instead of regno_pointer_flag for function
	pointer determination in map.
	* loop.c (strength_reduce, maybe_eliminate_biv_1): Use REG_POINTER.
	* predict.c (estimate_probability): Likewise.
	* regclass.c (record_address_regs, reg_scan_mark_refs): Likewise.
	* unroll.c (unroll_loop): Use x_regno_reg_rtx instead of
	regno_pointer_flag for function pointer determination in map.
	* convex.h (RTX_COSTS): Don't test regno_pointer_flag and use
	REG_POINTER.
	* pa.c (hppa_legitimize_address, emit_move_sequence, basereg_operand):
	Use REG_POINTER.
	(restore_unscaled_index_insn_codes): Revise comment.

From-SVN: r37863
2000-11-29 23:31:19 -07:00
Richard Kenner
efc9bd412d cse.c (cse_basic_block): Only call find_reg_note if REG_NOTES not 0.
* cse.c (cse_basic_block): Only call find_reg_note if REG_NOTES not 0.
	* reload.c (find_equiv_reg): Likewise.
	* alias.c (init_alias_analysis): Likewise.
	Only call prologue_epilogue_contains on insns.
	* basic-block.h (REG_SET_TO_HARD_REG_SET): Call new function.
	* bb-reorder.c (hard-reg-set.h): Include earlier.
	* haifa-sched.c (hard-reg-set.h): Likewise.
	* ifcvt.c (hard-reg-set.h): Likewise.
	* local-alloc.c (hard-reg-set.h): Likewise.
	* loop.c (hard-reg-set.h): Likewise.
	* predict.c (hard-reg-set.h): Likewise.
	* regrename.c (hard-reg-set.h): Likewise.
	* flow.c (hard-reg-set.h): Likewise.
	(reg_set_to_hard_reg_set): New function.
	* bitmap.c (regs.h, basic-block.h): No longer include.
	(bitmap.h): Now include.
	* conflict.c (hard-reg-set.h): Include.
	* profile.c (hard-reg-set.h): Likewise.
	* print-rtl.c (hard-reg-set.h): Likewise.
	* sbitmap.c (hard-reg-set.h): Likewise.
	* toplev.c (hard-reg-set.h): Likewise.
	* unroll.c (hard-reg-set.h, basic-block.h): Likewise.
	* hard-reg-set.h (reg_names): Now constant.
	* regs.h (reg_names): Likewise.
	* regclass.c (reg_names): Likewise.
	* loop.h (basic-block.h): No longer include.
	(bitmap.h): Now include.
	* reload1.c (order_regs_for_reload): Avoid loop over reg sets.
	* Makefile.in (LOOP_H, sbitmap.o, profile.o): Reflect above changes.
	(toplev.o, print-rtl.o, conflict.o, unroll.o, bitmap.o): Likewise.

From-SVN: r34039
2000-05-19 18:27:28 -04:00
Richard Henderson
c66f079e8d predict.c (PROB_NEVER, [...]): New.
* predict.c (PROB_NEVER, PROB_VERY_UNLIKELY): New.
        (PROB_UNLIKELY, PROB_EVEN, PROB_LIKELY): New.
        (PROB_VERY_LIKELY, PROB_ALWAYS): New.
        (estimate_probability, expected_value_to_br_prob): Use them.

From-SVN: r33792
2000-05-08 23:15:18 -07:00
Jeffrey A Law
cde9b87dfb predict.c: Remove May 4 change.
* predict.c: Remove May 4 change.
        * bb-reorder.c (make_reorder_chain): Do not perform block movement
        if we have predicted the branch at 50-50 probability.

From-SVN: r33707
2000-05-05 10:13:46 -06:00
Jeffrey A Law
926fd2e161 predict.c (estimate_probability): If no prediction was found...
* predict.c (estimate_probability): If no prediction was found, then
        predict the successor that is the next physical block (if such a
        successor exists).

From-SVN: r33683
2000-05-04 14:40:17 -06:00
Kaveh R. Ghazi
362440248c bb-reorder.c (get_next_bb_note, [...]): Prototype.
* bb-reorder.c (get_next_bb_note, get_prev_bb_note): Prototype.

	* diagnostic (vbuild_message_string, build_message_string,
	build_location_prefix, output_get_prefix, init_output_buffer,
	output_notice, vline_wrapper_message_with_location,
	v_message_with_decl, default_print_error_function): De-constify.
	(set_real_maximum_length): Prototype.

	* diagnostic.h (struct output_buffer, init_output_buffer,
	output_get_prefix, output_set_prefix): De-constify.

	* function.c (init_function_start): Constify.

	* gensupport.c (remove_constraints, process_rtx): Prototype.

	* gthr-posix.h: Indent uses of #pragma.

	* objc/objc-act.c (ggc_mark_imp_list, ggc_mark_hash_table):
	Prototype.

	* predict.c (find_expected_value): Delete prototype.
	(expected_value_to_br_prob): Initialize variable `ev_reg'.

	* sbitmap.h (debug_sbitmap): Prototype.

	* ssa.c (compute_coalesced_reg_partition): Prototype.

	* stor-layout.c (debug_rli): Prototype.

	* tree.h (round_down): Prototype.
	(init_function_start): Constify.

ch:
	* ch-tree.h (init_function_start): Constify.

From-SVN: r33675
2000-05-04 17:58:40 +00:00
Richard Henderson
9bcbfc524a predict.c (estimate_probability): Examine both sides of a branch for no exits.
* predict.c (estimate_probability): Examine both sides of
        a branch for no exits.  Use 90% not 50% for predict taken.
        Reorg for one copy of note generation code.

From-SVN: r33343
2000-04-22 12:16:03 -07:00
Richard Henderson
d9490f2f4e predict.c (expected_value_to_br_prob): Don't bomb if op1 of the collected condition is not a constant.
* predict.c (expected_value_to_br_prob): Don't bomb if op1 of
        the collected condition is not a constant.

From-SVN: r33340
2000-04-22 11:34:59 -07:00
Zack Weinberg
152897b152 predict.c (estimate_probability): New heuristic...
* predict.c (estimate_probability): New heuristic: if a jump
	branches around a block with no successors, predict it taken.
	Disentangle control flow.

From-SVN: r33308
2000-04-21 16:19:20 +00:00
Richard Henderson
10f1359422 loop.c (canonicalize_condition): Add WANT_REG argument.
* loop.c (canonicalize_condition): Add WANT_REG argument.
        Stop the search if we match it.
        * expr.h (canonicalize_condition): Update decl.
        * predict.c (expected_value_to_br_prob): Use it.  Track last
        expected value note.
        (find_expected_value): Remove.

        * reorg.c (mostly_true_jump): Always use BR_PROB if present.

From-SVN: r33214
2000-04-17 12:21:09 -07:00
Richard Henderson
994a57cd28 builtins.c (expand_builtin_expect): New.
* builtins.c (expand_builtin_expect): New.
        (expand_builtin): Call it.
        * builtins.def (BUILT_IN_EXPECT): New.
        * c-common.c (c_common_nodes_and_builtins): Declare __builtin_expect.
        * extend.texi: Document it.

        * predict.c (expected_value_to_br_prob): New.
        (find_expected_value): New.
        * basic-block.h (expected_value_to_br_prob): Declare.
        * toplev.c (rest_of_compilation): Invoke it.

        * rtl.h (NOTE_EXPECTED_VALUE): New.
        (NOTE_INSN_EXPECTED_VALUE): New.
        * rtl.c (note_insn_name): Update.
        * print-rtl.c (print_rtx): Reorg NOTE_LINE_NUMBER special
        cases; handle NOTE_INSN_EXPECTED_VALUE.

From-SVN: r33211
2000-04-17 09:49:00 -07:00
Jason Eckhardt
24c3bf687d predict.c (estimate_probability): Added the pointer heuristic to the collection of static branch predictors.
* predict.c (estimate_probability): Added the pointer heuristic to
        the collection of static branch predictors.

From-SVN: r32093
2000-02-21 23:04:43 +00:00
Jason Eckhardt
65169dcfc2 [multiple changes]
Fri Jan  7 19:48:04 CET 2000  Jan Hubicka  <jh@suse.cz>
	* sbitmap.c (sbitmap_first_set_bit, sbitmap_last_set_bit): New
	function.
	* sbitmap.h (sbitmap_first_set_bit, sbitmap_last_set_bit): Declare.
	* basic_block.h (FLOW_LOOP_FIRST_BLOCK): New macro.
	(FLOW_LOOP_LAST_BLOCK): Likewise.

2000-01-21  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>

	* basic-block.h (struct loop): New fields 'first' and 'last'.
	* flow.c (flow_loops_find): Compute loop->first and loop->last.
	(flow_loops_dump): Use loop->first to check for NOTE_INSN_LOOP_BEG
	and loop->last to check for NOTE_INSN_LOOP_END.

Fri Jan 28 10:57:58 2000  Jason Eckhardt  <jle@cygnus.com>

	* predict.c (estimate_probability): Use the new FIRST and LAST fields
	of the loop descriptor rather than HEADER and LATCH. Also added
	missing break statements as well making some coding style modifications
	as suggested by Michael Hayes.

From-SVN: r31679
2000-01-29 01:41:22 +00:00
Jason Eckhardt
f1ebdfc52a predict.c: New file.
Thu Jan 13 14:46:03 2000  Jason Eckhardt  <jle@cygnus.com>
                          Stan Cox  <scox@cygnus.com>

	* predict.c: New file. Preliminary infrastructure work for static
	branch prediction and basic block reordering.
	* basic-block.h: Add prototype for estimate_probability.
	* Makefile.in: Add rules for predict.o.

Co-Authored-By: Stan Cox <scox@cygnus.com>

From-SVN: r31402
2000-01-14 02:01:21 +00:00