On 03/16/2012 09:49 PM, Richard Henderson wrote:
> On 03/16/12 05:36, Bernd Schmidt wrote:
>> The machine is "special". Pointer addition is a different operation than
>> integer addition. It'll also need a new ptr_plus rtx code which takes a
>> Pmode and an SImode operand. Pmode is larger than SImode but fits in a
>> single register; intptr_t (which is what we'd need to use if we freely
>> cast between pointers and integers is DImode - that requires two regs
>> and can't be used for memory addressing.
> Surely the least amount of work is to not use sizetype/intptr_t, but a
> custom type that has the same bit-width as a pointer?

See some of the later mails in this thread for more details - the
pointer add instruction isn't commutative. There is no true Pmode add,
only a Pmode lea; in fact there is no normal arithmetic in Pmode at all.
So you can't afford to lose information about which operand is the
pointer. Making Pmode integer types would mean lying to the compiler
very heavily about what operations are available, and it becomes way too
hackish very quickly.


Reply via email to