I'm enhancing the out-of-tree msp430 back end to support the 20-bit extended registers of the 430X CPU. I'd like to do this using a native type rather than special-casing its use in addresses. It seems the best approach is to use PSImode, since the values are 20 bits when in a register, and 32 bits when written to memory---exactly the sort of thing PSImode appears designed to handle.
However, it seems that the implementation isn't complete: few back ends use PSImode, and AFAICT none support a general purpose integral builtin type . The first problem I'm running into is that genmodes.c's PARTIAL_INT_MODE doesn't permit me to set the bit size---it's locked at 32 inherited from SImode. Consequently any attempt to use GET_MODE_BITSIZE (PSImode) returns the wrong answer, which causes infinite recursion in convert_to_integer because the builtin type I had to register so type_for_mode works uses 20 bits. Is there a better way to support this sort of thing than extending genmode with something like a PARTIAL_INT_MODE_PRECISION(M,B) macro that will correctly set the underlying precision field to 20 instead -1? Is there a preferred spelling for that macro? And is there any reason (other than it doesn't seem to have been done before) to believe PSImode is the wrong way to support a general-purpose 20-bit integral type in gcc? Thanks. Peter