[LLVMdev] register allocation
jonas.paulsson at ericsson.com
Fri Feb 3 00:26:52 PST 2012
Well, I actually glue my condition-registers already, but as far as I know this only affects the scheduling from the DAG to the MachineFunction. It still happened that a register allocator at -O0 would spill this register for no reason at all in between these instructions.
The CopyCost attribute would help me, if the register allocators would factor it in with the spillWeight calculation. I suppose this would be fairly simple to implement, given that all the register allocators except -fast use the CalcSpillWeights class, where it could be included. Would this make sense to you as a patch? Maybe CopyCost and SpillCost should be held separate, I don't know, but in this case a new attribute could be introduced.
From: Jakob Stoklund Olesen [mailto:stoklund at 2pi.dk]
Sent: Friday, February 03, 2012 2:02 AM
To: Jeroen Dobbelaere
Cc: Jonas Paulsson; Jonas Paulsson; LLVMDEV
Subject: Re: [LLVMdev] register allocation
On 2012 2 2, at 08:40, Jeroen Dobbelaere <Jeroen.Dobbelaere at synopsys.com> wrote:
> I was able to get rid of the 'moves' by setting the copycost to -1.
> For getting rid of the spills, I was forced to introduce custom nodes,
> that pass the CC register through 'glue'.
> Having a property to register classes that identifies a 'glue-like' behavior would make sense to me.
I think setting CopyCost = -1 more or less does what you want, but I don't really understand what that field is for.
It is only ever used by the scheduler. Register allocation completely ignores it. Judging by how it is used, it should probably be a property of registers, not register classes.
More information about the llvm-dev