On 4/18/23 19:29, juzhe.zh...@rivai.ai wrote:
I tried refers_to_regno_p
It can not work for us since it just return true or false whether the
"rtx" has the regno.
Use refers_to_regno_p instead of the equality comparison for the REGNO.
So you're still going to have count_regno_occurrences, you're just
changing the test it uses so that it works for modes which potentially
span multiple hard registers.
Note that you'll want to pass in AVL rather than REGNO (avl). When you
call refers_to_regno_p it'll look something like
tmp = REGNO (avl);
mode = GET_MODE (avl);
if (REG_P (recog_data.operand[i])
&& refers_to_regno_p (tmp, hard_regno_nregs (tmp, mode),
recog_data.operand[i], NULL))
Or something like that. I'm assuming AVL is a hard register at this
point. If it could be a pseudo the code will be slightly different.
I'm still not sure all this stuff is handling SUBREGs properly either.
Though if it's only checked after reload, we should be OK as we should
have simplified the subreg away.
Jeff