Re: [PATCH] make Ada runtime function building use build_function_type_list
> Ping. http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01675.html Sorry for the delay. Moreover, I installed a patch in the meantime that badly conflicts with yours, so I've adjusted it. There was an oversight related to the number of integer_type_node in the first case of build_raise_check, but unfortunately we don't seem to have a testcase that exercices it. Tested on x86_64-suse-linux, applied on the mainline. 2011-05-03 Nathan Froyd Eric Botcazou * gcc-interface/trans.c (gigi): Call build_function_type_list instead of build_function_type. Adjust calls to... (build_raise_check): ...this. Do not take a void_tree parameter. Call build_function_type_list instead of build_function_type. Fix head comment and swap couple of conditional blocks. -- Eric Botcazou Index: gcc-interface/trans.c === --- gcc-interface/trans.c (revision 173209) +++ gcc-interface/trans.c (working copy) @@ -214,7 +214,7 @@ static void set_expr_location_from_node static bool set_end_locus_from_node (tree, Node_Id); static void set_gnu_expr_location_from_node (tree, Node_Id); static int lvalue_required_p (Node_Id, tree, bool, bool, bool); -static tree build_raise_check (int, tree, enum exception_info_kind); +static tree build_raise_check (int, enum exception_info_kind); /* Hooks for debug info back-ends, only supported and used in a restricted set of configurations. */ @@ -236,7 +236,7 @@ gigi (Node_Id gnat_root, int max_gnat_no Entity_Id standard_exception_type, Int gigi_operating_mode) { Entity_Id gnat_literal; - tree long_long_float_type, exception_type, t; + tree long_long_float_type, exception_type, t, ftype; tree int64_type = gnat_type_for_size (64, 0); struct elab_info *info; int i; @@ -344,39 +344,34 @@ gigi (Node_Id gnat_root, int max_gnat_no DECL_IGNORED_P (t) = 1; save_gnu_tree (gnat_literal, t, false); - void_ftype = build_function_type (void_type_node, NULL_TREE); + void_ftype = build_function_type_list (void_type_node, NULL_TREE); ptr_void_ftype = build_pointer_type (void_ftype); /* Now declare run-time functions. */ - t = tree_cons (NULL_TREE, void_type_node, NULL_TREE); + ftype = build_function_type_list (ptr_void_type_node, sizetype, NULL_TREE); /* malloc is a function declaration tree for a function to allocate memory. */ malloc_decl = create_subprog_decl (get_identifier ("__gnat_malloc"), NULL_TREE, - build_function_type (ptr_void_type_node, - tree_cons (NULL_TREE, - sizetype, t)), - NULL_TREE, false, true, true, true, NULL, Empty); + ftype, NULL_TREE, false, true, true, true, NULL, + Empty); DECL_IS_MALLOC (malloc_decl) = 1; /* malloc32 is a function declaration tree for a function to allocate 32-bit memory on a 64-bit system. Needed only on 64-bit VMS. */ malloc32_decl = create_subprog_decl (get_identifier ("__gnat_malloc32"), NULL_TREE, - build_function_type (ptr_void_type_node, - tree_cons (NULL_TREE, - sizetype, t)), - NULL_TREE, false, true, true, true, NULL, Empty); + ftype, NULL_TREE, false, true, true, true, NULL, + Empty); DECL_IS_MALLOC (malloc32_decl) = 1; /* free is a function declaration tree for a function to free memory. */ free_decl = create_subprog_decl (get_identifier ("__gnat_free"), NULL_TREE, - build_function_type (void_type_node, - tree_cons (NULL_TREE, - ptr_void_type_node, - t)), + build_function_type_list (void_type_node, + ptr_void_type_node, + NULL_TREE), NULL_TREE, false, true, true, true, NULL, Empty); /* This is used for 64-bit multiplication with overflow checking. */ @@ -403,18 +398,17 @@ gigi (Node_Id gnat_root, int max_gnat_no /* Functions to get and set the jumpbuf pointer for the current thread. */ get_jmpbuf_decl = create_subprog_decl -(get_identifier ("system__soft_links__get_jmpbuf_address_soft"), - NULL_TREE, build_function_type (jmpbuf_ptr_type, NULL_TREE), - NULL_TREE, false, true, true, true, NULL, Empty); + (get_identifier ("system__soft_links__get_jmpbuf_address_soft"), + NULL_TREE, build_function_type_list (jmpbuf_ptr_type, NULL_TREE), + NULL_TREE, false, true, true, true, NULL, Empty); DECL_IGNORED_P (get_jmpbuf_decl) = 1; set_jmpbuf_decl = create_subprog_decl -(get_identifier ("system__soft_links__set_jmpbuf_address_soft"), - NULL_TREE, - build_function_type (void_type_node, - tree_cons (NULL_TREE, jmpbuf_ptr_type, t)), - NULL_TREE, false, true, true, true, NULL, Empty); + (get_identifier ("system__soft_links__set_jmpbuf_address_soft"), + NULL_TREE, build_function_type_list (void_type_node, jmpbuf_ptr_type, + NULL_TREE), + NULL_TREE, false, true, true, true, NULL, Empty); DECL_IGNORED_P (set_jmp
Re: [PATCH] make Ada runtime function building use build_function_type_list
On Wed, Apr 20, 2011 at 10:08:21AM -0700, Nathan Froyd wrote: > This patch changes most of the uses of build_function_type in the Ada to > use build_function_type_list. There are a handful of > build_function_type calls left; replacing those will have to wait until > we get a build_function_type_{n,vec} interface. > > Tested on x86_64-unknown-linux-gnu. OK to commit? Ping. http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01675.html -Nathan
[PATCH] make Ada runtime function building use build_function_type_list
This patch changes most of the uses of build_function_type in the Ada to use build_function_type_list. There are a handful of build_function_type calls left; replacing those will have to wait until we get a build_function_type_{n,vec} interface. Tested on x86_64-unknown-linux-gnu. OK to commit? -Nathan * gcc-interface/trans.c (gigi): Call build_function_type_list instead of build_function_type. Adjust calls to... (build_raise_check): ...this. Do not take a void_tree parameter. Call build_function_type_list instead of build_function_type. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 378f88c..05e2842 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -214,7 +214,7 @@ static void set_expr_location_from_node (tree, Node_Id); static bool set_end_locus_from_node (tree, Node_Id); static void set_gnu_expr_location_from_node (tree, Node_Id); static int lvalue_required_p (Node_Id, tree, bool, bool, bool); -static tree build_raise_check (int, tree, enum exception_info_kind); +static tree build_raise_check (int, enum exception_info_kind); /* Hooks for debug info back-ends, only supported and used in a restricted set of configurations. */ @@ -236,7 +236,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, Entity_Id standard_exception_type, Int gigi_operating_mode) { Entity_Id gnat_literal; - tree long_long_float_type, exception_type, t; + tree long_long_float_type, exception_type, t, ftype; tree int64_type = gnat_type_for_size (64, 0); struct elab_info *info; int i; @@ -344,47 +344,39 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, DECL_IGNORED_P (t) = 1; save_gnu_tree (gnat_literal, t, false); - void_ftype = build_function_type (void_type_node, NULL_TREE); + void_ftype = build_function_type_list (void_type_node, NULL_TREE); ptr_void_ftype = build_pointer_type (void_ftype); /* Now declare run-time functions. */ - t = tree_cons (NULL_TREE, void_type_node, NULL_TREE); + ftype = build_function_type_list (ptr_void_type_node, sizetype, NULL_TREE); /* malloc is a function declaration tree for a function to allocate memory. */ malloc_decl = create_subprog_decl (get_identifier ("__gnat_malloc"), NULL_TREE, - build_function_type (ptr_void_type_node, - tree_cons (NULL_TREE, - sizetype, t)), - NULL_TREE, false, true, true, NULL, Empty); + ftype, NULL_TREE, false, true, true, NULL, Empty); DECL_IS_MALLOC (malloc_decl) = 1; /* malloc32 is a function declaration tree for a function to allocate 32-bit memory on a 64-bit system. Needed only on 64-bit VMS. */ malloc32_decl = create_subprog_decl (get_identifier ("__gnat_malloc32"), NULL_TREE, - build_function_type (ptr_void_type_node, - tree_cons (NULL_TREE, - sizetype, t)), - NULL_TREE, false, true, true, NULL, Empty); + ftype, NULL_TREE, false, true, true, NULL, Empty); DECL_IS_MALLOC (malloc32_decl) = 1; /* free is a function declaration tree for a function to free memory. */ + ftype = build_function_type_list (void_type_node, + ptr_void_type_node, NULL_TREE); free_decl = create_subprog_decl (get_identifier ("__gnat_free"), NULL_TREE, - build_function_type (void_type_node, - tree_cons (NULL_TREE, - ptr_void_type_node, - t)), - NULL_TREE, false, true, true, NULL, Empty); + ftype, NULL_TREE, false, true, true, NULL, Empty); /* This is used for 64-bit multiplication with overflow checking. */ + ftype = build_function_type_list (int64_type, + int64_type, int64_type, NULL_TREE); mulv64_decl = create_subprog_decl (get_identifier ("__gnat_mulv64"), NULL_TREE, - build_function_type_list (int64_type, int64_type, -int64_type, NULL_TREE), - NULL_TREE, false, true, true, NULL, Empty); + ftype, NULL_TREE, false, true, true, NULL, Empty); /* Name of the _Parent field in tagged record types. */ parent_name_id = get_identifier (Get_Name_String (Name_uParent)); @@ -401,61 +393,54 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, jmpbuf_ptr_type = build_pointer_type (jmpbuf_type); /* F