[llvm-commits] Add -arm-long-calls support for ARMFastISel

Jush Lu jush.msn at gmail.com
Tue Jun 12 01:00:13 PDT 2012


Hi Chad,

The new patch is attached, I moved the BuildMI out the if-else, so
that BuildMI will be called only once.

I also moved some duplicate code into a new private function
"getLibcallReg(const Twin &Name)".

Thanks,
Jush


On Tue, Jun 12, 2012 at 3:54 AM, Chad Rosier <mcrosier at apple.com> wrote:
> Hi Jush,
> Overall, LGTM.  When the call is emitted in EmitLibcall is there a difference in the logic when in ARM mode vs. Thumb?
>
> Specifically, this bit of logic:
>  // Issue the call.
>  MachineInstrBuilder MIB;
>  unsigned CallOpc = ARMSelectCallOp(EnableARMLongCalls);
>  if (isThumb2) {
>    // Explicitly adding the predicate here.
>    MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
>                         TII.get(CallOpc)));
>    if (EnableARMLongCalls)
>      MIB.addReg(CalleeReg);
>    else
>      MIB.addExternalSymbol(TLI.getLibcallName(Call));
>  } else {
>    if (EnableARMLongCalls)
>      // Explicitly adding the predicate here.
>      MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
>                           TII.get(CallOpc))
>            .addReg(CalleeReg));
>    else
>      // Explicitly adding the predicate here.
>      MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
>                           TII.get(CallOpc))
>            .addExternalSymbol(TLI.getLibcallName(Call)));
>  }
>
> Similarly, in EmitCall can the logic in the else clause be simplified like that in the if (isThumb2) clause?  Specifically, can you make a single call to BuildMI in the else clause for this bit of logic:
>
>  // Issue the call.
>  MachineInstrBuilder MIB;
>  unsigned CallOpc = ARMSelectCallOp(UseReg);
>  if(isThumb2) {
>    // Explicitly adding the predicate here.
>    MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
>                                 TII.get(CallOpc)));
>    if (UseReg)
>      MIB.addReg(CalleeReg);
>    else if (!IntrMemName)
>      MIB.addGlobalAddress(GV, 0, 0);
>    else
>      MIB.addExternalSymbol(IntrMemName, 0);
>  } else {
>    if (UseReg)
>      // Explicitly adding the predicate here.
>      MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
>                                   TII.get(CallOpc))
>            .addReg(CalleeReg));
>    else if (!IntrMemName)
>      // Explicitly adding the predicate here.
>      MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
>                                   TII.get(CallOpc))
>            .addGlobalAddress(GV, 0, 0));
>    else
>      // Explicitly adding the predicate here.
>      MIB = AddDefaultPred(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
>                                   TII.get(CallOpc))
>            .addExternalSymbol(IntrMemName, 0));
>  }
>
>
>  Chad
>
> On Jun 10, 2012, at 7:59 AM, Jush Lu wrote:
>
>> Hi,
>>
>> I removed some unnecessary variables from the patch in last mail,
>> please ignore the patch in the last mail, and use the new one attached
>> in this mail.
>>
>> Thanks,
>> Jush
>>
>> On Sun, Jun 10, 2012 at 9:30 AM, Jush Lu <jush.msn at gmail.com> wrote:
>>> Hi,
>>>
>>> This patch adds -arm-long-calls support for ARMFastISel.
>>>
>>> It can generate arm long calls for global functions, runtime library
>>> calls, and memory intrinsics such as llvm.memset.
>>>
>>> The testtcases in the patch show how they work. Basically, these long
>>> calls work by blx instructions as the call to non-global callee does
>>> in r157336.
>>>
>>> Please help me review, thanks.
>>>
>>> Thanks,
>>> Jush
>> <ARMFastISel-arm-long-calls.patch>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ARMFastISel-arm-long-calls-06-12.patch
Type: application/octet-stream
Size: 12393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120612/1f6230f8/attachment.obj>


More information about the llvm-commits mailing list