mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-24 19:29:47 +08:00
flow.c (mark_set_1, [...]): compute REG_FREQ using bb->frequency.
* flow.c (mark_set_1, attempt_auto_inc, mark_used_reg, try_pre_increment_1): compute REG_FREQ using bb->frequency. * regclass.c (loop_cost): Kill. (frequency): New global variable. (record_operand_costs): Replace loop_cost by frequency. (scan_one_insn): Likewise. (regclass): Likewise; set frequency according to bb->frequency. * flow.c (split_edge): Set frequency. From-SVN: r43523
This commit is contained in:
parent
44f498639c
commit
9401afe31a
@ -1,3 +1,16 @@
|
|||||||
|
Sat Jun 23 01:23:59 CEST 2001 Jan Hubicka <jh@suse.cz>
|
||||||
|
|
||||||
|
* flow.c (mark_set_1, attempt_auto_inc, mark_used_reg,
|
||||||
|
try_pre_increment_1): compute REG_FREQ using bb->frequency.
|
||||||
|
|
||||||
|
* regclass.c (loop_cost): Kill.
|
||||||
|
(frequency): New global variable.
|
||||||
|
(record_operand_costs): Replace loop_cost by frequency.
|
||||||
|
(scan_one_insn): Likewise.
|
||||||
|
(regclass): Likewise; set frequency according to bb->frequency.
|
||||||
|
|
||||||
|
* flow.c (split_edge): Set frequency.
|
||||||
|
|
||||||
Sat Jun 23 01:16:42 CEST 2001 Jan Hubicka <jh@suse.cz>
|
Sat Jun 23 01:16:42 CEST 2001 Jan Hubicka <jh@suse.cz>
|
||||||
|
|
||||||
* predict.c (block_info_def): Add nvisited.
|
* predict.c (block_info_def): Add nvisited.
|
||||||
|
14
gcc/flow.c
14
gcc/flow.c
@ -1627,7 +1627,8 @@ split_edge (edge_in)
|
|||||||
bb->pred = edge_in;
|
bb->pred = edge_in;
|
||||||
bb->succ = edge_out;
|
bb->succ = edge_out;
|
||||||
bb->count = edge_in->count;
|
bb->count = edge_in->count;
|
||||||
/* ??? Set bb->frequency. */
|
bb->frequency = (edge_in->probability * edge_in->src->frequency
|
||||||
|
/ REG_BR_PROB_BASE);
|
||||||
|
|
||||||
edge_in->dest = bb;
|
edge_in->dest = bb;
|
||||||
edge_in->flags &= ~EDGE_CRITICAL;
|
edge_in->flags &= ~EDGE_CRITICAL;
|
||||||
@ -4857,7 +4858,8 @@ mark_set_1 (pbi, code, reg, cond, insn, flags)
|
|||||||
register twice if it is modified, but that is correct. */
|
register twice if it is modified, but that is correct. */
|
||||||
REG_N_SETS (i) += 1;
|
REG_N_SETS (i) += 1;
|
||||||
REG_N_REFS (i) += 1;
|
REG_N_REFS (i) += 1;
|
||||||
REG_FREQ (i) += (optimize_size ? 1 : pbi->bb->loop_depth + 1);
|
REG_FREQ (i) += (optimize_size || !pbi->bb->frequency
|
||||||
|
? 1 : pbi->bb->frequency);
|
||||||
|
|
||||||
/* The insns where a reg is live are normally counted
|
/* The insns where a reg is live are normally counted
|
||||||
elsewhere, but we want the count to include the insn
|
elsewhere, but we want the count to include the insn
|
||||||
@ -5524,7 +5526,8 @@ attempt_auto_inc (pbi, inc, insn, mem, incr, incr_reg)
|
|||||||
/* Count an extra reference to the reg. When a reg is
|
/* Count an extra reference to the reg. When a reg is
|
||||||
incremented, spilling it is worse, so we want to make
|
incremented, spilling it is worse, so we want to make
|
||||||
that less likely. */
|
that less likely. */
|
||||||
REG_FREQ (regno) += (optimize_size ? 1 : pbi->bb->loop_depth + 1);
|
REG_FREQ (regno) += (optimize_size || !phi->bb->frequency
|
||||||
|
? 1 : pbi->bb->frequency);
|
||||||
|
|
||||||
/* Count the increment as a setting of the register,
|
/* Count the increment as a setting of the register,
|
||||||
even though it isn't a SET in rtl. */
|
even though it isn't a SET in rtl. */
|
||||||
@ -5690,7 +5693,7 @@ mark_used_reg (pbi, reg, cond, insn)
|
|||||||
|
|
||||||
/* Count (weighted) number of uses of each reg. */
|
/* Count (weighted) number of uses of each reg. */
|
||||||
REG_FREQ (regno_first)
|
REG_FREQ (regno_first)
|
||||||
+= (optimize_size ? 1 : pbi->bb->loop_depth + 1);
|
+= (optimize_size || !pbi->bb->frequency ? 1 : pbi->bb->frequency);
|
||||||
REG_N_REFS (regno_first)++;
|
REG_N_REFS (regno_first)++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6112,7 +6115,8 @@ try_pre_increment_1 (pbi, insn)
|
|||||||
so we want to make that less likely. */
|
so we want to make that less likely. */
|
||||||
if (regno >= FIRST_PSEUDO_REGISTER)
|
if (regno >= FIRST_PSEUDO_REGISTER)
|
||||||
{
|
{
|
||||||
REG_FREQ (regno) += (optimize_size ? 1 : pbi->bb->loop_depth + 1);
|
REG_FREQ (regno) += (optimize_size || !phi->bb->frequency
|
||||||
|
? 1 : pbi->bb->frequency);
|
||||||
REG_N_SETS (regno)++;
|
REG_N_SETS (regno)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,10 +794,9 @@ static struct reg_pref *reg_pref;
|
|||||||
|
|
||||||
static struct reg_pref *reg_pref_buffer;
|
static struct reg_pref *reg_pref_buffer;
|
||||||
|
|
||||||
/* Account for the fact that insns within a loop are executed very commonly,
|
/* Frequency of executions of current insn. */
|
||||||
but don't keep doing this as loops go too deep. */
|
|
||||||
|
|
||||||
static int loop_cost;
|
static int frequency;
|
||||||
|
|
||||||
static rtx scan_one_insn PARAMS ((rtx, int));
|
static rtx scan_one_insn PARAMS ((rtx, int));
|
||||||
static void record_operand_costs PARAMS ((rtx, struct costs *, struct reg_pref *));
|
static void record_operand_costs PARAMS ((rtx, struct costs *, struct reg_pref *));
|
||||||
@ -928,10 +927,10 @@ record_operand_costs (insn, op_costs, reg_pref)
|
|||||||
|
|
||||||
if (GET_CODE (recog_data.operand[i]) == MEM)
|
if (GET_CODE (recog_data.operand[i]) == MEM)
|
||||||
record_address_regs (XEXP (recog_data.operand[i], 0),
|
record_address_regs (XEXP (recog_data.operand[i], 0),
|
||||||
BASE_REG_CLASS, loop_cost * 2);
|
BASE_REG_CLASS, frequency * 2);
|
||||||
else if (constraints[i][0] == 'p')
|
else if (constraints[i][0] == 'p')
|
||||||
record_address_regs (recog_data.operand[i],
|
record_address_regs (recog_data.operand[i],
|
||||||
BASE_REG_CLASS, loop_cost * 2);
|
BASE_REG_CLASS, frequency * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for commutative in a separate loop so everything will
|
/* Check for commutative in a separate loop so everything will
|
||||||
@ -1007,9 +1006,9 @@ scan_one_insn (insn, pass)
|
|||||||
costs[REGNO (SET_DEST (set))].mem_cost
|
costs[REGNO (SET_DEST (set))].mem_cost
|
||||||
-= (MEMORY_MOVE_COST (GET_MODE (SET_DEST (set)),
|
-= (MEMORY_MOVE_COST (GET_MODE (SET_DEST (set)),
|
||||||
GENERAL_REGS, 1)
|
GENERAL_REGS, 1)
|
||||||
* loop_cost);
|
* frequency);
|
||||||
record_address_regs (XEXP (SET_SRC (set), 0),
|
record_address_regs (XEXP (SET_SRC (set), 0),
|
||||||
BASE_REG_CLASS, loop_cost * 2);
|
BASE_REG_CLASS, frequency * 2);
|
||||||
return insn;
|
return insn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1059,17 +1058,17 @@ scan_one_insn (insn, pass)
|
|||||||
/* This makes one more setting of new insns's dest. */
|
/* This makes one more setting of new insns's dest. */
|
||||||
REG_N_SETS (REGNO (recog_data.operand[0]))++;
|
REG_N_SETS (REGNO (recog_data.operand[0]))++;
|
||||||
REG_N_REFS (REGNO (recog_data.operand[0]))++;
|
REG_N_REFS (REGNO (recog_data.operand[0]))++;
|
||||||
REG_FREQ (REGNO (recog_data.operand[0])) += loop_cost;
|
REG_FREQ (REGNO (recog_data.operand[0])) += frequency;
|
||||||
|
|
||||||
*recog_data.operand_loc[1] = recog_data.operand[0];
|
*recog_data.operand_loc[1] = recog_data.operand[0];
|
||||||
REG_N_REFS (REGNO (recog_data.operand[0]))++;
|
REG_N_REFS (REGNO (recog_data.operand[0]))++;
|
||||||
REG_FREQ (REGNO (recog_data.operand[0])) += loop_cost;
|
REG_FREQ (REGNO (recog_data.operand[0])) += frequency;
|
||||||
for (i = recog_data.n_dups - 1; i >= 0; i--)
|
for (i = recog_data.n_dups - 1; i >= 0; i--)
|
||||||
if (recog_data.dup_num[i] == 1)
|
if (recog_data.dup_num[i] == 1)
|
||||||
{
|
{
|
||||||
*recog_data.dup_loc[i] = recog_data.operand[0];
|
*recog_data.dup_loc[i] = recog_data.operand[0];
|
||||||
REG_N_REFS (REGNO (recog_data.operand[0]))++;
|
REG_N_REFS (REGNO (recog_data.operand[0]))++;
|
||||||
REG_FREQ (REGNO (recog_data.operand[0])) += loop_cost;
|
REG_FREQ (REGNO (recog_data.operand[0])) += frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PREV_INSN (newinsn);
|
return PREV_INSN (newinsn);
|
||||||
@ -1087,9 +1086,9 @@ scan_one_insn (insn, pass)
|
|||||||
int regno = REGNO (recog_data.operand[i]);
|
int regno = REGNO (recog_data.operand[i]);
|
||||||
struct costs *p = &costs[regno], *q = &op_costs[i];
|
struct costs *p = &costs[regno], *q = &op_costs[i];
|
||||||
|
|
||||||
p->mem_cost += q->mem_cost * loop_cost;
|
p->mem_cost += q->mem_cost * frequency;
|
||||||
for (j = 0; j < N_REG_CLASSES; j++)
|
for (j = 0; j < N_REG_CLASSES; j++)
|
||||||
p->cost[j] += q->cost[j] * loop_cost;
|
p->cost[j] += q->cost[j] * frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
return insn;
|
return insn;
|
||||||
@ -1195,7 +1194,7 @@ regclass (f, nregs, dump)
|
|||||||
|
|
||||||
if (!optimize)
|
if (!optimize)
|
||||||
{
|
{
|
||||||
loop_cost = 1;
|
frequency = 1;
|
||||||
for (insn = f; insn; insn = NEXT_INSN (insn))
|
for (insn = f; insn; insn = NEXT_INSN (insn))
|
||||||
insn = scan_one_insn (insn, pass);
|
insn = scan_one_insn (insn, pass);
|
||||||
}
|
}
|
||||||
@ -1209,9 +1208,9 @@ regclass (f, nregs, dump)
|
|||||||
aggressive than the assumptions made elsewhere and is being
|
aggressive than the assumptions made elsewhere and is being
|
||||||
tried as an experiment. */
|
tried as an experiment. */
|
||||||
if (optimize_size)
|
if (optimize_size)
|
||||||
loop_cost = 1;
|
frequency = 1;
|
||||||
else
|
else
|
||||||
loop_cost = 1 << (2 * MIN (bb->loop_depth, 5));
|
frequency = bb->frequency ? bb->frequency : 1;
|
||||||
for (insn = bb->head; ; insn = NEXT_INSN (insn))
|
for (insn = bb->head; ; insn = NEXT_INSN (insn))
|
||||||
{
|
{
|
||||||
insn = scan_one_insn (insn, pass);
|
insn = scan_one_insn (insn, pass);
|
||||||
|
Loading…
Reference in New Issue
Block a user