[MLton] different word sizes

Matthew Fluet fluet@cs.cornell.edu
Mon, 26 Apr 2004 14:45:16 -0400 (EDT)


> The issue is that when faced with representing a value that takes,
> say, five bits, I can either use a Word8, a Word16, or a Word32.
> But when
> I have a complete five-bit value in a (Rssa/Machine) register, I can
> have the register be of size 8, 16, or 32.  For now, I always choose
> the smallest size that is big enough to hold the value.  But this
> seems to cause a lot of unnecessary coercions between different sizes.

O.k.  So, many of the coercions are Word32_toWord8 and Word8_toWord32.  I
think Henry's comment is correct, that Word32_toWord8 coercions are bad,
because they are accomplished by putting something into %eax and then
using %al.

> I don't actually need any support from the codegens to do this.  I can
> express it in the representation pass.  So, I'll put it on my todo as
> an experiment.  But I am curious if anyone has any thoughts why it
> might be good or bad.

It would be a worthwhile experiment.