This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Target dependent modes: a few more tweaks
- From: "Zack Weinberg" <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 20 Oct 2003 11:28:10 -0700
- Subject: Target dependent modes: a few more tweaks
These bits were included in the big IA64 patch I posted last week;
they're target independent and don't have the bugs that the IA64-
specific bits do, so I'm peeling them off and checking them in
separately.
zw
* c-common.c (registered_builtin_types): New static.
(c_common_type_for_mode): Consult registered_builtin_types.
(c_register_builtin_type): Add type to registered_builtin_types.
* optabs.c (init_floating_libfuncs): Initialize libfuncs for
all MODE_FLOAT modes, not just the ones corresponding to
float_type_node, double_type_node, and long_double_type_node.
===================================================================
Index: c-common.c
--- c-common.c 12 Oct 2003 22:09:20 -0000 1.463
+++ c-common.c 20 Oct 2003 18:24:26 -0000
@@ -1828,6 +1828,10 @@ c_common_type_for_size (unsigned int bit
return 0;
}
+/* Used for communication between c_common_type_for_mode and
+ c_register_builtin_type. */
+static GTY(()) tree registered_builtin_types;
+
/* Return a data type that has machine mode MODE.
If the mode is an integer,
then UNSIGNEDP selects between signed and unsigned types. */
@@ -1835,6 +1839,8 @@ c_common_type_for_size (unsigned int bit
tree
c_common_type_for_mode (enum machine_mode mode, int unsignedp)
{
+ tree t;
+
if (mode == TYPE_MODE (integer_type_node))
return unsignedp ? unsigned_type_node : integer_type_node;
@@ -1923,6 +1929,10 @@ c_common_type_for_mode (enum machine_mod
break;
}
+ for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
+ if (TYPE_MODE (TREE_VALUE (t)) == mode)
+ return TREE_VALUE (t);
+
return 0;
}
@@ -2051,6 +2061,8 @@ c_register_builtin_type (tree type, cons
if (!TYPE_NAME (type))
TYPE_NAME (type) = decl;
pushdecl (decl);
+
+ registered_builtin_types = tree_cons (0, type, registered_builtin_types);
}
===================================================================
Index: optabs.c
--- optabs.c 11 Oct 2003 19:00:49 -0000 1.200
+++ optabs.c 20 Oct 2003 18:24:26 -0000
@@ -5019,18 +5019,7 @@ init_integral_libfuncs (optab optable, c
static void
init_floating_libfuncs (optab optable, const char *opname, int suffix)
{
- enum machine_mode fmode, dmode, lmode;
-
- fmode = float_type_node ? TYPE_MODE (float_type_node) : VOIDmode;
- dmode = double_type_node ? TYPE_MODE (double_type_node) : VOIDmode;
- lmode = long_double_type_node ? TYPE_MODE (long_double_type_node) : VOIDmode;
-
- if (fmode != VOIDmode)
- init_libfuncs (optable, fmode, fmode, opname, suffix);
- if (dmode != fmode && dmode != VOIDmode)
- init_libfuncs (optable, dmode, dmode, opname, suffix);
- if (lmode != dmode && lmode != VOIDmode)
- init_libfuncs (optable, lmode, lmode, opname, suffix);
+ init_libfuncs (optable, MIN_MODE_FLOAT, MAX_MODE_FLOAT, opname, suffix);
}
/* Initialize the libfunc fields of an entire group of entries of an