aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2010-04-17 08:24:16 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-04-17 08:24:16 +0000
commit6936c61a5cb4cf17d8badafa6d547305cdef63ee (patch)
tree7dbe01ff367112db96a6d1b2f767aab61bd2f627 /gcc
parent1081f5a7c753c0850becc3758adee1ce3f968ec9 (diff)
downloadgcc-6936c61a5cb4cf17d8badafa6d547305cdef63ee.zip
gcc-6936c61a5cb4cf17d8badafa6d547305cdef63ee.tar.gz
gcc-6936c61a5cb4cf17d8badafa6d547305cdef63ee.tar.bz2
back-end.adb (Call_Back_End): Pass Standard_Character to gigi.
* back-end.adb (Call_Back_End): Pass Standard_Character to gigi. * gcc-interface/gigi.h (gigi): Add standard_character parameter. (CHAR_TYPE_SIZE, SHORT_TYPE_SIZE, INT_TYPE_SIZE, LONG_TYPE_SIZE, LONG_LONG_TYPE_SIZE, FLOAT_TYPE_SIZE, DOUBLE_TYPE_SIZE, LONG_DOUBLE_TYPE_SIZE, SIZE_TYPE): Delete. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Call rm_size. * gcc-interface/misc.c (gnat_init): Set signedness of char as per flag_signed_char. Tag sizetype with "size_type" moniker. * gcc-interface/trans.c (gigi): Add standard_character parameter. Remove useless built-in types. Equate unsigned_char_type_node to Standard.Character. Use it instead of char_type_node throughout. (Attribute_to_gnu): Likewise. (gnat_to_gnu): Likewise. * gcc-interface/utils2.c (build_call_raise): Likewise. From-SVN: r158462
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog18
-rw-r--r--gcc/ada/back_end.adb4
-rw-r--r--gcc/ada/gcc-interface/decl.c2
-rw-r--r--gcc/ada/gcc-interface/gigi.h40
-rw-r--r--gcc/ada/gcc-interface/misc.c6
-rw-r--r--gcc/ada/gcc-interface/trans.c43
-rw-r--r--gcc/ada/gcc-interface/utils2.c7
7 files changed, 55 insertions, 65 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 21800d8..2a0af0b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,23 @@
2010-04-17 Eric Botcazou <ebotcazou@adacore.com>
+ * back-end.adb (Call_Back_End): Pass Standard_Character to gigi.
+ * gcc-interface/gigi.h (gigi): Add standard_character parameter.
+ (CHAR_TYPE_SIZE, SHORT_TYPE_SIZE, INT_TYPE_SIZE, LONG_TYPE_SIZE,
+ LONG_LONG_TYPE_SIZE, FLOAT_TYPE_SIZE, DOUBLE_TYPE_SIZE,
+ LONG_DOUBLE_TYPE_SIZE, SIZE_TYPE): Delete.
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Call
+ rm_size.
+ * gcc-interface/misc.c (gnat_init): Set signedness of char as per
+ flag_signed_char. Tag sizetype with "size_type" moniker.
+ * gcc-interface/trans.c (gigi): Add standard_character parameter.
+ Remove useless built-in types. Equate unsigned_char_type_node to
+ Standard.Character. Use it instead of char_type_node throughout.
+ (Attribute_to_gnu): Likewise.
+ (gnat_to_gnu): Likewise.
+ * gcc-interface/utils2.c (build_call_raise): Likewise.
+
+2010-04-17 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/gigi.h (enum standard_datatypes): Add new values
ADT_sbitsize_one_node and ADT_sbitsize_unit_node.
(sbitsize_one_node): New macro.
diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb
index a15d9ec..f23a320 100644
--- a/gcc/ada/back_end.adb
+++ b/gcc/ada/back_end.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -78,6 +78,7 @@ package body Back_End is
file_info_ptr : Address;
gigi_standard_boolean : Entity_Id;
gigi_standard_integer : Entity_Id;
+ gigi_standard_character : Entity_Id;
gigi_standard_long_long_float : Entity_Id;
gigi_standard_exception_type : Entity_Id;
gigi_operating_mode : Back_End_Mode_Type);
@@ -115,6 +116,7 @@ package body Back_End is
file_info_ptr => File_Info_Array'Address,
gigi_standard_boolean => Standard_Boolean,
gigi_standard_integer => Standard_Integer,
+ gigi_standard_character => Standard_Character,
gigi_standard_long_long_float => Standard_Long_Long_Float,
gigi_standard_exception_type => Standard_Exception_Type,
gigi_operating_mode => Mode);
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index b7fd331..5d6bc79 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -2113,7 +2113,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
{
tree gnu_index_type = get_unpadded_type (Etype (gnat_index));
const int prec_comp
- = compare_tree_int (TYPE_RM_SIZE (gnu_index_type),
+ = compare_tree_int (rm_size (gnu_index_type),
TYPE_PRECISION (sizetype));
const bool subrange_p = (prec_comp < 0
&& (TYPE_UNSIGNED (gnu_index_type)
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
index 224abe8..b7f6639 100644
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -203,6 +203,7 @@ extern void gigi (Node_Id gnat_root, int max_gnat_node,
struct File_Info_Type *file_info_ptr,
Entity_Id standard_boolean,
Entity_Id standard_integer,
+ Entity_Id standard_character,
Entity_Id standard_long_long_float,
Entity_Id standard_exception_type,
Int gigi_operating_mode);
@@ -270,45 +271,6 @@ extern int double_float_alignment;
types whose size is greater or equal to 64 bits, or 0 if this alignment
is not specifically capped. */
extern int double_scalar_alignment;
-
-/* Standard data type sizes. Most of these are not used. */
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef SHORT_TYPE_SIZE
-#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_LONG_TYPE_SIZE
-#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-/* The choice of SIZE_TYPE here is very problematic. We need a signed
- type whose bit width is Pmode. Assume "long" is such a type here. */
-#undef SIZE_TYPE
-#define SIZE_TYPE "long int"
/* Data structures used to represent attributes. */
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 52fe65a..f3e7b1b 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -389,8 +389,9 @@ static bool
gnat_init (void)
{
/* Do little here, most of the standard declarations are set up after the
- front-end has been run. */
- build_common_tree_nodes (true, true);
+ front-end has been run. Use the same `char' as C, this doesn't really
+ matter since we'll use the explicit `unsigned char' for Character. */
+ build_common_tree_nodes (flag_signed_char, true);
/* In Ada, we use a signed type for SIZETYPE. Use the signed type
corresponding to the width of Pmode. In most cases when ptr_mode
@@ -398,6 +399,7 @@ gnat_init (void)
But we get far better code using the width of Pmode. */
size_type_node = gnat_type_for_mode (Pmode, 0);
set_sizetype (size_type_node);
+ TYPE_NAME (sizetype) = get_identifier ("size_type");
/* In Ada, we use an unsigned 8-bit type for the default boolean type. */
boolean_type_node = make_unsigned_type (8);
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 4b7946c..71c9e86 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -230,8 +230,9 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
struct Elist_Header *elists_ptr, struct Elmt_Item *elmts_ptr,
struct String_Entry *strings_ptr, Char_Code *string_chars_ptr,
struct List_Header *list_headers_ptr, Nat number_file,
- struct File_Info_Type *file_info_ptr, Entity_Id standard_boolean,
- Entity_Id standard_integer, Entity_Id standard_long_long_float,
+ struct File_Info_Type *file_info_ptr,
+ Entity_Id standard_boolean, Entity_Id standard_integer,
+ Entity_Id standard_character, Entity_Id standard_long_long_float,
Entity_Id standard_exception_type, Int gigi_operating_mode)
{
Entity_Id gnat_literal;
@@ -317,23 +318,26 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
double_float_alignment = get_target_double_float_alignment ();
double_scalar_alignment = get_target_double_scalar_alignment ();
- /* Record the builtin types. Define `integer' and `unsigned char' first so
- that dbx will output them first. */
+ /* Record the builtin types. Define `integer' and `character' first so that
+ dbx will output them first. */
record_builtin_type ("integer", integer_type_node);
- record_builtin_type ("unsigned char", char_type_node);
- record_builtin_type ("long integer", long_integer_type_node);
- unsigned_type_node = gnat_type_for_size (INT_TYPE_SIZE, 1);
- record_builtin_type ("unsigned int", unsigned_type_node);
- record_builtin_type (SIZE_TYPE, sizetype);
+ record_builtin_type ("character", unsigned_char_type_node);
record_builtin_type ("boolean", boolean_type_node);
record_builtin_type ("void", void_type_node);
/* Save the type we made for integer as the type for Standard.Integer. */
- save_gnu_tree (Base_Type (standard_integer), TYPE_NAME (integer_type_node),
+ save_gnu_tree (Base_Type (standard_integer),
+ TYPE_NAME (integer_type_node),
false);
- /* Save the type we made for boolean as the type for Standard.Boolean. */
- save_gnu_tree (Base_Type (standard_boolean), TYPE_NAME (boolean_type_node),
+ /* Likewise for character as the type for Standard.Character. */
+ save_gnu_tree (Base_Type (standard_character),
+ TYPE_NAME (unsigned_char_type_node),
+ false);
+
+ /* Likewise for boolean as the type for Standard.Boolean. */
+ save_gnu_tree (Base_Type (standard_boolean),
+ TYPE_NAME (boolean_type_node),
false);
gnat_literal = First_Literal (Base_Type (standard_boolean));
t = UI_To_gnu (Enumeration_Rep (gnat_literal), boolean_type_node);
@@ -474,7 +478,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
(get_identifier ("__gnat_last_chance_handler"), NULL_TREE,
build_function_type (void_type_node,
tree_cons (NULL_TREE,
- build_pointer_type (char_type_node),
+ build_pointer_type
+ (unsigned_char_type_node),
tree_cons (NULL_TREE,
integer_type_node,
t))),
@@ -496,7 +501,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
build_function_type (void_type_node,
tree_cons (NULL_TREE,
build_pointer_type
- (char_type_node),
+ (unsigned_char_type_node),
tree_cons (NULL_TREE,
integer_type_node,
t))),
@@ -512,9 +517,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
TYPE_QUAL_VOLATILE);
}
- /* Set the types that GCC and Gigi use from the front end. We would
- like to do this for char_type_node, but it needs to correspond to
- the C char type. */
+ /* Set the types that GCC and Gigi use from the front end. */
exception_type
= gnat_to_gnu_entity (Base_Type (standard_exception_type), NULL_TREE, 0);
except_type_node = TREE_TYPE (exception_type);
@@ -1354,7 +1357,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
if (TREE_CODE (gnu_obj_type) == RECORD_TYPE
&& TYPE_CONTAINS_TEMPLATE_P (gnu_obj_type))
{
- tree gnu_char_ptr_type = build_pointer_type (char_type_node);
+ tree gnu_char_ptr_type
+ = build_pointer_type (unsigned_char_type_node);
tree gnu_pos = byte_position (TYPE_FIELDS (gnu_obj_type));
gnu_ptr = convert (gnu_char_ptr_type, gnu_ptr);
gnu_ptr = build_binary_op (POINTER_PLUS_EXPR, gnu_char_ptr_type,
@@ -5391,7 +5395,8 @@ gnat_to_gnu (Node_Id gnat_node)
if (TREE_CODE (gnu_obj_type) == RECORD_TYPE
&& TYPE_CONTAINS_TEMPLATE_P (gnu_obj_type))
{
- tree gnu_char_ptr_type = build_pointer_type (char_type_node);
+ tree gnu_char_ptr_type
+ = build_pointer_type (unsigned_char_type_node);
tree gnu_pos = byte_position (TYPE_FIELDS (gnu_obj_type));
gnu_ptr = convert (gnu_char_ptr_type, gnu_ptr);
gnu_ptr = build_binary_op (POINTER_PLUS_EXPR, gnu_char_ptr_type,
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index ca35cc7..be7044b 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -1499,12 +1499,13 @@ build_call_raise (int msg, Node_Id gnat_node, char kind)
= (gnat_node != Empty && Sloc (gnat_node) != No_Location)
? Get_Logical_Line_Number (Sloc(gnat_node)) : input_line;
- TREE_TYPE (filename)
- = build_array_type (char_type_node, build_index_type (size_int (len)));
+ TREE_TYPE (filename) = build_array_type (unsigned_char_type_node,
+ build_index_type (size_int (len)));
return
build_call_2_expr (fndecl,
- build1 (ADDR_EXPR, build_pointer_type (char_type_node),
+ build1 (ADDR_EXPR,
+ build_pointer_type (unsigned_char_type_node),
filename),
build_int_cst (NULL_TREE, line_number));
}