[llvm-commits] [PATCH] Add support for ARMFastISel to select llvm.frameaddress

Jush Lu jush.msn at gmail.com
Wed May 30 00:13:19 PDT 2012


Hi,

The new patch is attached, I modified it just as suggestions.

thanks,
Jush


On Wed, May 30, 2012 at 12:09 AM, Chad Rosier <mcrosier at apple.com> wrote:
> Jush,
>
> +    unsigned LdrOpc = 0;
> +    const TargetRegisterClass *RC = NULL;
>
> I don't believe the compiler will warn if you don't initialize these.
>
> +    unsigned DestReg = createResultReg(RC);
> +
> +    const ARMBaseRegisterInfo *RegInfo =
> +          static_cast<const ARMBaseRegisterInfo*>(TM.getRegisterInfo());
> +    unsigned FramePtr = RegInfo->getFrameRegister(*(FuncInfo.MF));
> +    unsigned SrcReg = FramePtr;
> +
> +    // Recursively load frame address
> +    // ldr r0 [fp]
> +    // ldr r0 [r0]
> +    // ldr r0 [r0]
> +    // ...
> +    unsigned Depth = cast<ConstantInt>(I.getOperand(0))->getZExtValue();
> +    while (Depth--) {
> +      AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
> +                              TII.get(LdrOpc), DestReg)
> +                      .addReg(SrcReg)
> +                      .addImm(0));
> +
> +      SrcReg = DestReg;
> +      DestReg = createResultReg(RC);
> +    }
>
> Could you restructure the loop so that it doesn't have an extra call to createResultReg()?  Basically, remove the createResultReg() from outside the loop and move the call inside the loop above the call to BuildMI().
>
>  Chad
>
>
> On May 28, 2012, at 1:42 AM, Jush Lu wrote:
>
>> Hi,
>>
>> This patch adds support for ARMFastISel to select
>> llvm.frameaddress(i32), it passes all testcases and doesn't generate
>> any warnings.
>>
>> I have also tested this patch with several programs. Please help me
>> review, thanks.
>>
>> Jush
>> <fast-isel-frameaddress.patch>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fast-isel-frameaddress.patch
Type: application/octet-stream
Size: 4940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120530/7c7dee29/attachment.obj>


More information about the llvm-commits mailing list