Referencing a register in different modes

Jeff Law jeffreyalaw@gmail.com
Thu Aug 8 19:56:48 GMT 2024



On 8/8/24 10:26 AM, Stefan Schulze Frielinghaus wrote:
> 
> Since you installed this idea into my brain, I gave it a try.  Maybe something
> along the lines:
> 
>                rtx orig_reg = regno_reg_rtx[regno];
>                machine_mode m1 = GET_MODE (orig_reg);
>                machine_mode m2 = GET_MODE (reg);
>                if (m1 != m2)
>                  internal_error (
>                      "pseudo %i defined for mode %s but referenced in "
>                      "mode %s in insn %i", regno, GET_MODE_NAME (m1),
>                      GET_MODE_NAME (m2), INSN_UID (insn));
I wouldn't check the modes here, I'd trip the internal error on reg != 
orig_reg.



> 
> I haven't tested it extensively but it triggers at least for the current case.
> I would have loved to also print the insn but couldn't figure out how to ICE
> and stringify an insn.  I will have a look at this tomorrow.  Did you have any
> place in mind where to put/call something like this?
I didn't have anywhere specific in mind.   As I suspected the 
verify_rtl_sharing isn't a great fit from an implementation standpoint, 
but it seems right conceptually.

If you want to throw a patch over the wall for testing, happy to put it 
into my tester and see what comes out the other side.  I wouldn't be at 
all surprised if it tripped on other targets.

jeff



More information about the Gcc mailing list