https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105513

--- Comment #5 from Hongtao.liu <crazylht at gmail dot com> ---
And for constraint like 'vm', it's different from 'v,m' in calculating mem_cost
which will impact RA when op is REG_P. For 'v,m' mem_cost is just 1 *
frequency, but for 'vm' mem_cost is much bigger(memory_move_cost - 1) *
frequency. It means the impact of writing 'v,m' instead of 'vm' makes RA more
likely to choose mem instead of register.

 928                  if (op_class == NO_REGS)
 929                    /* Although we don't need insn to reload from
 930                       memory, still accessing memory is usually more
 931                       expensive than a register.  */
 932                    pp->mem_cost = frequency;
 933                  else
 934                    /* If the alternative actually allows memory, make
 935                       things a bit cheaper since we won't need an
 936                       extra insn to load it.  */
 937                    pp->mem_cost
 938                      = ((out_p ? ira_memory_move_cost[mode][op_class][0] :
0)
 939                         + (in_p ? ira_memory_move_cost[mode][op_class][1]
: 0)
 940=>                       - allows_mem[i]) * frequency;

Reply via email to