Commit 7d7fcb08 by Eric Botcazou Committed by Eric Botcazou

gigi.h (create_subprog_decl): Add ARTIFICIAL_FLAG parameter.

	* gcc-interface/gigi.h (create_subprog_decl): Add ARTIFICIAL_FLAG
	parameter.
	* gcc-interface/utils.c (create_subprog_decl): Likewise.  Set
	DECL_ARTIFICIAL and DECL_NO_INLINE_WARNING_P on the DECL accordingly.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Subprogram_Type>: Add
	ARTIFICIAL_FLAG local variable and pass it to create_subprog_decl.
	<all>: Do not set flags on the reused DECL node coming from an alias.
	Set DECL_IGNORED_P on the DECL node built for subprograms if they
	don't need debug info here...
	* gcc-interface/trans.c (Subprogram_Body_to_gnu): ...and not here.
	(gigi): Adjust calls to create_subprog_decl.
	(build_raise_check): Likewise.
	(establish_gnat_vms_condition_handler): Likewise.
	(Compilation_Unit_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.

From-SVN: r172862
parent 1b5f5069
2011-04-22 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (create_subprog_decl): Add ARTIFICIAL_FLAG
parameter.
* gcc-interface/utils.c (create_subprog_decl): Likewise. Set
DECL_ARTIFICIAL and DECL_NO_INLINE_WARNING_P on the DECL accordingly.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Subprogram_Type>: Add
ARTIFICIAL_FLAG local variable and pass it to create_subprog_decl.
<all>: Do not set flags on the reused DECL node coming from an alias.
Set DECL_IGNORED_P on the DECL node built for subprograms if they
don't need debug info here...
* gcc-interface/trans.c (Subprogram_Body_to_gnu): ...and not here.
(gigi): Adjust calls to create_subprog_decl.
(build_raise_check): Likewise.
(establish_gnat_vms_condition_handler): Likewise.
(Compilation_Unit_to_gnu): Likewise.
(gnat_to_gnu): Likewise.
2011-04-21 Eric Botcazou <ebotcazou@adacore.com> 2011-04-21 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/Makefile.in (NO_SIBLING_ADAFLAGS): Always define. * gcc-interface/Makefile.in (NO_SIBLING_ADAFLAGS): Always define.
......
...@@ -3934,6 +3934,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -3934,6 +3934,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
bool public_flag = Is_Public (gnat_entity) || imported_p; bool public_flag = Is_Public (gnat_entity) || imported_p;
bool extern_flag bool extern_flag
= (Is_Public (gnat_entity) && !definition) || imported_p; = (Is_Public (gnat_entity) && !definition) || imported_p;
bool artificial_flag = !Comes_From_Source (gnat_entity);
/* The semantics of "pure" in Ada essentially matches that of "const" /* The semantics of "pure" in Ada essentially matches that of "const"
in the back-end. In particular, both properties are orthogonal to in the back-end. In particular, both properties are orthogonal to
the "nothrow" property if the EH circuitry is explicit in the the "nothrow" property if the EH circuitry is explicit in the
...@@ -4379,9 +4380,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -4379,9 +4380,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
} }
else if (kind == E_Subprogram_Type) else if (kind == E_Subprogram_Type)
gnu_decl = create_type_decl (gnu_entity_name, gnu_type, attr_list, gnu_decl
!Comes_From_Source (gnat_entity), = create_type_decl (gnu_entity_name, gnu_type, attr_list,
debug_info_p, gnat_entity); artificial_flag, debug_info_p, gnat_entity);
else else
{ {
if (has_stub) if (has_stub)
...@@ -4389,21 +4390,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -4389,21 +4390,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_stub_name = gnu_ext_name; gnu_stub_name = gnu_ext_name;
gnu_ext_name = create_concat_name (gnat_entity, "internal"); gnu_ext_name = create_concat_name (gnat_entity, "internal");
public_flag = false; public_flag = false;
artificial_flag = true;
} }
gnu_decl = create_subprog_decl (gnu_entity_name, gnu_ext_name, gnu_decl
gnu_type, gnu_param_list, = create_subprog_decl (gnu_entity_name, gnu_ext_name, gnu_type,
inline_flag, public_flag, gnu_param_list, inline_flag, public_flag,
extern_flag, attr_list, extern_flag, artificial_flag, attr_list,
gnat_entity); gnat_entity);
if (has_stub) if (has_stub)
{ {
tree gnu_stub_decl tree gnu_stub_decl
= create_subprog_decl (gnu_entity_name, gnu_stub_name, = create_subprog_decl (gnu_entity_name, gnu_stub_name,
gnu_stub_type, gnu_stub_param_list, gnu_stub_type, gnu_stub_param_list,
inline_flag, true, inline_flag, true, extern_flag,
extern_flag, attr_list, false, attr_list, gnat_entity);
gnat_entity);
SET_DECL_FUNCTION_STUB (gnu_decl, gnu_stub_decl); SET_DECL_FUNCTION_STUB (gnu_decl, gnu_stub_decl);
} }
...@@ -4928,14 +4929,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -4928,14 +4929,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
} }
/* If we really have a ..._DECL node, set a couple of flags on it. But we /* If we really have a ..._DECL node, set a couple of flags on it. But we
cannot do that if we are reusing the ..._DECL node made for a renamed cannot do so if we are reusing the ..._DECL node made for an alias or a
object, since the predicates don't apply to it but to GNAT_ENTITY. */ renamed object as the predicates don't apply to it but to GNAT_ENTITY. */
if (DECL_P (gnu_decl) && !(Present (Renamed_Object (gnat_entity)) && saved)) if (DECL_P (gnu_decl)
&& !Present (Alias (gnat_entity))
&& !(Present (Renamed_Object (gnat_entity)) && saved))
{ {
if (!Comes_From_Source (gnat_entity)) if (!Comes_From_Source (gnat_entity))
DECL_ARTIFICIAL (gnu_decl) = 1; DECL_ARTIFICIAL (gnu_decl) = 1;
if (!debug_info_p && TREE_CODE (gnu_decl) != FUNCTION_DECL) if (!debug_info_p)
DECL_IGNORED_P (gnu_decl) = 1; DECL_IGNORED_P (gnu_decl) = 1;
} }
......
...@@ -646,29 +646,29 @@ extern tree create_field_decl (tree field_name, tree field_type, ...@@ -646,29 +646,29 @@ extern tree create_field_decl (tree field_name, tree field_type,
tree record_type, tree size, tree pos, tree record_type, tree size, tree pos,
int packed, int addressable); int packed, int addressable);
/* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter, /* Return a PARM_DECL node. PARAM_NAME is the name of the parameter and
PARAM_TYPE is its type. READONLY is true if the parameter is PARAM_TYPE is its type. READONLY is true if the parameter is readonly
readonly (either an In parameter or an address of a pass-by-ref (either an In parameter or an address of a pass-by-ref parameter). */
parameter). */
extern tree create_param_decl (tree param_name, tree param_type, extern tree create_param_decl (tree param_name, tree param_type,
bool readonly); bool readonly);
/* Returns a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram, /* Return a LABEL_DECL node for LABEL_NAME. */
extern tree create_label_decl (tree label_name);
/* Return a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
PARM_DECL nodes chained through the TREE_CHAIN field). PARM_DECL nodes chained through the TREE_CHAIN field).
INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, and ATTR_LIST are used to set the INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are
appropriate fields in the FUNCTION_DECL. GNAT_NODE gives the location. */ used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is
used for the position of the decl. */
extern tree create_subprog_decl (tree subprog_name, tree asm_name, extern tree create_subprog_decl (tree subprog_name, tree asm_name,
tree subprog_type, tree param_decl_list, tree subprog_type, tree param_decl_list,
bool inlinee_flag, bool public_flag, bool inline_flag, bool public_flag,
bool extern_flag, bool extern_flag, bool artificial_flag,
struct attrib *attr_list, Node_Id gnat_node); struct attrib *attr_list, Node_Id gnat_node);
/* Returns a LABEL_DECL node for LABEL_NAME. */
extern tree create_label_decl (tree label_name);
/* Set up the framework for generating code for SUBPROG_DECL, a subprogram /* Set up the framework for generating code for SUBPROG_DECL, a subprogram
body. This routine needs to be invoked before processing the declarations body. This routine needs to be invoked before processing the declarations
appearing in the subprogram. */ appearing in the subprogram. */
......
...@@ -357,7 +357,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -357,7 +357,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
build_function_type (ptr_void_type_node, build_function_type (ptr_void_type_node,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
sizetype, t)), sizetype, t)),
NULL_TREE, false, true, true, NULL, Empty); 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
...@@ -367,7 +367,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -367,7 +367,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
build_function_type (ptr_void_type_node, build_function_type (ptr_void_type_node,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
sizetype, t)), sizetype, t)),
NULL_TREE, false, true, true, NULL, Empty); 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. */
...@@ -377,14 +377,14 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -377,14 +377,14 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
ptr_void_type_node, ptr_void_type_node,
t)), t)),
NULL_TREE, false, 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. */
mulv64_decl mulv64_decl
= create_subprog_decl (get_identifier ("__gnat_mulv64"), NULL_TREE, = create_subprog_decl (get_identifier ("__gnat_mulv64"), NULL_TREE,
build_function_type_list (int64_type, int64_type, build_function_type_list (int64_type, int64_type,
int64_type, NULL_TREE), int64_type, NULL_TREE),
NULL_TREE, false, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
/* Name of the _Parent field in tagged record types. */ /* Name of the _Parent field in tagged record types. */
parent_name_id = get_identifier (Get_Name_String (Name_uParent)); parent_name_id = get_identifier (Get_Name_String (Name_uParent));
...@@ -405,7 +405,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -405,7 +405,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
= 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 (jmpbuf_ptr_type, NULL_TREE),
NULL_TREE, false, 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
...@@ -414,7 +414,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -414,7 +414,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
NULL_TREE, NULL_TREE,
build_function_type (void_type_node, build_function_type (void_type_node,
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)), tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
NULL_TREE, false, 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;
/* setjmp returns an integer and has one operand, which is a pointer to /* setjmp returns an integer and has one operand, which is a pointer to
...@@ -424,7 +424,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -424,7 +424,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
(get_identifier ("__builtin_setjmp"), NULL_TREE, (get_identifier ("__builtin_setjmp"), NULL_TREE,
build_function_type (integer_type_node, build_function_type (integer_type_node,
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)), tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
NULL_TREE, false, 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;
...@@ -435,7 +435,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -435,7 +435,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
(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 (void_type_node,
tree_cons (NULL_TREE, jmpbuf_ptr_type, t)), tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
NULL_TREE, false, 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;
...@@ -446,7 +446,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -446,7 +446,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
ptr_void_type_node, ptr_void_type_node,
t)), t)),
NULL_TREE, false, true, true, NULL, Empty); 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
...@@ -455,7 +455,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -455,7 +455,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
ptr_void_type_node, ptr_void_type_node,
t)), t)),
NULL_TREE, false, true, true, NULL, Empty); 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
...@@ -473,7 +473,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -473,7 +473,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
integer_type_node, integer_type_node,
t))), t))),
NULL_TREE, false, 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;
TREE_TYPE (decl) TREE_TYPE (decl)
...@@ -506,7 +506,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -506,7 +506,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
(get_identifier ("system__soft_links__get_gnat_exception"), (get_identifier ("system__soft_links__get_gnat_exception"),
NULL_TREE, NULL_TREE,
build_function_type (build_pointer_type (except_type_node), NULL_TREE), build_function_type (build_pointer_type (except_type_node), NULL_TREE),
NULL_TREE, false, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
raise_nodefer_decl raise_nodefer_decl
= create_subprog_decl = create_subprog_decl
...@@ -515,7 +515,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -515,7 +515,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
build_pointer_type (except_type_node), build_pointer_type (except_type_node),
t)), t)),
NULL_TREE, false, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
/* Indicate that these never return. */ /* Indicate that these never return. */
TREE_THIS_VOLATILE (raise_nodefer_decl) = 1; TREE_THIS_VOLATILE (raise_nodefer_decl) = 1;
...@@ -665,7 +665,7 @@ build_raise_check (int check, tree void_tree, enum exception_info_kind kind) ...@@ -665,7 +665,7 @@ build_raise_check (int check, tree void_tree, enum exception_info_kind kind)
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
integer_type_node, integer_type_node,
void_tree)))))), void_tree)))))),
NULL_TREE, false, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
} }
else else
{ {
...@@ -678,7 +678,7 @@ build_raise_check (int check, tree void_tree, enum exception_info_kind kind) ...@@ -678,7 +678,7 @@ build_raise_check (int check, tree void_tree, enum exception_info_kind kind)
tree_cons tree_cons
(NULL_TREE, build_pointer_type (unsigned_char_type_node), (NULL_TREE, build_pointer_type (unsigned_char_type_node),
tree_cons (NULL_TREE, integer_type_node, void_tree))), tree_cons (NULL_TREE, integer_type_node, void_tree))),
NULL_TREE, false, true, true, NULL, Empty); NULL_TREE, false, true, true, true, NULL, Empty);
} }
TREE_THIS_VOLATILE (result) = 1; TREE_THIS_VOLATILE (result) = 1;
...@@ -2427,7 +2427,8 @@ establish_gnat_vms_condition_handler (void) ...@@ -2427,7 +2427,8 @@ establish_gnat_vms_condition_handler (void)
ptr_void_type_node, ptr_void_type_node,
ptr_void_type_node, ptr_void_type_node,
NULL_TREE), NULL_TREE),
NULL_TREE, 0, 1, 1, 0, Empty); NULL_TREE, false, true, true, true, NULL,
Empty);
/* ??? DECL_CONTEXT shouldn't have been set because of DECL_EXTERNAL. */ /* ??? DECL_CONTEXT shouldn't have been set because of DECL_EXTERNAL. */
DECL_CONTEXT (gnat_vms_condition_handler_decl) = NULL_TREE; DECL_CONTEXT (gnat_vms_condition_handler_decl) = NULL_TREE;
...@@ -2508,10 +2509,6 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) ...@@ -2508,10 +2509,6 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
relayout_decl (gnu_result_decl); relayout_decl (gnu_result_decl);
} }
/* Propagate the debug mode. */
if (!Needs_Debug_Info (gnat_subprog_id))
DECL_IGNORED_P (gnu_subprog_decl) = 1;
/* Set the line number in the decl to correspond to that of the body so that /* Set the line number in the decl to correspond to that of the body so that
the line number notes are written correctly. */ the line number notes are written correctly. */
Sloc_to_locus (Sloc (gnat_node), &DECL_SOURCE_LOCATION (gnu_subprog_decl)); Sloc_to_locus (Sloc (gnat_node), &DECL_SOURCE_LOCATION (gnu_subprog_decl));
...@@ -3774,7 +3771,8 @@ Compilation_Unit_to_gnu (Node_Id gnat_node) ...@@ -3774,7 +3771,8 @@ Compilation_Unit_to_gnu (Node_Id gnat_node)
tree gnu_elab_proc_decl tree gnu_elab_proc_decl
= create_subprog_decl = create_subprog_decl
(create_concat_name (gnat_unit_entity, body_p ? "elabb" : "elabs"), (create_concat_name (gnat_unit_entity, body_p ? "elabb" : "elabs"),
NULL_TREE, void_ftype, NULL_TREE, false, true, false, NULL, gnat_unit); NULL_TREE, void_ftype, NULL_TREE, false, true, false, true, NULL,
gnat_unit);
struct elab_info *info; struct elab_info *info;
VEC_safe_push (tree, gc, gnu_elab_proc_stack, gnu_elab_proc_decl); VEC_safe_push (tree, gc, gnu_elab_proc_stack, gnu_elab_proc_decl);
...@@ -4505,7 +4503,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -4505,7 +4503,7 @@ gnat_to_gnu (Node_Id gnat_node)
(Entity (Prefix (gnat_node)), (Entity (Prefix (gnat_node)),
attr == Attr_Elab_Body ? "elabb" : "elabs"), attr == Attr_Elab_Body ? "elabb" : "elabs"),
NULL_TREE, void_ftype, NULL_TREE, false, NULL_TREE, void_ftype, NULL_TREE, false,
true, true, NULL, gnat_node); true, true, true, NULL, gnat_node);
gnu_result = Attribute_to_gnu (gnat_node, &gnu_result_type, attr); gnu_result = Attribute_to_gnu (gnat_node, &gnu_result_type, attr);
} }
......
...@@ -1795,7 +1795,7 @@ value_factor_p (tree value, HOST_WIDE_INT factor) ...@@ -1795,7 +1795,7 @@ value_factor_p (tree value, HOST_WIDE_INT factor)
return false; return false;
} }
/* Given 2 consecutive field decls PREV_FIELD and CURR_FIELD, return true /* Given two consecutive field decls PREV_FIELD and CURR_FIELD, return true
unless we can prove these 2 fields are laid out in such a way that no gap unless we can prove these 2 fields are laid out in such a way that no gap
exist between the end of PREV_FIELD and the beginning of CURR_FIELD. OFFSET exist between the end of PREV_FIELD and the beginning of CURR_FIELD. OFFSET
is the distance in bits between the end of PREV_FIELD and the starting is the distance in bits between the end of PREV_FIELD and the starting
...@@ -1841,7 +1841,7 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset) ...@@ -1841,7 +1841,7 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset)
return true; return true;
} }
/* Returns a LABEL_DECL node for LABEL_NAME. */ /* Return a LABEL_DECL node for LABEL_NAME. */
tree tree
create_label_decl (tree label_name) create_label_decl (tree label_name)
...@@ -1856,24 +1856,26 @@ create_label_decl (tree label_name) ...@@ -1856,24 +1856,26 @@ create_label_decl (tree label_name)
return label_decl; return label_decl;
} }
/* Returns a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram, /* Return a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
PARM_DECL nodes chained through the TREE_CHAIN field). PARM_DECL nodes chained through the TREE_CHAIN field).
INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, and ATTR_LIST are used to set the INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are
appropriate fields in the FUNCTION_DECL. GNAT_NODE gives the location. */ used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is
used for the position of the decl. */
tree tree
create_subprog_decl (tree subprog_name, tree asm_name, create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
tree subprog_type, tree param_decl_list, bool inline_flag, tree param_decl_list, bool inline_flag, bool public_flag,
bool public_flag, bool extern_flag, bool extern_flag, bool artificial_flag,
struct attrib *attr_list, Node_Id gnat_node) struct attrib *attr_list, Node_Id gnat_node)
{ {
tree subprog_decl = build_decl (input_location, FUNCTION_DECL, subprog_name, tree subprog_decl = build_decl (input_location, FUNCTION_DECL, subprog_name,
subprog_type); subprog_type);
tree result_decl = build_decl (input_location, RESULT_DECL, NULL_TREE, tree result_decl = build_decl (input_location, RESULT_DECL, NULL_TREE,
TREE_TYPE (subprog_type)); TREE_TYPE (subprog_type));
DECL_ARGUMENTS (subprog_decl) = param_decl_list;
/* If this is a non-inline function nested inside an inlined external /* If this is a non-inline function nested inside an inlined external
function, we cannot honor both requests without cloning the nested function, we cannot honor both requests without cloning the nested
...@@ -1887,13 +1889,15 @@ create_subprog_decl (tree subprog_name, tree asm_name, ...@@ -1887,13 +1889,15 @@ create_subprog_decl (tree subprog_name, tree asm_name,
&& DECL_EXTERNAL (current_function_decl)) && DECL_EXTERNAL (current_function_decl))
DECL_DECLARED_INLINE_P (current_function_decl) = 0; DECL_DECLARED_INLINE_P (current_function_decl) = 0;
DECL_EXTERNAL (subprog_decl) = extern_flag; DECL_ARTIFICIAL (subprog_decl) = artificial_flag;
TREE_PUBLIC (subprog_decl) = public_flag; DECL_EXTERNAL (subprog_decl) = extern_flag;
TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type); DECL_DECLARED_INLINE_P (subprog_decl) = inline_flag;
DECL_NO_INLINE_WARNING_P (subprog_decl) = inline_flag && artificial_flag;
TREE_PUBLIC (subprog_decl) = public_flag;
TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type);
TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type); TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type);
TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (subprog_type); TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (subprog_type);
DECL_DECLARED_INLINE_P (subprog_decl) = inline_flag;
DECL_ARGUMENTS (subprog_decl) = param_decl_list;
DECL_ARTIFICIAL (result_decl) = 1; DECL_ARTIFICIAL (result_decl) = 1;
DECL_IGNORED_P (result_decl) = 1; DECL_IGNORED_P (result_decl) = 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