[commit: ghc] master: Pass platform down to lastint (b6b6311)
Simon Marlow
marlowsd at gmail.com
Thu Aug 23 11:06:49 CEST 2012
On 22/08/2012 13:51, Ian Lynagh wrote:
> On Wed, Aug 22, 2012 at 10:30:54AM +0100, Simon Marlow wrote:
>>>
>>> class Show freeRegs => FR freeRegs where
>>> frAllocateReg :: RealReg -> freeRegs -> freeRegs
>>> - frGetFreeRegs :: RegClass -> freeRegs -> [RealReg]
>>> + frGetFreeRegs :: Platform -> RegClass -> freeRegs -> [RealReg]
>>> frInitFreeRegs :: Platform -> freeRegs
>>> frReleaseReg :: RealReg -> freeRegs -> freeRegs
>>
>> It seems a bit silly to have *both* a type class and explicit
>> passing around of the Platform here. Shouldn't we be using just one
>> or the other? (and preferably the class)
>
> Erm, maybe.
>
> In general, the Platform value contains more information than the type
> (e.g. the Platform value knows the armISAExt if we're on ARM). And in
> this case, x86 and x86_64 share a type
> RegAlloc.Linear.X86.FreeRegs.FreeRegs
> so the class can't distinguish them - although that type is
> conditionally defined depending on the platform, so one way or another
> that needs to be changed. But the easiest change would be to just make
> it (a newtyped) Word64 for both.
I'd make it a newtype, but keep it a Word32 on x86. Word64 has terrible
performance on 32-bit machines, and FreeRegs is in the inner loop of the
register allocator.
Cheers,
Simon
More information about the Cvs-ghc
mailing list