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]

[PATCH] Support TImode in go types_for_mode langhook (PR target/52079)


Hi!

ARM backend uses some libcalls that return TImode, so we need
lang_hooks.types.type_for_mode (TImode, ) to return non-NULL.  Other
FEs already handle it (except perhaps for Java), Go doesn't.
Fixed thusly, approved in the PR by Ian, committed to trunk.

2012-02-01  Jakub Jelinek  <jakub@redhat.com>

	PR target/52079
	* go-lang.c (go_langhook_type_for_mode): For TImode and 64-bit HWI
	return build_nonstandard_integer_type result if possible.

--- gcc/go/go-lang.c.jj	2012-01-13 21:47:31.000000000 +0100
+++ gcc/go/go-lang.c	2012-02-01 14:50:33.951279531 +0100
@@ -277,6 +277,7 @@ go_langhook_type_for_size (unsigned int
 static tree
 go_langhook_type_for_mode (enum machine_mode mode, int unsignedp)
 {
+  tree type;
   /* Go has no vector types.  Build them here.  FIXME: It does not
      make sense for the middle-end to ask the frontend for a type
      which the frontend does not support.  However, at least for now
@@ -291,7 +292,22 @@ go_langhook_type_for_mode (enum machine_
       return NULL_TREE;
     }
 
-  return go_type_for_mode (mode, unsignedp);
+  type = go_type_for_mode (mode, unsignedp);
+  if (type)
+    return type;
+
+#if HOST_BITS_PER_WIDE_INT >= 64
+  /* The middle-end and some backends rely on TImode being supported
+     for 64-bit HWI.  */
+  if (mode == TImode)
+    {
+      type = build_nonstandard_integer_type (GET_MODE_BITSIZE (TImode),
+					     unsignedp);
+      if (type && TYPE_MODE (type) == TImode)
+	return type;
+    }
+#endif
+  return NULL_TREE;
 }
 
 /* Record a builtin function.  We just ignore builtin functions.  */

	Jakub


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