aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2016-06-06 09:08:56 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2016-06-06 09:08:56 +0000
commit7414a3c340282ab3f7041dfa40ebc52c5f7156ef (patch)
tree18ed91aff77182fe03021fe69c55a9301f21761d /gcc/ada/gcc-interface/utils.c
parent128a98eacef4f47310de212932389f740acfa881 (diff)
downloadgcc-7414a3c340282ab3f7041dfa40ebc52c5f7156ef.zip
gcc-7414a3c340282ab3f7041dfa40ebc52c5f7156ef.tar.gz
gcc-7414a3c340282ab3f7041dfa40ebc52c5f7156ef.tar.bz2
gigi.h (finish_subprog_decl): Add ASM_NAME parameter.
* gcc-interface/gigi.h (finish_subprog_decl): Add ASM_NAME parameter. * gcc-interface/decl.c (gnu_ext_name_for_subprog): New function. (gnat_to_gnu_entity) <E_Subprogram_Type>: Do not check compatibility of profiles for builtins here... Call gnu_ext_name_for_subprog. Also update profiles if pointers to limited_with'ed types are updated. (gnat_to_gnu_param): Restore the correct source location information for vector ABI warnings. (associate_subprog_with_dummy_type): Add comment about AI05-019. Set TYPE_DUMMY_IN_PROFILE_P flag unconditionally. (update_profile): Deal with builtin declarations. Call gnu_ext_name_for_subprog. Adjust call to finish_subprog_decl. (update_profiles_with): Add comment. (gnat_to_gnu_subprog_type): Reuse the return type if it is complete. Likewise for parameter declarations in most cases. Do not change the return type for the CICO mechanism if the profile is incomplete. ...but here instead. Always reset the slot for the parameters. * gcc-interface/utils.c (create_subprog_decl): Call gnu_ext_name_for_subprog. Do not set the assembler name here but... (finish_subprog_decl): ...but here instead. Add ASM_NAME parameter. From-SVN: r237119
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 798048a..6a55796 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -3137,7 +3137,6 @@ create_subprog_decl (tree name, tree asm_name, tree type, tree param_decl_list,
{
tree subprog_decl = build_decl (input_location, FUNCTION_DECL, name, type);
DECL_ARGUMENTS (subprog_decl) = param_decl_list;
- finish_subprog_decl (subprog_decl, type);
DECL_ARTIFICIAL (subprog_decl) = artificial_p;
DECL_EXTERNAL (subprog_decl) = extern_flag;
@@ -3175,38 +3174,23 @@ create_subprog_decl (tree name, tree asm_name, tree type, tree param_decl_list,
process_attributes (&subprog_decl, &attr_list, true, gnat_node);
+ /* Once everything is processed, finish the subprogram declaration. */
+ finish_subprog_decl (subprog_decl, asm_name, type);
+
/* Add this decl to the current binding level. */
gnat_pushdecl (subprog_decl, gnat_node);
- if (asm_name)
- {
- /* Let the target mangle the name if this isn't a verbatim asm. */
- if (*IDENTIFIER_POINTER (asm_name) != '*')
- asm_name = targetm.mangle_decl_assembler_name (subprog_decl, asm_name);
-
- SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name);
-
- /* The expand_main_function circuitry expects "main_identifier_node" to
- designate the DECL_NAME of the 'main' entry point, in turn expected
- to be declared as the "main" function literally by default. Ada
- program entry points are typically declared with a different name
- within the binder generated file, exported as 'main' to satisfy the
- system expectations. Force main_identifier_node in this case. */
- if (asm_name == main_identifier_node)
- DECL_NAME (subprog_decl) = main_identifier_node;
- }
-
/* Output the assembler code and/or RTL for the declaration. */
rest_of_decl_compilation (subprog_decl, global_bindings_p (), 0);
return subprog_decl;
}
-/* Given a subprogram declaration DECL and its TYPE, finish constructing the
- subprogram declaration from TYPE. */
+/* Given a subprogram declaration DECL, its assembler name and its type,
+ finish constructing the subprogram declaration from ASM_NAME and TYPE. */
void
-finish_subprog_decl (tree decl, tree type)
+finish_subprog_decl (tree decl, tree asm_name, tree type)
{
tree result_decl
= build_decl (DECL_SOURCE_LOCATION (decl), RESULT_DECL, NULL_TREE,
@@ -3219,6 +3203,24 @@ finish_subprog_decl (tree decl, tree type)
TREE_READONLY (decl) = TYPE_READONLY (type);
TREE_SIDE_EFFECTS (decl) = TREE_THIS_VOLATILE (decl) = TYPE_VOLATILE (type);
+
+ if (asm_name)
+ {
+ /* Let the target mangle the name if this isn't a verbatim asm. */
+ if (*IDENTIFIER_POINTER (asm_name) != '*')
+ asm_name = targetm.mangle_decl_assembler_name (decl, asm_name);
+
+ SET_DECL_ASSEMBLER_NAME (decl, asm_name);
+
+ /* The expand_main_function circuitry expects "main_identifier_node" to
+ designate the DECL_NAME of the 'main' entry point, in turn expected
+ to be declared as the "main" function literally by default. Ada
+ program entry points are typically declared with a different name
+ within the binder generated file, exported as 'main' to satisfy the
+ system expectations. Force main_identifier_node in this case. */
+ if (asm_name == main_identifier_node)
+ DECL_NAME (decl) = main_identifier_node;
+ }
}
/* Set up the framework for generating code for SUBPROG_DECL, a subprogram