===================================================================
@@ -1468,13 +1468,9 @@
target machine. If you don't define this, the default is one word.
@end defmac
-@defmac ADA_LONG_TYPE_SIZE
-On some machines, the size used for the Ada equivalent of the type
-@code{long} by a native Ada compiler differs from that used by C@. In
-that situation, define this macro to be a C expression to be used for
-the size of that type. If you don't define this, the default is the
-value of @code{LONG_TYPE_SIZE}.
-@end defmac
+@deftypefn {Target Hook} int TARGET_ADA_LONG_TYPE_SIZE (void)
+The size, in bits, of the long type used by Ada. By default this is the same as for C.
+@end deftypefn
@defmac LONG_LONG_TYPE_SIZE
A C expression for the size in bits of the type @code{long long} on the
@@ -1489,11 +1485,9 @@
@code{BITS_PER_UNIT}.
@end defmac
-@defmac BOOL_TYPE_SIZE
-A C expression for the size in bits of the C++ type @code{bool} and
-C99 type @code{_Bool} on the target machine. If you don't define
-this, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}.
-@end defmac
+@deftypefn {Target Hook} int TARGET_BOOL_TYPE_SIZE (void)
+The size, in bits, of the boolean type used by most frontends that have such a type. (Java is an exception, because the language defines the type size). The default is @code{CHAR_TYPE_SIZE}.
+@end deftypefn
@defmac FLOAT_TYPE_SIZE
A C expression for the size in bits of the type @code{float} on the
===================================================================
@@ -1458,13 +1458,7 @@
target machine. If you don't define this, the default is one word.
@end defmac
-@defmac ADA_LONG_TYPE_SIZE
-On some machines, the size used for the Ada equivalent of the type
-@code{long} by a native Ada compiler differs from that used by C@. In
-that situation, define this macro to be a C expression to be used for
-the size of that type. If you don't define this, the default is the
-value of @code{LONG_TYPE_SIZE}.
-@end defmac
+@hook TARGET_ADA_LONG_TYPE_SIZE
@defmac LONG_LONG_TYPE_SIZE
A C expression for the size in bits of the type @code{long long} on the
@@ -1479,11 +1473,7 @@
@code{BITS_PER_UNIT}.
@end defmac
-@defmac BOOL_TYPE_SIZE
-A C expression for the size in bits of the C++ type @code{bool} and
-C99 type @code{_Bool} on the target machine. If you don't define
-this, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}.
-@end defmac
+@hook TARGET_BOOL_TYPE_SIZE
@defmac FLOAT_TYPE_SIZE
A C expression for the size in bits of the type @code{float} on the
===================================================================
@@ -437,6 +437,19 @@
return !!FLOAT_WORDS_BIG_ENDIAN;
}
+/* `bool' has size and alignment `1', on almost all platforms. */
+int
+default_bool_type_size (void)
+{
+ return CHAR_TYPE_SIZE;
+}
+
+int
+default_ada_long_type_size (void)
+{
+ return LONG_TYPE_SIZE;
+}
+
/* True if the target supports decimal floating point. */
bool
===================================================================
@@ -71,6 +71,8 @@
extern bool targhook_words_big_endian (void);
extern bool targhook_float_words_big_endian (void);
extern bool default_decimal_float_supported_p (void);
+extern int default_bool_type_size (void);
+extern int default_ada_long_type_size (void);
extern bool default_fixed_point_supported_p (void);
extern const char * default_invalid_within_doloop (const_rtx);
===================================================================
@@ -375,3 +375,10 @@
hook_void_gcc_optionsp (struct gcc_options *opts ATTRIBUTE_UNUSED)
{
}
+
+/* Generic hook that returns 64. */
+int
+hook_int_void_64 (void)
+{
+ return 64;
+}
===================================================================
@@ -90,4 +90,5 @@
extern const char *hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree);
extern const char *hook_constcharptr_int_const_tree_null (int, const_tree);
extern const char *hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree);
+extern int hook_int_void_64 (void);
#endif
===================================================================
@@ -1178,6 +1178,21 @@
bool, (void),
targhook_float_words_big_endian)
+DEFHOOK
+(bool_type_size,
+ "The size, in bits, of the boolean type used by most frontends that have such\
+ a type. (Java is an exception, because the language defines the type size). \
+ The default is @code{CHAR_TYPE_SIZE}.",
+ int, (void),
+ default_bool_type_size)
+
+DEFHOOK
+(ada_long_type_size,
+ "The size, in bits, of the long type used by Ada. By default this is the\
+ same as for C.",
+ int, (void),
+ default_ada_long_type_size)
+
/* True if the target supports decimal floating point. */
DEFHOOK
(decimal_float_supported_p,
===================================================================
@@ -431,11 +431,6 @@
#define CHAR_TYPE_SIZE BITS_PER_UNIT
#endif
-#ifndef BOOL_TYPE_SIZE
-/* `bool' has size and alignment `1', on almost all platforms. */
-#define BOOL_TYPE_SIZE CHAR_TYPE_SIZE
-#endif
-
#ifndef SHORT_TYPE_SIZE
#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
#endif
===================================================================
@@ -5087,11 +5087,11 @@
fileptr_type_node = ptr_type_node;
if (TREE_CODE (boolean_type_node) != BOOLEAN_TYPE
|| (TYPE_MODE (boolean_type_node)
- != mode_for_size (BOOL_TYPE_SIZE, MODE_INT, 0))
+ != mode_for_size (targetm.bool_type_size (), MODE_INT, 0))
|| TYPE_PRECISION (boolean_type_node) != 1
|| !TYPE_UNSIGNED (boolean_type_node))
{
- boolean_type_node = make_unsigned_type (BOOL_TYPE_SIZE);
+ boolean_type_node = make_unsigned_type (targetm.bool_type_size ());
TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
TYPE_MAX_VALUE (boolean_type_node) = build_int_cst (boolean_type_node, 1);
TYPE_PRECISION (boolean_type_node) = 1;
@@ -9014,10 +9014,11 @@
}
#endif
/* Define a boolean type. This type only represents boolean values but
- may be larger than char depending on the value of BOOL_TYPE_SIZE.
+ may be larger than char depending on the value of
+ targetm.bool_type_size ().
Front ends which want to override this size (i.e. Java) can redefine
boolean_type_node before calling build_common_tree_nodes_2. */
- boolean_type_node = make_unsigned_type (BOOL_TYPE_SIZE);
+ boolean_type_node = make_unsigned_type (targetm.bool_type_size ());
TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
TYPE_MAX_VALUE (boolean_type_node) = build_int_cst (boolean_type_node, 1);
TYPE_PRECISION (boolean_type_node) = 1;
===================================================================
@@ -31,6 +31,7 @@
#include "tree.h"
#include "tm.h"
#include "tm_p.h"
+#include "target.h"
#include "ada.h"
#include "types.h"
@@ -48,12 +49,6 @@
#include "ada-tree.h"
#include "gigi.h"
-/* If we don't have a specific size for Ada's equivalent of `long', use that
- of C. */
-#ifndef ADA_LONG_TYPE_SIZE
-#define ADA_LONG_TYPE_SIZE LONG_TYPE_SIZE
-#endif
-
#ifndef WIDEST_HARDWARE_FP_SIZE
#define WIDEST_HARDWARE_FP_SIZE LONG_DOUBLE_TYPE_SIZE
#endif
@@ -101,7 +96,7 @@
Pos
get_target_long_size (void)
{
- return ADA_LONG_TYPE_SIZE;
+ return targetm.ada_long_type_size ();
}
Pos
===================================================================
@@ -116,7 +116,7 @@
get_real_kind_from_node (long_double_type_node))
NAMED_LOGCST (ISOCBINDING_BOOL, "c_bool", \
- get_int_kind_from_width (BOOL_TYPE_SIZE))
+ get_int_kind_from_width (targetm.bool_type_size ()))
NAMED_CHARKNDCST (ISOCBINDING_CHAR, "c_char", gfc_default_character_kind)
===================================================================
@@ -771,7 +771,7 @@
int bit_size = info->bit_size;
tree new_type;
- if (bit_size == BOOL_TYPE_SIZE)
+ if (bit_size == targetm.bool_type_size ())
{
info->c_bool = 1;
return boolean_type_node;
===================================================================
@@ -51,7 +51,8 @@
DEF_PRIMITIVE_TYPE (BT_VOID, void_type_node)
DEF_PRIMITIVE_TYPE (BT_BOOL,
- (*lang_hooks.types.type_for_size) (BOOL_TYPE_SIZE, 1))
+ (*lang_hooks.types.type_for_size)
+ (targetm.bool_type_size (), 1))
DEF_PRIMITIVE_TYPE (BT_INT, integer_type_node)
DEF_PRIMITIVE_TYPE (BT_UINT, unsigned_type_node)
DEF_PRIMITIVE_TYPE (BT_LONG, long_integer_type_node)
===================================================================
@@ -759,7 +759,7 @@
LABEL_ALIGN_MAX_SKIP LOOP_ALIGN_MAX_SKIP \
LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP JUMP_ALIGN_MAX_SKIP \
CAN_DEBUG_WITHOUT_FP UNLIKELY_EXECUTED_TEXT_SECTION_NAME \
- HOT_TEXT_SECTION_NAME
+ HOT_TEXT_SECTION_NAME BOOL_TYPE_SIZE ADA_LONG_TYPE_SIZE
/* Other obsolete target macros, or macros that used to be in target
headers and were not used, and may be obsolete or may never have
===================================================================
@@ -62,7 +62,7 @@
/* "long" is 32 bits, but 64 bits for Ada. */
#undef LONG_TYPE_SIZE
#define LONG_TYPE_SIZE 32
-#define ADA_LONG_TYPE_SIZE 64
+#define TARGET_ADA_LONG_TYPE_SIZE hook_int_void_64
/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
#undef POINTER_SIZE
===================================================================
@@ -52,7 +52,7 @@
/* "long" is 32 bits, but 64 bits for Ada. */
#undef LONG_TYPE_SIZE
#define LONG_TYPE_SIZE 32
-#define ADA_LONG_TYPE_SIZE 64
+#define TARGET_ADA_LONG_TYPE_SIZE hook_int_void_64
/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
#undef POINTER_SIZE
===================================================================
@@ -369,7 +369,8 @@
/* For binary compatibility with 2.95; Darwin C APIs use bool from
stdbool.h, which was an int-sized enum in 2.95. Users can explicitly
choose to have sizeof(bool)==1 with the -mone-byte-bool switch. */
-#define BOOL_TYPE_SIZE (darwin_one_byte_bool ? CHAR_TYPE_SIZE : INT_TYPE_SIZE)
+extern int darwin_bool_type_size (void);
+#define TARGET_BOOL_TYPE_SIZE darwin_bool_type_size
#undef REGISTER_TARGET_PRAGMAS
#define REGISTER_TARGET_PRAGMAS() \
===================================================================
@@ -2998,4 +2998,10 @@
}
}
+int
+darwin_bool_type_size (void)
+{
+ return darwin_one_byte_bool ? CHAR_TYPE_SIZE : INT_TYPE_SIZE;
+}
+
#include "gt-darwin.h"
===================================================================
@@ -1242,7 +1242,7 @@
coretypes.h $(TM_H) $(TM_P_H) $(TREE_H) ada/gcc-interface/ada.h \
ada/types.h ada/atree.h ada/elists.h ada/namet.h ada/nlists.h \
ada/snames.h ada/stringt.h ada/uintp.h ada/urealp.h ada/fe.h ada/sinfo.h \
- ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h
+ ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h $(TARGET_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
ada/trans.o : ada/gcc-interface/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \