Commit d1d3865f by Zack Weinberg

c-common.c (registered_builtin_types): New static.

	* 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.

From-SVN: r72711
parent 65fc9769
2003-10-20 Zack Weinberg <zack@codesourcery.com>
* 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.
2003-10-20 Richard Henderson <rth@redhat.com>
* config/alpha/alpha.h (PREDICATE_CODES): Add normal_memory_operand.
......
......@@ -1828,6 +1828,10 @@ c_common_type_for_size (unsigned int bits, int unsignedp)
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 bits, int unsignedp)
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_mode mode, int unsignedp)
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, const char* name)
if (!TYPE_NAME (type))
TYPE_NAME (type) = decl;
pushdecl (decl);
registered_builtin_types = tree_cons (0, type, registered_builtin_types);
}
......
......@@ -5019,18 +5019,7 @@ init_integral_libfuncs (optab optable, const char *opname, int suffix)
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment