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: patch: Optionally use -mlong-double-128 by default on sparc



On Feb 3, 2006, at 5:16 PM, Aldy Hernandez wrote:


How does this look?

Small typo in sparc_mangle_fundamental_type corrected.


	* config/sparc/linux.h (TARGET_ALTERNATE_LONG_DOUBLE_MANGLING):
	Define.
	
	* config/sparc/linux64.h (TARGET_ALTERNATE_LONG_DOUBLE_MANGLING):
	Define.

	* config/sparc/sparc.c (sparc_override_options): Handle
	TARGET_DEFAULT_LONG_DOUBLE_128.
	(TARGET_MANGLE_FUNDAMENTAL_TYPE): Define.
	(sparc_mangle_fundamental_type): New.

+#ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
+/* Implement TARGET_MANGLE_FUNDAMENTAL_TYPE.  */
+
+static const char *
+sparc_mangle_fundamental_type (tree type)
+{
+  if (!TARGET_64BIT
+      && TYPE_MAIN_VARIANT (type) == long_double_type_node
+      && TARGET_LONG_DOUBLE_128)
+    return "g";
+
+  /* For all other types, use normal C++ mangling.  */
+  return NULL;
+}
+#endif


As I mentioned before, what about creating a config/linux.c that contains
something like:
#ifndef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
#define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING 0
+#endif
const char *
linux_mangle_fundamental_type (tree type)
{
if (TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
&& TYPE_MAIN_VARIANT (type) == long_double_type_node)
return "g";


  /* For all other types, use normal C++ mangling.  */
  return NULL;
}

And then in config/sparc/sparc.h and others do:
#define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING \
		!TARGET_64BIT && TARGET_LONG_DOUBLE_128

and also in config/linux.h:
#define TARGET_MANGLE_FUNDAMENTAL_TYPE linux_mangle_fundamental_type

That seems like a better idea than keep on copying this
function over and over again for each target.

Since this is Linux specific item, it seems like it should go into
the Linux specific files instead of processor specific files.

Other targets like Darwin and Solaris already does this for some
of the generic between targets configures.

Thanks,
Andrew Pinski


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