diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2010-07-23 19:37:40 +0000 |
---|---|---|
committer | H.J. Lu <hongjiu.lu@intel.com> | 2010-07-23 19:37:40 +0000 |
commit | e59b0ef2e7a1fb44791d473ee416aeb01fcb169c (patch) | |
tree | 437dca120093cc7b1f6debf6f6b31779526c7192 /gcc/lto-streamer-in.c | |
parent | f25b023a0d9de6a6c1e1965d93ba6028cb03fc7d (diff) | |
parent | 92ac755201aad4366eaff2b75b3239637bee3590 (diff) |
Merged with trunk at revision 162480.ifunc
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ifunc@162483 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r-- | gcc/lto-streamer-in.c | 163 |
1 files changed, 15 insertions, 148 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 635cff4d3f5..3451b84c076 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -872,124 +872,6 @@ input_ssa_names (struct lto_input_block *ib, struct data_in *data_in, } } - -/* Fixup the reference tree OP for replaced VAR_DECLs with mismatched - types. */ - -static void -maybe_fixup_handled_component (tree op) -{ - tree decl_type; - tree wanted_type; - - while (handled_component_p (TREE_OPERAND (op, 0))) - op = TREE_OPERAND (op, 0); - if (TREE_CODE (TREE_OPERAND (op, 0)) != VAR_DECL) - return; - - decl_type = TREE_TYPE (TREE_OPERAND (op, 0)); - - switch (TREE_CODE (op)) - { - case COMPONENT_REF: - /* The DECL_CONTEXT of the field-decl is the record type we look for. */ - wanted_type = DECL_CONTEXT (TREE_OPERAND (op, 1)); - break; - - case ARRAY_REF: - if (TREE_CODE (decl_type) == ARRAY_TYPE - && (TREE_TYPE (decl_type) == TREE_TYPE (op) - || useless_type_conversion_p (TREE_TYPE (op), - TREE_TYPE (decl_type)))) - return; - /* An unknown size array type should be ok. But we do not - lower the lower bound in all cases - ugh. */ - wanted_type = build_array_type (TREE_TYPE (op), NULL_TREE); - break; - - case ARRAY_RANGE_REF: - if (TREE_CODE (decl_type) == ARRAY_TYPE - && (TREE_TYPE (decl_type) == TREE_TYPE (TREE_TYPE (op)) - || useless_type_conversion_p (TREE_TYPE (TREE_TYPE (op)), - TREE_TYPE (decl_type)))) - return; - /* An unknown size array type should be ok. But we do not - lower the lower bound in all cases - ugh. */ - wanted_type = build_array_type (TREE_TYPE (TREE_TYPE (op)), NULL_TREE); - break; - - case BIT_FIELD_REF: - case VIEW_CONVERT_EXPR: - /* Very nice - nothing to do. */ - return; - - case REALPART_EXPR: - case IMAGPART_EXPR: - if (TREE_CODE (decl_type) == COMPLEX_TYPE - && (TREE_TYPE (decl_type) == TREE_TYPE (op) - || useless_type_conversion_p (TREE_TYPE (op), - TREE_TYPE (decl_type)))) - return; - wanted_type = build_complex_type (TREE_TYPE (op)); - break; - - default: - gcc_unreachable (); - } - - if (!useless_type_conversion_p (wanted_type, decl_type)) - TREE_OPERAND (op, 0) = build1 (VIEW_CONVERT_EXPR, wanted_type, - TREE_OPERAND (op, 0)); -} - -/* Fixup reference tree operands for substituted prevailing decls - with mismatched types in STMT. This handles plain DECLs where - we need the stmt for context to lookup the required type. */ - -static void -maybe_fixup_decls (gimple stmt) -{ - /* We have to fixup replaced decls here in case there were - inter-TU type mismatches. Catch the most common cases - for now - this way we'll get testcases for the rest as - the type verifier will complain. */ - if (gimple_assign_single_p (stmt)) - { - tree lhs = gimple_assign_lhs (stmt); - tree rhs = gimple_assign_rhs1 (stmt); - - /* First catch loads and aggregate copies by adjusting the rhs. */ - if (TREE_CODE (rhs) == VAR_DECL) - { - if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs))) - gimple_assign_set_rhs1 (stmt, build1 (VIEW_CONVERT_EXPR, - TREE_TYPE (lhs), rhs)); - } - /* Then catch scalar stores. */ - else if (TREE_CODE (lhs) == VAR_DECL) - { - if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs))) - gimple_assign_set_lhs (stmt, build1 (VIEW_CONVERT_EXPR, - TREE_TYPE (rhs), lhs)); - } - } - else if (is_gimple_call (stmt)) - { - tree lhs = gimple_call_lhs (stmt); - - if (lhs && TREE_CODE (lhs) == VAR_DECL) - { - if (!useless_type_conversion_p (TREE_TYPE (lhs), - gimple_call_return_type (stmt))) - gimple_call_set_lhs (stmt, build1 (VIEW_CONVERT_EXPR, - gimple_call_return_type (stmt), - lhs)); - } - - /* Arguments, especially for varargs functions will be funny... */ - } -} - /* Read a statement with tag TAG in function FN from block IB using descriptors in DATA_IN. */ @@ -1064,21 +946,6 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in, if (!op) continue; - /* Fixup reference tree operands for substituted prevailing decls - with mismatched types. For plain VAR_DECLs we need to look - at context to determine the wanted type - we do that below - after the stmt is completed. */ - if (TREE_CODE (op) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (op, 0)) == VAR_DECL - && !useless_type_conversion_p (TREE_TYPE (TREE_TYPE (op)), - TREE_TYPE (TREE_OPERAND (op, 0)))) - { - TREE_OPERAND (op, 0) - = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (TREE_TYPE (op)), - TREE_OPERAND (op, 0)); - continue; - } - /* Fixup FIELD_DECLs in COMPONENT_REFs, they are not handled by decl merging. */ if (TREE_CODE (op) == ADDR_EXPR) @@ -1093,7 +960,9 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in, for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem)) { if (tem == field - || (TREE_TYPE (tem) == TREE_TYPE (field) + || (gimple_types_compatible_p (TREE_TYPE (tem), + TREE_TYPE (field), + GTC_DIAG) && DECL_NONADDRESSABLE_P (tem) == DECL_NONADDRESSABLE_P (field) && gimple_compare_field_offset (tem, field))) @@ -1110,17 +979,8 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in, TREE_OPERAND (op, 1) = tem; } - /* Preserve the last handled component for the fixup of - its operand below. */ - if (!handled_component_p (TREE_OPERAND (op, 0))) - break; op = TREE_OPERAND (op, 0); } - - /* Fixup reference tree operands for substituted prevailing decls - with mismatched types. */ - if (handled_component_p (op)) - maybe_fixup_handled_component (op); } break; @@ -1160,10 +1020,6 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in, if (code == GIMPLE_CALL) gimple_call_reset_alias_info (stmt); - /* Fixup reference tree operands for substituted prevailing decls - with mismatched types. */ - maybe_fixup_decls (stmt); - /* Mark the statement modified so its operand vectors can be filled in. */ gimple_set_modified (stmt, true); @@ -1286,6 +1142,7 @@ input_function (tree fn_decl, struct data_in *data_in, struct bitpack_d bp; struct cgraph_node *node; tree args, narg, oarg; + int len; fn = DECL_STRUCT_FUNCTION (fn_decl); tag = input_record_start (ib); @@ -1320,7 +1177,17 @@ input_function (tree fn_decl, struct data_in *data_in, fn->nonlocal_goto_save_area = lto_input_tree (ib, data_in); /* Read all the local symbols. */ - fn->local_decls = lto_input_tree (ib, data_in); + len = lto_input_sleb128 (ib); + if (len > 0) + { + int i; + VEC_safe_grow (tree, gc, fn->local_decls, len); + for (i = 0; i < len; i++) + { + tree t = lto_input_tree (ib, data_in); + VEC_replace (tree, fn->local_decls, i, t); + } + } /* Read all function arguments. We need to re-map them here to the arguments of the merged function declaration. */ |