Commit 5cea3ad6 by Jakub Jelinek Committed by Jakub Jelinek

dwarf2out.h (struct dw_loc_descr_node): Adjust comment for frame_offset_rel bit.

	* dwarf2out.h (struct dw_loc_descr_node): Adjust comment
	for frame_offset_rel bit.
	(struct array_descr_info): Add rank field.
	* dwarf2out.c (struct loc_descr_context): Add placeholder_arg
	and placeholder_seen fields.
	(resolve_args_picking_1): Handle also frame_offset_rel DW_OP_dup
	and DW_OP_over.  Optimize DW_OP_pick 0 into DW_OP_dup and
	DW_OP_pick 1 into DW_OP_over.
	(function_to_dwarf_procedure, type_byte_size, field_byte_offset,
	gen_variant_part): Clear placeholder_{arg,seen}.
	(loc_list_from_tree_1): Drop const from context argument.
	Handle integral PLACEHOLDER_EXPR if context->placeholder_arg.
	(loc_list_for_address_of_addr_expr_of_indirect_ref,
	loc_list_from_tree, loc_descriptor_from_tree): Drop const from
	context argument.
	(add_scalar_info): Drop const from context argument.  Handle
	context->placeholder_arg.
	(add_bound_info): Drop const from context argument.
	(gen_descr_array_type_die): Drop const from ctx variable.
	Initialize placeholder_arg and placeholder_seen.  Add DW_AT_rank
	attribute and use a single DW_TAG_generic_subrange instead of
	7 DW_TAG_subrange_type for assumed rank arrays.
fortran/
	* trans-types.c (gfc_get_array_descr_info): For -gdwarf-5 or
	-gno-strict-dwarf, handle assumed rank arrays the way dwarf2out
	expects.
ada/
	* gcc-interface/misc.c (gnat_get_array_descr_info): Clear rank
	field.

From-SVN: r241719
parent 2a3d56bf
2016-10-31 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.h (struct dw_loc_descr_node): Adjust comment
for frame_offset_rel bit.
(struct array_descr_info): Add rank field.
* dwarf2out.c (struct loc_descr_context): Add placeholder_arg
and placeholder_seen fields.
(resolve_args_picking_1): Handle also frame_offset_rel DW_OP_dup
and DW_OP_over. Optimize DW_OP_pick 0 into DW_OP_dup and
DW_OP_pick 1 into DW_OP_over.
(function_to_dwarf_procedure, type_byte_size, field_byte_offset,
gen_variant_part): Clear placeholder_{arg,seen}.
(loc_list_from_tree_1): Drop const from context argument.
Handle integral PLACEHOLDER_EXPR if context->placeholder_arg.
(loc_list_for_address_of_addr_expr_of_indirect_ref,
loc_list_from_tree, loc_descriptor_from_tree): Drop const from
context argument.
(add_scalar_info): Drop const from context argument. Handle
context->placeholder_arg.
(add_bound_info): Drop const from context argument.
(gen_descr_array_type_die): Drop const from ctx variable.
Initialize placeholder_arg and placeholder_seen. Add DW_AT_rank
attribute and use a single DW_TAG_generic_subrange instead of
7 DW_TAG_subrange_type for assumed rank arrays.
* dwarf2out.h (enum dw_val_class): Add dw_val_class_loclistsptr.
* dwarf2out.c (struct dw_loc_list_struct): Change emitted field
from bool to 1-bit uchar bitfield. Add num_assigned and
2016-10-31 Jakub Jelinek <jakub@redhat.com>
* gcc-interface/misc.c (gnat_get_array_descr_info): Clear rank
field.
2016-10-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc-interface/Make-lang.in (lang_checks_parallelized): New target.
......
......@@ -898,6 +898,7 @@ gnat_get_array_descr_info (const_tree const_type,
}
info->ndimensions = i;
info->rank = NULL_TREE;
/* Too many dimensions? Give up generating proper description: yield instead
nested arrays. Note that in this case, this hook is invoked once on each
......
......@@ -241,9 +241,9 @@ struct GTY((chain_next ("%h.dw_loc_next"))) dw_loc_descr_node {
/* Used to distinguish DW_OP_addr with a direct symbol relocation
from DW_OP_addr with a dtp-relative symbol relocation. */
unsigned int dtprel : 1;
/* For DW_OP_pick operations: true iff. it targets a DWARF prodecure
argument. In this case, it needs to be relocated according to the current
frame offset. */
/* For DW_OP_pick, DW_OP_dup and DW_OP_over operations: true iff.
it targets a DWARF prodecure argument. In this case, it needs to be
relocated according to the current frame offset. */
unsigned int frame_offset_rel : 1;
int dw_loc_addr;
dw_val_node dw_loc_oprnd1;
......@@ -329,6 +329,7 @@ struct array_descr_info
tree allocated;
tree associated;
tree stride;
tree rank;
bool stride_in_bits;
struct array_descr_dimen
{
......
2016-10-31 Jakub Jelinek <jakub@redhat.com>
* trans-types.c (gfc_get_array_descr_info): For -gdwarf-5 or
-gno-strict-dwarf, handle assumed rank arrays the way dwarf2out
expects.
2016-10-30 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/67219
......
......@@ -3139,7 +3139,7 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
int rank, dim;
bool indirect = false;
tree etype, ptype, field, t, base_decl;
tree data_off, dim_off, dim_size, elem_size;
tree data_off, dim_off, dtype_off, dim_size, elem_size;
tree lower_suboff, upper_suboff, stride_suboff;
if (! GFC_DESCRIPTOR_TYPE_P (type))
......@@ -3203,6 +3203,7 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
data_off = byte_position (field);
field = DECL_CHAIN (field);
field = DECL_CHAIN (field);
dtype_off = byte_position (field);
field = DECL_CHAIN (field);
dim_off = byte_position (field);
dim_size = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (field)));
......@@ -3225,6 +3226,24 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
|| GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_POINTER_CONT)
info->associated = build2 (NE_EXPR, boolean_type_node,
info->data_location, null_pointer_node);
if ((GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_RANK
|| GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_RANK_CONT)
&& dwarf_version >= 5)
{
rank = 1;
info->ndimensions = 1;
t = base_decl;
if (!integer_zerop (dtype_off))
t = fold_build_pointer_plus (t, dtype_off);
t = build1 (NOP_EXPR, build_pointer_type (gfc_array_index_type), t);
t = build1 (INDIRECT_REF, gfc_array_index_type, t);
info->rank = build2 (BIT_AND_EXPR, gfc_array_index_type, t,
build_int_cst (gfc_array_index_type,
GFC_DTYPE_RANK_MASK));
t = build0 (PLACEHOLDER_EXPR, TREE_TYPE (dim_off));
t = size_binop (MULT_EXPR, t, dim_size);
dim_off = build2 (PLUS_EXPR, TREE_TYPE (dim_off), t, dim_off);
}
for (dim = 0; dim < rank; dim++)
{
......@@ -3260,7 +3279,8 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
t = build1 (INDIRECT_REF, gfc_array_index_type, t);
t = build2 (MULT_EXPR, gfc_array_index_type, t, elem_size);
info->dimen[dim].stride = t;
dim_off = size_binop (PLUS_EXPR, dim_off, dim_size);
if (dim + 1 < rank)
dim_off = size_binop (PLUS_EXPR, dim_off, dim_size);
}
return true;
......
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