This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Branch prediction infrastructure
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>
- Date: Mon, 12 Jan 2004 11:46:07 -0500
- Subject: Re: [tree-ssa] Branch prediction infrastructure
- Organization: Red Hat Canada
- References: <20031223120311.GO17542@kam.mff.cuni.cz>
On Tue, 2003-12-23 at 07:03, Jan Hubicka wrote:
> * basic-block.h: Include predict.h
> (tree_predicted_by_p, rtl_predicted_by_p, rtl_predict_edge,
> predict_edge_def): Declare.
> * cfghooks.h (cfg_hooks): add predict_edge and predicted_by_p
> (predict_edge, predicted_by_p): New macros.
> * cfgrtl (rtl_cfg_hooks, cfg_layout_rtl_cfg_hook): Add new hooks.
> * cse.c (struct cse_basic_block_data): Rename enum values to not
> conflict with profile.h; update all uses.
> * predict.c: Include tree-flow.h, ggc.h, tree-dump.h
> (predicted_by_p): Rename to ...
> (rtl_predicted_by_p): .. this one; make global
> (tree_predicted_by_p): New.
> (dump_prediction): Add FILE argument.
> (predict_edge): Rename to ...
> (rtl_predict_edge): .. this one.
> (tree_predict_edge): New.
> (combine_predictions_for_insn): Update calls of predict_edge.
> (predict_loops): Break out from ...
> (estimate_probability): ... here; update comments; move updating
> of unknown probabilities from ...
> (estimate_bb_frequencies): ... here.
> (combine_predictions_for_bb): New.
> (tree_predict_by_opcode): New.
> (tree_estimate_probability): New.
> * predict.def (PRED_TREE_POINTER, PRED_TREE_OPCODE_POSITIVE,
> PRED_TREE_OPCODE_NONEQUAL, PRED_TREE_FPOPCODE): New predictors.
> * predict.h: Add include guard.
> (predict_edge, predict_edge_def): Move prototypes to basic_block.h
> * tree-cfg.c (tree_cfg_hooks): Add prediction hooks.
> * tree-dump.c (dump_files): Add profile.
> * tree-flow.h (struct edge_prediction): New structure.
> (struct bb_ann_d): Add field predictions.
> (tree_estimate_probability): Declare.
> * tree-optimize.c (optimize_function_tree): Call tree_estimate_probability.
> * tree.h (tree_dump_index): Add TDI_profile.
>
Looks OK, I guess (minor changes below).
Now, what's the plan wrt exporting the predictors to RTL? Have we
settled on that already?
Diego.
> *************** predict_edge (edge e, enum br_predictor
> *** 211,216 ****
> --- 226,244 ----
> predict_insn (last_insn, predictor, probability);
> }
>
> + /* Same as PREDICT_EDGE but using tree presentation. */
>
Change to something more meaningful like 'Predict edge E with the given
PROBABILITY.'
> !
> ! /* When there is no succestor or only one choice, prediction is easy.
> !
s/succestor/successor/
> ! We are lazy for now and predict only basic blocks with two outgoing
> ! edges. It is possible to predict generic case too, but we have to
> ! ignore first match heursitics and do more involved combining. Implement
>
s/heursitics/heuristics/
Diego.