diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-28 21:14:23 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-28 21:14:23 +0000 |
commit | 877584e4ea0ece6c88a22ccec3f2a4218c98212e (patch) | |
tree | c4ddc30456b3babd4ddd7a75d077274a158cd121 /gcc/basic-block.h | |
parent | 36faf01bcfc5c3f3d9c2be33f39d585eda61c101 (diff) | |
download | ppe42-gcc-877584e4ea0ece6c88a22ccec3f2a4218c98212e.tar.gz ppe42-gcc-877584e4ea0ece6c88a22ccec3f2a4218c98212e.zip |
* basic-block.h (RDIV): Define.
(EDGE_FREQUENCY): Simplify.
(check_probability, combine_probabilities, apply_probability,
inverse_probability): New.
* cfgloop.c (scale_loop_profile): New function.
* cfgloop.h (scale_loop_profile): Declare.
(slpeel_add_loop_guard): Add probability parameter.
(set_prologue_iterations): Add probability parameter.
(slpeel_tree_peel_loop_to_edge): Add bound1 and bound2 parameters;
update probabilities correctly.
(vect_do_peeling_for_alignment, vect_gen_niters_for_prolog_loop): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191839 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/basic-block.h')
-rw-r--r-- | gcc/basic-block.h | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 32dd1773664..a5491b03011 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -478,11 +478,10 @@ struct edge_list #define BRANCH_EDGE(bb) (EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \ ? EDGE_SUCC ((bb), 1) : EDGE_SUCC ((bb), 0)) +#define RDIV(X,Y) (((X) + (Y) / 2) / (Y)) /* Return expected execution frequency of the edge E. */ -#define EDGE_FREQUENCY(e) (((e)->src->frequency \ - * (e)->probability \ - + REG_BR_PROB_BASE / 2) \ - / REG_BR_PROB_BASE) +#define EDGE_FREQUENCY(e) RDIV ((e)->src->frequency * (e)->probability, \ + REG_BR_PROB_BASE) /* Return nonzero if edge is critical. */ #define EDGE_CRITICAL_P(e) (EDGE_COUNT ((e)->src->succs) >= 2 \ @@ -910,4 +909,40 @@ extern void default_rtl_profile (void); /* In profile.c. */ extern gcov_working_set_t *find_working_set(unsigned pct_times_10); +/* Check tha probability is sane. */ + +static inline void +check_probability (int prob) +{ + gcc_checking_assert (prob >= 0 && prob <= REG_BR_PROB_BASE); +} + +/* Given PROB1 and PROB2, return PROB1*PROB2/REG_BR_PROB_BASE. + Used to combine BB probabilities. */ + +static inline int +combine_probabilities (int prob1, int prob2) +{ + check_probability (prob1); + check_probability (prob2); + return RDIV (prob1 * prob2, REG_BR_PROB_BASE); +} + +/* Apply probability PROB on frequency or count FREQ. */ + +static inline gcov_type +apply_probability (gcov_type freq, int prob) +{ + check_probability (prob); + return RDIV (freq * prob, REG_BR_PROB_BASE); +} + +/* Return inverse probability for PROB. */ + +static inline int +inverse_probability (int prob1) +{ + check_probability (prob1); + return REG_BR_PROB_BASE - prob1; +} #endif /* GCC_BASIC_BLOCK_H */ |