diff options
author | Doug Rupp <rupp@adacore.com> | 2008-07-30 13:06:45 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2008-07-30 15:06:45 +0200 |
commit | 6ca2b0a0388c2944e222aab817db7f09bd2f96c4 (patch) | |
tree | 6c15c021426f1cd845672d23d0d9b84ea0fdac47 /gcc/ada/gcc-interface/decl.c | |
parent | 002b2ad6a99fb1e713fb27fffdfc2135319a5a0c (diff) | |
download | gcc-6ca2b0a0388c2944e222aab817db7f09bd2f96c4.zip gcc-6ca2b0a0388c2944e222aab817db7f09bd2f96c4.tar.gz gcc-6ca2b0a0388c2944e222aab817db7f09bd2f96c4.tar.bz2 |
gigi.h (build_vms_descriptor64): New function prototype.
2008-07-30 Doug Rupp <rupp@adacore.com>
* gigi.h (build_vms_descriptor64): New function prototype.
(fill_vms_descriptor): Modified function prototype.
* utils.c (build_vms_descriptor64): New function.
* utils2.c (fill_vms_descriptor): Fix handling on 32bit systems.
* trans.c (call_to_gnu): Call fill_vms_descriptor with new third
argument.
* decl.c (gnat_to_gnu_tree): For By_Descriptor mech, build both a
64bit and 32bit descriptor and save the 64bit version as an alternate
TREE_TYPE in the parameter.
(make_type_from_size) <RECORD_TYPE>: Use the appropriate mode for the
thin pointer.
* ada-tree.h (DECL_PARM_ALT, SET_DECL_PARM_ALT): New macros.
From-SVN: r138307
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index ebc2e5e..61ae653 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -4774,6 +4774,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, { tree gnu_param_name = get_entity_name (gnat_param); tree gnu_param_type = gnat_to_gnu_type (Etype (gnat_param)); + tree gnu_param_type_alt = NULL_TREE; bool in_param = (Ekind (gnat_param) == E_In_Parameter); /* The parameter can be indirectly modified if its address is taken. */ bool ro_param = in_param && !Address_Taken (gnat_param); @@ -4820,12 +4821,20 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, gnu_param_type = TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_param_type)))); - /* VMS descriptors are themselves passed by reference. */ + /* VMS descriptors are themselves passed by reference. + Build both a 32bit and 64bit descriptor, one of which will be chosen + in fill_vms_descriptor based on the allocator size */ if (mech == By_Descriptor) - gnu_param_type - = build_pointer_type (build_vms_descriptor (gnu_param_type, - Mechanism (gnat_param), - gnat_subprog)); + { + gnu_param_type_alt + = build_pointer_type (build_vms_descriptor64 (gnu_param_type, + Mechanism (gnat_param), + gnat_subprog)); + gnu_param_type + = build_pointer_type (build_vms_descriptor (gnu_param_type, + Mechanism (gnat_param), + gnat_subprog)); + } /* Arrays are passed as pointers to element type for foreign conventions. */ else if (foreign @@ -4921,6 +4930,9 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, DECL_POINTS_TO_READONLY_P (gnu_param) = (ro_param && (by_ref || by_component_ptr)); + /* Save the 64bit descriptor for later. */ + SET_DECL_PARM_ALT (gnu_param, gnu_param_type_alt); + /* If no Mechanism was specified, indicate what we're using, then back-annotate it. */ if (mech == Default) @@ -7155,9 +7167,15 @@ make_type_from_size (tree type, tree size_tree, bool for_biased) /* Do something if this is a fat pointer, in which case we may need to return the thin pointer. */ if (TYPE_IS_FAT_POINTER_P (type) && size < POINTER_SIZE * 2) - return - build_pointer_type - (TYPE_OBJECT_RECORD_TYPE (TYPE_UNCONSTRAINED_ARRAY (type))); + { + enum machine_mode p_mode = mode_for_size (size, MODE_INT, 0); + if (!targetm.valid_pointer_mode (p_mode)) + p_mode = ptr_mode; + return + build_pointer_type_for_mode + (TYPE_OBJECT_RECORD_TYPE (TYPE_UNCONSTRAINED_ARRAY (type)), + p_mode, 0); + } break; case POINTER_TYPE: |