* Makefile.in (convert.o, calls.o, expmed.o): Update.
* attribs.c (handle_mode_attribute, handle_vector_size_attribute):
Use new hooks.
* builtin-types.def (BT_PTRMODE): Update.
* c-common.c (type_for_size): Rename c_common_type_for_size.
(type_for_mode): Similarly.
(shorten_compare, pointer_int_sum, c_common_nodes_and_builtins):
Use new hook.
* c-bommon.h (c_common_type_for_size, c_common_type_for_mode): New.
* c-decl.c (finish_enum, build_enumerator): Use new hooks.
* c-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):
Redefine.
* c-typeck.c (common_type, comptypes, default_conversion):
Use new hooks.
* calls.c: Include langhooks.h.
(emit_library_call_value_1): Use new hooks. Avoid redundant
calls.
* convert.c: Include langhooks.h
(convert_to_pointer, convert_to_integer): Use new hooks.
* except.c (init_eh): Similarly.
* expmed.c: Include langhooks.h.
(expand_mult_add): Use new hooks.
* expr.c (store_expr, store_constructor, expand_expr, do_jump,
try_casesi): Similarly.
* fold-const.c (optimize_bit_field_compare, make_range,
decode_field_reference, fold_truthop, fold): Similarly.
* function.c (assign_stack_local_1, assign_stack_temp_for_type,
put_var_into_stack): Similarly.
* langhooks-def.h (LANG_HOOKS_TYPE_FOR_MODE,
LANG_HOOKS_TYPE_FOR_SIZE): New.
(LANG_HOOKS_TYPES_INITIALIZER): Update.
* langhooks.h (lang_hooks_for_types): New hooks.
* stmt.c (expand_decl_cleanup, emit_case_nodes): Use new hooks.
* tree.c (get_unwidened, get_narrower): Similarly.
* tree.h (type_for_mode, type_for_size): Remove.
* varasm.c (force_const_mem): Use new hooks.
ada:
* gigi.h (type_for_size, type_for_mode): Rename.
* misc.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):
Redefine.
* trans.c (tree_transform): Update.
* utils.c (gnat_init_decl_processing, init_gigi_decls,
builtin_function, float_type_for_size, signed_or_unsigned_type,
build_vms_descriptor, unchecked_convert): Update.
(type_for_mode, type_for_size): Rename.
* utils2.c (nonbinary_modular_operation): Update.
cp:
* cp-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):
Redefine.
* cvt.c (cp_convert_to_pointer, type_promotes_to): Use new hooks.
* decl.c (finish_enum): Similarly.
* error.c (dump_type): Similarly.
* lex.c (cxx_init): Similarly.
* mangle.c (write_builtin_type): Similarly.
* typeck.c (comptypes): Similarly.
f:
* com.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):
Redefine.
(type_for_mode, type_for_size): Rename.
(signed_or_unsigned_type, signed_type, truthvalue_conversion,
unsigned_type): Use new hooks.
java:
* Make-lang.in (builtins.o): Update.
* boehm.c (get_boehm_type_descriptor): Update.
* builtins.c: Include langhooks.h.
* decl.c (java_init_decl_processing): Update.
* java-tree.h (java_type_for_mode, java_type_for_size): New.
* lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIaZE):
Redefine.
* typeck.c (type_for_mode, type_for_size): Update.
objc:
* objc-act.c (handle_impent): Update.
* objc-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIaZE):
Redefine.
From-SVN: r51571
+2002-03-29 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * Makefile.in (convert.o, calls.o, expmed.o): Update.
+ * attribs.c (handle_mode_attribute, handle_vector_size_attribute):
+ Use new hooks.
+ * builtin-types.def (BT_PTRMODE): Update.
+ * c-common.c (type_for_size): Rename c_common_type_for_size.
+ (type_for_mode): Similarly.
+ (shorten_compare, pointer_int_sum, c_common_nodes_and_builtins):
+ Use new hook.
+ * c-bommon.h (c_common_type_for_size, c_common_type_for_mode): New.
+ * c-decl.c (finish_enum, build_enumerator): Use new hooks.
+ * c-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):
+ Redefine.
+ * c-typeck.c (common_type, comptypes, default_conversion):
+ Use new hooks.
+ * calls.c: Include langhooks.h.
+ (emit_library_call_value_1): Use new hooks. Avoid redundant
+ calls.
+ * convert.c: Include langhooks.h
+ (convert_to_pointer, convert_to_integer): Use new hooks.
+ * except.c (init_eh): Similarly.
+ * expmed.c: Include langhooks.h.
+ (expand_mult_add): Use new hooks.
+ * expr.c (store_expr, store_constructor, expand_expr, do_jump,
+ try_casesi): Similarly.
+ * fold-const.c (optimize_bit_field_compare, make_range,
+ decode_field_reference, fold_truthop, fold): Similarly.
+ * function.c (assign_stack_local_1, assign_stack_temp_for_type,
+ put_var_into_stack): Similarly.
+ * langhooks-def.h (LANG_HOOKS_TYPE_FOR_MODE,
+ LANG_HOOKS_TYPE_FOR_SIZE): New.
+ (LANG_HOOKS_TYPES_INITIALIZER): Update.
+ * langhooks.h (lang_hooks_for_types): New hooks.
+ * stmt.c (expand_decl_cleanup, emit_case_nodes): Use new hooks.
+ * tree.c (get_unwidened, get_narrower): Similarly.
+ * tree.h (type_for_mode, type_for_size): Remove.
+ * varasm.c (force_const_mem): Use new hooks.
+ * utils2.c (nonbinary_modular_operation): Update.
+objc:
+ * objc-act.c (handle_impent): Update.
+ * objc-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIaZE):
+ Redefine.
+
2002-03-29 Steve Ellcey <sje@cup.hp.com>
* config/ia64/ia64.md (*ptr_extend_plus_1, *ptr_extend_plus_2): New.
-DPREFIX=\"$(prefix)\" \
-c $(srcdir)/prefix.c $(OUTPUT_OPTION)
-convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h convert.h toplev.h
+convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h convert.h \
+ toplev.h langhooks.h
langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) toplev.h \
tree-inline.h $(RTL_H) insn-config.h integrate.h langhooks.h \
$(TARGET_H) function.h $(REGS_H) $(EXPR_H) $(OPTABS_H) insn-config.h \
$(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h \
except.h $(TM_P_H) $(PREDICT_H) libfuncs.h
-calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h $(EXPR_H) \
+calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
+ $(EXPR_H) langhooks.h \
libfuncs.h $(REGS_H) toplev.h output.h function.h $(TIMEVAR_H) $(TM_P_H)
expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) real.h \
- toplev.h $(TM_P_H)
+ toplev.h $(TM_P_H) langhooks.h
explow.o : explow.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
hard-reg-set.h insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \
toplev.h function.h ggc.h $(TM_P_H)
/* Return an integer type with the number of bits of precision given by
PRECISION. UNSIGNEDP is nonzero if the type is unsigned; otherwise
it is a signed type. */
-extern tree type_for_size PARAMS ((unsigned, int));
+extern tree gnat_type_for_size PARAMS ((unsigned, int));
/* Return a data type that has machine mode MODE. UNSIGNEDP selects
an unsigned type; otherwise a signed type is returned. */
-extern tree type_for_mode PARAMS ((enum machine_mode, int));
+extern tree gnat_type_for_mode PARAMS ((enum machine_mode, int));
/* Return the unsigned version of a TYPE_NODE, a scalar type. */
extern tree unsigned_type PARAMS ((tree));
#define LANG_HOOKS_PRINT_TYPE gnat_print_type
#undef LANG_HOOKS_DECL_PRINTABLE_NAME
#define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_printable_name
+#undef LANG_HOOKS_TYPE_FOR_MODE
+#define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode
+#undef LANG_HOOKS_TYPE_FOR_SIZE
+#define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
gnu_actual
= unchecked_convert
(DECL_ARG_TYPE (get_gnu_tree (gnat_formal)),
- convert (type_for_size
+ convert (gnat_type_for_size
(tree_low_cst (gnu_actual_size, 1), 1),
integer_zero_node));
else
/* In Ada, we use a signed type for SIZETYPE. Use the signed type
corresponding to the size of ptr_mode. Make this here since we need
this before we can expand the GNAT types. */
- set_sizetype (type_for_size (GET_MODE_BITSIZE (ptr_mode), 0));
+ set_sizetype (gnat_type_for_size (GET_MODE_BITSIZE (ptr_mode), 0));
build_common_tree_nodes_2 (0);
pushdecl (build_decl (TYPE_DECL, get_identifier (SIZE_TYPE), sizetype));
except_type_node = TREE_TYPE (exception_type);
- unsigned_type_node = type_for_size (INT_TYPE_SIZE, 1);
+ unsigned_type_node = gnat_type_for_size (INT_TYPE_SIZE, 1);
pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"),
unsigned_type_node));
/* Make the types and functions used for exception processing. */
jmpbuf_type
- = build_array_type (type_for_mode (Pmode, 0),
+ = build_array_type (gnat_type_for_mode (Pmode, 0),
build_index_type (build_int_2 (5, 0)));
pushdecl (build_decl (TYPE_DECL, get_identifier ("JMPBUF_T"), jmpbuf_type));
jmpbuf_ptr_type = build_pointer_type (jmpbuf_type);
it is a signed type. */
tree
-type_for_size (precision, unsignedp)
+gnat_type_for_size (precision, unsignedp)
unsigned precision;
int unsignedp;
{
an unsigned type; otherwise a signed type is returned. */
tree
-type_for_mode (mode, unsignedp)
+gnat_type_for_mode (mode, unsignedp)
enum machine_mode mode;
int unsignedp;
{
if (GET_MODE_CLASS (mode) == MODE_FLOAT)
return float_type_for_size (GET_MODE_BITSIZE (mode), mode);
else
- return type_for_size (GET_MODE_BITSIZE (mode), unsignedp);
+ return gnat_type_for_size (GET_MODE_BITSIZE (mode), unsignedp);
}
/* Return the unsigned version of a TYPE_NODE, a scalar type. */
unsigned_type (type_node)
tree type_node;
{
- tree type = type_for_size (TYPE_PRECISION (type_node), 1);
+ tree type = gnat_type_for_size (TYPE_PRECISION (type_node), 1);
if (TREE_CODE (type_node) == INTEGER_TYPE && TYPE_MODULAR_P (type_node))
{
signed_type (type_node)
tree type_node;
{
- tree type = type_for_size (TYPE_PRECISION (type_node), 0);
+ tree type = gnat_type_for_size (TYPE_PRECISION (type_node), 0);
if (TREE_CODE (type_node) == INTEGER_TYPE && TYPE_MODULAR_P (type_node))
{
if (! INTEGRAL_TYPE_P (type) || TREE_UNSIGNED (type) == unsignedp)
return type;
else
- return type_for_size (TYPE_PRECISION (type), unsignedp);
+ return gnat_type_for_size (TYPE_PRECISION (type), unsignedp);
}
\f
/* EXP is an expression for the size of an object. If this size contains
field_list
= chainon (field_list,
make_descriptor_field
- ("LENGTH", type_for_size (16, 1), record_type,
+ ("LENGTH", gnat_type_for_size (16, 1), record_type,
size_in_bytes (mech == By_Descriptor_A ? inner_type : type)));
field_list = chainon (field_list,
- make_descriptor_field ("DTYPE", type_for_size (8, 1),
+ make_descriptor_field ("DTYPE",
+ gnat_type_for_size (8, 1),
record_type, size_int (dtype)));
field_list = chainon (field_list,
- make_descriptor_field ("CLASS", type_for_size (8, 1),
+ make_descriptor_field ("CLASS",
+ gnat_type_for_size (8, 1),
record_type, size_int (class)));
field_list
field_list
= chainon (field_list,
make_descriptor_field
- ("SB_L1", type_for_size (32, 1), record_type,
+ ("SB_L1", gnat_type_for_size (32, 1), record_type,
TREE_CODE (type) == ARRAY_TYPE
? TYPE_MIN_VALUE (TYPE_DOMAIN (type)) : size_zero_node));
field_list
= chainon (field_list,
make_descriptor_field
- ("SB_L2", type_for_size (32, 1), record_type,
+ ("SB_L2", gnat_type_for_size (32, 1), record_type,
TREE_CODE (type) == ARRAY_TYPE
? TYPE_MAX_VALUE (TYPE_DOMAIN (type)) : size_zero_node));
break;
case By_Descriptor_NCA:
field_list = chainon (field_list,
make_descriptor_field ("SCALE",
- type_for_size (8, 1),
+ gnat_type_for_size (8, 1),
record_type,
size_zero_node));
field_list = chainon (field_list,
make_descriptor_field ("DIGITS",
- type_for_size (8, 1),
+ gnat_type_for_size (8, 1),
record_type,
size_zero_node));
field_list
= chainon (field_list,
make_descriptor_field
- ("AFLAGS", type_for_size (8, 1), record_type,
+ ("AFLAGS", gnat_type_for_size (8, 1), record_type,
size_int (mech == By_Descriptor_NCA
? 0
/* Set FL_COLUMN, FL_COEFF, and FL_BOUNDS. */
field_list = chainon (field_list,
make_descriptor_field ("DIMCT",
- type_for_size (8, 1),
+ gnat_type_for_size (8, 1),
record_type,
size_int (ndim)));
field_list = chainon (field_list,
make_descriptor_field ("ARSIZE",
- type_for_size (32, 1),
+ gnat_type_for_size (32, 1),
record_type,
size_in_bytes (type)));
fname[0] = (mech == By_Descriptor_NCA ? 'S' : 'M');
fname[1] = '0' + i, fname[2] = 0;
- field_list = chainon (field_list,
- make_descriptor_field (fname,
- type_for_size (32, 1),
- record_type,
- idx_length));
+ field_list
+ = chainon (field_list,
+ make_descriptor_field (fname,
+ gnat_type_for_size (32, 1),
+ record_type, idx_length));
if (mech == By_Descriptor_NCA)
tem = idx_length;
field_list
= chainon (field_list,
make_descriptor_field
- (fname, type_for_size (32, 1), record_type,
+ (fname, gnat_type_for_size (32, 1), record_type,
TYPE_MIN_VALUE (idx_arr[i])));
fname[0] = 'U';
field_list
= chainon (field_list,
make_descriptor_field
- (fname, type_for_size (32, 1), record_type,
+ (fname, gnat_type_for_size (32, 1), record_type,
TYPE_MAX_VALUE (idx_arr[i])));
}
break;
0))
&& ! (TREE_UNSIGNED (type) && TREE_UNSIGNED (etype)))
{
- tree base_type = type_for_mode (TYPE_MODE (type), TREE_UNSIGNED (type));
+ tree base_type = gnat_type_for_mode (TYPE_MODE (type),
+ TREE_UNSIGNED (type));
tree shift_expr
= convert (base_type,
size_binop (MINUS_EXPR,
|| TREE_UNSIGNED (op_type) != unsignedp)
{
/* Copy the node so we ensure it can be modified to make it modular. */
- op_type = copy_node (type_for_size (precision, unsignedp));
+ op_type = copy_node (gnat_type_for_size (precision, unsignedp));
modulus = convert (op_type, modulus);
TYPE_MODULUS (op_type) = modulus;
TYPE_MODULAR_P (op_type) = 1;
possible size. */
if (op_code == MULT_EXPR)
{
- tree div_type = copy_node (type_for_size (needed_precision, 1));
+ tree div_type = copy_node (gnat_type_for_size (needed_precision, 1));
modulus = convert (div_type, modulus);
TYPE_MODULUS (div_type) = modulus;
TYPE_MODULAR_P (div_type) = 1;
if (mode == VOIDmode)
error ("unknown machine mode `%s'", p);
- else if (0 == (typefm = type_for_mode (mode,
- TREE_UNSIGNED (type))))
+ else if (0 == (typefm = (*lang_hooks.types.type_for_mode)
+ (mode, TREE_UNSIGNED (type))))
error ("no data type for mode `%s'", p);
else
*node = typefm;
{
tree index, array, rt;
- new_type = type_for_mode (new_mode, TREE_UNSIGNED (type));
+ new_type = (*lang_hooks.types.type_for_mode) (new_mode,
+ TREE_UNSIGNED (type));
if (!new_type)
{
DEF_PRIMITIVE_TYPE (BT_PTR, ptr_type_node)
DEF_PRIMITIVE_TYPE (BT_CONST_PTR, const_ptr_type_node)
-DEF_PRIMITIVE_TYPE (BT_PTRMODE, type_for_mode (ptr_mode, 0))
+DEF_PRIMITIVE_TYPE (BT_PTRMODE, (*lang_hooks.types.type_for_mode)(ptr_mode, 0))
DEF_PRIMITIVE_TYPE (BT_SIZE, c_size_type_node)
DEF_PRIMITIVE_TYPE (BT_STRING, string_type_node)
DEF_PRIMITIVE_TYPE (BT_CONST_STRING, const_string_type_node)
that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */
tree
-type_for_size (bits, unsignedp)
+c_common_type_for_size (bits, unsignedp)
unsigned bits;
int unsignedp;
{
then UNSIGNEDP selects between signed and unsigned types. */
tree
-type_for_mode (mode, unsignedp)
+c_common_type_for_mode (mode, unsignedp)
enum machine_mode mode;
int unsignedp;
{
values from it's underlying integral type, not the enumerated
type itself. */
if (TREE_CODE (type) == ENUMERAL_TYPE)
- type = type_for_size (TYPE_PRECISION (type), unsignedp0);
+ type = c_common_type_for_size (TYPE_PRECISION (type), unsignedp0);
maxval = TYPE_MAX_VALUE (type);
minval = TYPE_MIN_VALUE (type);
if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype)
|| TREE_UNSIGNED (TREE_TYPE (intop)) != TREE_UNSIGNED (sizetype))
- intop = convert (type_for_size (TYPE_PRECISION (sizetype),
- TREE_UNSIGNED (sizetype)), intop);
+ intop = convert (c_common_type_for_size (TYPE_PRECISION (sizetype),
+ TREE_UNSIGNED (sizetype)), intop);
/* Replace the integer argument with a suitable product by the object size.
Do this multiplication as signed, then convert to the appropriate
record_builtin_type (RID_MAX, "signed char", signed_char_type_node);
record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node);
- /* These are types that type_for_size and type_for_mode use. */
+ /* These are types that c_common_type_for_size and
+ c_common_type_for_mode use. */
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
intQI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
extern tree handle_format_arg_attribute PARAMS ((tree *, tree, tree,
int, bool *));
extern void c_common_insert_default_attributes PARAMS ((tree));
+extern tree c_common_type_for_mode PARAMS ((enum machine_mode,
+ int));
+extern tree c_common_type_for_size PARAMS ((unsigned int, int));
extern void c_apply_type_quals_to_decl PARAMS ((int, tree));
extern tree c_sizeof PARAMS ((tree));
extern tree c_alignof PARAMS ((tree));
min_precision (maxnode, unsign));
if (TYPE_PACKED (enumtype) || precision > TYPE_PRECISION (integer_type_node))
{
- tree narrowest = type_for_size (precision, unsign);
+ tree narrowest = c_common_type_for_size (precision, unsign);
if (narrowest == 0)
{
warning ("enumeration values exceed range of largest integer");
precision = TYPE_PRECISION (integer_type_node);
if (precision == TYPE_PRECISION (integer_type_node))
- enum_value_type = type_for_size (precision, 0);
+ enum_value_type = c_common_type_for_size (precision, 0);
else
enum_value_type = enumtype;
/* Now create a declaration for the enum value name. */
type = TREE_TYPE (value);
- type = type_for_size (MAX (TYPE_PRECISION (type),
- TYPE_PRECISION (integer_type_node)),
- (TYPE_PRECISION (type) >= TYPE_PRECISION (integer_type_node)
- && TREE_UNSIGNED (type)));
+ type = c_common_type_for_size (MAX (TYPE_PRECISION (type),
+ TYPE_PRECISION (integer_type_node)),
+ (TYPE_PRECISION (type)
+ >= TYPE_PRECISION (integer_type_node)
+ && TREE_UNSIGNED (type)));
decl = build_decl (CONST_DECL, name, type);
DECL_INITIAL (decl) = convert (type, value);
#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
c_convert_parm_for_inlining
+#undef LANG_HOOKS_TYPE_FOR_MODE
+#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
+#undef LANG_HOOKS_TYPE_FOR_SIZE
+#define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
+
/* ### When changing hooks, consider if ObjC needs changing too!! ### */
/* Each front end provides its own. */
/* Treat an enum type as the unsigned integer type of the same width. */
if (TREE_CODE (t1) == ENUMERAL_TYPE)
- t1 = type_for_size (TYPE_PRECISION (t1), 1);
+ t1 = c_common_type_for_size (TYPE_PRECISION (t1), 1);
if (TREE_CODE (t2) == ENUMERAL_TYPE)
- t2 = type_for_size (TYPE_PRECISION (t2), 1);
+ t2 = c_common_type_for_size (TYPE_PRECISION (t2), 1);
code1 = TREE_CODE (t1);
code2 = TREE_CODE (t2);
signedness. */
if (TREE_CODE (t1) == ENUMERAL_TYPE)
- t1 = type_for_size (TYPE_PRECISION (t1), TREE_UNSIGNED (t1));
+ t1 = c_common_type_for_size (TYPE_PRECISION (t1), TREE_UNSIGNED (t1));
if (TREE_CODE (t2) == ENUMERAL_TYPE)
- t2 = type_for_size (TYPE_PRECISION (t2), TREE_UNSIGNED (t2));
+ t2 = c_common_type_for_size (TYPE_PRECISION (t2), TREE_UNSIGNED (t2));
if (t1 == t2)
return 1;
but convert wide enums to something wider. */
if (code == ENUMERAL_TYPE)
{
- type = type_for_size (MAX (TYPE_PRECISION (type),
- TYPE_PRECISION (integer_type_node)),
- ((TYPE_PRECISION (type)
- >= TYPE_PRECISION (integer_type_node))
- && TREE_UNSIGNED (type)));
+ type = c_common_type_for_size (MAX (TYPE_PRECISION (type),
+ TYPE_PRECISION (integer_type_node)),
+ ((TYPE_PRECISION (type)
+ >= TYPE_PRECISION (integer_type_node))
+ && TREE_UNSIGNED (type)));
return convert (type, exp);
}
#include "tm_p.h"
#include "timevar.h"
#include "sbitmap.h"
+#include "langhooks.h"
#if !defined FUNCTION_OK_FOR_SIBCALL
#define FUNCTION_OK_FOR_SIBCALL(DECL) 1
int reg_parm_stack_space = 0;
int needed;
rtx before_call;
+ tree tfom; /* type_for_mode (outmode, 0) */
#ifdef REG_PARM_STACK_SPACE
/* Define the boundary of the register parm stack space that needs to be
/* If this kind of value comes back in memory,
decide where in memory it should come back. */
- if (outmode != VOIDmode && aggregate_value_p (type_for_mode (outmode, 0)))
+ if (outmode != VOIDmode)
{
+ tfom = (*lang_hooks.types.type_for_mode) (outmode, 0);
+ if (aggregate_value_p (tfom))
+ {
#ifdef PCC_STATIC_STRUCT_RETURN
- rtx pointer_reg
- = hard_function_value (build_pointer_type (type_for_mode (outmode, 0)),
- 0, 0);
- mem_value = gen_rtx_MEM (outmode, pointer_reg);
- pcc_struct_value = 1;
- if (value == 0)
- value = gen_reg_rtx (outmode);
+ rtx pointer_reg
+ = hard_function_value (build_pointer_type (tfom), 0, 0);
+ mem_value = gen_rtx_MEM (outmode, pointer_reg);
+ pcc_struct_value = 1;
+ if (value == 0)
+ value = gen_reg_rtx (outmode);
#else /* not PCC_STATIC_STRUCT_RETURN */
- struct_value_size = GET_MODE_SIZE (outmode);
- if (value != 0 && GET_CODE (value) == MEM)
- mem_value = value;
- else
- mem_value = assign_temp (type_for_mode (outmode, 0), 0, 1, 1);
+ struct_value_size = GET_MODE_SIZE (outmode);
+ if (value != 0 && GET_CODE (value) == MEM)
+ mem_value = value;
+ else
+ mem_value = assign_temp (tfom, 0, 1, 1);
#endif
-
- /* This call returns a big structure. */
- flags &= ~(ECF_CONST | ECF_PURE | ECF_LIBCALL_BLOCK);
+ /* This call returns a big structure. */
+ flags &= ~(ECF_CONST | ECF_PURE | ECF_LIBCALL_BLOCK);
+ }
}
+ else
+ tfom = void_type_node;
/* ??? Unfinished: must pass the memory address as an argument. */
slot = val;
else if (must_copy)
{
- slot = assign_temp (type_for_mode (mode, 0), 0, 1, 1);
+ slot = assign_temp ((*lang_hooks.types.type_for_mode) (mode, 0),
+ 0, 1, 1);
emit_move_insn (slot, val);
}
else
{
- tree type = type_for_mode (mode, 0);
+ tree type = (*lang_hooks.types.type_for_mode) (mode, 0);
slot = gen_rtx_MEM (mode,
expand_expr (build1 (ADDR_EXPR,
emit_call_1 (fun,
get_identifier (XSTR (orgfun, 0)),
- build_function_type (outmode == VOIDmode ? void_type_node
- : type_for_mode (outmode, 0), NULL_TREE),
+ build_function_type (tfom, NULL_TREE),
original_args_size.constant, args_size.constant,
struct_value_size,
FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
#include "flags.h"
#include "convert.h"
#include "toplev.h"
+#include "langhooks.h"
/* Convert EXPR to some pointer or reference type TYPE.
return
convert_to_pointer (type,
- convert (type_for_size (POINTER_SIZE, 0), expr));
+ convert ((*lang_hooks.types.type_for_size)
+ (POINTER_SIZE, 0), expr));
default:
error ("cannot convert to a pointer type");
if (integer_zerop (expr))
expr = integer_zero_node;
else
- expr = fold (build1 (CONVERT_EXPR,
- type_for_size (POINTER_SIZE, 0), expr));
+ expr = fold (build1 (CONVERT_EXPR, (*lang_hooks.types.type_for_size)
+ (POINTER_SIZE, 0), expr));
return convert_to_integer (type, expr);
else if (TREE_CODE (type) == ENUMERAL_TYPE
|| outprec != GET_MODE_BITSIZE (TYPE_MODE (type)))
return build1 (NOP_EXPR, type,
- convert (type_for_mode (TYPE_MODE (type),
- TREE_UNSIGNED (type)),
+ convert ((*lang_hooks.types.type_for_mode)
+ (TYPE_MODE (type), TREE_UNSIGNED (type)),
expr));
/* Here detect when we can distribute the truncation down past some
/* Can't do arithmetic in enumeral types
so use an integer type that will hold the values. */
if (TREE_CODE (typex) == ENUMERAL_TYPE)
- typex = type_for_size (TYPE_PRECISION (typex),
- TREE_UNSIGNED (typex));
+ typex = (*lang_hooks.types.type_for_size)
+ (TYPE_PRECISION (typex), TREE_UNSIGNED (typex));
/* But now perhaps TYPEX is as wide as INPREC.
In that case, do nothing special here.
/* Can't do arithmetic in enumeral types
so use an integer type that will hold the values. */
if (TREE_CODE (typex) == ENUMERAL_TYPE)
- typex = type_for_size (TYPE_PRECISION (typex),
- TREE_UNSIGNED (typex));
+ typex = (*lang_hooks.types.type_for_size)
+ (TYPE_PRECISION (typex), TREE_UNSIGNED (typex));
/* But now perhaps TYPEX is as wide as INPREC.
In that case, do nothing special here.
+2002-03-29 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):
+ Redefine.
+ * cvt.c (cp_convert_to_pointer, type_promotes_to): Use new hooks.
+ * decl.c (finish_enum): Similarly.
+ * error.c (dump_type): Similarly.
+ * lex.c (cxx_init): Similarly.
+ * mangle.c (write_builtin_type): Similarly.
+ * typeck.c (comptypes): Similarly.
+
2002-03-28 Roger Sayle <roger@eyesopen.com>
PR c++/5998:
#undef LANG_HOOKS_MAKE_TYPE
#define LANG_HOOKS_MAKE_TYPE cxx_make_type
+#undef LANG_HOOKS_TYPE_FOR_MODE
+#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
+#undef LANG_HOOKS_TYPE_FOR_SIZE
+#define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
/* Each front end provides its own hooks, for toplev.c. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
{
if (TYPE_PRECISION (intype) == POINTER_SIZE)
return build1 (CONVERT_EXPR, type, expr);
- expr = cp_convert (type_for_size (POINTER_SIZE, 0), expr);
+ expr = cp_convert (c_common_type_for_size (POINTER_SIZE, 0), expr);
/* Modes may be different but sizes should be the same. */
if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (expr)))
!= GET_MODE_SIZE (TYPE_MODE (type)))
{
int precision = MAX (TYPE_PRECISION (type),
TYPE_PRECISION (integer_type_node));
- tree totype = type_for_size (precision, 0);
+ tree totype = c_common_type_for_size (precision, 0);
if (TREE_UNSIGNED (type)
&& ! int_fits_type_p (TYPE_MAX_VALUE (type), totype))
- type = type_for_size (precision, 1);
+ type = c_common_type_for_size (precision, 1);
else
type = totype;
}
if (flag_short_enums || (precision > TYPE_PRECISION (integer_type_node)))
/* Use the width of the narrowest normal C type which is wide
enough. */
- TYPE_PRECISION (enumtype) = TYPE_PRECISION (type_for_size
+ TYPE_PRECISION (enumtype) = TYPE_PRECISION (c_common_type_for_size
(precision, 1));
else
TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node);
which has no name and is not very useful for diagnostics. So
look up the equivalent C type and print its name. */
tree elt = TREE_TYPE (t);
- elt = type_for_mode (TYPE_MODE (elt), TREE_UNSIGNED (elt));
+ elt = c_common_type_for_mode (TYPE_MODE (elt), TREE_UNSIGNED (elt));
dump_type (elt, flags);
}
break;
/* Create the built-in __null node. */
null_node = build_int_2 (0, 0);
- TREE_TYPE (null_node) = type_for_size (POINTER_SIZE, 0);
+ TREE_TYPE (null_node) = c_common_type_for_size (POINTER_SIZE, 0);
ridpointers[RID_NULL] = null_node;
token_count = init_cpp_parse ();
if (itk == itk_none)
{
- tree t = type_for_mode (TYPE_MODE (type), TREE_UNSIGNED (type));
+ tree t = c_common_type_for_mode (TYPE_MODE (type),
+ TREE_UNSIGNED (type));
if (type == t)
{
if (TYPE_PRECISION (type) == 128)
/* Treat an enum type as the unsigned integer type of the same width. */
if (TREE_CODE (t1) == ENUMERAL_TYPE)
- t1 = type_for_size (TYPE_PRECISION (t1), 1);
+ t1 = c_common_type_for_size (TYPE_PRECISION (t1), 1);
if (TREE_CODE (t2) == ENUMERAL_TYPE)
- t2 = type_for_size (TYPE_PRECISION (t2), 1);
+ t2 = c_common_type_for_size (TYPE_PRECISION (t2), 1);
if (t1 == t2)
return 1;
DECL_FIELD_CONTEXT (f_cs) = sjlj_fc_type_node;
tmp = build_index_type (build_int_2 (4 - 1, 0));
- tmp = build_array_type (type_for_mode (word_mode, 1), tmp);
+ tmp = build_array_type ((*lang_hooks.types.type_for_mode) (word_mode, 1),
+ tmp);
f_data = build_decl (FIELD_DECL, get_identifier ("__data"), tmp);
DECL_FIELD_CONTEXT (f_data) = sjlj_fc_type_node;
#include "optabs.h"
#include "real.h"
#include "recog.h"
+#include "langhooks.h"
static void store_fixed_bit_field PARAMS ((rtx, unsigned HOST_WIDE_INT,
unsigned HOST_WIDE_INT,
enum machine_mode mode;
int unsignedp;
{
- tree type = type_for_mode (mode, unsignedp);
+ tree type = (*lang_hooks.types.type_for_mode) (mode, unsignedp);
tree add_type = (GET_MODE (add) == VOIDmode
- ? type : type_for_mode (GET_MODE (add), unsignedp));
+ ? type: (*lang_hooks.types.type_for_mode) (GET_MODE (add),
+ unsignedp));
tree result = fold (build (PLUS_EXPR, type,
fold (build (MULT_EXPR, type,
make_tree (type, x),
TREE_TYPE (exp)),
exp);
- exp = convert (type_for_mode (GET_MODE (SUBREG_REG (target)),
- SUBREG_PROMOTED_UNSIGNED_P (target)),
+ exp = convert ((*lang_hooks.types.type_for_mode)
+ (GET_MODE (SUBREG_REG (target)),
+ SUBREG_PROMOTED_UNSIGNED_P (target)),
exp);
inner_target = SUBREG_REG (target);
if (TYPE_PRECISION (type) < BITS_PER_WORD)
{
- type = type_for_size (BITS_PER_WORD, TREE_UNSIGNED (type));
+ type = (*lang_hooks.types.type_for_size)
+ (BITS_PER_WORD, TREE_UNSIGNED (type));
value = convert (type, value);
}
{
targetx
= assign_temp
- ((build_qualified_type (type_for_mode (GET_MODE (target), 0),
+ ((build_qualified_type ((*lang_hooks.types.type_for_mode)
+ (GET_MODE (target), 0),
TYPE_QUAL_CONST)),
0, 1, 1);
emit_move_insn (targetx, target);
if (mode == BLKmode)
{
rtx new = assign_temp (build_qualified_type
- (type_for_mode (ext_mode, 0),
+ ((*lang_hooks.types.type_for_mode)
+ (ext_mode, 0),
TYPE_QUAL_CONST), 0, 1, 1);
emit_move_insn (new, op0);
&& TYPE_PRECISION (TREE_TYPE (exp)) <= HOST_BITS_PER_WIDE_INT
&& (i = tree_floor_log2 (TREE_OPERAND (exp, 1))) >= 0
&& (mode = mode_for_size (i + 1, MODE_INT, 0)) != BLKmode
- && (type = type_for_mode (mode, 1)) != 0
+ && (type = (*lang_hooks.types.type_for_mode) (mode, 1)) != 0
&& TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
&& (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
!= CODE_FOR_nothing))
get_inner_reference (exp, &bitsize, &bitpos, &offset, &mode,
&unsignedp, &volatilep);
- type = type_for_size (bitsize, unsignedp);
+ type = (*lang_hooks.types.type_for_size) (bitsize, unsignedp);
if (! SLOW_BYTE_ACCESS
&& type != 0 && bitsize >= 0
&& TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
{
if (TYPE_MODE (index_type) != index_mode)
{
- index_expr = convert (type_for_size (index_bits, 0),
- index_expr);
+ index_expr = convert ((*lang_hooks.types.type_for_size)
+ (index_bits, 0), index_expr);
index_type = TREE_TYPE (index_expr);
}
+Fri Mar 29 21:59:15 2002 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * com.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):
+ Redefine.
+ (type_for_mode, type_for_size): Rename.
+ (signed_or_unsigned_type, signed_type, truthvalue_conversion,
+ unsigned_type): Use new hooks.
+
Tue Mar 26 10:30:05 2002 Andrew Cagney <ac131313@redhat.com>
* invoke.texi (Warning Options): Mention -Wswitch-enum.
/* Static functions (internal). */
+static tree ffe_type_for_mode PARAMS ((enum machine_mode, int));
+static tree ffe_type_for_size PARAMS ((unsigned int, int));
static void ffecom_init_decl_processing PARAMS ((void));
static tree ffecom_arglist_expr_ (const char *argstring, ffebld args);
static tree ffecom_widest_expr_type_ (ffebld list);
#define LANG_HOOKS_PRINT_IDENTIFIER ffe_print_identifier
#undef LANG_HOOKS_DECL_PRINTABLE_NAME
#define LANG_HOOKS_DECL_PRINTABLE_NAME ffe_printable_name
+#undef LANG_HOOKS_TYPE_FOR_MODE
+#define LANG_HOOKS_TYPE_FOR_MODE ffe_type_for_mode
+#undef LANG_HOOKS_TYPE_FOR_SIZE
+#define LANG_HOOKS_TYPE_FOR_SIZE ffe_type_for_size
/* We do not wish to use alias-set based aliasing at all. Used in the
extreme (every object with its own set, with equivalences recorded) it
return (unsignedp ? long_long_unsigned_type_node
: long_long_integer_type_node);
- type2 = type_for_size (TYPE_PRECISION (type), unsignedp);
+ type2 = ffe_type_for_size (TYPE_PRECISION (type), unsignedp);
if (type2 == NULL_TREE)
return type;
return intQI_type_node;
#endif
- type2 = type_for_size (TYPE_PRECISION (type1), 0);
+ type2 = ffe_type_for_size (TYPE_PRECISION (type1), 0);
if (type2 != NULL_TREE)
return type2;
convert (TREE_TYPE (expr), integer_zero_node));
}
-tree
-type_for_mode (mode, unsignedp)
+static tree
+ffe_type_for_mode (mode, unsignedp)
enum machine_mode mode;
int unsignedp;
{
return 0;
}
-tree
-type_for_size (bits, unsignedp)
+static tree
+ffe_type_for_size (bits, unsignedp)
unsigned bits;
int unsignedp;
{
return unsigned_intQI_type_node;
#endif
- type2 = type_for_size (TYPE_PRECISION (type1), 1);
+ type2 = ffe_type_for_size (TYPE_PRECISION (type1), 1);
if (type2 != NULL_TREE)
return type2;
/* Set signed and unsigned types of the precision of this mode for the
shifts below. */
- signed_type = type_for_mode (nmode, 0);
- unsigned_type = type_for_mode (nmode, 1);
+ signed_type = (*lang_hooks.types.type_for_mode) (nmode, 0);
+ unsigned_type = (*lang_hooks.types.type_for_mode) (nmode, 1);
/* Compute the bit position and size for the new reference and our offset
within it. If the new reference is the same size as the original, we
return 0;
/* Compute the mask to access the bitfield. */
- unsigned_type = type_for_size (*pbitsize, 1);
+ unsigned_type = (*lang_hooks.types.type_for_size) (*pbitsize, 1);
precision = TYPE_PRECISION (unsigned_type);
mask = build_int_2 (~0, ~0);
be interpreted as positive. */
if (TREE_UNSIGNED (type) && ! TREE_UNSIGNED (TREE_TYPE (exp)))
{
- tree equiv_type = type_for_mode (TYPE_MODE (type), 1);
+ tree equiv_type = (*lang_hooks.types.type_for_mode)
+ (TYPE_MODE (type), 1);
tree high_positive;
/* A range without an upper bound is, naturally, unbounded.
lnbitsize = GET_MODE_BITSIZE (lnmode);
lnbitpos = first_bit & ~ (lnbitsize - 1);
- lntype = type_for_size (lnbitsize, 1);
+ lntype = (*lang_hooks.types.type_for_size) (lnbitsize, 1);
xll_bitpos = ll_bitpos - lnbitpos, xrl_bitpos = rl_bitpos - lnbitpos;
if (BYTES_BIG_ENDIAN)
rnbitsize = GET_MODE_BITSIZE (rnmode);
rnbitpos = first_bit & ~ (rnbitsize - 1);
- rntype = type_for_size (rnbitsize, 1);
+ rntype = (*lang_hooks.types.type_for_size) (rnbitsize, 1);
xlr_bitpos = lr_bitpos - rnbitpos, xrr_bitpos = rr_bitpos - rnbitpos;
if (BYTES_BIG_ENDIAN)
|| integer_onep (folded_compare))
return omit_one_operand (type, folded_compare, varop);
- unsigned_type = type_for_size (size, 1);
+ unsigned_type = (*lang_hooks.types.type_for_size)(size, 1);
precision = TYPE_PRECISION (unsigned_type);
mask = build_int_2 (~0, ~0);
TREE_TYPE (mask) = unsigned_type;
|| integer_onep (folded_compare))
return omit_one_operand (type, folded_compare, varop);
- unsigned_type = type_for_size (size, 1);
+ unsigned_type = (*lang_hooks.types.type_for_size)(size, 1);
precision = TYPE_PRECISION (unsigned_type);
mask = build_int_2 (~0, ~0);
TREE_TYPE (mask) = TREE_TYPE (varop);
/* Allow the target to (possibly) increase the alignment of this
stack slot. */
- type = type_for_mode (mode, 0);
+ type = (*lang_hooks.types.type_for_mode) (mode, 0);
if (type)
alignment = LOCAL_ALIGNMENT (type, alignment);
align = GET_MODE_ALIGNMENT (mode);
if (! type)
- type = type_for_mode (mode, 0);
+ type = (*lang_hooks.types.type_for_mode) (mode, 0);
if (type)
align = LOCAL_ALIGNMENT (type, align);
to the whole CONCAT, lest we do double fixups for the latter
references. */
enum machine_mode part_mode = GET_MODE (XEXP (reg, 0));
- tree part_type = type_for_mode (part_mode, 0);
+ tree part_type = (*lang_hooks.types.type_for_mode) (part_mode, 0);
rtx lopart = XEXP (reg, 0);
rtx hipart = XEXP (reg, 1);
#ifdef FRAME_GROWS_DOWNWARD
+2002-03-29 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * Make-lang.in (builtins.o): Update.
+ * boehm.c (get_boehm_type_descriptor): Update.
+ * builtins.c: Include langhooks.h.
+ * decl.c (java_init_decl_processing): Update.
+ * java-tree.h (java_type_for_mode, java_type_for_size): New.
+ * lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIaZE):
+ Redefine.
+ * typeck.c (type_for_mode, type_for_size): Update.
+
2002-03-29 Martin Kahlert <martin.kahlert@infineon.com>
* lex.c (java_new_lexer): Alias "646" to DEFAULT_ENCODING.
java/parse.h toplev.h
java/buffer.o: java/buffer.c $(CONFIG_H) java/buffer.h $(SYSTEM_H) toplev.h
java/builtins.o: java/builtins.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) \
- $(GGC_H) flags.h
+ $(GGC_H) flags.h builtin-types.def langhooks.h
java/check-init.o: java/check-init.c $(CONFIG_H) \
$(JAVA_TREE_H) $(SYSTEM_H) toplev.h
java/class.o: java/class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) java/jcf.h \
value = build_int_2 (2, 0);
}
- TREE_TYPE (value) = type_for_mode (ptr_mode, 1);
+ TREE_TYPE (value) = java_type_for_mode (ptr_mode, 1);
return value;
}
#include "tree.h"
#include "ggc.h"
#include "flags.h"
-
+#include "langhooks.h"
#include "java-tree.h"
enum builtin_type
set_sizetype (make_unsigned_type (POINTER_SIZE));
/* Define these next since types below may used them. */
- integer_type_node = type_for_size (INT_TYPE_SIZE, 0);
+ integer_type_node = java_type_for_size (INT_TYPE_SIZE, 0);
integer_zero_node = build_int_2 (0, 0);
integer_one_node = build_int_2 (1, 0);
integer_two_node = build_int_2 (2, 0);
extern void java_set_yydebug PARAMS ((int));
extern void java_parse_file PARAMS ((void));
extern void java_mark_tree PARAMS ((tree));
+extern tree java_type_for_mode PARAMS ((enum machine_mode, int));
+extern tree java_type_for_size PARAMS ((unsigned int, int));
extern void add_assume_compiled PARAMS ((const char *, int));
extern tree lookup_class PARAMS ((tree));
extern tree lookup_java_constructor PARAMS ((tree, tree));
#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL java_dup_lang_specific_decl
#undef LANG_HOOKS_DECL_PRINTABLE_NAME
#define LANG_HOOKS_DECL_PRINTABLE_NAME lang_printable_name
+#undef LANG_HOOKS_TYPE_FOR_MODE
+#define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode
+#undef LANG_HOOKS_TYPE_FOR_SIZE
+#define LANG_HOOKS_TYPE_FOR_SIZE java_type_for_size
/* Each front end provides its own. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
then UNSIGNEDP selects between signed and unsigned types. */
tree
-type_for_mode (mode, unsignedp)
+java_type_for_mode (mode, unsignedp)
enum machine_mode mode;
int unsignedp;
{
that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */
tree
-type_for_size (bits, unsignedp)
+java_type_for_size (bits, unsignedp)
unsigned bits;
int unsignedp;
{
LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \
}
-/* Types hooks. */
+/* Types hooks. No default for LANG_HOOKS_TYPE_FOR_MODE or
+ LANG_HOOKS_TYPE_FOR_SIZE. */
#define LANG_HOOKS_MAKE_TYPE make_node
#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
- LANG_HOOKS_MAKE_TYPE \
+ LANG_HOOKS_MAKE_TYPE, \
+ LANG_HOOKS_TYPE_FOR_MODE, \
+ LANG_HOOKS_TYPE_FOR_SIZE \
}
/* Declaration hooks. */
struct lang_hooks_for_types
{
+ /* Return a new type (with the indicated CODE), doing whatever
+ language-specific processing is required. */
tree (*make_type) PARAMS ((enum tree_code));
+
+ /* Given MODE and UNSIGNEDP, return a suitable type-tree with that
+ mode. */
+ tree (*type_for_mode) PARAMS ((enum machine_mode, int));
+
+ /* Given PRECISION and UNSIGNEDP, return a suitable type-tree for an
+ integer type with at least that precision. */
+ tree (*type_for_size) PARAMS ((unsigned, int));
};
/* Language hooks related to decls and the symbol table. */
tree decl, init;
init = build_int_2 (0, 0);
- TREE_TYPE (init) = type_for_size (BITS_PER_WORD, 1);
+ TREE_TYPE (init) = c_common_type_for_size (BITS_PER_WORD, 1);
decl = build_decl (VAR_DECL, get_identifier (string), TREE_TYPE (init));
TREE_PUBLIC (decl) = 1;
TREE_READONLY (decl) = 1;
#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
c_convert_parm_for_inlining
+#undef LANG_HOOKS_TYPE_FOR_MODE
+#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
+#undef LANG_HOOKS_TYPE_FOR_SIZE
+#define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
+
/* Each front end provides its own hooks, for toplev.c. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
emit_move_insn (flag, const1_rtx);
- cond = build_decl (VAR_DECL, NULL_TREE, type_for_mode (word_mode, 1));
+ cond = build_decl (VAR_DECL, NULL_TREE,
+ (*lang_hooks.types.type_for_mode) (word_mode, 1));
SET_DECL_RTL (cond, flag);
/* Conditionalize the cleanup. */
else if (!low_bound && !high_bound)
{
/* Widen LOW and HIGH to the same width as INDEX. */
- tree type = type_for_mode (mode, unsignedp);
+ tree type = (*lang_hooks.types.type_for_mode) (mode, unsignedp);
tree low = build1 (CONVERT_EXPR, type, node->low);
tree high = build1 (CONVERT_EXPR, type, node->high);
rtx low_rtx, new_index, new_bound;
{
unsigned int innerprec
= tree_low_cst (DECL_SIZE (TREE_OPERAND (op, 1)), 1);
-
- type = type_for_size (innerprec, TREE_UNSIGNED (TREE_OPERAND (op, 1)));
+ int unsignedp = TREE_UNSIGNED (TREE_OPERAND (op, 1));
+ type = (*lang_hooks.types.type_for_size) (innerprec, unsignedp);
/* We can get this structure field in the narrowest type it fits in.
If FOR_TYPE is 0, do this only for a field that matches the
if (innerprec < TYPE_PRECISION (TREE_TYPE (op))
&& (for_type || ! DECL_BIT_FIELD (TREE_OPERAND (op, 1)))
- && (! uns || final_prec <= innerprec
- || TREE_UNSIGNED (TREE_OPERAND (op, 1)))
+ && (! uns || final_prec <= innerprec || unsignedp)
&& type != 0)
{
win = build (COMPONENT_REF, type, TREE_OPERAND (op, 0),
{
unsigned HOST_WIDE_INT innerprec
= tree_low_cst (DECL_SIZE (TREE_OPERAND (op, 1)), 1);
- tree type = type_for_size (innerprec, TREE_UNSIGNED (op));
+ tree type = (*lang_hooks.types.type_for_size) (innerprec,
+ TREE_UNSIGNED (op));
/* We can get this structure field in a narrower type that fits it,
but the resulting extension to its nominal type (a fullword type)
extern tree get_narrower PARAMS ((tree, int *));
-/* Given MODE and UNSIGNEDP, return a suitable type-tree
- with that mode.
- The definition of this resides in language-specific code
- as the repertoire of available types may vary. */
-
-extern tree type_for_mode PARAMS ((enum machine_mode, int));
-
-/* Given PRECISION and UNSIGNEDP, return a suitable type-tree
- for an integer type with at least that precision.
- The definition of this resides in language-specific code
- as the repertoire of available types may vary. */
-
-extern tree type_for_size PARAMS ((unsigned, int));
-
/* Given an integer type T, return a type like T but unsigned.
If T is unsigned, the value is T.
The definition of this resides in language-specific code
/* Align the location counter as required by EXP's data type. */
align = GET_MODE_ALIGNMENT (mode == VOIDmode ? word_mode : mode);
#ifdef CONSTANT_ALIGNMENT
- align = CONSTANT_ALIGNMENT (make_tree (type_for_mode (mode, 0), x), align);
+ align = CONSTANT_ALIGNMENT (make_tree ((*lang_hooks.types.type_for_mode)
+ (mode, 0), x), align);
#endif
pool_offset += (align / BITS_PER_UNIT) - 1;
pool->desc->rtl = def
= gen_rtx_MEM (mode, gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (label)));
set_mem_alias_set (def, const_alias_set);
- set_mem_attributes (def, type_for_mode (mode, 0), 1);
+ set_mem_attributes (def, (*lang_hooks.types.type_for_mode) (mode, 0), 1);
RTX_UNCHANGING_P (def) = 1;
/* Add label to symbol hash table. */