[Bug other/46677] frontends and tree optimizers use *_TYPE_SIZE

amylaar at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 29 04:25:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46677

--- Comment #10 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> 2010-11-29 02:53:27 UTC ---
(In reply to comment #3)
> * POINTER_SIZE and ADA_LONG_TYPE_SIZE I haven't looked at in detail - 

We have several possible substitutes for POINTER_SIZE:
GET_MODE_BITSIZE (ptr_mode)
TYPE_PRECISION (ptr_type_mode)
GET_MODE_BITSIZE (targetm.addr_space.pointer_mode (ADDR_SPACE_GENERIC))

Using machine modes is undesirable in files that don't already need to know
about modes.  TYPE_PRECISION (ptr_type_mode) seems reasonable for frontends
after this node has been initialized; however, AFAICT, this node is not
set for java.
All the substitutes suffer from initialization problems when used before
backend initialization.  With targetm.addr_space.pointer_mode this might
eventually be fixed by changing the hook definitions.

Therefore, I propose that targhooks.c provides a wrapper function for
GET_MODE_BITSIZE (targetm.addr_space.pointer_mode (ADDR_SPACE_GENERIC)) .
In can work around the intialization problems for now by checking for VOIDmode,
and using POINTER_SIZE when that happens.



More information about the Gcc-bugs mailing list