aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-nested.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-06-22 03:07:05 +0000
committerRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-06-22 03:07:05 +0000
commit75e119bef1e494385e59a2268a4f9922eda7a0f4 (patch)
tree0f08ba8e2fff4040497202121f17db146e774840 /gcc/tree-nested.c
parent69a36665aedb71e884f2c0a4f28ac64fcd7b876f (diff)
* alias.c (adjust_offset_for_component_ref): Use
component_ref_field_offset. * c-decl.c (build_array_declarator): Add news args for ARRAY_REF. * c-gimplify.c (gimplify_expr_stmt): Use alloc_stmt_list. (gimplify_decl_stmt): Call gimplify_type_sizes for type. For decl, call gimplify_one_sizepos and use statement list. (gimplify_compound_literal_expr): New arg PRE_P. Add statement to PRE_P list and return DECL. (c_gimplify_expr, case COMPOUND_LITERAL_EXPR): Add arg to gimplify_compound_literal_expr. * c-tree.h (getdecls): Deleted. * c-typeck.c (build_component_ref): Add operand for COMPONENT_REF. (build_array_ref): Add two operands for ARRAY_REF. (build_unary_op): Set TREE_INVARIANT and TREE_CONSTANT for COMPOUND_LITERAL_EXPR. * coverage.c (tree_coverage_counter_ref): Add new operands for ARRAY_REF. * emit-rtl.c (component_ref_for_mem_expr): Add new operand for COMPONENT_REF. (set_mem_attributes_minus_bitpos): Use array_ref_low_bound and array_ref_element_size. (widen_memory_access):Use component_ref_field_offset. * explow.c (update_nonlocal_goto_save_area): Add two operands for ARRAY_REF. * expr.c (array_ref_element_size, array_ref_low_bound): New functions. (component_ref_field_offset): Likewise. (get_inner_reference): Use them. (expand_expr_real_1, case ARRAY_REF): Use array_ref_low_bound. * fold-const.c (fold, case EQ_EXPR): Properly handle DECL_SIZE. (fold_read_from_constant_string): Use array_ref_low_bound. Verify that result is a character type. (build_fold_indirect_ref): Add two operands for ARRAY_REF. * function.c (expand_function_start): Likewise. * gimple-low.c (expand_var_p): Delete duplicated line. * gimplify.c: Add static decls for local functions. (cgraph.h): Now included. (create_tmp_var): Remove check for ARRAY_TYPE. (copy_if_shared_r): Look at bounds and sizes of types. (build_and_jump): Return alloc_stmt_list instead of build_empty_stmt. (gimplify_exit_expr, shortcut_cond_expr): Likewise. (gimplify_save_expr, gimple_push_cleanup): Likewise. (gimplify_init_constructor): Likewise. WANT_VALUE now bool. If empty list with no result wanted, return GS_UNHANDLED. Add additional operands for ARRAY_REF and COMPONENT_REF. (canonicalize_component_ref): Convert to &array[L]. (gimplify_array_ref_to_plus): Use array_ref_element_size and array_ref_lower_bound. (build_addr_expr_with_type, build_addr_expr): New functions. (gimplify_compound_lval): WANT_LVALUE now bool. Major rework to allow handle_component_p and initialize and gimplify new operands for ARRAY_REF, ARRAY_RANGE_REF, and COMPONENT_REF. (gimplify_array_ref): Deleted. (gimplify_self_mod_expr): WANT_VALUE now bool. (gimplify_modify_expr): Gimplify to_p and from_p later. Factor out code into gimplify_modify_expr_rhs and call twice. Move variable-size code earlier and handle PLACEHOLDER_EXPR. (gimplify_modify_expr_rhs, gimplify_variable_sized_compare): New fns. (gimplify_addr_expr, case VIEW_CONVERT_EXPR): New case. (gimplify_expr, case ARRAY_REF): Delete special case. Instead handle like COMPONENT_REF; also do ARRAY_RANGE_REF, IMAGPART, and REALPART the same way. (gimplify_expr, case VIEW_CONVERT_EXPR): New case. (gimplify_expr): Call gimplify_variable_sized_compare if applicable. Call alloc_stmt_list instead of build_empty_stmt. Deal with _REF that's volatile. (gimplify_type_sizes, gimplify_one_sizepos): New functions. (unshare_body, unvisit_body): New functions. (gimplify_body): Call them. * stmt.c (expand_stack_alloc): Don't expand TYPE_MAX_VALUE. * stor-layout.c (get_pending_sizes): Don't change SAVE_EXPR_CONTEXT. * tree-alias-common.c (get_alias_var): Also skip ARRAY_RANGE_REF. * tree-cfg.c (tree_node_can_be_shared): Treat ARRAY_RANGE_REF like ARRAY_REF. (verify_expr, case ADDR_EXPR): Use handled_component_p. * tree-dfa.c (get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump, case COMPONENT_REF, ARRAY_REF): New cases to dump new operands; likewise for ARRAY_RANGE_REF. * tree-eh.c (tree_could_trap, case ARRAY_RANGE_REF): Like ARRAY_REF. * tree-gimple.c (is_gimple_addr_expr_arg): Add ARRAY_RANGE_REF and INDIRECT_REF. (get_base_address): Use handled_component_p. * tree-gimple.h (gimplify_type_sizes, gimplify_one_sizepos): New. * tree-line.c (walk_tree): Walk more things for types and decls. * tree-mudflap.c (mf_build_check_statement_for): Add new operands for ARRAY_REF and COMPONENT_REF. (mx_xform_derefs_1): Clean up usage of decl sizes. * tree-nested.c (build_addr): Use handled_component_p. (walk_stmts, case CATCH_EXPR): Add missing "break". (get_static_chain, get_frame_field): Add new operand for COMPONENT_REF. (finalize_nesting_tree_1): Likewise. (convert_nonlocal_reference, case ARRAY_RANGE_REF): Like ARRAY_REF and process additional operands. (convert_local_reference): Likewise. * tree-outof-ssa.c (discover_nonconstant_array_refs_r): Treat ARRAY_RANGE_REF similarly to ARRAY_REF. * tree-pretty-print.c (dump_generic_node, case QUAL_UNION_TYPE): Handle like RECORD_TYPE. (dump_generic_node, case COMPONENT_REF): Print offset operand. (dump_generic_node, case ARRAY_RANGE_REF): Treat like ARRAY_REF and print lower bound and element size for both. (op_prio, case ARRAY_RANGE_REF): Like ARRAY_REF. * tree-sra.c (csc_build_component_ref): Add new operand. (scalarize_call_expr): Use get_base_address. * tree-ssa-ccp.c (widen_bitfield): Clean up size handling. (maybe_fold_offset_to_array_ref): Rework to handle input having an ARRAY_REF, refine handling of lower bound, and add new operands for ARRAY_REF. (maybe_fold_to_component_ref): Add new operand for COMPONENT_REF. (maybe_fold_stmt_indirect): Only fold *&B to B if types match. (maybe_fold_stmt_addition): Only handle constant lower bound. * tree-ssa-operands.c (get_expr_operands): Minor rearrangements. Treat ARRAY_REF and ARRAY_RANGE_REF the same; look at extra operands. Look at new offset operand of COMPONENT_REF. * tree-ssa.c (set_is_used): Use handled_component_p. * tree.c (substitute_in_expr, case COMPONENT_REF): Add new operand. (stabilize_reference, case COMPONENT_REF): Likewise. (stabilize_reference, case ARRAY_RANGE_REF, ARRAY_REF): Similarly. (recompute_tree_invariant_for_addr_expr): Completely rework to be more precise. Also set TREE_SIDE_EFFECTS. (build1_stat, case ARRAY_EXPR): Don't handle TREE_SIDE_EFFECTS here. (build2_stat, build3_stat, build4_stat): For references, propagate TREE_THIS_VOLATILE. (get_unwidened): Add new operand for COMPONENT_REF. (get_narrower): Likewise; use host_integerp for DECL_SIZE. * tree.def (COMPONENT_REF): Add new operand. (ARRAY_REF, ARRAY_RANGE_REF): Add two new operands. * tree.h (array_ref_element_size, array_ref_low_bound): New decls. (component_ref_field_offset): Likewise. * config/alpha/alpha.c (alpha_va_start): Add new op for COMPONENT_REF. (alpha_gimplify_va_arg): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/i860/i860.c (i860_va_start, i860_va_arg): Likewise. * config/iq2000/iq2000.c (iq2000_va_arg): Likewise. * config/mips/mips.c (mips_va_start, mips_va_arg): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg): Likewise. * config/s390/s390.c (s390_va_start, s390_gimplify_va_arg): Likewise. * config/sh/sh.c (sh_va_start, sh_va_arg): Likewise. * config/stormy16/stormy16.c (xstormy1_expand_builin_va_start): Likewise. (xstormy16_expand_builtin_va_arg): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_va_arg): Likewise. * cp/call.c (build_vfield_ref): Add new operand for COMPONENT_REF. (build_new_method_call): Likewise. * cp/decl.c (local_variable_p_walkfn): Don't walk into types. * cp/decl2.c (grok_array_decl): Add new operands for ARRAY_REF. (build_anon_union_vars): Add new operand for COMPONENT_REF. * cp/init.c (buld_new): Add new operand for ARRAY_REF. * cp/method.c (do_build_copy_constructor): New op for COMPONENT_REF. (do_build_assign_ref): Likewise. * cp/parser.c (cp_parser_direct_new_declarator): Add new operands for ARRAY_REF. (cp_parser_direct_declarator): Likewise. * cp/pt.c (tsubst): Likewise. (tsubst_copy, tsubst_copy_and_build): Likewise; also add new operand for COMPONENT_REF. * cp/semantics.c (finish_non_static_data_member): Add new operand for COMPONENT_REF. * cp/typeck.c (build_class_member_access_expr): Likewise. (build_class_member_access_expr, finish_class_member_access_expr): Likewise. (build_ptrmemfunc_access_expr): Likewise. (build_array_ref): Add new operands for ARRAY_REF. * cp/typeck2.c (split_nonconstant_init_1): Likewise; COMPONENT_REF too. * cp/tree.c (count_trees_r, no_linkage_helper): Don't walk in types. * fortran/f95-lang.c (LANG_HOOKS_GIMPLE_BEFORE_INLINING): Deleted. * fortran/trans-array.c (gfc_conv_descriptor_data): Add operand for COMPONENT_REF. (gfc_conv_descriptor_offset, gfc_conv_descriptor_dtype): Likewise. (gfc_conv_descriptor_dimension, gfc_conv_descriptor_stride): Likewise. (gfc_conv_descriptor_lbound, gfc_conv_descriptor_ubound): Likewise. * fortran/trans-common.c (create_common): Likewise. * fortran/trans-expr.c (gfc_conv_component_ref): Likewise. * fortran/trans-io.c (set_parameter_value): Likewise. (set_parameter_ref, set_string, set_flag, io_result): Likewise. (transfer_expr): Likewise. * fortran/trans-decl.c (gfc_trans_auto_character_variable): Set up to get DECL_SIZE and DECL_SIZE_UNIT gimplified. (gfc_simplify_function): New function. (gfc_generate_function-code): Properly handle nested functions. * fortran/trans.c (gfc_build_array_ref): Add two new operands for ARRAY_REF. * java/class.c (build_class_ref): Add new operand for COMPONENT_REF. (build_static_field_ref): Likewise and add new operands for ARRAY_REF. * java/constants.c (build_ref_from_constant_pool): Likewise. * java/expr.c (build_java_array_length_access): Likewise. (build_get_class, build_field_ref, build_known_method_ref): Likewise. (invoke_build_dtable, build_invokevirtual): Likewise. (build_invokeinterface, java_expand_expr): Likewise. (emit_init_test_initialization): Likewise. * java/java-gimplify.c (java_gimplify_new_array_init): Likewise. * java/parse.y (make_qualifed_name, build_array_ref): Likewise. * objc/ojbc-act.c (generate_static_references): Add additional operands to ARRAY_REF. (generate_strings, build_method_prototype_list_template): Likewise. (generate_protocol_list): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@83474 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r--gcc/tree-nested.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 24d3e74b746..1f32e1f60f9 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -157,8 +157,13 @@ static tree
build_addr (tree exp)
{
tree base = exp;
- while (TREE_CODE (base) == COMPONENT_REF || TREE_CODE (base) == ARRAY_REF)
+
+ if (TREE_CODE (base) == REALPART_EXPR || TREE_CODE (base) == IMAGPART_EXPR)
base = TREE_OPERAND (base, 0);
+ else
+ while (handled_component_p (base))
+ base = TREE_OPERAND (base, 0);
+
if (DECL_P (base))
TREE_ADDRESSABLE (base) = 1;
@@ -550,6 +555,7 @@ walk_stmts (struct walk_stmt_info *wi, tree *tp)
break;
case CATCH_EXPR:
walk_stmts (wi, &CATCH_BODY (t));
+ break;
case EH_FILTER_EXPR:
walk_stmts (wi, &EH_FILTER_FAILURE (t));
break;
@@ -657,7 +663,7 @@ get_static_chain (struct nesting_info *info, tree target_context,
tree field = get_chain_field (i);
x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
- x = build (COMPONENT_REF, TREE_TYPE (field), x, field);
+ x = build (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
x = init_tmp_var (info, x, tsi);
}
}
@@ -691,14 +697,14 @@ get_frame_field (struct nesting_info *info, tree target_context,
tree field = get_chain_field (i);
x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
- x = build (COMPONENT_REF, TREE_TYPE (field), x, field);
+ x = build (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
x = init_tmp_var (info, x, tsi);
}
x = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (x)), x);
}
- x = build (COMPONENT_REF, TREE_TYPE (field), x, field);
+ x = build (COMPONENT_REF, TREE_TYPE (field), x, field, NULL_TREE);
return x;
}
@@ -800,10 +806,13 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
break;
case ARRAY_REF:
+ case ARRAY_RANGE_REF:
wi->val_only = false;
walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL);
wi->val_only = true;
walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference, wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 3), convert_nonlocal_reference, wi, NULL);
break;
case BIT_FIELD_REF:
@@ -932,10 +941,13 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
break;
case ARRAY_REF:
+ case ARRAY_RANGE_REF:
wi->val_only = false;
walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
wi->val_only = true;
walk_tree (&TREE_OPERAND (t, 1), convert_local_reference, wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi, NULL);
+ walk_tree (&TREE_OPERAND (t, 3), convert_local_reference, wi, NULL);
break;
case BIT_FIELD_REF:
@@ -1242,7 +1254,7 @@ finalize_nesting_tree_1 (struct nesting_info *root)
x = p;
y = build (COMPONENT_REF, TREE_TYPE (field),
- root->frame_decl, field);
+ root->frame_decl, field, NULL_TREE);
x = build (MODIFY_EXPR, TREE_TYPE (field), y, x);
append_to_statement_list (x, &stmt_list);
}
@@ -1252,9 +1264,8 @@ finalize_nesting_tree_1 (struct nesting_info *root)
from chain_decl. */
if (root->chain_field)
{
- tree x;
- x = build (COMPONENT_REF, TREE_TYPE (root->chain_field),
- root->frame_decl, root->chain_field);
+ tree x = build (COMPONENT_REF, TREE_TYPE (root->chain_field),
+ root->frame_decl, root->chain_field, NULL_TREE);
x = build (MODIFY_EXPR, TREE_TYPE (x), x, get_chain_decl (root));
append_to_statement_list (x, &stmt_list);
}
@@ -1281,7 +1292,7 @@ finalize_nesting_tree_1 (struct nesting_info *root)
arg = tree_cons (NULL, x, arg);
x = build (COMPONENT_REF, TREE_TYPE (field),
- root->frame_decl, field);
+ root->frame_decl, field, NULL_TREE);
x = build_addr (x);
arg = tree_cons (NULL, x, arg);