Commit 9a30c7c4 by Arnaud Charlet

[multiple changes]

2014-08-01  Olivier Hainque  <hainque@adacore.com>

	* gcc-interface/Make-lang.in (ADA_TOOLS_FLAGS_TO_PASS, native): use
	$(CXX) instead of ../../xg++ to feed CXX.
	(CXX_LFLAGS): Remove. Now unused as the proper flags
	are expected to be included in the CXX variable.

2014-08-01  Pierre-Marie Derodat  <derodat@adacore.com>

	* gcc-interface/decl.c (elaborate_expression_1): Return the new
	variable when debug info is needed and the expression is not
	constant.  Tag as external only new variables that are global.
	(gnat_to_gnu_entity): Call it after the GNU declaration is saved.
	* gcc-interface/trans.c (Attribute_to_gnu): Do not cache
	attributes for IN array parameters when their actual subtype
	needs debug info.
	(Compilation_Unit_to_gnu): Call it to process all remaining nodes.
	* gcc-interface/gigi.h (process_deferred_decl_context): New.
	* gcc-interface/utils.c (gnat_write_global_declarations): Do not
	emit debug info for ignored global declarations.
	(struct deferred_decl_context_node,
	add_deferred_decl_context, add_deferred_type_context,
	compute_deferred_decl_context, defer_or_set_type_context,
	deferred_decl_context_queue, get_debug_scope,
	get_global_context, process_deferred_decl_context): New.
	(gnat_pushdecl): Re-implement the DECL_CONTEXT and TYPE_CONTEXT
	computation machinery to rely on the GNAT Scope attribute.

2014-08-01  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/utils2.c (build_simple_component_ref): Add guard.

From-SVN: r213482
parent 88b1a322
2014-08-01 Olivier Hainque <hainque@adacore.com>
* gcc-interface/Make-lang.in (ADA_TOOLS_FLAGS_TO_PASS, native): use
$(CXX) instead of ../../xg++ to feed CXX.
(CXX_LFLAGS): Remove. Now unused as the proper flags
are expected to be included in the CXX variable.
2014-08-01 Pierre-Marie Derodat <derodat@adacore.com>
* gcc-interface/decl.c (elaborate_expression_1): Return the new
variable when debug info is needed and the expression is not
constant. Tag as external only new variables that are global.
(gnat_to_gnu_entity): Call it after the GNU declaration is saved.
* gcc-interface/trans.c (Attribute_to_gnu): Do not cache
attributes for IN array parameters when their actual subtype
needs debug info.
(Compilation_Unit_to_gnu): Call it to process all remaining nodes.
* gcc-interface/gigi.h (process_deferred_decl_context): New.
* gcc-interface/utils.c (gnat_write_global_declarations): Do not
emit debug info for ignored global declarations.
(struct deferred_decl_context_node,
add_deferred_decl_context, add_deferred_type_context,
compute_deferred_decl_context, defer_or_set_type_context,
deferred_decl_context_queue, get_debug_scope,
get_global_context, process_deferred_decl_context): New.
(gnat_pushdecl): Re-implement the DECL_CONTEXT and TYPE_CONTEXT
computation machinery to rely on the GNAT Scope attribute.
2014-08-01 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils2.c (build_simple_component_ref): Add guard.
2014-08-01 Robert Dewar <dewar@adacore.com> 2014-08-01 Robert Dewar <dewar@adacore.com>
* sem_ch8.adb, opt.ads Minor comment updates. * sem_ch8.adb, opt.ads Minor comment updates.
......
...@@ -128,11 +128,12 @@ ada: gnat1$(exeext) gnatbind$(exeext) ...@@ -128,11 +128,12 @@ ada: gnat1$(exeext) gnatbind$(exeext)
# Tell GNU Make to ignore these, if they exist. # Tell GNU Make to ignore these, if they exist.
.PHONY: ada .PHONY: ada
CXX_LFLAGS = \ # Compute the FLAGS to pass for gnattools, now linked with a C++ driver as
-B../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ # we're linking against at least libcommon which contains C++ compiled code.
-B../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \ # We need to use the same driver to link as the one that was used to produce
-L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ # the objects, which depends on whether we're bootstrapping or not. The CXX
-L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs # variable conveys what we need for this, set to "g++" if not bootstrapping,
# ".../xg++" otherwise.
# There are too many Ada sources to check against here. Let's # There are too many Ada sources to check against here. Let's
# always force the recursive make. # always force the recursive make.
...@@ -142,7 +143,7 @@ ifeq ($(build), $(host)) ...@@ -142,7 +143,7 @@ ifeq ($(build), $(host))
# tree. # tree.
ADA_TOOLS_FLAGS_TO_PASS=\ ADA_TOOLS_FLAGS_TO_PASS=\
CC="../../xgcc -B../../" \ CC="../../xgcc -B../../" \
CXX="../../xg++ -B../../ $(CXX_LFLAGS)" \ CXX="$(CXX)" \
$(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \ $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
ADA_INCLUDES="-I- -I../rts" \ ADA_INCLUDES="-I- -I../rts" \
GNATMAKE="../../gnatmake" \ GNATMAKE="../../gnatmake" \
......
...@@ -5190,6 +5190,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -5190,6 +5190,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (!saved) if (!saved)
save_gnu_tree (gnat_entity, gnu_decl, false); save_gnu_tree (gnat_entity, gnu_decl, false);
/* Now we are sure gnat_entity has a corresponding ..._DECL node,
eliminate as many deferred computations as possible. */
process_deferred_decl_context (false);
/* If this is an enumeration or floating-point type, we were not able to set /* If this is an enumeration or floating-point type, we were not able to set
the bounds since they refer to the type. These are always static. */ the bounds since they refer to the type. These are always static. */
if ((kind == E_Enumeration_Type && Present (First_Literal (gnat_entity))) if ((kind == E_Enumeration_Type && Present (First_Literal (gnat_entity)))
...@@ -6184,14 +6188,30 @@ elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, tree gnu_name, ...@@ -6184,14 +6188,30 @@ elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, tree gnu_name,
/* Now create it, possibly only for debugging purposes. */ /* Now create it, possibly only for debugging purposes. */
if (use_variable || need_debug) if (use_variable || need_debug)
{ {
/* The following variable creation can happen when processing the body of
subprograms that are defined out of the extended main unit and
inlined. In this case, we are not at the global scope, and thus the
new variable must not be tagged "external", as we used to do here as
long as definition == 0. */
const bool external_flag = !definition && expr_global_p;
tree gnu_decl tree gnu_decl
= create_var_decl_1 = create_var_decl_1
(create_concat_name (gnat_entity, IDENTIFIER_POINTER (gnu_name)), (create_concat_name (gnat_entity, IDENTIFIER_POINTER (gnu_name)),
NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, true, expr_public_p, NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, true, expr_public_p,
!definition, expr_global_p, !need_debug, NULL, gnat_entity); external_flag, expr_global_p, !need_debug, NULL, gnat_entity);
DECL_ARTIFICIAL (gnu_decl) = 1; DECL_ARTIFICIAL (gnu_decl) = 1;
if (use_variable)
/* Using this variable at debug time (if need_debug is true) requires a
proper location. The back-end will compute a location for this
variable only if the variable is used by the generated code.
Returning the variable ensures the caller will use it in generated
code. Note that there is no need for a location if the debug info
contains an integer constant.
FIXME: when the encoding-based debug scheme is dropped, move this
condition to the top-level IF block: we will not need to create a
variable anymore in such cases, then. */
if (use_variable || (need_debug && !TREE_CONSTANT (gnu_expr)))
return gnu_decl; return gnu_decl;
} }
......
...@@ -999,6 +999,12 @@ extern int fp_size_to_prec (int size); ...@@ -999,6 +999,12 @@ extern int fp_size_to_prec (int size);
initialization is likely to disturb debugging. */ initialization is likely to disturb debugging. */
extern bool renaming_from_generic_instantiation_p (Node_Id gnat_node); extern bool renaming_from_generic_instantiation_p (Node_Id gnat_node);
/* Try to process all nodes in the deferred context queue. Keep in the queue
the ones that cannot be processed yet, remove the other ones. If FORCE is
true, force the processing for all nodes, use the global context when nodes
don't have a GNU translation. */
extern void process_deferred_decl_context (bool force);
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
......
...@@ -1975,8 +1975,16 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1975,8 +1975,16 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE); gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
/* When not optimizing, look up the slot associated with the parameter /* When not optimizing, look up the slot associated with the parameter
and the dimension in the cache and create a new one on failure. */ and the dimension in the cache and create a new one on failure.
if (!optimize && Present (gnat_param)) Don't do this when the actual subtype needs debug info (this happens
with -gnatD): in elaborate_expression_1, we create variables that
hold the bounds, so caching attributes isn't very interesting and
causes dependency issues between these variables and cached
expressions. */
if (!optimize
&& Present (gnat_param)
&& !(Present (Actual_Subtype (gnat_param))
&& Needs_Debug_Info (Actual_Subtype (gnat_param))))
{ {
FOR_EACH_VEC_SAFE_ELT (f_parm_attr_cache, i, pa) FOR_EACH_VEC_SAFE_ELT (f_parm_attr_cache, i, pa)
if (pa->id == gnat_param && pa->dim == Dimension) if (pa->id == gnat_param && pa->dim == Dimension)
...@@ -4978,6 +4986,9 @@ Compilation_Unit_to_gnu (Node_Id gnat_node) ...@@ -4978,6 +4986,9 @@ Compilation_Unit_to_gnu (Node_Id gnat_node)
stabilization of the renamed entities may create SAVE_EXPRs which stabilization of the renamed entities may create SAVE_EXPRs which
have been tied to a specific elaboration routine just above. */ have been tied to a specific elaboration routine just above. */
invalidate_global_renaming_pointers (); invalidate_global_renaming_pointers ();
/* Force the processing for all nodes that remain in the queue. */
process_deferred_decl_context (true);
} }
/* Subroutine of gnat_to_gnu to translate gnat_node, an N_Raise_xxx_Error, /* Subroutine of gnat_to_gnu to translate gnat_node, an N_Raise_xxx_Error,
......
...@@ -2002,7 +2002,8 @@ build_simple_component_ref (tree record_variable, tree component, tree field, ...@@ -2002,7 +2002,8 @@ build_simple_component_ref (tree record_variable, tree component, tree field,
/* Look through a conversion between original and packable version, but /* Look through a conversion between original and packable version, but
the field needs to be adjusted in this case. */ the field needs to be adjusted in this case. */
else if (TYPE_NAME (inner_type) == TYPE_NAME (record_type)) else if (RECORD_OR_UNION_TYPE_P (inner_type)
&& TYPE_NAME (inner_type) == TYPE_NAME (record_type))
{ {
tree new_field; tree new_field;
......
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