tree.h (struct tree_base): Add nameless_flag bitfield.

* tree.h (struct tree_base): Add nameless_flag bitfield.
	(TYPE_NAMELESS, DECL_NAMELESS): Define.
	* omp-low.c (create_omp_child_function, scan_omp_parallel,
	scan_omp_task, lower_omp_taskreg): Set DECL_NAMELESS and/or
	DECL_ARTIFICIAL where needed.
	* dwarf2out.c (dwarf2_name): Return NULL if DECL_NAMELESS.
	(type_tag): Return NULL if TYPE_NAMELESS or if TYPE_DECL
	has DECL_NAMELESS set.

	* trans-types.c (gfc_get_array_descriptor_base,
	gfc_get_array_type_bounds): Set TYPE_NAMELESS.
	* trans-decl.c (gfc_build_qualified_array): Set DECL_NAMELESS
	instead of clearing DECL_NAME.
	(gfc_build_dummy_array_decl): Set DECL_NAMELESS.

From-SVN: r162476
This commit is contained in:
Jakub Jelinek 2010-07-23 19:04:35 +02:00 committed by Jakub Jelinek
parent 52e092abdd
commit cd3f04c80f
7 changed files with 52 additions and 8 deletions

View file

@ -1,3 +1,14 @@
2010-07-23 Jakub Jelinek <jakub@redhat.com>
* tree.h (struct tree_base): Add nameless_flag bitfield.
(TYPE_NAMELESS, DECL_NAMELESS): Define.
* omp-low.c (create_omp_child_function, scan_omp_parallel,
scan_omp_task, lower_omp_taskreg): Set DECL_NAMELESS and/or
DECL_ARTIFICIAL where needed.
* dwarf2out.c (dwarf2_name): Return NULL if DECL_NAMELESS.
(type_tag): Return NULL if TYPE_NAMELESS or if TYPE_DECL
has DECL_NAMELESS set.
2010-07-23 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/44915

View file

@ -11249,6 +11249,8 @@ output_comdat_type_unit (comdat_type_node *node)
static const char *
dwarf2_name (tree decl, int scope)
{
if (DECL_NAMELESS (decl))
return NULL;
return lang_hooks.dwarf_name (decl, scope ? 1 : 0);
}
@ -17717,7 +17719,8 @@ type_tag (const_tree type)
tree t = 0;
/* Find the IDENTIFIER_NODE for the type name. */
if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE
&& !TYPE_NAMELESS (type))
t = TYPE_NAME (type);
/* The g++ front end makes the TYPE_NAME of *each* tagged type point to
@ -17730,7 +17733,8 @@ type_tag (const_tree type)
DECL_NAME isn't set. The default hook for decl_printable_name
doesn't like that, and in this context it's correct to return
0, instead of "<anonymous>" or the like. */
if (DECL_NAME (TYPE_NAME (type)))
if (DECL_NAME (TYPE_NAME (type))
&& !DECL_NAMELESS (TYPE_NAME (type)))
name = lang_hooks.dwarf_name (TYPE_NAME (type), 2);
}

View file

@ -1,3 +1,11 @@
2010-07-23 Jakub Jelinek <jakub@redhat.com>
* trans-types.c (gfc_get_array_descriptor_base,
gfc_get_array_type_bounds): Set TYPE_NAMELESS.
* trans-decl.c (gfc_build_qualified_array): Set DECL_NAMELESS
instead of clearing DECL_NAME.
(gfc_build_dummy_array_decl): Set DECL_NAMELESS.
2009-07-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24524

View file

@ -759,16 +759,16 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
gtype = build_array_type (gtype, rtype);
/* Ensure the bound variables aren't optimized out at -O0.
For -O1 and above they often will be optimized out, but
can be tracked by VTA. Also clear the artificial
lbound.N or ubound.N DECL_NAME, so that it doesn't end up
in debug info. */
can be tracked by VTA. Also set DECL_NAMELESS, so that
the artificial lbound.N or ubound.N DECL_NAME doesn't
end up in debug info. */
if (lbound && TREE_CODE (lbound) == VAR_DECL
&& DECL_ARTIFICIAL (lbound) && DECL_IGNORED_P (lbound))
{
if (DECL_NAME (lbound)
&& strstr (IDENTIFIER_POINTER (DECL_NAME (lbound)),
"lbound") != 0)
DECL_NAME (lbound) = NULL_TREE;
DECL_NAMELESS (lbound) = 1;
DECL_IGNORED_P (lbound) = 0;
}
if (ubound && TREE_CODE (ubound) == VAR_DECL
@ -777,7 +777,7 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
if (DECL_NAME (ubound)
&& strstr (IDENTIFIER_POINTER (DECL_NAME (ubound)),
"ubound") != 0)
DECL_NAME (ubound) = NULL_TREE;
DECL_NAMELESS (ubound) = 1;
DECL_IGNORED_P (ubound) = 0;
}
}
@ -879,6 +879,7 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy)
VAR_DECL, get_identifier (name), type);
DECL_ARTIFICIAL (decl) = 1;
DECL_NAMELESS (decl) = 1;
TREE_PUBLIC (decl) = 0;
TREE_STATIC (decl) = 0;
DECL_EXTERNAL (decl) = 0;

View file

@ -1546,6 +1546,7 @@ gfc_get_array_descriptor_base (int dimen, int codimen, bool restricted)
sprintf (name, "array_descriptor" GFC_RANK_PRINTF_FORMAT, dimen + codimen);
TYPE_NAME (fat_type) = get_identifier (name);
TYPE_NAMELESS (fat_type) = 1;
/* Add the data member as the first element of the descriptor. */
decl = gfc_add_field_to_struct_1 (fat_type,
@ -1616,6 +1617,7 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
sprintf (name, "array" GFC_RANK_PRINTF_FORMAT "_%.*s", dimen + codimen,
GFC_MAX_SYMBOL_LEN, type_name);
TYPE_NAME (fat_type) = get_identifier (name);
TYPE_NAMELESS (fat_type) = 1;
GFC_DESCRIPTOR_TYPE_P (fat_type) = 1;
TYPE_LANG_SPECIFIC (fat_type)

View file

@ -1563,6 +1563,7 @@ create_omp_child_function (omp_context *ctx, bool task_copy)
TREE_STATIC (decl) = 1;
TREE_USED (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
DECL_NAMELESS (decl) = 1;
DECL_IGNORED_P (decl) = 0;
TREE_PUBLIC (decl) = 0;
DECL_UNINLINABLE (decl) = 1;
@ -1580,6 +1581,7 @@ create_omp_child_function (omp_context *ctx, bool task_copy)
t = build_decl (DECL_SOURCE_LOCATION (decl),
PARM_DECL, get_identifier (".omp_data_i"), ptr_type_node);
DECL_ARTIFICIAL (t) = 1;
DECL_NAMELESS (t) = 1;
DECL_ARG_TYPE (t) = ptr_type_node;
DECL_CONTEXT (t) = current_function_decl;
TREE_USED (t) = 1;
@ -1592,6 +1594,7 @@ create_omp_child_function (omp_context *ctx, bool task_copy)
PARM_DECL, get_identifier (".omp_data_o"),
ptr_type_node);
DECL_ARTIFICIAL (t) = 1;
DECL_NAMELESS (t) = 1;
DECL_ARG_TYPE (t) = ptr_type_node;
DECL_CONTEXT (t) = current_function_decl;
TREE_USED (t) = 1;
@ -1638,6 +1641,8 @@ scan_omp_parallel (gimple_stmt_iterator *gsi, omp_context *outer_ctx)
name = create_tmp_var_name (".omp_data_s");
name = build_decl (gimple_location (stmt),
TYPE_DECL, name, ctx->record_type);
DECL_ARTIFICIAL (name) = 1;
DECL_NAMELESS (name) = 1;
TYPE_NAME (ctx->record_type) = name;
create_omp_child_function (ctx, false);
gimple_omp_parallel_set_child_fn (stmt, ctx->cb.dst_fn);
@ -1681,6 +1686,8 @@ scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx)
name = create_tmp_var_name (".omp_data_s");
name = build_decl (gimple_location (stmt),
TYPE_DECL, name, ctx->record_type);
DECL_ARTIFICIAL (name) = 1;
DECL_NAMELESS (name) = 1;
TYPE_NAME (ctx->record_type) = name;
create_omp_child_function (ctx, false);
gimple_omp_task_set_child_fn (stmt, ctx->cb.dst_fn);
@ -1692,6 +1699,8 @@ scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx)
name = create_tmp_var_name (".omp_data_a");
name = build_decl (gimple_location (stmt),
TYPE_DECL, name, ctx->srecord_type);
DECL_ARTIFICIAL (name) = 1;
DECL_NAMELESS (name) = 1;
TYPE_NAME (ctx->srecord_type) = name;
create_omp_child_function (ctx, true);
}
@ -6487,6 +6496,7 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
ctx->sender_decl
= create_tmp_var (ctx->srecord_type ? ctx->srecord_type
: ctx->record_type, ".omp_data_o");
DECL_NAMELESS (ctx->sender_decl) = 1;
TREE_ADDRESSABLE (ctx->sender_decl) = 1;
gimple_omp_taskreg_set_data_arg (stmt, ctx->sender_decl);
}

View file

@ -387,8 +387,9 @@ struct GTY(()) tree_base {
unsigned visited : 1;
unsigned packed_flag : 1;
unsigned user_align : 1;
unsigned nameless_flag : 1;
unsigned spare : 13;
unsigned spare : 12;
/* This field is only used with type nodes; the only reason it is present
in tree_base instead of tree_type is to save space. The size of the
@ -2180,6 +2181,9 @@ extern enum machine_mode vector_type_mode (const_tree);
the term. */
#define TYPE_RESTRICT(NODE) (TYPE_CHECK (NODE)->type.restrict_flag)
/* If nonzero, type's name shouldn't be emitted into debug info. */
#define TYPE_NAMELESS(NODE) (TYPE_CHECK (NODE)->base.nameless_flag)
/* The address space the type is in. */
#define TYPE_ADDR_SPACE(NODE) (TYPE_CHECK (NODE)->base.address_space)
@ -2529,6 +2533,10 @@ struct function;
#define DECL_CONTEXT(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.context)
#define DECL_FIELD_CONTEXT(NODE) \
(FIELD_DECL_CHECK (NODE)->decl_minimal.context)
/* If nonzero, decl's name shouldn't be emitted into debug info. */
#define DECL_NAMELESS(NODE) (DECL_MINIMAL_CHECK (NODE)->base.nameless_flag)
struct GTY(()) tree_decl_minimal {
struct tree_common common;
location_t locus;