From e297e2eaa6e39126dd216a09dc47458824eb5d52 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 15 Apr 2014 09:23:21 +0000 Subject: decl.c (gnat_to_gnu_entity): Create a mere scalar constant instead of a reference for renaming of scalar literal. * gcc-interface/decl.c (gnat_to_gnu_entity) : Create a mere scalar constant instead of a reference for renaming of scalar literal. Do not create a new object for constant renaming except for a function call. Make sure a VAR_DECL is created for the renaming pointer. * gcc-interface/trans.c (constant_decl_with_initializer_p): New. (fold_constant_decl_in_expr): New function. (Identifier_to_gnu): Use constant_decl_with_initializer_p. For a constant renaming, try to fold a constant DECL in the result. (lvalue_required_p) : Always return 1. (Identifier_to_gnu): Reference the renamed object of constant renaming pointers directly. (Case_Statement_to_gnu): Do not re-fold the bounds of integer types. Assert that the case values are constant. * gcc-interface/utils.c (invalidate_global_renaming_pointers): Do not invalidate constant renaming pointers. Co-Authored-By: Pierre-Marie de Rodat From-SVN: r209411 --- gcc/ada/gcc-interface/utils.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/ada/gcc-interface/utils.c') diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 8172f5f..4814f9a 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -2514,7 +2514,10 @@ record_global_renaming_pointer (tree decl) vec_safe_push (global_renaming_pointers, decl); } -/* Invalidate the global renaming pointers. */ +/* Invalidate the global renaming pointers that are not constant, lest their + renamed object contains SAVE_EXPRs tied to an elaboration routine. Note + that we should not blindly invalidate everything here because of the need + to propagate constant values through renaming. */ void invalidate_global_renaming_pointers (void) @@ -2526,7 +2529,8 @@ invalidate_global_renaming_pointers (void) return; FOR_EACH_VEC_ELT (*global_renaming_pointers, i, iter) - SET_DECL_RENAMED_OBJECT (iter, NULL_TREE); + if (!TREE_CONSTANT (DECL_RENAMED_OBJECT (iter))) + SET_DECL_RENAMED_OBJECT (iter, NULL_TREE); vec_free (global_renaming_pointers); } -- cgit v1.1