Patchwork [ARM] soft/hard-float preprocessor symbol

login
register
mail settings
Submitter Chung-Lin Tang
Date July 21, 2010, 4:06 p.m.
Message ID <4C471AF4.4000302@codesourcery.com>
Download mbox | patch
Permalink /patch/59452/
State New
Headers show

Comments

Chung-Lin Tang - July 21, 2010, 4:06 p.m.
Hi, this patch adds built-in preprocessor symbols __ARM_PCS, 
__ARM_PCS_VFP to indicate the current soft/hard-float calling 
convention, as described in the draft ACLE.

If approved, please help to apply to trunk, as I don't have commit 
rights yet.

Thanks,
Chung-Lin

2010-07-22  Chung-Lin Tang  <cltang@codesourcery.com>

	* config/arm/arm.h (TARGET_CPU_CPP_BUILTINS): Define __ARM_PCS or
	__ARM_PCS_VFP to indicate soft/hard-float calling convention.
Mark Mitchell - July 22, 2010, 10:32 p.m.
Chung-Lin Tang wrote:

> Hi, this patch adds built-in preprocessor symbols __ARM_PCS,
> __ARM_PCS_VFP to indicate the current soft/hard-float calling
> convention, as described in the draft ACLE.

Do you have a pointer to that document?  I just want to double-check the
specification, and then I can review/approve this.

Thanks,
Richard Earnshaw - July 23, 2010, 9:46 p.m.
On Thu, 2010-07-22 at 00:06 +0800, Chung-Lin Tang wrote:
> Hi, this patch adds built-in preprocessor symbols __ARM_PCS, 
> __ARM_PCS_VFP to indicate the current soft/hard-float calling 
> convention, as described in the draft ACLE.
> 
> If approved, please help to apply to trunk, as I don't have commit 
> rights yet.
> 
> Thanks,
> Chung-Lin
> 
> 2010-07-22  Chung-Lin Tang  <cltang@codesourcery.com>
> 
> 	* config/arm/arm.h (TARGET_CPU_CPP_BUILTINS): Define __ARM_PCS or
> 	__ARM_PCS_VFP to indicate soft/hard-float calling convention.
> 
> 
> 
> plain text document attachment (pcs.diff)
> Index: arm.h
> ===================================================================
> --- arm.h	(revision 162381)
> +++ arm.h	(working copy)
> @@ -94,7 +94,13 @@
>  	if (arm_arch_iwmmxt)				\
>  	  builtin_define ("__IWMMXT__");		\
>  	if (TARGET_AAPCS_BASED)				\
> -	  builtin_define ("__ARM_EABI__");		\
> +	  {						\
> +	    if (TARGET_VFP && TARGET_HARD_FLOAT_ABI)	\
> +	      builtin_define ("__ARM_PCS_VFP");		\
> +	    else					\
> +	      builtin_define ("__ARM_PCS");		\
> +	    builtin_define ("__ARM_EABI__");		\
> +	  }						\
>      } while (0)
>  
>  /* The various ARM cores.  */

The tests should be on arm_pcs_default.  If that has the value
ARM_PCS_AAPCS_VFP then __ARM_PCS_VFP should be defined.  If it has the
value ARM_PCS_AAPCS, then __ARM_PCS should be defined.  In other cases,
I think neither should be defined (leaving the option open to create new
pre-processor defines in future).

That does leave nothing defined for the IWMMXT variant.  I'm not
entirely sure what to do about that.  It appears that this just follows
the base standard for calling, in which case __ARM_PCS probably should
be defined, but I want to think that case through further before making
that decision: there may be a subtlety that I've missed.

R.

Patch

Index: arm.h
===================================================================
--- arm.h	(revision 162381)
+++ arm.h	(working copy)
@@ -94,7 +94,13 @@ 
 	if (arm_arch_iwmmxt)				\
 	  builtin_define ("__IWMMXT__");		\
 	if (TARGET_AAPCS_BASED)				\
-	  builtin_define ("__ARM_EABI__");		\
+	  {						\
+	    if (TARGET_VFP && TARGET_HARD_FLOAT_ABI)	\
+	      builtin_define ("__ARM_PCS_VFP");		\
+	    else					\
+	      builtin_define ("__ARM_PCS");		\
+	    builtin_define ("__ARM_EABI__");		\
+	  }						\
     } while (0)
 
 /* The various ARM cores.  */