aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-09-06 12:53:58 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-09-06 12:53:58 +0200
commit203ddceaeda20a6d1de0a283873d64f4fb3a5cef (patch)
treeca430b765206683111d5a1c7faa156f19e0bd6c6 /gcc/ada/gcc-interface/trans.c
parent32dba5ef786a92d5d041594106995f8ffd2bda34 (diff)
downloadgcc-203ddceaeda20a6d1de0a283873d64f4fb3a5cef.zip
gcc-203ddceaeda20a6d1de0a283873d64f4fb3a5cef.tar.gz
gcc-203ddceaeda20a6d1de0a283873d64f4fb3a5cef.tar.bz2
[multiple changes]
2011-09-06 Robert Dewar <dewar@adacore.com> * s-tpopsp-vxworks.adb, prj-nmsc.adb: Minor reformatting. 2011-09-06 Hristian Kirtchev <kirtchev@adacore.com> * gcc-interface/trans.c (Attribute_to_gnu): New case for attribute Descriptor_Size. * exp_attr.adb (Expand_N_Attribute_Reference): Add processing for attribute Descriptor_Size. * exp_ch7.adb (Double_Size_Of): Removed. (Make_Finalize_Address_Stmts): Remove the code which generates an expression to calculate the dope vector of an unconstrained array. Instead use attribute Descriptor_Size and leave the calculation to the back end. (Nearest_Multiple_Rounded_Up): Removed. (Size_Of): Removed. * sem_attr.adb (Analyze_Attribute): Add processing for attribute Descriptor_Size. Currently the attribute is applicable only to unconstrained arrays. (Eval_Attribute): Add processing for attribute Descriptor_Size. * snames.ads-tmpl: Add a predefined name and an Attribute_Id for Descriptor_Size. 2011-09-06 Ed Schonberg <schonberg@adacore.com> * exp_aggr.adb: Remove useless formal. From-SVN: r178585
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 8e0ccd4..13df71f 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -1878,6 +1878,20 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
prefix_unused = true;
break;
+ case Attr_Descriptor_Size:
+ gnu_type = TREE_TYPE (gnu_prefix);
+ gcc_assert (TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE);
+
+ /* What we want is the offset of the ARRAY field in the record that the
+ thin pointer designates, but the components have been shifted so this
+ is actually the opposite of the offset of the BOUNDS field. */
+ gnu_type = TYPE_OBJECT_RECORD_TYPE (gnu_type);
+ gnu_result = size_binop (MINUS_EXPR, bitsize_zero_node,
+ bit_position (TYPE_FIELDS (gnu_type)));
+ gnu_result_type = get_unpadded_type (Etype (gnat_node));
+ prefix_unused = true;
+ break;
+
case Attr_Null_Parameter:
/* This is just a zero cast to the pointer type for our prefix and
dereferenced. */