[llvm] r253465 - [WebAssembly] Enable register coloring and register stackifying.

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 16:59:09 PST 2015


We do want to support alloca for things we can't registerize (variable
size, address-taken, struct return, ...). Those are somewhat limited though.

Derek was thinking about tackling this after thanksgiving. We discussed a
quick design yesterday, but haven't written it down yet or discussed it
with Dan, we'll do that soon :-)

On Thu, Nov 19, 2015 at 4:51 PM, Eric Christopher via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

>
>
> 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
>>
>>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151119/52eecbca/attachment.html>


More information about the llvm-commits mailing list