Commit de870512 by Jakub Jelinek Committed by Jakub Jelinek

dwarf2out.c (descr_info_loc): Handle VAR_DECL.

	* dwarf2out.c (descr_info_loc): Handle VAR_DECL.

	* trans.h (struct lang_type): Add span.
	(GFC_TYPE_ARRAY_SPAN): Define.
	* trans-decl.c (gfc_get_symbol_decl): For subref array pointers,
	copy TREE_STATIC from decl to span instead of setting it
	unconditionally, set DECL_ARTIFICIAL, fix type of initializer
	and set GFC_TYPE_ARRAY_SPAN on decl's type.
	* trans-types.c (gfc_get_array_descr_info): If
	GFC_TYPE_ARRAY_SPAN is non-NULL, use it as element size.

From-SVN: r139782
parent bd11e37d
2008-08-29 Jakub Jelinek <jakub@redhat.com> 2008-08-29 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (descr_info_loc): Handle VAR_DECL.
* dwarf2out.c (gen_const_die): New function. * dwarf2out.c (gen_const_die): New function.
(size_of_die, value_format, output_die): Output larger (size_of_die, value_format, output_die): Output larger
dw_val_class_vec using DW_FORM_block2 or DW_FORM_block4. dw_val_class_vec using DW_FORM_block2 or DW_FORM_block4.
......
...@@ -12854,6 +12854,8 @@ descr_info_loc (tree val, tree base_decl) ...@@ -12854,6 +12854,8 @@ descr_info_loc (tree val, tree base_decl)
{ {
CASE_CONVERT: CASE_CONVERT:
return descr_info_loc (TREE_OPERAND (val, 0), base_decl); return descr_info_loc (TREE_OPERAND (val, 0), base_decl);
case VAR_DECL:
return loc_descriptor_from_tree_1 (val, 0);
case INTEGER_CST: case INTEGER_CST:
if (host_integerp (val, 0)) if (host_integerp (val, 0))
return int_loc_descriptor (tree_low_cst (val, 0)); return int_loc_descriptor (tree_low_cst (val, 0));
......
2008-08-29 Jakub Jelinek <jakub@redhat.com> 2008-08-29 Jakub Jelinek <jakub@redhat.com>
* trans.h (struct lang_type): Add span.
(GFC_TYPE_ARRAY_SPAN): Define.
* trans-decl.c (gfc_get_symbol_decl): For subref array pointers,
copy TREE_STATIC from decl to span instead of setting it
unconditionally, set DECL_ARTIFICIAL, fix type of initializer
and set GFC_TYPE_ARRAY_SPAN on decl's type.
* trans-types.c (gfc_get_array_descr_info): If
GFC_TYPE_ARRAY_SPAN is non-NULL, use it as element size.
* trans-decl.c (check_constant_initializer, * trans-decl.c (check_constant_initializer,
gfc_emit_parameter_debug_info): New functions. gfc_emit_parameter_debug_info): New functions.
(gfc_generate_module_vars, gfc_generate_function_code): Emit (gfc_generate_module_vars, gfc_generate_function_code): Emit
......
...@@ -1105,10 +1105,12 @@ gfc_get_symbol_decl (gfc_symbol * sym) ...@@ -1105,10 +1105,12 @@ gfc_get_symbol_decl (gfc_symbol * sym)
span = build_decl (VAR_DECL, create_tmp_var_name ("span"), span = build_decl (VAR_DECL, create_tmp_var_name ("span"),
gfc_array_index_type); gfc_array_index_type);
gfc_finish_var_decl (span, sym); gfc_finish_var_decl (span, sym);
TREE_STATIC (span) = 1; TREE_STATIC (span) = TREE_STATIC (decl);
DECL_INITIAL (span) = build_int_cst (NULL_TREE, 0); DECL_ARTIFICIAL (span) = 1;
DECL_INITIAL (span) = build_int_cst (gfc_array_index_type, 0);
GFC_DECL_SPAN (decl) = span; GFC_DECL_SPAN (decl) = span;
GFC_TYPE_ARRAY_SPAN (TREE_TYPE (decl)) = span;
} }
sym->backend_decl = decl; sym->backend_decl = decl;
......
...@@ -2289,7 +2289,10 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info) ...@@ -2289,7 +2289,10 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
else else
info->base_decl = base_decl = build_decl (VAR_DECL, NULL_TREE, ptype); info->base_decl = base_decl = build_decl (VAR_DECL, NULL_TREE, ptype);
elem_size = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (etype)); if (GFC_TYPE_ARRAY_SPAN (type))
elem_size = GFC_TYPE_ARRAY_SPAN (type);
else
elem_size = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (etype));
field = TYPE_FIELDS (TYPE_MAIN_VARIANT (type)); field = TYPE_FIELDS (TYPE_MAIN_VARIANT (type));
data_off = byte_position (field); data_off = byte_position (field);
field = TREE_CHAIN (field); field = TREE_CHAIN (field);
......
...@@ -615,6 +615,7 @@ struct lang_type GTY(()) ...@@ -615,6 +615,7 @@ struct lang_type GTY(())
tree offset; tree offset;
tree dtype; tree dtype;
tree dataptr_type; tree dataptr_type;
tree span;
}; };
struct lang_decl GTY(()) struct lang_decl GTY(())
...@@ -667,6 +668,7 @@ struct lang_decl GTY(()) ...@@ -667,6 +668,7 @@ struct lang_decl GTY(())
#define GFC_TYPE_ARRAY_DTYPE(node) (TYPE_LANG_SPECIFIC(node)->dtype) #define GFC_TYPE_ARRAY_DTYPE(node) (TYPE_LANG_SPECIFIC(node)->dtype)
#define GFC_TYPE_ARRAY_DATAPTR_TYPE(node) \ #define GFC_TYPE_ARRAY_DATAPTR_TYPE(node) \
(TYPE_LANG_SPECIFIC(node)->dataptr_type) (TYPE_LANG_SPECIFIC(node)->dataptr_type)
#define GFC_TYPE_ARRAY_SPAN(node) (TYPE_LANG_SPECIFIC(node)->span)
/* Build an expression with void type. */ /* Build an expression with void type. */
#define build1_v(code, arg) fold_build1(code, void_type_node, arg) #define build1_v(code, arg) fold_build1(code, void_type_node, arg)
......
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