This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [arm] Rework soft-float flags


On Thursday 18 November 2004 14:36, Richard Earnshaw wrote:
> The one change I would probably make is to move the default setting of
> TARGET_DEFAULT_FLOAT_ABI to arm.h (making it ARM_FLOAT_ABI_SOFT).  Then
> the number of places that needs to override the default goes down
> significantly.

Ok. Applied as attached.

Paul

2004-11-18  Paul Brook  <paul@codesourcery.com>

 * config/arm/arm.c (target_float_switch): New variable..
 (arm_override_options): Use TARGET_DEFAULT_FLOAT_ABI and
 target_float_switch.
 * config/arm/arm.h (target_float_switch): Declare.
 (ARM_FLAG_SOFT_FLOAT): Remove.
 (TARGET_SWITCHES): Remove hard-float and soft-float.
 (TARGET_OPTIONS): Add hard-float and soft-float.
 (TARGET_DEFAULT_FLOAT_ABI): Define.
 * config/arm/coff.h (TARGET_DEFAULT_FLOAT_ABI): Define
 (TARGET_DEFAULT): Don't use ARM_FLAG_SOFT_FLOAT.
 * config/arm/elf.h: Don't use ARM_FLAG_SOFT_FLOAT.
 * config/arm/netbsd-elf.h: Ditto.
 * config/arm/netbsd.h: Ditto.
 * config/arm/pe.h: Ditto.
 * config/arm/unknown-elf.h: Ditto.
 * config/arm/wince-pe.h: Ditto.
 * config/arm/linux-elf.h (TARGET_DEFAULT_FLOAT_ABI): Define.
 * config/arm/semi.h (TARGET_DEFAULT_FLOAT_ABI): Define.
 * config/arm/semiaof.h (TARGET_DEFAULT_FLOAT_ABI): Define.
Index: gcc/config/arm/arm.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.418
diff -u -p -r1.418 arm.c
--- gcc/config/arm/arm.c	11 Nov 2004 14:52:54 -0000	1.418
+++ gcc/config/arm/arm.c	18 Nov 2004 15:50:15 -0000
@@ -352,6 +352,9 @@ const char * target_fpe_name = NULL;
 /* Set by the -mfloat-abi=... option.  */
 const char * target_float_abi_name = NULL;
 
+/* Set by the legacy -mhard-float and -msoft-float options.  */
+const char * target_float_switch = NULL;
+
 /* Set by the -mabi=... option.  */
 const char * target_abi_name = NULL;
 
@@ -1078,14 +1081,16 @@ arm_override_options (void)
 	error ("invalid floating point abi: -mfloat-abi=%s",
 	       target_float_abi_name);
     }
-  else
+  else if (target_float_switch)
     {
-      /* Use soft-float target flag.  */
-      if (target_flags & ARM_FLAG_SOFT_FLOAT)
-	arm_float_abi = ARM_FLOAT_ABI_SOFT;
-      else
+      /* This is a bit of a hack to avoid needing target flags for these.  */
+      if (target_float_switch[1] == 'h')
 	arm_float_abi = ARM_FLOAT_ABI_HARD;
+      else
+	arm_float_abi = ARM_FLOAT_ABI_SOFT;
     }
+  else
+    arm_float_abi = TARGET_DEFAULT_FLOAT_ABI;
 
   if (arm_float_abi == ARM_FLOAT_ABI_HARD && TARGET_VFP)
     sorry ("-mfloat-abi=hard and VFP");
Index: gcc/config/arm/arm.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/arm.h,v
retrieving revision 1.260
diff -u -p -r1.260 arm.h
--- gcc/config/arm/arm.h	14 Oct 2004 07:37:09 -0000	1.260
+++ gcc/config/arm/arm.h	18 Nov 2004 15:50:15 -0000
@@ -125,6 +125,8 @@ extern const char *target_fpu_name;
 extern const char *target_fpe_name;
 /* Whether to use floating point hardware.  */
 extern const char *target_float_abi_name;
+/* For -m{soft,hard}-float.  */
+extern const char *target_float_switch;
 /* Which ABI to use.  */
 extern const char *target_abi_name;
 /* Define the information needed to generate branch insns.  This is
@@ -212,9 +214,7 @@ extern GTY(()) rtx aof_pic_label;
 #define ARM_FLAG_APCS_REENT	(1 << 6)
 
   /* FLAG 0x0080 now spare (used to be alignment traps).  */
-/* Nonzero if all floating point instructions are missing (and there is no
-   emulator either).  Generate function calls for all ops in this case.  */
-#define ARM_FLAG_SOFT_FLOAT	(1 << 8)
+  /* FLAG (1 << 8) is now spare (used to be soft-float).  */
 
 /* Nonzero if we should compile with BYTES_BIG_ENDIAN set to 1.  */
 #define ARM_FLAG_BIG_END	(1 << 9)
@@ -329,10 +329,6 @@ extern GTY(()) rtx aof_pic_label;
   {"apcs-reentrant",		ARM_FLAG_APCS_REENT,			\
    N_("Generate re-entrant, PIC code") },				\
   {"no-apcs-reentrant",	       -ARM_FLAG_APCS_REENT, "" },		\
-  {"soft-float",		ARM_FLAG_SOFT_FLOAT,			\
-   N_("Use library calls to perform FP operations") },			\
-  {"hard-float",	       -ARM_FLAG_SOFT_FLOAT,			\
-   N_("Use hardware floating point instructions") },			\
   {"big-endian",		ARM_FLAG_BIG_END,			\
    N_("Assume target CPU is configured as big endian") },		\
   {"little-endian",	       -ARM_FLAG_BIG_END,			\
@@ -397,7 +393,11 @@ extern GTY(()) rtx aof_pic_label;
    N_("Specify the minimum bit alignment of structures"), 0},		\
   {"pic-register=", & arm_pic_register_string,				\
    N_("Specify the register to be used for PIC addressing"), 0},	\
-  {"abi=", &target_abi_name, N_("Specify an ABI"), 0}			\
+  {"abi=", &target_abi_name, N_("Specify an ABI"), 0},			\
+  {"soft-float", &target_float_switch,					\
+   N_("Alias for -mfloat-abi=soft"), 0},				\
+  {"hard-float", &target_float_switch,					\
+   N_("Alias for -mfloat-abi=hard"), 0}					\
 }
 
 /* Support for a compile-time default CPU, et cetera.  The rules are:
@@ -481,6 +481,10 @@ enum float_abi_type
 
 extern enum float_abi_type arm_float_abi;
 
+#ifndef TARGET_DEFAULT_FLOAT_ABI
+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
+#endif
+
 /* Which ABI to use.  */
 enum arm_abi_type
 {
Index: gcc/config/arm/coff.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/coff.h,v
retrieving revision 1.33
diff -u -p -r1.33 coff.h
--- gcc/config/arm/coff.h	15 May 2004 12:41:33 -0000	1.33
+++ gcc/config/arm/coff.h	18 Nov 2004 15:50:15 -0000
@@ -30,8 +30,11 @@
 #undef  TARGET_VERSION
 #define TARGET_VERSION fputs (" (ARM/coff)", stderr)
 
+#undef  TARGET_DEFAULT_FLOAT_ABI
+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
+
 #undef  TARGET_DEFAULT
-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_FRAME)
+#define TARGET_DEFAULT (ARM_FLAG_APCS_FRAME)
 
 #ifndef MULTILIB_DEFAULTS
 #define MULTILIB_DEFAULTS \
Index: gcc/config/arm/elf.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/elf.h,v
retrieving revision 1.48
diff -u -p -r1.48 elf.h
--- gcc/config/arm/elf.h	15 Sep 2004 17:03:01 -0000	1.48
+++ gcc/config/arm/elf.h	18 Nov 2004 15:50:15 -0000
@@ -108,7 +108,7 @@
 #endif
 
 #ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_FRAME)
+#define TARGET_DEFAULT (ARM_FLAG_APCS_FRAME)
 #endif
 
 #ifndef MULTILIB_DEFAULTS
Index: gcc/config/arm/linux-elf.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/linux-elf.h,v
retrieving revision 1.50
diff -u -p -r1.50 linux-elf.h
--- gcc/config/arm/linux-elf.h	11 Nov 2004 03:17:59 -0000	1.50
+++ gcc/config/arm/linux-elf.h	18 Nov 2004 15:50:15 -0000
@@ -30,6 +30,9 @@
 /* Do not assume anything about header files.  */
 #define NO_IMPLICIT_EXTERN_C
 
+#undef  TARGET_DEFAULT_FLOAT_ABI
+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
+
 #undef  TARGET_DEFAULT
 #define TARGET_DEFAULT (0)
 
Index: gcc/config/arm/netbsd-elf.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/netbsd-elf.h,v
retrieving revision 1.11
diff -u -p -r1.11 netbsd-elf.h
--- gcc/config/arm/netbsd-elf.h	15 May 2004 12:41:33 -0000	1.11
+++ gcc/config/arm/netbsd-elf.h	18 Nov 2004 15:50:15 -0000
@@ -35,8 +35,7 @@
 /* Default it to use ATPCS with soft-VFP.  */
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT			\
-  (ARM_FLAG_SOFT_FLOAT			\
-   | ARM_FLAG_APCS_FRAME		\
+  (ARM_FLAG_APCS_FRAME			\
    | TARGET_ENDIAN_DEFAULT)
 
 #undef ARM_DEFAULT_ABI
Index: gcc/config/arm/netbsd.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/netbsd.h,v
retrieving revision 1.29
diff -u -p -r1.29 netbsd.h
--- gcc/config/arm/netbsd.h	15 May 2004 12:41:35 -0000	1.29
+++ gcc/config/arm/netbsd.h	18 Nov 2004 15:50:15 -0000
@@ -36,7 +36,7 @@
 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
 
 #undef TARGET_DEFAULT
-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_FRAME)
+#define TARGET_DEFAULT (ARM_FLAG_APCS_FRAME)
 
 /* Some defines for CPP.
    arm32 is the NetBSD port name, so we always define arm32 and __arm32__.  */
Index: gcc/config/arm/pe.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/pe.h,v
retrieving revision 1.29
diff -u -p -r1.29 pe.h
--- gcc/config/arm/pe.h	9 Sep 2004 17:11:16 -0000	1.29
+++ gcc/config/arm/pe.h	18 Nov 2004 15:50:15 -0000
@@ -60,7 +60,7 @@
 { "no-nop-fun-dllimport",	- TARGET_FLAG_NOP_FUN, "" },
 
 #undef  TARGET_DEFAULT
-#define TARGET_DEFAULT	(ARM_FLAG_SOFT_FLOAT | TARGET_FLAG_NOP_FUN)
+#define TARGET_DEFAULT	(TARGET_FLAG_NOP_FUN)
 
 #undef  MULTILIB_DEFAULTS
 #define MULTILIB_DEFAULTS \
Index: gcc/config/arm/semi.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/semi.h,v
retrieving revision 1.15
diff -u -p -r1.15 semi.h
--- gcc/config/arm/semi.h	15 May 2004 12:41:35 -0000	1.15
+++ gcc/config/arm/semi.h	18 Nov 2004 15:50:15 -0000
@@ -38,6 +38,10 @@
 #define TARGET_VERSION fputs (" (ARM/semi-hosted)", stderr);
 #endif
 
+#ifndef TARGET_DEFAULT_FLOAT_ABI
+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
+#endif
+
 #ifndef TARGET_DEFAULT
 #define TARGET_DEFAULT (ARM_FLAG_APCS_FRAME)
 #endif
Index: gcc/config/arm/semiaof.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/semiaof.h,v
retrieving revision 1.8
diff -u -p -r1.8 semiaof.h
--- gcc/config/arm/semiaof.h	15 May 2004 12:41:35 -0000	1.8
+++ gcc/config/arm/semiaof.h	18 Nov 2004 15:50:15 -0000
@@ -32,6 +32,8 @@
 
 #define TARGET_VERSION fputs (" (ARM/semi-hosted)", stderr);
 
+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
+
 #define TARGET_DEFAULT (0)
 
 /* The Norcroft C library defines size_t as "unsigned int".  */
Index: gcc/config/arm/unknown-elf.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/unknown-elf.h,v
retrieving revision 1.35
diff -u -p -r1.35 unknown-elf.h
--- gcc/config/arm/unknown-elf.h	17 Oct 2004 18:09:36 -0000	1.35
+++ gcc/config/arm/unknown-elf.h	18 Nov 2004 15:50:56 -0000
@@ -30,7 +30,7 @@
 
 /* Default to using software floating point.  */
 #ifndef TARGET_DEFAULT
-#define TARGET_DEFAULT	(ARM_FLAG_SOFT_FLOAT)
+#define TARGET_DEFAULT	(0)
 #endif
 
 /* Now we define the strings used to build the spec file.  */
Index: gcc/config/arm/wince-pe.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/wince-pe.h,v
retrieving revision 1.2
diff -u -p -r1.2 wince-pe.h
--- gcc/config/arm/wince-pe.h	15 May 2004 12:41:35 -0000	1.2
+++ gcc/config/arm/wince-pe.h	18 Nov 2004 15:50:15 -0000
@@ -20,7 +20,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #undef  TARGET_DEFAULT
-#define TARGET_DEFAULT	(ARM_FLAG_SOFT_FLOAT | TARGET_FLAG_NOP_FUN)
+#define TARGET_DEFAULT	(TARGET_FLAG_NOP_FUN)
 
 #undef  MULTILIB_DEFAULTS
 #define MULTILIB_DEFAULTS \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]