Commit 09ef48fe by Gary Dismukes Committed by Arnaud Charlet

gigi.h, trans.c (Identifier_to_gnu): Change test for deferred constant by adding…

gigi.h, trans.c (Identifier_to_gnu): Change test for deferred constant by adding guard that the entity is an...

2007-04-20  Gary Dismukes  <dismukes@adacore.com>
	    Eric Botcazou  <ebotcazou@adacore.com>
	    Tristan Gingold  <gingold@adacore.com>
	    Olivier Hainque  <hainque@adacore.com>

	* gigi.h, trans.c (Identifier_to_gnu): Change test for deferred
	constant by adding guard that the entity is an E_Constant before
	testing presence of Full_view (and remove now-unnecessary test that
	entity is not a type).
	For a CONST_DECL used by reference, manually retrieve
	the DECL_INITIAL.  Do not invoke fold in the other DECL_P cases either.
	(struct language_function): Move from utils.c to here.
	(struct parm_attr): New structure.
	(parm_attr, parm_attr vector, parm_attr GC vector): New types.
	(f_parm_attr_cache): New macro.
	(Attribute_to_gnu) <Attr_Length>: When not optimizing, cache the
	expressions for the 'First, 'Last and 'Length attributes of the
	unconstrained array IN parameters.
	(Subprogram_Body_to_gnu): Use gnu_subprog_decl throughout.
	Allocate the information structure for the function earlier, as well
	as the language-specific part.
	If the parameter attributes cache has been populated, evaluate the
	cached expressions on entry.
	(takes_address): Add OPERAND_TYPE parameter.  Handle N_Function_Call,
	N_Procedure_Call_Statement and N_Indexed_Component.
	(Pragma_to_gnu): Translate inspection_point to an asm statement
	containaing a comment and a reference to the object (either its address
	for BLKmode or its value).
	(Identifier_to_gnu): Use TREE_CONSTANT instead of CONST_DECL to decide
	to go to DECL_INITIAL. Together with the size constraint relaxation
	in create_var_decl, enlarges the set of situations in which an
	identifier may be used as an initializer without implying elaboration
	code.
	(Subprogram_Body_to_gnu): Do not fiddle with the debug interface but set
	DECL_IGNORED_P on the function if Needs_Debug_Info is not set on the
	node.
	(maybe_stabilize_reference): Remove lvalues_only parameter.
	(gnat_stabilize_reference): Adjust for above change.
	(gnat_to_gnu): Do not set location information on the result
	if it is a reference.
	(add_cleanup): Add gnat_node parameter and set the location of the
	cleanup to it.
	(Handled_Sequence_Of_Statements_to_gnu): Adjust calls to add_cleanup.
	(Exception_Handler_to_gnu_zcx): Likewise.
	(gigi): Remove the cgraph node if the elaboration procedure is empty.
	(Subprogram_Body_to_gnu): If a stub is attached to the subprogram, emit
	the former right after the latter.
	(start_stmt_group): Make global.
	(end_stmt_group): Likewise.
	(gnu_constraint_error_label_stack, gnu_storage_error_label_stack): New
	vars.
	(gnu_program_error_label_stack): Likewise.
	(gigi): Initialize them.
	(call_to_gnu, gnat_to_gnu, emit_check): Add new arg to build_call_raise.
	(gnat_to_gnu, N_{Push,Pop}_{Constraint,Storage,Program}_Error_Label):
	New cases.
	(push_exception_label_stack): New function.
	(takes_address): New function.

	* utils.c (struct language_function): Move to trans.c from here.
	(unchecked_convert): Do not wrap up integer constants in
	VIEW_CONVERT_EXPRs.
	(create_var_decl_1): Decouple TREE_CONSTANT from CONST_DECL. Prevent
	the latter for aggregate types, unexpected by later passes, and relax an
	arbitrary size constraint on the former.
	(create_field_decl): Use tree_int_cst_equal instead of operand_equal_p
	to compare the sizes.
	(convert_vms_descriptor): When converting to a fat pointer type, be
	prepared for a S descriptor at runtime in spite of a SB specification.
	(shift_unc_components_for_thin_pointers): New function.
	(write_record_type_debug_info): For variable-sized fields, cap the
	alignment of the pointer to the computed alignment.
	(finish_record_type): Change HAS_REP parameter into REP_LEVEL.
	If REP_LEVEL is 2, do not compute the sizes.
	(build_vms_descriptor): Adjust for new prototype of finish_record_type.
	(build_unc_object_type): Likewise.
	(declare_debug_type): New function.

        * ada-tree.def: USE_STMT: removed (not emitted anymore).

        * misc.c (gnat_expand_expr): Call to gnat_expand_stmt removed because
        no statement is expandable anymore.
        (gnat_init_gcc_eh): Do not initialize the DWARF-2 CFI machinery twice.
        (gnat_handle_option): Only allow flag_eliminate_debug_types to be set
        when the user requested it explicitely.
        (gnat_post_options): By default, set flag_eliminate_unused_debug_types
        to 0 for Ada.
        (get_alias_set): Return alias set 0 for a type if
        TYPE_UNIVERSAL_ALIASING_P is set on its main variant.

        * ada-tree.h: (TYPE_UNIVERSAL_ALIASING_P): New macro.
        (DECL_FUNCTION_STUB): New accessor macro.
        (SET_DECL_FUNCTION_STUB): New setter macro.

        * lang.opt (feliminate-unused-debug-types): Intercept this flag for Ada.

	* fe.h (Get_Local_Raise_Call_Entity, Get_RT_Exception_Entity): New
	declarations.

From-SVN: r125371
parent fce2526f
...@@ -80,6 +80,3 @@ DEFTREECODE (REGION_STMT, "region_stmt", tcc_statement, 3) ...@@ -80,6 +80,3 @@ DEFTREECODE (REGION_STMT, "region_stmt", tcc_statement, 3)
handler itself, and HANDLER_STMT_BLOCK is the BLOCK node for this handler itself, and HANDLER_STMT_BLOCK is the BLOCK node for this
binding. */ binding. */
DEFTREECODE (HANDLER_STMT, "handler_stmt", tcc_statement, 3) DEFTREECODE (HANDLER_STMT, "handler_stmt", tcc_statement, 3)
/* A statement that emits a USE for its single operand. */
DEFTREECODE (USE_STMT, "use_expr", tcc_statement, 1)
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Header File * * C Header File *
* * * *
* Copyright (C) 1992-2006 Free Software Foundation, Inc. * * Copyright (C) 1992-2007, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -161,6 +161,9 @@ struct lang_type GTY(()) {tree t; }; ...@@ -161,6 +161,9 @@ struct lang_type GTY(()) {tree t; };
padding or alignment. */ padding or alignment. */
#define TYPE_IS_PADDING_P(NODE) TYPE_LANG_FLAG_5 (RECORD_TYPE_CHECK (NODE)) #define TYPE_IS_PADDING_P(NODE) TYPE_LANG_FLAG_5 (RECORD_TYPE_CHECK (NODE))
/* True if TYPE can alias any other types. */
#define TYPE_UNIVERSAL_ALIASING_P(NODE) TYPE_LANG_FLAG_6 (NODE)
/* This field is only defined for FUNCTION_TYPE nodes. If the Ada /* This field is only defined for FUNCTION_TYPE nodes. If the Ada
subprogram contains no parameters passed by copy in/copy out then this subprogram contains no parameters passed by copy in/copy out then this
field is 0. Otherwise it points to a list of nodes used to specify the field is 0. Otherwise it points to a list of nodes used to specify the
...@@ -288,6 +291,13 @@ struct lang_type GTY(()) {tree t; }; ...@@ -288,6 +291,13 @@ struct lang_type GTY(()) {tree t; };
#define SET_DECL_RENAMED_OBJECT(NODE, X) \ #define SET_DECL_RENAMED_OBJECT(NODE, X) \
SET_DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE), X) SET_DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE), X)
/* In a FUNCTION_DECL, points to the stub associated with the function
if any, otherwise 0. */
#define DECL_FUNCTION_STUB(NODE) \
GET_DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))
#define SET_DECL_FUNCTION_STUB(NODE, X) \
SET_DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE), X)
/* In a FIELD_DECL corresponding to a discriminant, contains the /* In a FIELD_DECL corresponding to a discriminant, contains the
discriminant number. */ discriminant number. */
#define DECL_DISCRIMINANT_NUMBER(NODE) DECL_INITIAL (FIELD_DECL_CHECK (NODE)) #define DECL_DISCRIMINANT_NUMBER(NODE) DECL_INITIAL (FIELD_DECL_CHECK (NODE))
......
...@@ -100,6 +100,14 @@ extern Entity_Id Error_Msg_Node_2; ...@@ -100,6 +100,14 @@ extern Entity_Id Error_Msg_Node_2;
extern Uint Error_Msg_Uint_1; extern Uint Error_Msg_Uint_1;
extern Uint Error_Msg_Uint_2; extern Uint Error_Msg_Uint_2;
/* exp_ch11: */
#define Get_Local_Raise_Call_Entity exp_ch11__get_local_raise_call_entity
#define Get_RT_Exception_Entity exp_ch11__get_rt_exception_entity
extern Entity_Id Get_Local_Raise_Call_Entity (void);
extern Entity_Id Get_RT_Exception_Entity (int);
/* exp_code: */ /* exp_code: */
#define Asm_Input_Constraint exp_code__asm_input_constraint #define Asm_Input_Constraint exp_code__asm_input_constraint
......
...@@ -69,6 +69,12 @@ nostdinc ...@@ -69,6 +69,12 @@ nostdinc
Ada RejectNegative Ada RejectNegative
; Don't look for source files ; Don't look for source files
feliminate-unused-debug-types
Ada
; Effect documented for C - intercepted for Ada to force the associated flag
; not to be set by default, as it currently eliminates unreferenced parallel
; types we need for encoding descriptions to the debugger.
nostdlib nostdlib
Ada Ada
; Don't look for object files ; Don't look for object files
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 1992-2006, Free Software Foundation, Inc. * * Copyright (C) 1992-2007, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -302,6 +302,14 @@ gnat_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED) ...@@ -302,6 +302,14 @@ gnat_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
gnat_argc++; gnat_argc++;
break; break;
case OPT_feliminate_unused_debug_types:
/* We arrange for post_option to be able to only set the corresponding
flag to 1 when explicitely requested by the user. We expect the
default flag value to be either 0 or positive, and expose a positive
-f as a negative value to post_option. */
flag_eliminate_unused_debug_types = -value;
break;
case OPT_fRTS_: case OPT_fRTS_:
gnat_argv[gnat_argc] = xstrdup ("-fRTS"); gnat_argv[gnat_argc] = xstrdup ("-fRTS");
gnat_argc++; gnat_argc++;
...@@ -362,6 +370,14 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED) ...@@ -362,6 +370,14 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
if (flag_inline_functions) if (flag_inline_functions)
flag_inline_trees = 2; flag_inline_trees = 2;
/* Force eliminate_unused_debug_types to 0 unless an explicit positive
-f has been passed. This forces the default to 0 for Ada, which might
differ from the common default. */
if (flag_eliminate_unused_debug_types < 0)
flag_eliminate_unused_debug_types = 1;
else
flag_eliminate_unused_debug_types = 0;
/* The structural alias analysis machinery essentially assumes that /* The structural alias analysis machinery essentially assumes that
everything is addressable (modulo bit-fields) by disregarding everything is addressable (modulo bit-fields) by disregarding
the TYPE_NONALIASED_COMPONENT and DECL_NONADDRESSABLE_P macros. */ the TYPE_NONALIASED_COMPONENT and DECL_NONADDRESSABLE_P macros. */
...@@ -484,6 +500,11 @@ gnat_compute_largest_alignment (void) ...@@ -484,6 +500,11 @@ gnat_compute_largest_alignment (void)
void void
gnat_init_gcc_eh (void) gnat_init_gcc_eh (void)
{ {
#ifdef DWARF2_UNWIND_INFO
/* lang_dependent_init already called dwarf2out_frame_init if true. */
int dwarf2out_frame_initialized = dwarf2out_do_frame ();
#endif
/* We shouldn't do anything if the No_Exceptions_Handler pragma is set, /* We shouldn't do anything if the No_Exceptions_Handler pragma is set,
though. This could for instance lead to the emission of tables with though. This could for instance lead to the emission of tables with
references to symbols (such as the Ada eh personality routine) within references to symbols (such as the Ada eh personality routine) within
...@@ -517,7 +538,7 @@ gnat_init_gcc_eh (void) ...@@ -517,7 +538,7 @@ gnat_init_gcc_eh (void)
init_eh (); init_eh ();
#ifdef DWARF2_UNWIND_INFO #ifdef DWARF2_UNWIND_INFO
if (dwarf2out_do_frame ()) if (!dwarf2out_frame_initialized && dwarf2out_do_frame ())
dwarf2out_frame_init (); dwarf2out_frame_init ();
#endif #endif
} }
...@@ -633,13 +654,6 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode, ...@@ -633,13 +654,6 @@ gnat_expand_expr (tree exp, rtx target, enum machine_mode tmode,
tree type = TREE_TYPE (exp); tree type = TREE_TYPE (exp);
tree new; tree new;
/* If this is a statement, call the expansion routine for statements. */
if (IS_STMT (exp))
{
gnat_expand_stmt (exp);
return const0_rtx;
}
/* Update EXP to be the new expression to expand. */ /* Update EXP to be the new expression to expand. */
switch (TREE_CODE (exp)) switch (TREE_CODE (exp))
{ {
...@@ -746,6 +760,10 @@ gnat_get_alias_set (tree type) ...@@ -746,6 +760,10 @@ gnat_get_alias_set (tree type)
return return
get_alias_set (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (type))))); get_alias_set (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (type)))));
/* If the type can alias any other types, return the alias set 0. */
else if (TYPE_P (type)
&& TYPE_UNIVERSAL_ALIASING_P (TYPE_MAIN_VARIANT (type)))
return 0;
return -1; return -1;
} }
......
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