This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unreviewed patch to tree-ssa-loop-ivopts.c


Paul Schlie <schlie@comcast.net> writes:
>> Could someone review this patch?
>>
>> ivopts and unsigned_intSI_type_node
>> http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01840.html
>> 
>> Without this patch, c4x port doesn't build (according to the patch
>> description).
>
> Unless I misunderstand Richard already objected and was ignored. Although
> such a target specific patch should likely never have been proposed in the
> first place (much less applied).
>
>  http://gcc.gnu.org/ml/gcc-patches/2004-09/msg00580.html

Yeah, I linked to the same message in my patch submission (quoted above).
I also copied Richard's objection to Jan's patch in the mail:

----------------------------------------------------------------------------
The middle end should basically never refer to these type nodes.
Use lang_hooks.type_for_size.
----------------------------------------------------------------------------

> please see:
>
>  http://gcc.gnu.org/ml/gcc-patches/2005-04/msg00290.html
>
> the same basic problem here, I'd like to believe the maintainers can get
> there hands around this basic problem and propose a clean and simple
> solution to being able to simply identify the mode which corresponds to
> each target's defined type so that no black magic or guessing is required,
> which inevitably breaks something, typically at the unnecessary expense of
> smaller less vogue targets.

I don't follow.  The maintainers have already provided an interface to
do what you want.  No "black magic" is needed.  It's just a question of
using those interfaces (and that's what my patches are trying to do).

Your messages seem focused on modes rather than types, so let's
take those first.

The sizes of modes are already well-defined.  Specifically:

    GET_MODE_BITSIZE (QImode) == BITS_PER_UNIT
    GET_MODE_BITSIZE (HImode) == BITS_PER_UNIT * 2
    ...etc...

As for the interfaces: if you want an N-bit integer mode, use:

    mode_for_size (N, MODE_INT, 0)

Or you can use the following short-cuts:

    word_mode: a word-sized integer mode
    Pmode: an integer mode for pointers stored in registers
    ptr_mode: an integer mode for pointers stored in memory
    ...etc...

As for types: I took rth's message as saying that the correct way of
getting an N-bit signed or unsigned type was to use lang_hooks, not to
use *?I_type_node.  So if you want a 32-bit type, you use:

    lang_hooks.types.type_for_size (32, unsigned_p)

rather than:

    (unsigned_)intSI_type_node

So like I say, the interfaces for handling bitsize<->mode and
bitsize<->type lookups are already there.  And they're not
particularly complicated either ;)  We just need to use them...

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]