diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0faaf574946..bf19108be22 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2007-11-19 Eric Botcazou + + PR ada/34098 + * misc.c (gnat_adjust_rli): Delete. + (gnat_init): Do not initialize the translation code here. + Do not call set_lang_adjust_rli. + * trans.c (init_code_table): Make static. + (gnat_init_stmt_group): Delete. + (gigi): Initialize the translation code entirely here. + Emit debug info for the common types here instead of... + * utils.c (gnat_init_decl_processing): ...here. + * gigi.h (init_code_table): Delete. + (gnat_init_stmt_group): Likewise. + 2007-11-16 Olivier Hainque * utils2.c (build_call_alloc_dealloc) : Move the code diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h index fd7e5967904..f4acd146b51 100644 --- a/gcc/ada/gigi.h +++ b/gcc/ada/gigi.h @@ -271,10 +271,6 @@ extern void post_error_ne_tree_2 (const char *msg, Node_Id node, Entity_Id ent, /* Protect EXP from multiple evaluation. This may make a SAVE_EXPR. */ extern tree protect_multiple_eval (tree exp); -/* Initialize the table that maps GNAT codes to GCC codes for simple - binary and unary operations. */ -extern void init_code_table (void); - /* Return a label to branch to for the exception type in KIND or NULL_TREE if none. */ extern tree get_exception_label (char); @@ -455,7 +451,6 @@ extern void insert_block (tree block); and uses GNAT_NODE for location information. */ extern void gnat_pushdecl (tree decl, Node_Id gnat_node); -extern void gnat_init_stmt_group (void); extern void gnat_init_decl_processing (void); extern void init_gigi_decls (tree long_long_float_type, tree exception_type); extern void gnat_init_gcc_eh (void); diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 03cce3a94d4..c54bd9f7b90 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -101,7 +101,6 @@ static void gnat_parse_file (int); static rtx gnat_expand_expr (tree, rtx, enum machine_mode, int, rtx *); static void internal_error_function (const char *, va_list *); -static void gnat_adjust_rli (record_layout_info); static tree gnat_type_max_size (const_tree); /* Definitions for our language-specific hooks. */ @@ -433,9 +432,6 @@ internal_error_function (const char *msgid, va_list *ap) static bool gnat_init (void) { - /* Initialize translations and the outer statement group. */ - gnat_init_stmt_group (); - /* Performs whatever initialization steps needed by the language-dependent lexical analyzer. */ gnat_init_decl_processing (); @@ -450,8 +446,6 @@ gnat_init (void) /* Show that REFERENCE_TYPEs are internal and should be Pmode. */ internal_reference_types (); - set_lang_adjust_rli (gnat_adjust_rli); - return true; } @@ -675,35 +669,6 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode, return expand_expr_real (new, target, tmode, modifier, alt_rtl); } -/* Adjusts the RLI used to layout a record after all the fields have been - added. We only handle the packed case and cause it to use the alignment - that will pad the record at the end. */ - -static void -gnat_adjust_rli (record_layout_info rli ATTRIBUTE_UNUSED) -{ -#if 0 - /* ??? This code seems to have no actual effect; record_align should already - reflect the largest alignment desired by a field. jason 2003-04-01 */ - unsigned int record_align = rli->unpadded_align; - tree field; - - /* If an alignment has been specified, don't use anything larger unless we - have to. */ - if (TYPE_ALIGN (rli->t) != 0 && TYPE_ALIGN (rli->t) < record_align) - record_align = MAX (rli->record_align, TYPE_ALIGN (rli->t)); - - /* If any fields have variable size, we need to force the record to be at - least as aligned as the alignment of that type. */ - for (field = TYPE_FIELDS (rli->t); field; field = TREE_CHAIN (field)) - if (TREE_CODE (DECL_SIZE_UNIT (field)) != INTEGER_CST) - record_align = MAX (record_align, DECL_ALIGN (field)); - - if (TYPE_PACKED (rli->t)) - rli->record_align = record_align; -#endif -} - /* Do nothing (return the tree node passed). */ static tree diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 449f0f7fc3a..df6ab75bf04 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -181,6 +181,7 @@ static enum tree_code gnu_codes[Number_Node_Kinds]; /* Current node being treated, in case abort called. */ Node_Id error_gnat_node; +static void init_code_table (void); static void Compilation_Unit_to_gnu (Node_Id); static void record_code_position (Node_Id); static void insert_code_for (Node_Id); @@ -269,6 +270,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, } #endif + /* Initialize ourselves. */ + init_code_table (); init_gnat_to_gnu (); gnat_compute_largest_alignment (); init_dummy_type (); @@ -281,6 +284,20 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, TYPE_SIZE_UNIT (void_type_node) = size_zero_node; } + /* Enable GNAT stack checking method if needed */ + if (!Stack_Check_Probes_On_Target) + set_stack_check_libfunc (gen_rtx_SYMBOL_REF (Pmode, "_gnat_stack_check")); + + /* Give names and make TYPE_DECLs for common types. */ + create_type_decl (get_identifier (SIZE_TYPE), sizetype, + NULL, false, true, Empty); + create_type_decl (get_identifier ("integer"), integer_type_node, + NULL, false, true, Empty); + create_type_decl (get_identifier ("unsigned char"), char_type_node, + NULL, false, true, Empty); + create_type_decl (get_identifier ("long integer"), long_integer_type_node, + NULL, false, true, Empty); + /* Save the type we made for integer as the type for Standard.Integer. Then make the rest of the standard types. Note that some of these may be subtypes. */ @@ -313,6 +330,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, gnat_init_gcc_eh (); gcc_assert (Nkind (gnat_root) == N_Compilation_Unit); + start_stmt_group (); Compilation_Unit_to_gnu (gnat_root); /* Now see if we have any elaboration procedures to deal with. */ @@ -361,20 +379,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, error_gnat_node = Empty; } -/* Perform initializations for this module. */ - -void -gnat_init_stmt_group (void) -{ - /* Initialize ourselves. */ - init_code_table (); - start_stmt_group (); - - /* Enable GNAT stack checking method if needed */ - if (!Stack_Check_Probes_On_Target) - set_stack_check_libfunc (gen_rtx_SYMBOL_REF (Pmode, "_gnat_stack_check")); -} - /* Returns a positive value if GNAT_NODE requires an lvalue for an operand of OPERAND_TYPE, whose aliasing is specified by ALIASED, zero otherwise. This is int instead of bool to facilitate usage @@ -6763,7 +6767,7 @@ post_error_ne_tree_2 (const char *msg, /* Initialize the table that maps GNAT codes to GCC codes for simple binary and unary operations. */ -void +static void init_code_table (void) { gnu_codes[N_And_Then] = TRUTH_ANDIF_EXPR; diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index 77be01dc6d9..9fed4a9cb5e 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -495,16 +495,6 @@ gnat_init_decl_processing (void) set_sizetype (size_type_node); build_common_tree_nodes_2 (0); - /* Give names and make TYPE_DECLs for common types. */ - create_type_decl (get_identifier (SIZE_TYPE), sizetype, - NULL, false, true, Empty); - create_type_decl (get_identifier ("integer"), integer_type_node, - NULL, false, true, Empty); - create_type_decl (get_identifier ("unsigned char"), char_type_node, - NULL, false, true, Empty); - create_type_decl (get_identifier ("long integer"), long_integer_type_node, - NULL, false, true, Empty); - ptr_void_type_node = build_pointer_type (void_type_node); gnat_install_builtins (); diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 23e0cf5549e..1ae2db5ca00 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -496,17 +496,6 @@ relayout_decl (tree decl) layout_decl (decl, 0); } -/* Hook for a front-end function that can modify the record layout as needed - immediately before it is finalized. */ - -static void (*lang_adjust_rli) (record_layout_info) = 0; - -void -set_lang_adjust_rli (void (*f) (record_layout_info)) -{ - lang_adjust_rli = f; -} - /* Begin laying out type T, which may be a RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE. Return a pointer to a struct record_layout_info which is to be passed to all other layout functions for this record. It is the @@ -1866,9 +1855,6 @@ layout_type (tree type) if (TREE_CODE (type) == QUAL_UNION_TYPE) TYPE_FIELDS (type) = nreverse (TYPE_FIELDS (type)); - if (lang_adjust_rli) - (*lang_adjust_rli) (rli); - /* Finish laying out the record. */ finish_record_layout (rli, /*free_p=*/true); } diff --git a/gcc/tree.h b/gcc/tree.h index 0fb68ed7fd9..75702ec0606 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4274,7 +4274,6 @@ typedef struct record_layout_info_s int packed_maybe_necessary; } *record_layout_info; -extern void set_lang_adjust_rli (void (*) (record_layout_info)); extern record_layout_info start_record_layout (tree); extern tree bit_from_pos (tree, tree); extern tree byte_from_pos (tree, tree);