GCC Middle and Back End API Reference
predict.c File Reference

Data Structures

struct  predictor_info
struct  edge_prediction
struct  block_info_def
struct  edge_info_def

Typedefs

typedef struct block_info_defblock_info
typedef struct edge_info_defedge_info

Functions

static void combine_predictions_for_insn (rtx, basic_block)
static void dump_prediction (FILE *, enum br_predictor, int, basic_block, int)
static void predict_paths_leading_to (basic_block, enum br_predictor, enum prediction)
static void predict_paths_leading_to_edge (edge, enum br_predictor, enum prediction)
static bool can_predict_insn_p (const_rtx)
static bool maybe_hot_frequency_p ()
gcov_type get_hot_bb_threshold ()
void set_hot_bb_threshold ()
static bool maybe_hot_count_p ()
bool maybe_hot_bb_p ()
bool cgraph_maybe_hot_edge_p ()
bool maybe_hot_edge_p ()
bool probably_never_executed_bb_p ()
bool cgraph_optimize_for_size_p ()
bool optimize_function_for_size_p ()
bool optimize_function_for_speed_p ()
bool optimize_bb_for_size_p ()
bool optimize_bb_for_speed_p ()
bool optimize_edge_for_size_p ()
bool optimize_edge_for_speed_p ()
bool optimize_insn_for_size_p ()
bool optimize_insn_for_speed_p ()
bool optimize_loop_for_size_p ()
bool optimize_loop_for_speed_p ()
bool optimize_loop_nest_for_speed_p ()
bool optimize_loop_nest_for_size_p ()
bool predictable_edge_p ()
void rtl_profile_for_bb ()
void rtl_profile_for_edge ()
void default_rtl_profile ()
bool rtl_predicted_by_p ()
bool gimple_predicted_by_p ()
static bool probability_reliable_p ()
bool edge_probability_reliable_p ()
bool br_prob_note_reliable_p ()
static void predict_insn ()
void predict_insn_def (rtx insn, enum br_predictor predictor, enum prediction taken)
void rtl_predict_edge ()
void gimple_predict_edge ()
void remove_predictions_associated_with_edge ()
static void clear_bb_predictions ()
static bool can_predict_insn_p ()
void predict_edge_def (edge e, enum br_predictor predictor, enum prediction taken)
void invert_br_probabilities ()
static void set_even_probabilities ()
static void combine_predictions_for_insn ()
static void combine_predictions_for_bb ()
static tree strips_small_constant ()
static tree get_base_value ()
static bool is_comparison_with_loop_invariant_p (gimple stmt, struct loop *loop, tree *loop_invariant, enum tree_code *compare_code, tree *loop_step, tree *loop_iv_base)
static bool expr_coherent_p ()
static void predict_iv_comparison (struct loop *loop, basic_block bb, tree loop_bound_var, tree loop_iv_base_var, enum tree_code loop_bound_code, int loop_bound_step)
static void predict_extra_loop_exits ()
static void predict_loops ()
static void bb_estimate_probability_locally ()
void guess_outgoing_edge_probabilities ()
static tree expr_expected_value (tree, bitmap)
static tree expr_expected_value_1 (tree type, tree op0, enum tree_code code, tree op1, bitmap visited)
static tree expr_expected_value ()
static unsigned int strip_predict_hints ()
static void tree_predict_by_opcode ()
static enum br_predictor return_prediction ()
static void apply_return_prediction ()
static void tree_bb_level_predictions ()
static bool assert_is_empty (const void *key, void **value, void *data)
static void tree_estimate_probability_bb ()
void tree_estimate_probability ()
static unsigned int tree_estimate_probability_driver ()
static void predict_paths_for_bb (basic_block cur, basic_block bb, enum br_predictor pred, enum prediction taken, bitmap visited)
static void propagate_freq ()
static void estimate_loops_at_level ()
static void estimate_loops ()
int counts_to_freqs ()
bool expensive_function_p ()
void estimate_bb_frequencies ()
void compute_function_frequency ()
static bool gate_estimate_probability ()
tree build_predict_expr ()
const char * predictor_name ()
gimple_opt_passmake_pass_profile ()
gimple_opt_passmake_pass_strip_predict_hints ()
void rebuild_frequencies ()

Variables

static sreal real_zero
static sreal real_one
static sreal real_almost_one
static sreal real_br_prob_base
static sreal real_inv_br_prob_base
static sreal real_one_half
static sreal real_bb_freq_max
static struct predictor_info predictor_info []
static gcov_type min_count = -1
static struct pointer_map_tbb_predictions

Typedef Documentation

typedef struct block_info_def * block_info
This is used to carry information about basic blocks.  It is
   attached to the AUX field of the standard CFG block.   
typedef struct edge_info_def * edge_info
Similar information for edges.   

Function Documentation

static void apply_return_prediction ( )
static
Find the basic block with return expression and look up for possible
   return value trying to apply RETURN_PREDICTION heuristics.   

References gimple_phi_arg_edge(), gimple_phi_num_args(), gimple_return_retval(), last_stmt(), predict_paths_leading_to_edge(), return_prediction(), and edge_def::src.

Referenced by tree_bb_level_predictions().

static bool assert_is_empty ( const void *  key,
void **  value,
void *  data 
)
static
Callback for pointer_map_traverse, asserts that the pointer map is
   empty.   

Referenced by tree_estimate_probability().

static void bb_estimate_probability_locally ( )
static
Attempt to predict probabilities of BB outgoing edges using local
   properties.   

References can_predict_insn_p(), get_condition(), NOT_TAKEN, predict_insn_def(), and TAKEN.

Referenced by guess_outgoing_edge_probabilities().

bool br_prob_note_reliable_p ( )
Same predicate as edge_probability_reliable_p, working on notes.   

References probability_reliable_p().

tree build_predict_expr ( )
Build PREDICT_EXPR.   

References build_int_cst().

static bool can_predict_insn_p ( const_rtx  )
static
static bool can_predict_insn_p ( )
static
Return true when we can store prediction on insn INSN.
   At the moment we represent predictions only on conditional
   jumps, not at computed jump or other complicated cases.   

References any_condjump_p().

bool cgraph_optimize_for_size_p ( )
Return true if NODE should be optimized for size.   

References NODE_FREQUENCY_UNLIKELY_EXECUTED.

static void clear_bb_predictions ( )
static
Clears the list of predictions stored for BB.   

References edge_prediction::ep_next, free(), and pointer_map_contains().

Referenced by combine_predictions_for_bb().

static void combine_predictions_for_insn ( rtx  ,
basic_block   
)
static
static void combine_predictions_for_insn ( )
static
Combine all REG_BR_PRED notes into single probability and attach REG_BR_PROB
   note if not already present.  Remove now useless REG_BR_PRED notes.   

References add_reg_note(), can_predict_insn_p(), dump_file, dump_prediction(), END_PREDICTORS, find_reg_note(), basic_block_def::index, prob, edge_def::probability, set_even_probabilities(), single_succ_edge(), and single_succ_p().

int counts_to_freqs ( void  )
Convert counts measured by profile driven feedback to frequencies.
   Return nonzero iff there was any nonzero execution count.   

References basic_block_def::count, and basic_block_def::frequency.

Referenced by compute_branch_probabilities(), estimate_bb_frequencies(), gimple_value_profile_transformations(), and rebuild_frequencies().

void default_rtl_profile ( void  )
static void dump_prediction ( FILE *  file,
enum br_predictor  predictor,
int  probability,
basic_block  bb,
int  used 
)
static
Dump information about the branch prediction to the output file.   

References edge_def::count, basic_block_def::count, edge_def::flags, HOST_WIDEST_INT_PRINT_DEC, and basic_block_def::succs.

Referenced by combine_predictions_for_bb(), and combine_predictions_for_insn().

bool edge_probability_reliable_p ( )
Same predicate as above, working on edges.   

References edge_def::probability, and probability_reliable_p().

static void estimate_loops ( )
static
Propagates frequencies through structure of loops.   

References bitmap_set_bit(), cfun, estimate_loops_at_level(), basic_block_def::index, number_of_loops(), and propagate_freq().

Referenced by estimate_bb_frequencies().

static void estimate_loops_at_level ( )
static
Estimate probabilities of loopback edges in loops at same nest level.   

References bitmap_set_bit(), free(), get_loop_body(), loop::header, loop::inner, loop_latch_edge(), loop::next, loop::num_nodes, and propagate_freq().

Referenced by estimate_loops().

bool expensive_function_p ( )
Return true if function is likely to be expensive, so there is no point to
   optimize performance of prologue, epilogue or do inlining at the expense
   of code size growth.  THRESHOLD is the limit of number of instructions
   function can execute at average to be still considered not expensive.   

References active_insn_p(), basic_block_def::frequency, and limit.

static bool expr_coherent_p ( )
static
Compare two SSA_NAMEs: returns TRUE if T1 and T2 are value coherent.   

References is_gimple_assign().

Referenced by predict_iv_comparison().

static tree expr_expected_value ( tree  ,
bitmap   
)
static

Referenced by expr_expected_value_1().

static tree expr_expected_value ( )
static
Return constant EXPR will likely have at execution time, NULL if unknown.
   The function is used by builtin_expect branch predictor so the evidence
   must come from this construct and additional possible constant folding.

   We may want to implement more involved value guess (such as value range
   propagation based prediction), but such tricks shall go to new
   implementation.   

References expr_expected_value_1(), and extract_ops_from_tree().

static bool gate_estimate_probability ( )
static
static tree get_base_value ( )
static
Return the SSA_NAME in T or T's operands.
   Return NULL if SSA_NAME cannot be found.   

References strips_small_constant().

Referenced by is_comparison_with_loop_invariant_p().

gcov_type get_hot_bb_threshold ( void  )
Determine the threshold for hot BB counts.   

References find_working_set(), min_count, and gcov_working_set_info::min_counter.

Referenced by ipa_profile(), maybe_hot_count_p(), and output_profile_summary().

bool gimple_predicted_by_p ( )
Return true if the one of outgoing edges is already predicted by
   PREDICTOR.   

References edge_prediction::ep_next, edge_prediction::ep_predictor, and pointer_map_contains().

void guess_outgoing_edge_probabilities ( )
Set edge->probability for each successor edge of BB.   

References bb_estimate_probability_locally(), and combine_predictions_for_insn().

void invert_br_probabilities ( )
Invert all branch predictions or probability notes in the INSN.  This needs
   to be done each time we invert the condition used by the jump.   

Referenced by redirect_jump_2().

static bool is_comparison_with_loop_invariant_p ( gimple  stmt,
struct loop loop,
tree loop_invariant,
enum tree_code compare_code,
tree loop_step,
tree loop_iv_base 
)
static
Check the compare STMT in LOOP. If it compares an induction
   variable to a loop invariant, return true, and save
   LOOP_INVARIANT, COMPARE_CODE and LOOP_STEP.
   Otherwise return false and set LOOP_INVAIANT to NULL.   

References affine_iv::base, get_base_value(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), host_integerp(), integer_zerop(), invert_tree_comparison(), loop_containing_stmt(), simple_iv(), and affine_iv::step.

Referenced by predict_iv_comparison(), and predict_loops().

gimple_opt_pass* make_pass_profile ( )
gimple_opt_pass* make_pass_strip_predict_hints ( )
bool maybe_hot_bb_p ( )
Return true in case BB can be CPU intensive and should be optimized
   for maximal performance.   

References basic_block_def::count, basic_block_def::frequency, maybe_hot_count_p(), maybe_hot_frequency_p(), and PROFILE_READ.

static bool maybe_hot_count_p ( )
inlinestatic
Return TRUE if frequency FREQ is considered to be hot.   

References get_hot_bb_threshold(), profile_info, PROFILE_READ, and gcov_ctr_summary::runs.

Referenced by cgraph_maybe_hot_edge_p(), maybe_hot_bb_p(), and maybe_hot_edge_p().

bool maybe_hot_edge_p ( )
Return true in case BB can be CPU intensive and should be optimized
   for maximal performance.   

References cfun, edge_def::count, maybe_hot_count_p(), maybe_hot_frequency_p(), and PROFILE_READ.

static bool maybe_hot_frequency_p ( )
inlinestatic
bool optimize_bb_for_size_p ( )
Return TRUE when BB should be optimized for size.   

References cfun, maybe_hot_bb_p(), and optimize_function_for_size_p().

bool optimize_bb_for_speed_p ( )
Return TRUE when BB should be optimized for speed.   

References optimize_bb_for_size_p().

bool optimize_edge_for_size_p ( )
Return TRUE when BB should be optimized for size.   

References cfun, maybe_hot_edge_p(), and optimize_function_for_size_p().

bool optimize_edge_for_speed_p ( )
Return TRUE when BB should be optimized for speed.   

References optimize_edge_for_size_p().

bool optimize_function_for_size_p ( )
Return true when current function should always be optimized for size.   

References cgraph_get_node(), and cgraph_optimize_for_size_p().

bool optimize_function_for_speed_p ( )
Return true when current function should always be optimized for speed.   

References optimize_function_for_size_p().

bool optimize_insn_for_size_p ( void  )
Return TRUE when BB should be optimized for size.   

References cfun, and optimize_function_for_size_p().

Referenced by expand_builtin_mathfn(), expand_builtin_mathfn_2(), expand_switch_as_decision_tree_p(), and optimize_insn_for_speed_p().

bool optimize_loop_for_size_p ( )
Return TRUE when LOOP should be optimized for size.   

References loop::header, and optimize_bb_for_size_p().

bool optimize_loop_for_speed_p ( )
Return TRUE when LOOP should be optimized for speed.   

References loop::header, and optimize_bb_for_speed_p().

bool optimize_loop_nest_for_size_p ( )
Return TRUE when LOOP nest should be optimized for size.   

References optimize_loop_nest_for_speed_p().

bool optimize_loop_nest_for_speed_p ( )
Return TRUE when LOOP nest should be optimized for speed.   

References loop::inner, loop_outer(), loop::next, and optimize_loop_for_speed_p().

void predict_edge_def ( edge  e,
enum br_predictor  predictor,
enum prediction  taken 
)
static void predict_extra_loop_exits ( )
static
Predict for extra loop exits that will lead to EXIT_EDGE. The extra loop
   exits are resulted from short-circuit conditions that will generate an
   if_tmp. E.g.:

   if (foo() || global > 10)
     break;

   This will be translated into:

   BB3:
     loop header...
   BB4:
     if foo() goto BB6 else goto BB5
   BB5:
     if global > 10 goto BB6 else goto BB7
   BB6:
     goto BB7
   BB7:
     iftmp = (PHI 0(BB5), 1(BB6))
     if iftmp == 1 goto BB8 else goto BB3
   BB8:
     outside of the loop...

   The edge BB7->BB8 is loop exit because BB8 is outside of the loop.
   From the dataflow, we can infer that BB4->BB6 and BB5->BB6 are also loop
   exits. This function takes BB7->BB8 as input, and finds out the extra loop
   exits to predict them using PRED_LOOP_EXIT.   

References edge_def::flags, gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_phi_arg_def(), gimple_phi_arg_edge(), gimple_phi_num_args(), integer_onep(), integer_zerop(), last_stmt(), NOT_TAKEN, predict_paths_leading_to_edge(), basic_block_def::preds, edge_def::src, and basic_block_def::succs.

Referenced by predict_loops().

static void predict_insn ( )
static
void predict_insn_def ( rtx  insn,
enum br_predictor  predictor,
enum prediction  taken 
)
Predict insn by given predictor.   

References predict_insn(), and TAKEN.

Referenced by bb_estimate_probability_locally(), and stack_protect_epilogue().

static void predict_iv_comparison ( struct loop loop,
basic_block  bb,
tree  loop_bound_var,
tree  loop_iv_base_var,
enum tree_code  loop_bound_code,
int  loop_bound_step 
)
static
Predict branch probability of BB when BB contains a branch that compares
   an induction variable in LOOP with LOOP_IV_BASE_VAR to LOOP_BOUND_VAR. The
   loop exit is compared using LOOP_BOUND_CODE, with step of LOOP_BOUND_STEP.

   E.g.
     for (int i = 0; i < bound; i++) {
       if (i < bound - 2)
         computation_1();
       else
         computation_2();
     }

  In this loop, we will predict the branch inside the loop to be taken.   

References double_int::arshift(), clz_hwi(), double_int::divmod(), double_int::divmod_with_overflow(), expr_coherent_p(), edge_def::flags, double_int::from_shwi(), double_int::high, host_integerp(), is_comparison_with_loop_invariant_p(), double_int::is_negative(), double_int::is_zero(), last_stmt(), double_int::mul_with_sign(), NOT_TAKEN, predict_edge(), predict_edge_def(), predicted_by_p(), double_int::scmp(), double_int::sub_with_overflow(), basic_block_def::succs, TAKEN, double_int::to_uhwi(), and tree_to_double_int().

Referenced by predict_loops().

static void predict_paths_for_bb ( basic_block  cur,
basic_block  bb,
enum br_predictor  pred,
enum prediction  taken,
bitmap  visited 
)
static
Predict edges to successors of CUR whose sources are not postdominated by
   BB by PRED and recurse to all postdominators.   

References bitmap_set_bit(), CDI_POST_DOMINATORS, edge_def::dest, dominated_by_p(), first_dom_son(), edge_def::flags, basic_block_def::index, next_dom_son(), predict_edge_def(), basic_block_def::preds, edge_def::src, and basic_block_def::succs.

Referenced by predict_paths_leading_to(), and predict_paths_leading_to_edge().

static void predict_paths_leading_to ( basic_block  bb,
enum br_predictor  pred,
enum prediction  taken 
)
static
Sets branch probabilities according to PREDiction and
   FLAGS.   

References predict_paths_for_bb(), and visited.

Referenced by tree_bb_level_predictions().

static void predict_paths_leading_to_edge ( edge  e,
enum br_predictor  pred,
enum prediction  taken 
)
static
bool predictable_edge_p ( )
Return true when edge E is likely to be well predictable by branch
   predictor.   

References edge_def::probability, and PROFILE_ABSENT.

const char* predictor_name ( )
static bool probability_reliable_p ( )
static
Return true when the probability of edge is reliable.

   The profile guessing code is good at predicting branch outcome (ie.
   taken/not taken), that is predicted right slightly over 75% of time.
   It is however notoriously poor on predicting the probability itself.
   In general the profile appear a lot flatter (with probabilities closer
   to 50%) than the reality so it is bad idea to use it to drive optimization
   such as those disabling dynamic branch prediction for well predictable
   branches.

   There are two exceptions - edges leading to noreturn edges and edges
   predicted by number of iterations heuristics are predicted well.  This macro
   should be able to distinguish those, but at the moment it simply check for
   noreturn heuristic that is only one giving probability over 99% or bellow
   1%.  In future we might want to propagate reliability information across the
   CFG if we find this information useful on multiple places.    

References PROFILE_GUESSED, and PROFILE_READ.

Referenced by br_prob_note_reliable_p(), and edge_probability_reliable_p().

bool probably_never_executed_bb_p ( )
Return true in case BB is probably never executed.   

References cgraph_get_node(), basic_block_def::count, NODE_FREQUENCY_UNLIKELY_EXECUTED, profile_info, and gcov_ctr_summary::runs.

void rebuild_frequencies ( void  )
Rebuild function frequencies.  Passes are in general expected to
   maintain profile by hand, however in some cases this is not possible:
   for example when inlining several functions with loops freuqencies might run
   out of scale and thus needs to be recomputed.   

References add_noreturn_fake_exit_edges(), connect_infinite_loops_to_exit(), counts_to_freqs(), estimate_bb_frequencies(), loop_optimizer_finalize(), loop_optimizer_init(), mark_irreducible_loops(), PROFILE_GUESSED, PROFILE_READ, remove_fake_exit_edges(), timevar_pop(), and timevar_push().

Referenced by execute_function_todo(), and tree_function_versioning().

void remove_predictions_associated_with_edge ( )
Remove all predictions on given basic block that are attached
   to edge E.   

References edge_prediction::ep_next, free(), pointer_map_contains(), and edge_def::src.

static enum br_predictor return_prediction ( )
static
Try to guess whether the value of return means error code.   

References integer_onep(), integer_zerop(), NOT_TAKEN, TAKEN, and tree_int_cst_sgn().

Referenced by apply_return_prediction().

void rtl_predict_edge ( )
Predict edge E with given probability if possible.   

References any_condjump_p(), edge_def::flags, predict_insn(), and edge_def::src.

bool rtl_predicted_by_p ( )
Return true if the one of outgoing edges is already predicted by
   PREDICTOR.   
void rtl_profile_for_bb ( )
Set RTL expansion for BB profile.   

References cfun, and maybe_hot_bb_p().

void rtl_profile_for_edge ( )
Set RTL expansion for edge profile.   

References maybe_hot_edge_p().

static void set_even_probabilities ( )
static
We can not predict the probabilities of outgoing edges of bb.  Set them
   evenly and hope for the best.   

References edge_def::flags, edge_def::probability, and basic_block_def::succs.

Referenced by combine_predictions_for_bb(), and combine_predictions_for_insn().

void set_hot_bb_threshold ( )
Set the threshold for hot BB counts.   

References min_count.

Referenced by input_profile_summary(), and ipa_profile().

static unsigned int strip_predict_hints ( )
static
Get rid of all builtin_expect calls and GIMPLE_PREDICT statements
   we no longer need.   

References BUILT_IN_NORMAL, gimple_call_arg(), gimple_call_fndecl(), gimple_call_lhs(), gimple_call_num_args(), gsi_end_p(), gsi_next(), gsi_remove(), gsi_replace(), gsi_start_bb(), gsi_stmt(), and nb_iter_bound::stmt.

static tree strips_small_constant ( )
static
Check if T1 and T2 satisfy the IV_COMPARE condition.
   Return the SSA_NAME if the condition satisfies, NULL otherwise.

   T1 and T2 should be one of the following cases:
     1. T1 is SSA_NAME, T2 is NULL
     2. T1 is SSA_NAME, T2 is INTEGER_CST between [-4, 4]
     3. T2 is SSA_NAME, T1 is INTEGER_CST between [-4, 4]   

References host_integerp(), and tree_low_cst().

Referenced by get_base_value().

static void tree_bb_level_predictions ( )
static
Look for basic block that contains unlikely to happen events
   (such as noreturn calls) and mark all paths leading to execution
   of this basic blocks as unlikely.   

References apply_return_prediction(), edge_def::flags, gimple_call_flags(), gimple_call_fndecl(), gimple_predict_outcome(), gimple_predict_predictor(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), is_gimple_call(), lookup_attribute(), NOT_TAKEN, predict_paths_leading_to(), and nb_iter_bound::stmt.

Referenced by tree_estimate_probability().

static unsigned int tree_estimate_probability_driver ( )
static
Predict branch probabilities and estimate profile of the tree CFG.
   This is the driver function for PASS_PROFILE.   

References cfun, dump_file, dump_flags, flow_loops_dump(), gimple_dump_cfg(), loop_optimizer_finalize(), loop_optimizer_init(), mark_irreducible_loops(), number_of_loops(), PROFILE_ABSENT, PROFILE_GUESSED, scev_finalize(), scev_initialize(), and tree_estimate_probability().


Variable Documentation

struct pointer_map_t* bb_predictions
static
This map contains for a basic block the list of predictions for the
   outgoing edges.   
gcov_type min_count = -1
static
struct predictor_info predictor_info[]
static
Initial value:
{
#include "predict.def"
{NULL, 0, 0}
}
sreal real_almost_one
static
sreal real_bb_freq_max
static
sreal real_br_prob_base
static
sreal real_inv_br_prob_base
static
sreal real_one
static

Referenced by rewrite_reciprocal().

sreal real_one_half
static
sreal real_zero
static
@verbatim Branch prediction routines for the GNU compiler.

Copyright (C) 2000-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

References:

   [1] "Branch Prediction for Free"
       Ball and Larus; PLDI '93.
   [2] "Static Branch Frequency and Program Profile Analysis"
       Wu and Larus; MICRO-27.
   [3] "Corpus-based Static Branch Prediction"
       Calder, Grunwald, Lindsay, Martin, Mozer, and Zorn; PLDI '95.   
real constants: 0, 1, 1-1/REG_BR_PROB_BASE, REG_BR_PROB_BASE,
                   1/REG_BR_PROB_BASE, 0.5, BB_FREQ_MAX.