[llvm] r253465 - [WebAssembly] Enable register coloring and register stackifying.
Eric Christopher via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 19 16:51:45 PST 2015
On Thu, Nov 19, 2015 at 4:50 PM Dan Gohman <sunfish at mozilla.com> wrote:
> On Thu, Nov 19, 2015 at 4:33 PM, Eric Christopher <echristo at gmail.com>
> wrote:
>
>>
>>
>> On Thu, Nov 19, 2015 at 4:32 PM Dan Gohman <sunfish at mozilla.com> wrote:
>>
>>> On Thu, Nov 19, 2015 at 2:38 PM, Eric Christopher <echristo at gmail.com>
>>> wrote:
>>>
>>>>
>>>>
>>>>> + // FIXME: If scheduling has moved an ARGUMENT virtual register,
>>>>> move it back,
>>>>> + // and recompute liveness. This is a temporary hack.
>>>>> + bool SawNonArg = false;
>>>>> + bool MovedArg = false;
>>>>> + MachineBasicBlock &EntryMBB = MF.front();
>>>>> + for (auto MII = EntryMBB.begin(); MII != EntryMBB.end(); ) {
>>>>> + MachineInstr *MI = &*MII++;
>>>>> + if (MI->getOpcode() == WebAssembly::ARGUMENT_I32 ||
>>>>> + MI->getOpcode() == WebAssembly::ARGUMENT_I64 ||
>>>>> + MI->getOpcode() == WebAssembly::ARGUMENT_F32 ||
>>>>> + MI->getOpcode() == WebAssembly::ARGUMENT_F64) {
>>>>> + EntryMBB.insert(EntryMBB.begin(), MI->removeFromParent());
>>>>> + if (SawNonArg)
>>>>> + MovedArg = true;
>>>>> + } else {
>>>>> + SawNonArg = true;
>>>>> + }
>>>>> + }
>>>>> + if (MovedArg) {
>>>>> + SlotIndexes &Slots = getAnalysis<SlotIndexes>();
>>>>> + Liveness->releaseMemory();
>>>>> + Slots.releaseMemory();
>>>>> + Slots.runOnMachineFunction(MF);
>>>>> + Liveness->runOnMachineFunction(MF);
>>>>> + }
>>>>>
>>>>>
>>>> How temporary is this and do you plan on making the arguments
>>>> non-schedulable? (Which is arguably what should be happening right? They
>>>> should be the equivalent to an alloca yes?)
>>>>
>>>
>>> I already wrote code to replace it: http://reviews.llvm.org/D14750 . If
>>> that patch isn't accepted, I'll go back to the drawing board to find some
>>> other way to pin the instructions to the top of the block. I don't yet have
>>> an idea for doing this, but it would be a high priority to find one.
>>>
>>
>> Makes sense. I'm curious on the difference between this and using an
>> alloca to do the same work?
>>
>
> An alloca would translate into a FrameIndex operand, but we really want it
> to act like a virtual register so that we can compute its liveness using
> LiveIntervals and color it along with the other registers.
>
Hrm. That's what I thought you were going to say. Frustrating. :)
-eric
>
> Dan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151120/1a42db0c/attachment.html>
More information about the llvm-commits
mailing list