X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Fgimple.c;h=79596a4ec9c10d51c29674bce5021ba73b975cb9;hp=81c119048f2346a6b4cfd3553040587cbfe5b3c1;hb=0ac23bc8a78146c50d65692bc654ff40831fe18c;hpb=f19604951bb23dfdf8939bf20be6e23c98f6721f diff --git a/gcc/gimple.c b/gcc/gimple.c index 81c119048f2..79596a4ec9c 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -1481,7 +1481,7 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op, tree lhs = gimple_assign_lhs (stmt); wi->val_only = (is_gimple_reg_type (TREE_TYPE (lhs)) && !is_gimple_reg (lhs)) - || !gimple_assign_single_p (stmt); + || gimple_assign_rhs_class (stmt) != GIMPLE_SINGLE_RHS; } for (i = 1; i < gimple_num_ops (stmt); i++) @@ -1497,11 +1497,14 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op, if (wi) { /* If the RHS has more than 1 operand, it is not appropriate - for the memory. */ - wi->val_only = !(is_gimple_mem_rhs (gimple_assign_rhs1 (stmt)) - || TREE_CODE (gimple_assign_rhs1 (stmt)) - == CONSTRUCTOR) - || !gimple_assign_single_p (stmt); + for the memory. + ??? A lhs always requires an lvalue, checking the val_only flag + does not make any sense, so we should be able to avoid computing + it here. */ + tree rhs1 = gimple_assign_rhs1 (stmt); + wi->val_only = !(is_gimple_mem_rhs (rhs1) + || TREE_CODE (rhs1) == CONSTRUCTOR) + || gimple_assign_rhs_class (stmt) != GIMPLE_SINGLE_RHS; wi->is_lhs = true; } @@ -2908,14 +2911,6 @@ is_gimple_id (tree t) || TREE_CODE (t) == STRING_CST); } -/* Return true if TYPE is a suitable type for a scalar register variable. */ - -bool -is_gimple_reg_type (tree type) -{ - return !AGGREGATE_TYPE_P (type); -} - /* Return true if T is a non-aggregate register variable. */ bool @@ -2963,17 +2958,6 @@ is_gimple_reg (tree t) } -/* Return true if T is a GIMPLE variable whose address is not needed. */ - -bool -is_gimple_non_addressable (tree t) -{ - if (TREE_CODE (t) == SSA_NAME) - t = SSA_NAME_VAR (t); - - return (is_gimple_variable (t) && ! needs_to_live_in_memory (t)); -} - /* Return true if T is a GIMPLE rvalue, i.e. an identifier or a constant. */ bool @@ -3318,11 +3302,21 @@ compare_type_names_p (tree t1, tree t2) tree name1 = TYPE_NAME (t1); tree name2 = TYPE_NAME (t2); - if (name1 && TREE_CODE (name1) == TYPE_DECL) + if ((name1 != NULL_TREE) != (name2 != NULL_TREE)) + return false; + + if (name1 == NULL_TREE) + return true; + + /* Either both should be a TYPE_DECL or both an IDENTIFIER_NODE. */ + if (TREE_CODE (name1) != TREE_CODE (name2)) + return false; + + if (TREE_CODE (name1) == TYPE_DECL) name1 = DECL_NAME (name1); gcc_checking_assert (!name1 || TREE_CODE (name1) == IDENTIFIER_NODE); - if (name2 && TREE_CODE (name2) == TYPE_DECL) + if (TREE_CODE (name2) == TYPE_DECL) name2 = DECL_NAME (name2); gcc_checking_assert (!name2 || TREE_CODE (name2) == IDENTIFIER_NODE); @@ -3537,6 +3531,19 @@ gimple_types_compatible_p_1 (tree t1, tree t2, type_pair_t p, if (!compare_type_names_p (t1, t2)) goto different_types; + /* We may not merge typedef types to the same type in different + contexts. */ + if (TYPE_NAME (t1) + && TREE_CODE (TYPE_NAME (t1)) == TYPE_DECL + && DECL_CONTEXT (TYPE_NAME (t1)) + && TYPE_P (DECL_CONTEXT (TYPE_NAME (t1)))) + { + if (!gtc_visit (DECL_CONTEXT (TYPE_NAME (t1)), + DECL_CONTEXT (TYPE_NAME (t2)), + state, sccstack, sccstate, sccstate_obstack)) + goto different_types; + } + /* If their attributes are not the same they can't be the same type. */ if (!attribute_list_equal (TYPE_ATTRIBUTES (t1), TYPE_ATTRIBUTES (t2))) goto different_types; @@ -3570,13 +3577,6 @@ gimple_types_compatible_p_1 (tree t1, tree t2, type_pair_t p, goto same_types; else if (i1 == NULL_TREE || i2 == NULL_TREE) goto different_types; - /* If for a complete array type the possibly gimplified sizes - are different the types are different. */ - else if (((TYPE_SIZE (i1) != NULL) ^ (TYPE_SIZE (i2) != NULL)) - || (TYPE_SIZE (i1) - && TYPE_SIZE (i2) - && !operand_equal_p (TYPE_SIZE (i1), TYPE_SIZE (i2), 0))) - goto different_types; else { tree min1 = TYPE_MIN_VALUE (i1); @@ -3980,6 +3980,7 @@ iterative_hash_name (tree name, hashval_t v) { if (!name) return v; + v = iterative_hash_hashval_t (TREE_CODE (name), v); if (TREE_CODE (name) == TYPE_DECL) name = DECL_NAME (name); if (!name) @@ -4046,6 +4047,12 @@ iterative_hash_gimple_type (tree type, hashval_t val, only existing types having the same features as the new type will be checked. */ v = iterative_hash_name (TYPE_NAME (type), 0); + if (TYPE_NAME (type) + && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL + && DECL_CONTEXT (TYPE_NAME (type)) + && TYPE_P (DECL_CONTEXT (TYPE_NAME (type)))) + v = visit (DECL_CONTEXT (TYPE_NAME (type)), state, v, + sccstack, sccstate, sccstate_obstack); v = iterative_hash_hashval_t (TREE_CODE (type), v); v = iterative_hash_hashval_t (TYPE_QUALS (type), v); v = iterative_hash_hashval_t (TREE_ADDRESSABLE (type), v); @@ -4081,9 +4088,8 @@ iterative_hash_gimple_type (tree type, hashval_t val, v = iterative_hash_hashval_t (TYPE_STRING_FLAG (type), v); } - /* For array types hash their domain and the string flag. */ - if (TREE_CODE (type) == ARRAY_TYPE - && TYPE_DOMAIN (type)) + /* For array types hash the domain and the string flag. */ + if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type)) { v = iterative_hash_hashval_t (TYPE_STRING_FLAG (type), v); v = visit (TYPE_DOMAIN (type), state, v, @@ -4121,9 +4127,7 @@ iterative_hash_gimple_type (tree type, hashval_t val, v = iterative_hash_hashval_t (na, v); } - if (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE - || TREE_CODE (type) == QUAL_UNION_TYPE) + if (RECORD_OR_UNION_TYPE_P (type)) { unsigned nf; tree f; @@ -4312,19 +4316,23 @@ iterative_hash_canonical_type (tree type, hashval_t val) v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v); } - /* For integer types hash the types min/max values and the string flag. */ + /* For integer types hash the sizetype and the string flag. */ if (TREE_CODE (type) == INTEGER_TYPE) { v = iterative_hash_hashval_t (TYPE_STRING_FLAG (type), v); v = iterative_hash_hashval_t (TYPE_IS_SIZETYPE (type), v); } - /* For array types hash their domain and the string flag. */ - if (TREE_CODE (type) == ARRAY_TYPE - && TYPE_DOMAIN (type)) + /* For array types hash the domain bounds and the string flag. */ + if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type)) { v = iterative_hash_hashval_t (TYPE_STRING_FLAG (type), v); - v = iterative_hash_canonical_type (TYPE_DOMAIN (type), v); + /* OMP lowering can introduce error_mark_node in place of + random local decls in types. */ + if (TYPE_MIN_VALUE (TYPE_DOMAIN (type)) != error_mark_node) + v = iterative_hash_expr (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), v); + if (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != error_mark_node) + v = iterative_hash_expr (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), v); } /* Recurse for aggregates with a single element type. */ @@ -4354,9 +4362,7 @@ iterative_hash_canonical_type (tree type, hashval_t val) v = iterative_hash_hashval_t (na, v); } - if (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE - || TREE_CODE (type) == QUAL_UNION_TYPE) + if (RECORD_OR_UNION_TYPE_P (type)) { unsigned nf; tree f; @@ -4595,13 +4601,6 @@ gimple_canonical_types_compatible_p (tree t1, tree t2) return true; else if (i1 == NULL_TREE || i2 == NULL_TREE) return false; - /* If for a complete array type the possibly gimplified sizes - are different the types are different. */ - else if (((TYPE_SIZE (i1) != NULL) ^ (TYPE_SIZE (i2) != NULL)) - || (TYPE_SIZE (i1) - && TYPE_SIZE (i2) - && !operand_equal_p (TYPE_SIZE (i1), TYPE_SIZE (i2), 0))) - return false; else { tree min1 = TYPE_MIN_VALUE (i1); @@ -4672,7 +4671,7 @@ gimple_canonical_types_compatible_p (tree t1, tree t2) /* For aggregate types, all the fields must be the same. */ for (f1 = TYPE_FIELDS (t1), f2 = TYPE_FIELDS (t2); - f1 && f2; + f1 || f2; f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2)) { /* Skip non-fields. */