[llvm-commits] [PATCH] Add support for fast calling convention

Jush Lu jush.msn at gmail.com
Thu Aug 9 20:49:34 PDT 2012


**
*
Hi Chad,
*

**
**
*
In this patch, the first part
*
*

*
*   case CallingConv::Fast:
-    // Ignore fastcc. Silence compiler warnings.
-    (void)RetFastCC_ARM_APCS;
-    (void)FastCC_ARM_APCS;
+    if (Subtarget->hasVFP2() && !isVarArg) {
+      if (!Subtarget->isAAPCS_ABI())
+        return (Return ? RetFastCC_ARM_APCS : FastCC_ARM_APCS);
+      // For AAPCS ABI targets, just use VFP variant of the calling
convention.
+      return (Return ? RetCC_ARM_AAPCS_VFP : CC_ARM_AAPCS_VFP);
+    }
    // Fallthrough*

This part only adds support for fastcc, and fastcc support will fix the
inconsistency of calling convention, there is no extra code for fixing
inconsistency of calling convention. Should I split this part? it is hard
to split it, I am afraid that my bad description leads you to think that
the rest of this patch is to fix the inconsistency of calling convention,
but it doesn't .


the rest of this patch

*   case CallingConv::C:
    // Use target triple & subtarget features to do actual dispatch.
-    if (Subtarget->isAAPCS_ABI()) {
-      if (Subtarget->hasVFP2() &&
-          TM.Options.FloatABIType == FloatABI::Hard && !isVarArg)
-        return (Return ? RetCC_ARM_AAPCS_VFP: CC_ARM_AAPCS_VFP);
-      else
-        return (Return ? RetCC_ARM_AAPCS: CC_ARM_AAPCS);
-    } else
-        return (Return ? RetCC_ARM_APCS: CC_ARM_APCS);
+    if (!Subtarget->isAAPCS_ABI())
+      return (Return ? RetCC_ARM_APCS : CC_ARM_APCS);
+    if (Subtarget->hasVFP2() &&
+        TM.Options.FloatABIType == FloatABI::Hard && !isVarArg)
+      return (Return ? RetCC_ARM_AAPCS_VFP: CC_ARM_AAPCS_VFP);
+    return (Return ? RetCC_ARM_AAPCS: CC_ARM_AAPCS);
  case CallingConv::ARM_AAPCS_VFP:*

This part doesn’t fix anything, it just simplifies if statements, no
functionality changes in this part.

In the attached patch, I only remove the ‘else’ from ‘else if’ as your
comments, the rest is same as the last patch, I didn’t do split yet.

Thanks,
Jush

On Fri, Aug 10, 2012 at 3:07 AM, Chad Rosier <mcrosier at apple.com> wrote:

> Jush,
> Based on your description this patch has two fixes.  I realize these are
> very small changes, but can you please split this into two patches?
>
> Also
>
> +    if (!Subtarget->isAAPCS_ABI())
> +      return (Return ? RetCC_ARM_APCS : CC_ARM_APCS);
> +    else if (Subtarget->hasVFP2() &&
> +           TM.Options.FloatABIType == FloatABI::Hard && !isVarArg)
> +      return (Return ? RetCC_ARM_AAPCS_VFP: CC_ARM_AAPCS_VFP);
>
> No need for the 'else' in the 'else if' since the previous statement was a
> return.
>
>  Chad
>
> On Aug 9, 2012, at 4:53 AM, Jush Lu wrote:
>
> *
> Hi,
>
> This patch adds support for fast calling convention, and this patch is
> almost same as r117119, I just copied a piece of code from
> CCAssignFnForNode which is in lib/Target/ARM/ARMISelLowering.cpp
>
> Currently ARMFastISel handles fastcc for caller side by simply falling
> through to other calling conventions such as CC_ARM_AAPCS, but the callee
> with fastcc always uses CC_ARM_AAPCS_VFP calling convention if VFP2 is
> available. This inconsistency of calling conventions will make problems,
> and this patch will fix it as well.
>
> Please review this patch, thanks.
>
> Jush* <fast-isel-fastcc.patch>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120810/04db386e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fast-isel-fastcc.patch
Type: application/octet-stream
Size: 2357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120810/04db386e/attachment.obj>


More information about the llvm-commits mailing list