From 8b60815339b0cfea75a21b78a8e90b3878f6c359 Mon Sep 17 00:00:00 2001 From: charlet Date: Tue, 27 Apr 2004 10:49:37 +0000 Subject: [PATCH] 2004-04-27 Ed Schonberg * a-wtmoio.ads: Formal type must be a modular type, not a signed integer type. 2004-04-27 Richard Kenner * decl.c (gnat_to_gnu_entity, case object): Call __builtin_update_setjmp_buf. * gigi.h (update_setjmp_buf): Deleted. (ADT_update_setjmp_buf_decl, update_setjmp_buf_decl): New. * misc.c: (update_setjmp_buf): Deleted. * trans.c (gnat_to_gnu): Call do_pending_stack_adjust and emit_queue around block of RTL. * utils.c (init_gigi_decls): Initialize update_setjmp_buf. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81218 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 20 ++++++++++++++++++++ gcc/ada/a-wtmoio.ads | 4 ++-- gcc/ada/decl.c | 6 +++++- gcc/ada/gigi.h | 6 ++---- gcc/ada/misc.c | 34 ---------------------------------- gcc/ada/trans.c | 9 ++++++++- gcc/ada/utils.c | 12 ++++++++++++ 7 files changed, 49 insertions(+), 42 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b7d9daa..80e49c3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,23 @@ +2004-04-27 Ed Schonberg + + * a-wtmoio.ads: Formal type must be a modular type, not a signed + integer type. + +2004-04-27 Richard Kenner + + * decl.c (gnat_to_gnu_entity, case object): Call + __builtin_update_setjmp_buf. + + * gigi.h (update_setjmp_buf): Deleted. + (ADT_update_setjmp_buf_decl, update_setjmp_buf_decl): New. + + * misc.c: (update_setjmp_buf): Deleted. + + * trans.c (gnat_to_gnu): Call do_pending_stack_adjust and emit_queue + around block of RTL. + + * utils.c (init_gigi_decls): Initialize update_setjmp_buf. + 2004-04-26 Thomas Quinot * sem_dist.adb, exp_dist.adb: When constructing a RAS value for a local diff --git a/gcc/ada/a-wtmoio.ads b/gcc/ada/a-wtmoio.ads index b123223..cec7193 100644 --- a/gcc/ada/a-wtmoio.ads +++ b/gcc/ada/a-wtmoio.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-1997 Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -42,7 +42,7 @@ -- difference in semantics so that it is invisible to the Ada programmer. private generic - type Num is range <>; + type Num is mod <>; package Ada.Wide_Text_IO.Modular_IO is diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index 289617b3..73c35c5 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -1048,7 +1048,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) || (flag_stack_check && ! STACK_CHECK_BUILTIN && 0 < compare_tree_int (DECL_SIZE_UNIT (gnu_decl), STACK_CHECK_MAX_VAR_SIZE)))) - update_setjmp_buf (TREE_VALUE (gnu_block_stack)); + expand_expr_stmt + (build_call_1_expr (update_setjmp_buf_decl, + build_unary_op + (ADDR_EXPR, NULL_TREE, + TREE_VALUE (gnu_block_stack)))); /* If this is a public constant or we're not optimizing and we're not making a VAR_DECL for it, make one just for export or debugger diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h index 5f5b995..99b858b 100644 --- a/gcc/ada/gigi.h +++ b/gcc/ada/gigi.h @@ -58,10 +58,6 @@ extern tree emit_stack_check (tree); /* Make a TRANSFORM_EXPR to later expand GNAT_NODE into code. */ extern tree make_transform_expr (Node_Id); -/* Update the setjmp buffer BUF with the current stack pointer. We assume - here that a __builtin_setjmp was done to BUF. */ -extern void update_setjmp_buf (tree); - /* GNU_TYPE is a type. Determine if it should be passed by reference by default. */ extern int default_pass_by_ref (tree); @@ -346,6 +342,7 @@ enum standard_datatypes ADT_get_excptr_decl, ADT_setjmp_decl, ADT_longjmp_decl, + ADT_update_setjmp_buf_decl, ADT_raise_nodefer_decl, ADT_begin_handler_decl, ADT_end_handler_decl, @@ -369,6 +366,7 @@ extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1]; #define get_excptr_decl gnat_std_decls[(int) ADT_get_excptr_decl] #define setjmp_decl gnat_std_decls[(int) ADT_setjmp_decl] #define longjmp_decl gnat_std_decls[(int) ADT_longjmp_decl] +#define update_setjmp_buf_decl gnat_std_decls[(int) ADT_update_setjmp_buf_decl] #define raise_nodefer_decl gnat_std_decls[(int) ADT_raise_nodefer_decl] #define begin_handler_decl gnat_std_decls[(int) ADT_begin_handler_decl] #define end_handler_decl gnat_std_decls[(int) ADT_end_handler_decl] diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 7be3b5d..f40d272 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -671,40 +671,6 @@ make_transform_expr (Node_Id gnat_node) return gnu_result; } -/* Update the setjmp buffer BUF with the current stack pointer. We assume - here that a __builtin_setjmp was done to BUF. */ - -void -update_setjmp_buf (tree buf) -{ - enum machine_mode sa_mode = Pmode; - rtx stack_save; - -#ifdef HAVE_save_stack_nonlocal - if (HAVE_save_stack_nonlocal) - sa_mode = insn_data[(int) CODE_FOR_save_stack_nonlocal].operand[0].mode; -#endif -#ifdef STACK_SAVEAREA_MODE - sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL); -#endif - - stack_save - = gen_rtx_MEM (sa_mode, - memory_address - (sa_mode, - plus_constant (expand_expr - (build_unary_op (ADDR_EXPR, NULL_TREE, buf), - NULL_RTX, VOIDmode, 0), - 2 * GET_MODE_SIZE (Pmode)))); - -#ifdef HAVE_setjmp - if (HAVE_setjmp) - emit_insn (gen_setjmp ()); -#endif - - emit_stack_save (SAVE_NONLOCAL, &stack_save, NULL_RTX); -} - /* These routines are used in conjunction with GCC exception handling. */ /* Map compile-time to run-time tree for GCC exception handling scheme. */ diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 9c2534e..841d5c8 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -265,6 +265,8 @@ gnat_to_gnu (Node_Id gnat_node) we do generates RTL and returns error_mark_node. */ if (!global_bindings_p ()) { + do_pending_stack_adjust (); + emit_queue (); start_sequence (); emit_note (NOTE_INSN_DELETED); made_sequence = true; @@ -285,14 +287,19 @@ gnat_to_gnu (Node_Id gnat_node) gigi_abort (303); } + do_pending_stack_adjust (); + emit_queue (); gnu_root = make_expr_stmt_from_rtl (first_nondeleted_insn (get_insns ()), gnat_node); end_sequence (); } else if (made_sequence) { - rtx insns = first_nondeleted_insn (get_insns ()); + rtx insns; + do_pending_stack_adjust (); + emit_queue (); + insns = first_nondeleted_insn (get_insns ()); end_sequence (); if (insns) diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index 8c25f48..01be160 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -688,6 +688,18 @@ init_gigi_decls (tree long_long_float_type, tree exception_type) DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL; DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP; + /* update_setjmp_buf updates a setjmp buffer from the current stack pointer + address. */ + update_setjmp_buf_decl + = create_subprog_decl + (get_identifier ("__builtin_update_setjmp_buf"), NULL_TREE, + build_function_type (void_type_node, + tree_cons (NULL_TREE, jmpbuf_ptr_type, endlink)), + NULL_TREE, 0, 1, 1, 0); + + DECL_BUILT_IN_CLASS (update_setjmp_buf_decl) = BUILT_IN_NORMAL; + DECL_FUNCTION_CODE (update_setjmp_buf_decl) = BUILT_IN_UPDATE_SETJMP_BUF; + main_identifier_node = get_identifier ("main"); } -- 2.7.4