aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2008-04-08 18:12:53 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2008-04-08 18:12:53 +0000
commit581edf9260bddd3f0ce13e2f2b6758f6f638b22c (patch)
treee042a3438f9aaea3565ebd713196dfa9f19c8e53 /gcc/ada/utils.c
parent57b9e36755f9459bcb6b6699b12b150037a5adb4 (diff)
downloadgcc-581edf9260bddd3f0ce13e2f2b6758f6f638b22c.zip
gcc-581edf9260bddd3f0ce13e2f2b6758f6f638b22c.tar.gz
gcc-581edf9260bddd3f0ce13e2f2b6758f6f638b22c.tar.bz2
gigi.h (standard_datatypes): Add ADT_fdesc_type and ADT_null_fdesc.
* gigi.h (standard_datatypes): Add ADT_fdesc_type and ADT_null_fdesc. (fdesc_type_node): Define. (null_fdesc_node): Likewise. * decl.c (gnat_to_gnu_entity) <E_Access_Subprogram_Type>: If the target uses descriptors for vtables and the type comes from a dispatch table, return the descriptor type. * trans.c (Attribute_to_gnu) <Attr_Unrestricted_Access>: If the target uses descriptors for vtables and the type comes from a dispatch table, build a descriptor in the static case and copy the existing one in the non-static case. (gnat_to_gnu) <N_Null>: If the target uses descriptors for vtables and the type is a pointer-to-subprogram coming from a dispatch table, return the null descriptor. <N_Unchecked_Type_Conversion>: If the target uses descriptors for vtables, the source type is the descriptor type and the target type is a pointer type, first build the pointer. * utils.c (init_gigi_decls): If the target uses descriptors for vtables build the descriptor type and the null descriptor. From-SVN: r134101
Diffstat (limited to 'gcc/ada/utils.c')
-rw-r--r--gcc/ada/utils.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index 1625484..76f4aab 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -548,6 +548,27 @@ init_gigi_decls (tree long_long_float_type, tree exception_type)
void_ftype = build_function_type (void_type_node, NULL_TREE);
ptr_void_ftype = build_pointer_type (void_ftype);
+ /* Build the special descriptor type and its null node if needed. */
+ if (TARGET_VTABLE_USES_DESCRIPTORS)
+ {
+ tree field_list = NULL_TREE, null_list = NULL_TREE;
+ int j;
+
+ fdesc_type_node = make_node (RECORD_TYPE);
+
+ for (j = 0; j < TARGET_VTABLE_USES_DESCRIPTORS; j++)
+ {
+ tree field = create_field_decl (NULL_TREE, ptr_void_ftype,
+ fdesc_type_node, 0, 0, 0, 1);
+ TREE_CHAIN (field) = field_list;
+ field_list = field;
+ null_list = tree_cons (field, null_pointer_node, null_list);
+ }
+
+ finish_record_type (fdesc_type_node, nreverse (field_list), 0, false);
+ null_fdesc_node = gnat_build_constructor (fdesc_type_node, null_list);
+ }
+
/* Now declare runtime functions. */
endlink = tree_cons (NULL_TREE, void_type_node, NULL_TREE);