[llvm-commits] Add -arm-long-calls support for ARMFastISel
Chad Rosier
mcrosier at apple.com
Mon Jun 11 12:54:54 PDT 2012
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>
More information about the llvm-commits
mailing list