* Another patch for PR88282
@ 2018-12-06 18:44 Vladimir Makarov
2018-12-07 11:38 ` Richard Sandiford
0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Makarov @ 2018-12-06 18:44 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 235 bytes --]
 Here is another solution for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88282
 less hackish than original one.
 The patch was bootstrapped and tested on x86/x86-64/ppc64/aarch64.
 Committed as rev. 266862.
[-- Attachment #2: pr88282-2.patch --]
[-- Type: text/x-patch, Size: 3529 bytes --]
Index: ChangeLog
===================================================================
--- ChangeLog (revision 266861)
+++ ChangeLog (working copy)
@@ -1,3 +1,11 @@
+2018-12-06 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR target/88282
+ * ira.c (ira_init_register_move_cost): Use info from
+ hard_regno_mode_ok instead of contains_reg_of_mode.
+ * ira-costs.c (contains_reg_of_mode): Don't use cost from bigger
+ hard register class for some fixed hard registers.
+
2018-12-06 Segher Boessenkool <segher@kernel.crashing.org>
* doc/extend.texi (Using Assembly Language with C): Document asm inline.
Index: ira.c
===================================================================
--- ira.c (revision 266861)
+++ ira.c (working copy)
@@ -1573,11 +1573,17 @@ ira_init_register_move_cost (machine_mod
{
static unsigned short last_move_cost[N_REG_CLASSES][N_REG_CLASSES];
bool all_match = true;
- unsigned int cl1, cl2;
+ unsigned int i, cl1, cl2;
+ HARD_REG_SET ok_regs;
ira_assert (ira_register_move_cost[mode] == NULL
&& ira_may_move_in_cost[mode] == NULL
&& ira_may_move_out_cost[mode] == NULL);
+ CLEAR_HARD_REG_SET (ok_regs);
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (targetm.hard_regno_mode_ok (i, mode))
+ SET_HARD_REG_BIT (ok_regs, i);
+
/* Note that we might be asked about the move costs of modes that
cannot be stored in any hard register, for example if an inline
asm tries to create a register operand with an impossible mode.
@@ -1586,8 +1592,8 @@ ira_init_register_move_cost (machine_mod
for (cl2 = 0; cl2 < N_REG_CLASSES; cl2++)
{
int cost;
- if (!contains_reg_of_mode[cl1][mode]
- || !contains_reg_of_mode[cl2][mode])
+ if (!hard_reg_set_intersect_p (ok_regs, reg_class_contents[cl1])
+ || !hard_reg_set_intersect_p (ok_regs, reg_class_contents[cl2]))
{
if ((ira_reg_class_max_nregs[cl1][mode]
> ira_class_hard_regs_num[cl1])
Index: ira-costs.c
===================================================================
--- ira-costs.c (revision 266784)
+++ ira-costs.c (working copy)
@@ -1323,14 +1323,6 @@ record_operand_costs (rtx_insn *insn, en
move_costs = ira_register_move_cost[mode];
hard_reg_class = REGNO_REG_CLASS (other_regno);
bigger_hard_reg_class = ira_pressure_class_translate[hard_reg_class];
- if (bigger_hard_reg_class == NO_REGS
- && (other_regno == STACK_POINTER_REGNUM
-#ifdef STATIC_CHAIN_REGNUM
- || other_regno == STATIC_CHAIN_REGNUM
-#endif
- || other_regno == FRAME_POINTER_REGNUM
- || other_regno == HARD_FRAME_POINTER_REGNUM))
- bigger_hard_reg_class = GENERAL_REGS;
/* Target code may return any cost for mode which does not
fit the the hard reg class (e.g. DImode for AREG on
i386). Check this and use a bigger class to get the
@@ -1345,17 +1337,6 @@ record_operand_costs (rtx_insn *insn, en
cost = (i == 0
? move_costs[hard_reg_class][rclass]
: move_costs[rclass][hard_reg_class]);
- /* Target code might define wrong big costs for smaller
- reg classes or reg classes containing only fixed hard
- regs. Try a bigger class. */
- if (bigger_hard_reg_class != hard_reg_class)
- {
- int cost2 = (i == 0
- ? move_costs[bigger_hard_reg_class][rclass]
- : move_costs[rclass][bigger_hard_reg_class]);
- if (cost2 < cost)
- cost = cost2;
- }
op_costs[i]->cost[k] = cost * frequency;
/* If we have assigned a class to this allocno in our
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Another patch for PR88282
2018-12-06 18:44 Another patch for PR88282 Vladimir Makarov
@ 2018-12-07 11:38 ` Richard Sandiford
0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2018-12-07 11:38 UTC (permalink / raw)
To: Vladimir Makarov; +Cc: gcc-patches
Vladimir Makarov <vmakarov@redhat.com> writes:
> Here is another solution for
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88282
>
> less hackish than original one.
>
> The patch was bootstrapped and tested on x86/x86-64/ppc64/aarch64.
>
> Committed as rev. 266862.
Nice! Thanks for doing this.
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-07 11:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 18:44 Another patch for PR88282 Vladimir Makarov
2018-12-07 11:38 ` Richard Sandiford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).