On 03/16/2012 11:08 AM, Richard Guenther wrote: > > Your patch as-is is not safe at the moment. But why is casting a pointer > to an integer prohibitly expensive? That fact should be an implementation > detail of GIMPLE. Or is it the issue that IVOPTs chooses an integer > type that does not necessarily match the mode we'll use on RTL? > (thus, ptr_mode vs. Pmode issues, and/or sizeof (sizetype) != sizeof (void *) > issues?)
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. Bernd