Commit 315cff15 by Eric Botcazou Committed by Eric Botcazou

ada-tree.h (TYPE_FAT_POINTER_P): Swap with...

	* gcc-interface/ada-tree.h (TYPE_FAT_POINTER_P): Swap with...
	(TYPE_IS_FAT_POINTER_P): ...this.
	(TYPE_THIN_POINTER_P): Rename into...
	(TYPE_IS_THIN_POINTER_P): ...this.
	(TYPE_FAT_OR_THIN_POINTER_P): Rename into...
	(TYPE_IS_FAT_OR_THIN_POINTER_P): ...this.
	(TYPE_IS_PADDING_P): Change definition, move old one to...
	(TYPE_PADDING_P): ...this.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Adjust for above changes.
	(get_unpadded_type): Likewise.
	(gnat_to_gnu_component_type): Likewise.
	(gnat_to_gnu_param): Likewise.
	(relate_alias_sets): Likewise.
	(make_packable_type): Likewise.
	(maybe_pad_type): Likewise.
	(gnat_to_gnu_field): Likewise.
	(is_variable_size): Likewise.
	(annotate_object): Likewise.
	(validate_size): Likewise.
	(set_rm_size): Likewise.
	(make_type_from_size): Likewise.
	(rm_size): Likewise.
	* gcc-interface/misc.c (gnat_print_type): Likewise.
	(gnat_get_alias_set): Likewise.
	* gcc-interface/trans.c (Identifier_to_gnu): Likewise.
	(Attribute_to_gnu): Likewise.
	(call_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.
	(add_decl_expr): Likewise.
	(convert_with_check): Likewise.
	(addressable_p): Likewise.
	(maybe_implicit_deref): Likewise.
	(protect_multiple_eval): Likewise.
	(gnat_stabilize_reference_1): Likewise.
	* gcc-interface/utils.c (gnat_pushdecl): Likewise.
	(finish_record_type): Likewise.
	(rest_of_record_type_compilation): Likewise.
	(create_type_decl): Likewise.
	(gnat_types_compatible_p): Likewise.
	(build_template): Likewise.
	(convert_vms_descriptor64): Likewise.
	(convert_vms_descriptor32): Likewise.
	(build_unc_object_type_from_ptr): Likewise.
	(update_pointer_to): Likewise.
	(convert_to_fat_pointer): Likewise.
	(convert_to_fat_pointer): Likewise.
	(convert): Likewise.
	(remove_conversions): Likewise.
	(maybe_unconstrained_array): Likewise.
	(unchecked_convert): Likewise.
	(handle_vector_type_attribute): Likewise.
	* gcc-interface/utils2.c (build_binary_op): Likewise.
	(build_unary_op): Likewise.
	(build_allocator): Likewise.

From-SVN: r152917
parent afb4afcd
2009-10-16 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/ada-tree.h (TYPE_FAT_POINTER_P): Swap with...
(TYPE_IS_FAT_POINTER_P): ...this.
(TYPE_THIN_POINTER_P): Rename into...
(TYPE_IS_THIN_POINTER_P): ...this.
(TYPE_FAT_OR_THIN_POINTER_P): Rename into...
(TYPE_IS_FAT_OR_THIN_POINTER_P): ...this.
(TYPE_IS_PADDING_P): Change definition, move old one to...
(TYPE_PADDING_P): ...this.
* gcc-interface/decl.c (gnat_to_gnu_entity): Adjust for above changes.
(get_unpadded_type): Likewise.
(gnat_to_gnu_component_type): Likewise.
(gnat_to_gnu_param): Likewise.
(relate_alias_sets): Likewise.
(make_packable_type): Likewise.
(maybe_pad_type): Likewise.
(gnat_to_gnu_field): Likewise.
(is_variable_size): Likewise.
(annotate_object): Likewise.
(validate_size): Likewise.
(set_rm_size): Likewise.
(make_type_from_size): Likewise.
(rm_size): Likewise.
* gcc-interface/misc.c (gnat_print_type): Likewise.
(gnat_get_alias_set): Likewise.
* gcc-interface/trans.c (Identifier_to_gnu): Likewise.
(Attribute_to_gnu): Likewise.
(call_to_gnu): Likewise.
(gnat_to_gnu): Likewise.
(add_decl_expr): Likewise.
(convert_with_check): Likewise.
(addressable_p): Likewise.
(maybe_implicit_deref): Likewise.
(protect_multiple_eval): Likewise.
(gnat_stabilize_reference_1): Likewise.
* gcc-interface/utils.c (gnat_pushdecl): Likewise.
(finish_record_type): Likewise.
(rest_of_record_type_compilation): Likewise.
(create_type_decl): Likewise.
(gnat_types_compatible_p): Likewise.
(build_template): Likewise.
(convert_vms_descriptor64): Likewise.
(convert_vms_descriptor32): Likewise.
(build_unc_object_type_from_ptr): Likewise.
(update_pointer_to): Likewise.
(convert_to_fat_pointer): Likewise.
(convert_to_fat_pointer): Likewise.
(convert): Likewise.
(remove_conversions): Likewise.
(maybe_unconstrained_array): Likewise.
(unchecked_convert): Likewise.
(handle_vector_type_attribute): Likewise.
* gcc-interface/utils2.c (build_binary_op): Likewise.
(build_unary_op): Likewise.
(build_allocator): Likewise.
2009-10-16 Eric Botcazou <ebotcazou@adacore.com>
* exp_dbug.ads: Adjust type names in comments.
* gcc-interface/decl.c (maybe_pad_type): Remove NAME_TRAILER parameter,
add new IS_COMPONENT_TYPE parameter. Adjust. Remove dead code.
......
......@@ -65,11 +65,11 @@ do { \
/* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this is a
record being used as a fat pointer (only true for RECORD_TYPE). */
#define TYPE_IS_FAT_POINTER_P(NODE) \
#define TYPE_FAT_POINTER_P(NODE) \
TYPE_LANG_FLAG_0 (RECORD_OR_UNION_CHECK (NODE))
#define TYPE_FAT_POINTER_P(NODE) \
(TREE_CODE (NODE) == RECORD_TYPE && TYPE_IS_FAT_POINTER_P (NODE))
#define TYPE_IS_FAT_POINTER_P(NODE) \
(TREE_CODE (NODE) == RECORD_TYPE && TYPE_FAT_POINTER_P (NODE))
/* For integral types and array types, nonzero if this is a packed array type
used for bit-packed types. Such types should not be extended to a larger
......@@ -117,15 +117,15 @@ do { \
TYPE_LANG_FLAG_3 (INTEGER_TYPE_CHECK (NODE))
/* True if NODE is a thin pointer. */
#define TYPE_THIN_POINTER_P(NODE) \
#define TYPE_IS_THIN_POINTER_P(NODE) \
(POINTER_TYPE_P (NODE) \
&& TREE_CODE (TREE_TYPE (NODE)) == RECORD_TYPE \
&& TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (NODE)))
/* True if TYPE is either a fat or thin pointer to an unconstrained
array. */
#define TYPE_FAT_OR_THIN_POINTER_P(NODE) \
(TYPE_FAT_POINTER_P (NODE) || TYPE_THIN_POINTER_P (NODE))
#define TYPE_IS_FAT_OR_THIN_POINTER_P(NODE) \
(TYPE_IS_FAT_POINTER_P (NODE) || TYPE_IS_THIN_POINTER_P (NODE))
/* For INTEGER_TYPEs, nonzero if the type has a biased representation. */
#define TYPE_BIASED_REPRESENTATION_P(NODE) \
......@@ -143,7 +143,6 @@ do { \
is a dummy type, made to correspond to a private or incomplete type. */
#define TYPE_DUMMY_P(NODE) TYPE_LANG_FLAG_4 (NODE)
/* True if TYPE is such a dummy type. */
#define TYPE_IS_DUMMY_P(NODE) \
((TREE_CODE (NODE) == VOID_TYPE || TREE_CODE (NODE) == RECORD_TYPE \
|| TREE_CODE (NODE) == UNION_TYPE || TREE_CODE (NODE) == ENUMERAL_TYPE) \
......@@ -160,7 +159,10 @@ do { \
/* For a RECORD_TYPE, nonzero if this was made just to supply needed
padding or alignment. */
#define TYPE_IS_PADDING_P(NODE) TYPE_LANG_FLAG_5 (RECORD_TYPE_CHECK (NODE))
#define TYPE_PADDING_P(NODE) TYPE_LANG_FLAG_5 (RECORD_TYPE_CHECK (NODE))
#define TYPE_IS_PADDING_P(NODE) \
(TREE_CODE (NODE) == RECORD_TYPE && TYPE_PADDING_P (NODE))
/* True if TYPE can alias any other types. */
#define TYPE_UNIVERSAL_ALIASING_P(NODE) TYPE_LANG_FLAG_6 (NODE)
......
......@@ -527,7 +527,7 @@ gnat_print_type (FILE *file, tree node, int indent)
break;
case RECORD_TYPE:
if (TYPE_IS_FAT_POINTER_P (node) || TYPE_CONTAINS_TEMPLATE_P (node))
if (TYPE_FAT_POINTER_P (node) || TYPE_CONTAINS_TEMPLATE_P (node))
print_node (file, "unconstrained array",
TYPE_UNCONSTRAINED_ARRAY (node), indent + 4);
else
......@@ -600,8 +600,7 @@ static alias_set_type
gnat_get_alias_set (tree type)
{
/* If this is a padding type, use the type of the first field. */
if (TREE_CODE (type) == RECORD_TYPE
&& TYPE_IS_PADDING_P (type))
if (TYPE_IS_PADDING_P (type))
return get_alias_set (TREE_TYPE (TYPE_FIELDS (type)));
/* If the type is an unconstrained array, use the type of the
......
......@@ -654,12 +654,9 @@ build_binary_op (enum tree_code op_code, tree result_type,
can convert the constructor to the inner type, to avoid putting a
VIEW_CONVERT_EXPR on the LHS. But don't do so if we wouldn't have
actually copied anything. */
else if (TREE_CODE (left_type) == RECORD_TYPE
&& TYPE_IS_PADDING_P (left_type)
else if (TYPE_IS_PADDING_P (left_type)
&& TREE_CONSTANT (TYPE_SIZE (left_type))
&& ((TREE_CODE (right_operand) == COMPONENT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (right_operand, 0)))
== RECORD_TYPE
&& TYPE_IS_PADDING_P
(TREE_TYPE (TREE_OPERAND (right_operand, 0)))
&& gnat_types_compatible_p
......@@ -836,8 +833,8 @@ build_binary_op (enum tree_code op_code, tree result_type,
convert both operands to that type. */
if (left_base_type != right_base_type)
{
if (TYPE_FAT_POINTER_P (left_base_type)
&& TYPE_FAT_POINTER_P (right_base_type)
if (TYPE_IS_FAT_POINTER_P (left_base_type)
&& TYPE_IS_FAT_POINTER_P (right_base_type)
&& TYPE_MAIN_VARIANT (left_base_type)
== TYPE_MAIN_VARIANT (right_base_type))
best_type = left_base_type;
......@@ -872,7 +869,7 @@ build_binary_op (enum tree_code op_code, tree result_type,
/* If we are comparing a fat pointer against zero, we need to
just compare the data pointer. */
else if (TYPE_FAT_POINTER_P (left_base_type)
else if (TYPE_IS_FAT_POINTER_P (left_base_type)
&& TREE_CODE (right_operand) == CONSTRUCTOR
&& integer_zerop (VEC_index (constructor_elt,
CONSTRUCTOR_ELTS (right_operand),
......@@ -1117,11 +1114,10 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
/* If INNER is a padding type whose field has a self-referential
size, convert to that inner type. We know the offset is zero
and we need to have that type visible. */
if (TREE_CODE (TREE_TYPE (inner)) == RECORD_TYPE
&& TYPE_IS_PADDING_P (TREE_TYPE (inner))
&& (CONTAINS_PLACEHOLDER_P
(TYPE_SIZE (TREE_TYPE (TYPE_FIELDS
(TREE_TYPE (inner)))))))
if (TYPE_IS_PADDING_P (TREE_TYPE (inner))
&& CONTAINS_PLACEHOLDER_P
(TYPE_SIZE (TREE_TYPE (TYPE_FIELDS
(TREE_TYPE (inner))))))
inner = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (inner))),
inner);
......@@ -1154,13 +1150,11 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
/* If this is just a constructor for a padded record, we can
just take the address of the single field and convert it to
a pointer to our type. */
if (TREE_CODE (type) == RECORD_TYPE && TYPE_IS_PADDING_P (type))
if (TYPE_IS_PADDING_P (type))
{
result = (VEC_index (constructor_elt,
CONSTRUCTOR_ELTS (operand),
0)
->value);
result = VEC_index (constructor_elt,
CONSTRUCTOR_ELTS (operand),
0)->value;
result = convert (build_pointer_type (TREE_TYPE (operand)),
build_unary_op (ADDR_EXPR, NULL_TREE, result));
break;
......@@ -1202,8 +1196,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
/* If we are taking the address of a padded record whose field is
contains a template, take the address of the template. */
if (TREE_CODE (type) == RECORD_TYPE
&& TYPE_IS_PADDING_P (type)
if (TYPE_IS_PADDING_P (type)
&& TREE_CODE (TREE_TYPE (TYPE_FIELDS (type))) == RECORD_TYPE
&& TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (TYPE_FIELDS (type))))
{
......@@ -1226,7 +1219,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
make up an expression to do so. This will never survive to
the backend. If TYPE is a thin pointer, first convert the
operand to a fat pointer. */
if (TYPE_THIN_POINTER_P (type)
if (TYPE_IS_THIN_POINTER_P (type)
&& TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type)))
{
operand
......@@ -1235,7 +1228,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
type = TREE_TYPE (operand);
}
if (TYPE_FAT_POINTER_P (type))
if (TYPE_IS_FAT_POINTER_P (type))
{
result = build1 (UNCONSTRAINED_ARRAY_REF,
TYPE_UNCONSTRAINED_ARRAY (type), operand);
......@@ -1252,7 +1245,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
}
side_effects
= (!TYPE_FAT_POINTER_P (type) && TYPE_VOLATILE (TREE_TYPE (type)));
= (!TYPE_IS_FAT_POINTER_P (type) && TYPE_VOLATILE (TREE_TYPE (type)));
break;
case NEGATE_EXPR:
......@@ -2027,7 +2020,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
/* If RESULT_TYPE is a fat or thin pointer, set SIZE to be the sum of the
sizes of the object and its template. Allocate the whole thing and
fill in the parts that are known. */
else if (TYPE_FAT_OR_THIN_POINTER_P (result_type))
else if (TYPE_IS_FAT_OR_THIN_POINTER_P (result_type))
{
tree storage_type
= build_unc_object_type_from_ptr (result_type, type,
......@@ -2049,10 +2042,9 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
gnat_proc, gnat_pool, gnat_node);
storage = convert (storage_ptr_type, protect_multiple_eval (storage));
if (TREE_CODE (type) == RECORD_TYPE && TYPE_IS_PADDING_P (type))
if (TYPE_IS_PADDING_P (type))
{
type = TREE_TYPE (TYPE_FIELDS (type));
if (init)
init = convert (type, init);
}
......
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