summaryrefslogtreecommitdiff
path: root/gcc/regs.h
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-30 20:03:37 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-30 20:03:37 +0000
commiteefdec482d3b01c97ab6d360dbee968b9ca9c252 (patch)
treeaa952727c06ed38ed797f094dd095bd14f5da5f4 /gcc/regs.h
parent7572bd481e5ce1c6ea23bd61461bc3adb55ba901 (diff)
downloadgcc-eefdec482d3b01c97ab6d360dbee968b9ca9c252.tar.gz
* flow.c (mark_set_1): Use REG_FREQ_FROM_BB.
(attempt_auto_inc): LIkewise. (mark_used_reg): Likewise. (try_pre_increment_1): Likewise. * regclass.c (regclass): Likewise. * global.c (allocno_compare): Update comment; change scaling factor. * local-alloc.c (QTY_CMP_PRI): Likewise. * regs.h (REG_FREQ_FROM_BB): New. (REG_FREQ_MAX): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44483 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/regs.h')
-rw-r--r--gcc/regs.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/regs.h b/gcc/regs.h
index 3857c829dc1..e852d6d3212 100644
--- a/gcc/regs.h
+++ b/gcc/regs.h
@@ -86,6 +86,24 @@ extern varray_type reg_n_info;
#define REG_FREQ(N) (VARRAY_REG (reg_n_info, N)->freq)
+/* The weights for each insn varries from 0 to REG_FREQ_BASE.
+ This constant does not need to be high, as in infrequently executed
+ regions we want to count instructions equivalently to optimize for
+ size instead of speed. */
+#define REG_FREQ_MAX 1000
+
+/* Compute register frequency from the BB frequency. When optimizing for size,
+ or profile driven feedback is available and the function is never executed,
+ frequency is always equivalent. Otherwise rescale the basic block
+ frequency. */
+#define REG_FREQ_FROM_BB(bb) (optimize_size \
+ || (flag_branch_probabilities \
+ && !ENTRY_BLOCK_PTR->count) \
+ ? REG_FREQ_MAX \
+ : ((bb)->frequency * REG_FREQ_MAX / BB_FREQ_MAX)\
+ ? ((bb)->frequency * REG_FREQ_MAX / BB_FREQ_MAX)\
+ : 1)
+
/* Indexed by n, gives number of times (REG n) is set.
??? both regscan and flow allocate space for this. We should settle
on just copy. */