[llvm] r187139 - Allocate local registers in order for optimal coloring.
Jakob Stoklund Olesen
stoklund at 2pi.dk
Thu Jul 25 16:25:20 PDT 2013
On Jul 25, 2013, at 11:35 AM, Andrew Trick <atrick at apple.com> wrote:
> Author: atrick
> Date: Thu Jul 25 13:35:14 2013
> New Revision: 187139
>
> URL: http://llvm.org/viewvc/llvm-project?rev=187139&view=rev
> Log:
> Allocate local registers in order for optimal coloring.
Linear scan forever!
Besides the better coloring, I like how this enables more ldm/ldrd formation on ARM.
> @@ -411,9 +413,21 @@ void RAGreedy::enqueue(LiveInterval *LI)
> // everything else has been allocated.
> Prio = Size;
> } else {
> - // Everything is allocated in long->short order. Long ranges that don't fit
> - // should be spilled (or split) ASAP so they don't create interference.
> - Prio = (1u << 31) + Size;
> + if (ExtraRegInfo[Reg].Stage == RS_Assign && !LI->empty() &&
> + LIS->intervalIsInOneMBB(*LI)) {
> + // Allocate original local ranges in linear instruction order. Since they
> + // are singly defined, this produces optimal coloring in the absence of
> + // global interference and other constraints.
> + Prio = LI->beginIndex().distance(Indexes->getLastIndex());
The distance here could be divided by SlotIndexes::Slot_Count to prevent it from interfering with the high bits of Prio.
Thanks,
/jakob
More information about the llvm-commits
mailing list