Commit 0e24192c by Eric Botcazou Committed by Eric Botcazou

gigi.h (enum inline_status_t): New type.

	* gcc-interface/gigi.h (enum inline_status_t): New type.
	(create_subprog_decl): Adjust prototype.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Procedure>: Adjust
	calls to create_subprog_decl.
	(get_minimal_subprog_decl): Likewise.
	* gcc-interface/trans.c (gigi): Likewise.
	(build_raise_check): Likewise.
	(establish_gnat_vms_condition_handler): Likewise.
	(Compilation_Unit_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.
	* gcc-interface/utils.c (create_subprog_decl): Change inline_flag
	parameter to inline_status and implement for suppressed inlining.

From-SVN: r199286
parent 828012a5
2013-05-24 Eric Botcazou <ebotcazou@adacore.com> 2013-05-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (enum inline_status_t): New type.
(create_subprog_decl): Adjust prototype.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Procedure>: Adjust
calls to create_subprog_decl.
(get_minimal_subprog_decl): Likewise.
* gcc-interface/trans.c (gigi): Likewise.
(build_raise_check): Likewise.
(establish_gnat_vms_condition_handler): Likewise.
(Compilation_Unit_to_gnu): Likewise.
(gnat_to_gnu): Likewise.
* gcc-interface/utils.c (create_subprog_decl): Change inline_flag
parameter to inline_status and implement for suppressed inlining.
2013-05-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/ada-tree.h (LOOP_STMT_NO_UNROLL): New define. * gcc-interface/ada-tree.h (LOOP_STMT_NO_UNROLL): New define.
(LOOP_STMT_UNROLL): Likewise. (LOOP_STMT_UNROLL): Likewise.
(LOOP_STMT_NO_VECTOR): Likewise. (LOOP_STMT_NO_VECTOR): Likewise.
......
...@@ -4130,7 +4130,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -4130,7 +4130,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
tree gnu_stub_type = NULL_TREE, gnu_stub_name = NULL_TREE; tree gnu_stub_type = NULL_TREE, gnu_stub_name = NULL_TREE;
tree gnu_ext_name = create_concat_name (gnat_entity, NULL); tree gnu_ext_name = create_concat_name (gnat_entity, NULL);
Entity_Id gnat_param; Entity_Id gnat_param;
bool inline_flag = Is_Inlined (gnat_entity); enum inline_status_t inline_status
= Has_Pragma_No_Inline (gnat_entity)
? is_suppressed
: (Is_Inlined (gnat_entity) ? is_enabled : is_disabled);
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;
...@@ -4686,15 +4689,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -4686,15 +4689,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_decl gnu_decl
= create_subprog_decl (gnu_entity_name, gnu_ext_name, gnu_type, = create_subprog_decl (gnu_entity_name, gnu_ext_name, gnu_type,
gnu_param_list, inline_flag, public_flag, gnu_param_list, inline_status,
extern_flag, artificial_flag, attr_list, public_flag, extern_flag, artificial_flag,
gnat_entity); attr_list, 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, extern_flag, inline_status, true, extern_flag,
false, attr_list, gnat_entity); false, attr_list, gnat_entity);
SET_DECL_FUNCTION_STUB (gnu_decl, gnu_stub_decl); SET_DECL_FUNCTION_STUB (gnu_decl, gnu_stub_decl);
} }
...@@ -5427,7 +5430,7 @@ get_minimal_subprog_decl (Entity_Id gnat_entity) ...@@ -5427,7 +5430,7 @@ get_minimal_subprog_decl (Entity_Id gnat_entity)
return return
create_subprog_decl (gnu_entity_name, gnu_ext_name, void_ftype, NULL_TREE, create_subprog_decl (gnu_entity_name, gnu_ext_name, void_ftype, NULL_TREE,
false, true, true, true, attr_list, gnat_entity); is_disabled, true, true, true, attr_list, gnat_entity);
} }
/* Return whether the E_Subprogram_Type/E_Function/E_Procedure GNAT_ENTITY is /* Return whether the E_Subprogram_Type/E_Function/E_Procedure GNAT_ENTITY is
......
...@@ -430,6 +430,17 @@ enum exception_info_kind ...@@ -430,6 +430,17 @@ enum exception_info_kind
exception_column exception_column
}; };
/* Define the inline status of a subprogram. */
enum inline_status_t
{
/* Inlining is suppressed for the subprogram. */
is_suppressed,
/* No inlining is requested for the subprogram. */
is_disabled,
/* Inlining is requested for the subprogram. */
is_enabled
};
extern GTY(()) tree gnat_std_decls[(int) ADT_LAST]; extern GTY(()) tree gnat_std_decls[(int) ADT_LAST];
extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1]; extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1];
extern GTY(()) tree gnat_raise_decls_ext[(int) LAST_REASON_CODE + 1]; extern GTY(()) tree gnat_raise_decls_ext[(int) LAST_REASON_CODE + 1];
...@@ -718,13 +729,14 @@ extern tree create_label_decl (tree, Node_Id); ...@@ -718,13 +729,14 @@ extern tree create_label_decl (tree, Node_Id);
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 DECL_CHAIN field). PARM_DECL nodes chained through the DECL_CHAIN field).
INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are
used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is
used for the position of the decl. */ 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 inline_flag, bool public_flag, enum inline_status_t inline_status,
bool extern_flag, bool artificial_flag, bool public_flag, bool extern_flag,
bool artificial_flag,
struct attrib *attr_list, Node_Id gnat_node); struct attrib *attr_list, Node_Id gnat_node);
/* Set up the framework for generating code for SUBPROG_DECL, a subprogram /* Set up the framework for generating code for SUBPROG_DECL, a subprogram
......
...@@ -413,16 +413,16 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -413,16 +413,16 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
memory. */ memory. */
malloc_decl malloc_decl
= create_subprog_decl (get_identifier ("__gnat_malloc"), NULL_TREE, = create_subprog_decl (get_identifier ("__gnat_malloc"), NULL_TREE,
ftype, NULL_TREE, false, true, true, true, NULL, ftype, NULL_TREE, is_disabled, true, true, true,
Empty); 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,
ftype, NULL_TREE, false, true, true, true, NULL, ftype, NULL_TREE, is_disabled, true, true, true,
Empty); 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. */
...@@ -431,14 +431,16 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -431,14 +431,16 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
build_function_type_list (void_type_node, build_function_type_list (void_type_node,
ptr_void_type_node, ptr_void_type_node,
NULL_TREE), NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, is_disabled, 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, true, NULL, Empty); NULL_TREE, is_disabled, 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));
...@@ -459,7 +461,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -459,7 +461,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_list (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, is_disabled, 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
...@@ -467,7 +469,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -467,7 +469,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
(get_identifier ("system__soft_links__set_jmpbuf_address_soft"), (get_identifier ("system__soft_links__set_jmpbuf_address_soft"),
NULL_TREE, build_function_type_list (void_type_node, jmpbuf_ptr_type, NULL_TREE, build_function_type_list (void_type_node, jmpbuf_ptr_type,
NULL_TREE), NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, is_disabled, 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
...@@ -477,7 +479,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -477,7 +479,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_list (integer_type_node, jmpbuf_ptr_type, build_function_type_list (integer_type_node, jmpbuf_ptr_type,
NULL_TREE), NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, is_disabled, 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;
...@@ -487,7 +489,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -487,7 +489,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
= 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_list (void_type_node, jmpbuf_ptr_type, NULL_TREE), build_function_type_list (void_type_node, jmpbuf_ptr_type, NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, is_disabled, 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;
...@@ -497,27 +499,27 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -497,27 +499,27 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
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,
ftype, NULL_TREE, false, true, true, true, NULL, ftype, NULL_TREE, is_disabled, true, true, true,
Empty); 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,
ftype, NULL_TREE, false, true, true, true, NULL, ftype, NULL_TREE, is_disabled, true, true, true,
Empty); NULL, Empty);
DECL_IGNORED_P (end_handler_decl) = 1; DECL_IGNORED_P (end_handler_decl) = 1;
unhandled_except_decl unhandled_except_decl
= create_subprog_decl (get_identifier ("__gnat_unhandled_except_handler"), = create_subprog_decl (get_identifier ("__gnat_unhandled_except_handler"),
NULL_TREE, NULL_TREE,
ftype, NULL_TREE, false, true, true, true, NULL, ftype, NULL_TREE, is_disabled, true, true, true,
Empty); NULL, Empty);
DECL_IGNORED_P (unhandled_except_decl) = 1; DECL_IGNORED_P (unhandled_except_decl) = 1;
reraise_zcx_decl reraise_zcx_decl
= create_subprog_decl (get_identifier ("__gnat_reraise_zcx"), NULL_TREE, = create_subprog_decl (get_identifier ("__gnat_reraise_zcx"), NULL_TREE,
ftype, NULL_TREE, false, true, true, true, NULL, ftype, NULL_TREE, is_disabled, true, true, true,
Empty); NULL, Empty);
/* Indicate that these never return. */ /* Indicate that these never return. */
DECL_IGNORED_P (reraise_zcx_decl) = 1; DECL_IGNORED_P (reraise_zcx_decl) = 1;
TREE_THIS_VOLATILE (reraise_zcx_decl) = 1; TREE_THIS_VOLATILE (reraise_zcx_decl) = 1;
...@@ -537,7 +539,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -537,7 +539,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
build_pointer_type build_pointer_type
(unsigned_char_type_node), (unsigned_char_type_node),
integer_type_node, NULL_TREE), integer_type_node, NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, is_disabled, 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)
...@@ -570,7 +572,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -570,7 +572,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
(get_identifier ("system__soft_links__get_gnat_exception"), NULL_TREE, (get_identifier ("system__soft_links__get_gnat_exception"), NULL_TREE,
build_function_type_list (build_pointer_type (except_type_node), build_function_type_list (build_pointer_type (except_type_node),
NULL_TREE), NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, is_disabled, true, true, true, NULL, Empty);
DECL_IGNORED_P (get_excptr_decl) = 1; DECL_IGNORED_P (get_excptr_decl) = 1;
raise_nodefer_decl raise_nodefer_decl
...@@ -579,7 +581,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, ...@@ -579,7 +581,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
build_function_type_list (void_type_node, build_function_type_list (void_type_node,
build_pointer_type (except_type_node), build_pointer_type (except_type_node),
NULL_TREE), NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty); NULL_TREE, is_disabled, true, true, true, NULL, Empty);
/* Indicate that it never returns. */ /* Indicate that it never returns. */
TREE_THIS_VOLATILE (raise_nodefer_decl) = 1; TREE_THIS_VOLATILE (raise_nodefer_decl) = 1;
...@@ -752,7 +754,7 @@ build_raise_check (int check, enum exception_info_kind kind) ...@@ -752,7 +754,7 @@ build_raise_check (int check, enum exception_info_kind kind)
result result
= create_subprog_decl (get_identifier (Name_Buffer), = create_subprog_decl (get_identifier (Name_Buffer),
NULL_TREE, ftype, NULL_TREE, NULL_TREE, ftype, NULL_TREE,
false, true, true, true, NULL, Empty); is_disabled, true, true, true, NULL, Empty);
/* Indicate that it never returns. */ /* Indicate that it never returns. */
TREE_THIS_VOLATILE (result) = 1; TREE_THIS_VOLATILE (result) = 1;
...@@ -2813,7 +2815,7 @@ establish_gnat_vms_condition_handler (void) ...@@ -2813,7 +2815,7 @@ 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, false, true, true, true, NULL, NULL_TREE, is_disabled, true, true, true, NULL,
Empty); Empty);
/* ??? DECL_CONTEXT shouldn't have been set because of DECL_EXTERNAL. */ /* ??? DECL_CONTEXT shouldn't have been set because of DECL_EXTERNAL. */
...@@ -4867,7 +4869,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_node) ...@@ -4867,7 +4869,7 @@ 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, true, NULL, NULL_TREE, void_ftype, NULL_TREE, is_disabled, true, false, true, NULL,
gnat_unit); gnat_unit);
struct elab_info *info; struct elab_info *info;
...@@ -5795,7 +5797,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -5795,7 +5797,7 @@ gnat_to_gnu (Node_Id gnat_node)
create_subprog_decl (create_concat_name create_subprog_decl (create_concat_name
(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, is_disabled,
true, 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);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 1992-2012, Free Software Foundation, Inc. * * Copyright (C) 1992-2013, 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- *
...@@ -2621,14 +2621,14 @@ create_label_decl (tree label_name, Node_Id gnat_node) ...@@ -2621,14 +2621,14 @@ create_label_decl (tree label_name, Node_Id gnat_node)
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 DECL_CHAIN field). PARM_DECL nodes chained through the DECL_CHAIN field).
INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG, ARTIFICIAL_FLAG and ATTR_LIST are
used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is used to set the appropriate fields in the FUNCTION_DECL. GNAT_NODE is
used for the position of the decl. */ used for the position of the decl. */
tree tree
create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type, create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
tree param_decl_list, bool inline_flag, bool public_flag, tree param_decl_list, enum inline_status_t inline_status,
bool extern_flag, bool artificial_flag, bool public_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,
...@@ -2642,7 +2642,7 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type, ...@@ -2642,7 +2642,7 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
function in the current unit since it is private to the other unit. function in the current unit since it is private to the other unit.
We could inline the nested function as well but it's probably better We could inline the nested function as well but it's probably better
to err on the side of too little inlining. */ to err on the side of too little inlining. */
if (!inline_flag if (inline_status != is_enabled
&& !public_flag && !public_flag
&& current_function_decl && current_function_decl
&& DECL_DECLARED_INLINE_P (current_function_decl) && DECL_DECLARED_INLINE_P (current_function_decl)
...@@ -2651,8 +2651,24 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type, ...@@ -2651,8 +2651,24 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
DECL_ARTIFICIAL (subprog_decl) = artificial_flag; DECL_ARTIFICIAL (subprog_decl) = artificial_flag;
DECL_EXTERNAL (subprog_decl) = extern_flag; DECL_EXTERNAL (subprog_decl) = extern_flag;
DECL_DECLARED_INLINE_P (subprog_decl) = inline_flag;
DECL_NO_INLINE_WARNING_P (subprog_decl) = inline_flag && artificial_flag; switch (inline_status)
{
case is_suppressed:
DECL_UNINLINABLE (subprog_decl) = 1;
break;
case is_disabled:
break;
case is_enabled:
DECL_DECLARED_INLINE_P (subprog_decl) = 1;
DECL_NO_INLINE_WARNING_P (subprog_decl) = artificial_flag;
break;
default:
gcc_unreachable ();
}
TREE_PUBLIC (subprog_decl) = public_flag; TREE_PUBLIC (subprog_decl) = public_flag;
TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type); TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type);
......
2013-05-24 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/noinline1.ads: New test.
* gnat.dg/noinline2.ad[sb]: Likewise.
* gnat.dg/specs/noinline3.ads: Likewise.
* gnat.dg/specs/noinline3_pkg.ad[sb]: New helper.
2013-05-24 Alexander Ivchenko <alexander.ivchenko@intel.com> 2013-05-24 Alexander Ivchenko <alexander.ivchenko@intel.com>
PR tree-ssa/57385 PR tree-ssa/57385
......
-- { dg-do compile }
-- { dg-options "-O2 -fdump-tree-optimized" }
package body Noinline2 is
function Inner (A, B : Integer) return Integer;
pragma No_Inline (Inner);
function Inner (A, B : Integer) return Integer is
begin
return A + B;
end;
function F (A, B : Integer) return Integer is
begin
return Inner (A, B) + Inner (A, -B);
end;
end Noinline2;
-- { dg-final { scan-tree-dump-times "noinline2.inner" 2 "optimized" } }
-- { dg-final { cleanup-tree-dump "optimized" } }
package Noinline2 is
function F (A, B : Integer) return Integer;
end Noinline2;
-- { dg-do compile }
package Noinline1 is
procedure Proc1;
pragma Inline (Proc1);
pragma No_Inline (Proc1); -- { dg-warning "both specified" }
procedure Proc2;
pragma No_Inline (Proc2);
pragma Inline (Proc2); -- { dg-warning "both specified" }
procedure Proc3;
pragma Inline_Always (Proc3);
pragma No_Inline (Proc3); -- { dg-error "mutually exclusive" }
procedure Proc4;
pragma No_Inline (Proc4);
pragma Inline_Always (Proc4); -- { dg-error "mutually exclusive" }
end Noinline1;
-- { dg-do compile }
-- { dg-options "-O2 -fdump-tree-optimized" }
with Noinline3_Pkg;
package Noinline3 is new Noinline3_Pkg (0);
-- { dg-final { scan-tree-dump-times "noinline3.inner" 2 "optimized" } }
-- { dg-final { cleanup-tree-dump "optimized" } }
package body Noinline3_Pkg is
function Inner (A, B : Integer) return Integer;
pragma No_Inline (Inner);
function Inner (A, B : Integer) return Integer is
begin
return A + B;
end;
function F (A, B : Integer) return Integer is
begin
return Inner (A, B) + Inner (A, -B);
end;
end Noinline3_Pkg;
-- { dg-excess-errors "cannot generate code" }
generic
I : Integer;
package Noinline3_Pkg is
function F (A, B : Integer) return Integer;
end Noinline3_Pkg;
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