Commit c1fd8753 by Nathan Froyd Committed by Eric Botcazou

trans.c (gigi): Call build_function_type_list instead of build_function_type.

	* 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.

Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>

From-SVN: r173325
parent f0b568f3
2011-05-03 Nathan Froyd <froydnj@codesourcery.com>
Eric Botcazou <ebotcazou@adacore.com>
* 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.
2011-04-30 Eric Botcazou <ebotcazou@adacore.com> 2011-04-30 Eric Botcazou <ebotcazou@adacore.com>
* gnatvsn.ads (Library_Version): Bump to 4.7. * gnatvsn.ads (Library_Version): Bump to 4.7.
......
...@@ -214,7 +214,7 @@ static void set_expr_location_from_node (tree, Node_Id); ...@@ -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 bool set_end_locus_from_node (tree, Node_Id);
static void set_gnu_expr_location_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 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 /* Hooks for debug info back-ends, only supported and used in a restricted set
of configurations. */ of configurations. */
...@@ -236,7 +236,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -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 standard_exception_type, Int gigi_operating_mode)
{ {
Entity_Id gnat_literal; 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); tree int64_type = gnat_type_for_size (64, 0);
struct elab_info *info; struct elab_info *info;
int i; int i;
...@@ -344,39 +344,34 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -344,39 +344,34 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
DECL_IGNORED_P (t) = 1; DECL_IGNORED_P (t) = 1;
save_gnu_tree (gnat_literal, t, false); 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); ptr_void_ftype = build_pointer_type (void_ftype);
/* Now declare run-time functions. */ /* 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 /* malloc is a function declaration tree for a function to allocate
memory. */ memory. */
malloc_decl malloc_decl
= create_subprog_decl (get_identifier ("__gnat_malloc"), NULL_TREE, = create_subprog_decl (get_identifier ("__gnat_malloc"), NULL_TREE,
build_function_type (ptr_void_type_node, ftype, NULL_TREE, false, true, true, true, NULL,
tree_cons (NULL_TREE, Empty);
sizetype, t)),
NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IS_MALLOC (malloc_decl) = 1; DECL_IS_MALLOC (malloc_decl) = 1;
/* malloc32 is a function declaration tree for a function to allocate /* 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. */ 32-bit memory on a 64-bit system. Needed only on 64-bit VMS. */
malloc32_decl malloc32_decl
= create_subprog_decl (get_identifier ("__gnat_malloc32"), NULL_TREE, = create_subprog_decl (get_identifier ("__gnat_malloc32"), NULL_TREE,
build_function_type (ptr_void_type_node, ftype, NULL_TREE, false, true, true, true, NULL,
tree_cons (NULL_TREE, Empty);
sizetype, t)),
NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IS_MALLOC (malloc32_decl) = 1; DECL_IS_MALLOC (malloc32_decl) = 1;
/* free is a function declaration tree for a function to free memory. */ /* free is a function declaration tree for a function to free memory. */
free_decl free_decl
= create_subprog_decl (get_identifier ("__gnat_free"), NULL_TREE, = create_subprog_decl (get_identifier ("__gnat_free"), NULL_TREE,
build_function_type (void_type_node, build_function_type_list (void_type_node,
tree_cons (NULL_TREE,
ptr_void_type_node, ptr_void_type_node,
t)), NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
/* This is used for 64-bit multiplication with overflow checking. */ /* This is used for 64-bit multiplication with overflow checking. */
...@@ -404,16 +399,15 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -404,16 +399,15 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
get_jmpbuf_decl get_jmpbuf_decl
= create_subprog_decl = create_subprog_decl
(get_identifier ("system__soft_links__get_jmpbuf_address_soft"), (get_identifier ("system__soft_links__get_jmpbuf_address_soft"),
NULL_TREE, build_function_type (jmpbuf_ptr_type, NULL_TREE), NULL_TREE, build_function_type_list (jmpbuf_ptr_type, NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IGNORED_P (get_jmpbuf_decl) = 1; DECL_IGNORED_P (get_jmpbuf_decl) = 1;
set_jmpbuf_decl set_jmpbuf_decl
= create_subprog_decl = create_subprog_decl
(get_identifier ("system__soft_links__set_jmpbuf_address_soft"), (get_identifier ("system__soft_links__set_jmpbuf_address_soft"),
NULL_TREE, NULL_TREE, build_function_type_list (void_type_node, jmpbuf_ptr_type,
build_function_type (void_type_node, NULL_TREE),
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IGNORED_P (set_jmpbuf_decl) = 1; DECL_IGNORED_P (set_jmpbuf_decl) = 1;
...@@ -422,8 +416,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -422,8 +416,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
setjmp_decl setjmp_decl
= create_subprog_decl = create_subprog_decl
(get_identifier ("__builtin_setjmp"), NULL_TREE, (get_identifier ("__builtin_setjmp"), NULL_TREE,
build_function_type (integer_type_node, build_function_type_list (integer_type_node, jmpbuf_ptr_type,
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)), NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL; DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP; DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP;
...@@ -433,29 +427,25 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -433,29 +427,25 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
update_setjmp_buf_decl update_setjmp_buf_decl
= create_subprog_decl = create_subprog_decl
(get_identifier ("__builtin_update_setjmp_buf"), NULL_TREE, (get_identifier ("__builtin_update_setjmp_buf"), NULL_TREE,
build_function_type (void_type_node, build_function_type_list (void_type_node, jmpbuf_ptr_type, NULL_TREE),
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
DECL_BUILT_IN_CLASS (update_setjmp_buf_decl) = BUILT_IN_NORMAL; DECL_BUILT_IN_CLASS (update_setjmp_buf_decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (update_setjmp_buf_decl) = BUILT_IN_UPDATE_SETJMP_BUF; DECL_FUNCTION_CODE (update_setjmp_buf_decl) = BUILT_IN_UPDATE_SETJMP_BUF;
/* Hooks to call when entering/leaving an exception handler. */ /* Hooks to call when entering/leaving an exception handler. */
ftype
= build_function_type_list (void_type_node, ptr_void_type_node, NULL_TREE);
begin_handler_decl begin_handler_decl
= create_subprog_decl (get_identifier ("__gnat_begin_handler"), NULL_TREE, = create_subprog_decl (get_identifier ("__gnat_begin_handler"), NULL_TREE,
build_function_type (void_type_node, ftype, NULL_TREE, false, true, true, true, NULL,
tree_cons (NULL_TREE, Empty);
ptr_void_type_node,
t)),
NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IGNORED_P (begin_handler_decl) = 1; DECL_IGNORED_P (begin_handler_decl) = 1;
end_handler_decl end_handler_decl
= create_subprog_decl (get_identifier ("__gnat_end_handler"), NULL_TREE, = create_subprog_decl (get_identifier ("__gnat_end_handler"), NULL_TREE,
build_function_type (void_type_node, ftype, NULL_TREE, false, true, true, true, NULL,
tree_cons (NULL_TREE, Empty);
ptr_void_type_node,
t)),
NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IGNORED_P (end_handler_decl) = 1; DECL_IGNORED_P (end_handler_decl) = 1;
/* If in no exception handlers mode, all raise statements are redirected to /* If in no exception handlers mode, all raise statements are redirected to
...@@ -466,13 +456,10 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -466,13 +456,10 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
tree decl tree decl
= create_subprog_decl = create_subprog_decl
(get_identifier ("__gnat_last_chance_handler"), NULL_TREE, (get_identifier ("__gnat_last_chance_handler"), NULL_TREE,
build_function_type (void_type_node, build_function_type_list (void_type_node,
tree_cons (NULL_TREE,
build_pointer_type build_pointer_type
(unsigned_char_type_node), (unsigned_char_type_node),
tree_cons (NULL_TREE, integer_type_node, NULL_TREE),
integer_type_node,
t))),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
TREE_THIS_VOLATILE (decl) = 1; TREE_THIS_VOLATILE (decl) = 1;
TREE_SIDE_EFFECTS (decl) = 1; TREE_SIDE_EFFECTS (decl) = 1;
...@@ -485,10 +472,10 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -485,10 +472,10 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
{ {
/* Otherwise, make one decl for each exception reason. */ /* Otherwise, make one decl for each exception reason. */
for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++) for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++)
gnat_raise_decls[i] = build_raise_check (i, t, exception_simple); gnat_raise_decls[i] = build_raise_check (i, exception_simple);
for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls_ext); i++) for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls_ext); i++)
gnat_raise_decls_ext[i] gnat_raise_decls_ext[i]
= build_raise_check (i, t, = build_raise_check (i,
i == CE_Index_Check_Failed i == CE_Index_Check_Failed
|| i == CE_Range_Check_Failed || i == CE_Range_Check_Failed
|| i == CE_Invalid_Data || i == CE_Invalid_Data
...@@ -503,21 +490,20 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -503,21 +490,20 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
/* Make other functions used for exception processing. */ /* Make other functions used for exception processing. */
get_excptr_decl get_excptr_decl
= create_subprog_decl = create_subprog_decl
(get_identifier ("system__soft_links__get_gnat_exception"), (get_identifier ("system__soft_links__get_gnat_exception"), NULL_TREE,
NULL_TREE, build_function_type_list (build_pointer_type (except_type_node),
build_function_type (build_pointer_type (except_type_node), NULL_TREE), NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
raise_nodefer_decl raise_nodefer_decl
= create_subprog_decl = create_subprog_decl
(get_identifier ("__gnat_raise_nodefer_with_msg"), NULL_TREE, (get_identifier ("__gnat_raise_nodefer_with_msg"), NULL_TREE,
build_function_type (void_type_node, build_function_type_list (void_type_node,
tree_cons (NULL_TREE,
build_pointer_type (except_type_node), build_pointer_type (except_type_node),
t)), NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
/* Indicate that these never return. */ /* Indicate that it never returns. */
TREE_THIS_VOLATILE (raise_nodefer_decl) = 1; TREE_THIS_VOLATILE (raise_nodefer_decl) = 1;
TREE_SIDE_EFFECTS (raise_nodefer_decl) = 1; TREE_SIDE_EFFECTS (raise_nodefer_decl) = 1;
TREE_TYPE (raise_nodefer_decl) TREE_TYPE (raise_nodefer_decl)
...@@ -638,49 +624,40 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -638,49 +624,40 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
} }
/* Return a subprogram decl corresponding to __gnat_rcheck_xx for the given /* Return a subprogram decl corresponding to __gnat_rcheck_xx for the given
CHECK (if EXTENDED is false), or __gnat_rcheck_xx_ext (if EXTENDED is CHECK if KIND is EXCEPTION_SIMPLE, or else to __gnat_rcheck_xx_ext. */
true). */
static tree static tree
build_raise_check (int check, tree void_tree, enum exception_info_kind kind) build_raise_check (int check, enum exception_info_kind kind)
{ {
char name[21]; char name[21];
tree result; tree result, ftype;
if (kind != exception_simple) if (kind == exception_simple)
{ {
sprintf (name, "__gnat_rcheck_%.2d_ext", check); sprintf (name, "__gnat_rcheck_%.2d", check);
result ftype
= create_subprog_decl = build_function_type_list (void_type_node,
(get_identifier (name), NULL_TREE, build_pointer_type
build_function_type (unsigned_char_type_node),
(void_type_node, integer_type_node, NULL_TREE);
tree_cons
(NULL_TREE, build_pointer_type (unsigned_char_type_node),
tree_cons (NULL_TREE, integer_type_node,
tree_cons (NULL_TREE, integer_type_node,
kind == exception_column
? void_tree
: tree_cons (NULL_TREE, integer_type_node,
tree_cons (NULL_TREE,
integer_type_node,
void_tree)))))),
NULL_TREE, false, true, true, true, NULL, Empty);
} }
else else
{ {
sprintf (name, "__gnat_rcheck_%.2d", check); tree t = (kind == exception_column ? NULL_TREE : integer_type_node);
result sprintf (name, "__gnat_rcheck_%.2d_ext", check);
= create_subprog_decl ftype
(get_identifier (name), NULL_TREE, = build_function_type_list (void_type_node,
build_function_type build_pointer_type
(void_type_node, (unsigned_char_type_node),
tree_cons integer_type_node, integer_type_node,
(NULL_TREE, build_pointer_type (unsigned_char_type_node), t, t, NULL_TREE);
tree_cons (NULL_TREE, integer_type_node, void_tree))),
NULL_TREE, false, true, true, true, NULL, Empty);
} }
result
= create_subprog_decl (get_identifier (name), NULL_TREE, ftype, NULL_TREE,
false, true, true, true, NULL, Empty);
/* Indicate that it never returns. */
TREE_THIS_VOLATILE (result) = 1; TREE_THIS_VOLATILE (result) = 1;
TREE_SIDE_EFFECTS (result) = 1; TREE_SIDE_EFFECTS (result) = 1;
TREE_TYPE (result) TREE_TYPE (result)
......
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