This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
Re: Use of DI mode on 32-bit hosts
Frank Ch. Eigler writes:
> I guess I don't see the abstraction and simplicity this
> indirection is to provide. Do you have an example?
- I'd rather have one version of "add" for sparc 32/64
- I'd rather write 'IAI in the .scm sources when refering to 'pc
than doing something else
[for example]
> > INT/UINT are treated separately. They're for host values
> > where one doesn't care about target sizes.
>
> In what circumstances do you consider it reasonable for cgen
> model files to deal with host data types/sizes?
Don't say "deal with host data types/sizes". That'll trigger arguments
that go off on tangents. Each host has lots of data types/sizes.
What I meant was integers not tied to particular widths,
and for pragmatic sake one can assume the application will have available
at least a 32 bit integral type to use.
Sometimes the code will need a mode but imposing a specific
width muddies the waters. If one wanted to write some rtl
that looped over something, picking one of QI/HI/SI/DI
may be less appealing than "just give me a big enough int".
How many in C-land write "for (unsigned i = 0; mumble; mumble)
vs "for (uint32_t i = 0; mumble; mumble)"?
[
And actually I was incomplete. INT/UINT are also used for varying
width values, whereas SI/DI have explicit widths.
So actually, I should have two separate forms of INT/UINT,
but the distinction has yet to be needed.
>From doc/rtl.texi:
@example
@code{(immediate mode)}
@code{(immediate (mode bits))}
@end example
The second form is for values for which a mode of that size doesn't exist.
@samp{mode} for the second form must be one of @code{INT} or @code{UINT}.
Since these two modes don't have an implicit size, they cannot be used
for the first form.
??? There's no real reason why a mode like SI can't be used
for odd-sized immediate values. The @samp{bits} field indicates the size
and the @samp{mode} field indicates the mode in which the value will be used,
as well as its signedness. This would allow removing INT/UINT for this
purpose. On the other hand, a non-width specific mode allows applications
to choose one (a simulator might prefer to store immediates in an `int'
rather than, say, char if the specified mode was @code{QI}).
[and I should rephrase that to say that imposing one width with SI
on a value (e.g. immediate) of a different width is confusing]
]