aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-04-16 14:53:32 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-04-16 14:53:32 +0000
commit646bea10e5f7be362618a8cdcf91d87ea9771fd1 (patch)
tree39a3f83699560f41244729712877b85ac31886a7 /gcc/tree-cfg.c
parent02e819ffd481be3a48701f535e7daad5ddaaae6a (diff)
downloadgcc-646bea10e5f7be362618a8cdcf91d87ea9771fd1.zip
gcc-646bea10e5f7be362618a8cdcf91d87ea9771fd1.tar.gz
gcc-646bea10e5f7be362618a8cdcf91d87ea9771fd1.tar.bz2
tree-cfg.c (verify_gimple_assign_binary): Allow POINTER_PLUS_EXPR-like PLUS_EXPR for vectors.
2009-04-16 Richard Guenther <rguenther@suse.de> * tree-cfg.c (verify_gimple_assign_binary): Allow POINTER_PLUS_EXPR-like PLUS_EXPR for vectors. * ipa-struct-reorg.c (gen_size): Fold the built expressions. (create_general_new_stmt): Note that this function is broken. From-SVN: r146197
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c59
1 files changed, 44 insertions, 15 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 447e6cf..2eab9ad 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3568,8 +3568,52 @@ verify_gimple_assign_binary (gimple stmt)
return false;
}
+ case PLUS_EXPR:
+ {
+ /* We use regular PLUS_EXPR for vectors.
+ ??? This just makes the checker happy and may not be what is
+ intended. */
+ if (TREE_CODE (lhs_type) == VECTOR_TYPE
+ && POINTER_TYPE_P (TREE_TYPE (lhs_type)))
+ {
+ if (TREE_CODE (rhs1_type) != VECTOR_TYPE
+ || TREE_CODE (rhs2_type) != VECTOR_TYPE)
+ {
+ error ("invalid non-vector operands to vector valued plus");
+ return true;
+ }
+ lhs_type = TREE_TYPE (lhs_type);
+ rhs1_type = TREE_TYPE (rhs1_type);
+ rhs2_type = TREE_TYPE (rhs2_type);
+ /* PLUS_EXPR is commutative, so we might end up canonicalizing
+ the pointer to 2nd place. */
+ if (POINTER_TYPE_P (rhs2_type))
+ {
+ tree tem = rhs1_type;
+ rhs1_type = rhs2_type;
+ rhs2_type = tem;
+ }
+ goto do_pointer_plus_expr_check;
+ }
+ }
+ /* Fallthru. */
+ case MINUS_EXPR:
+ {
+ if (POINTER_TYPE_P (lhs_type)
+ || POINTER_TYPE_P (rhs1_type)
+ || POINTER_TYPE_P (rhs2_type))
+ {
+ error ("invalid (pointer) operands to plus/minus");
+ return true;
+ }
+
+ /* Continue with generic binary expression handling. */
+ break;
+ }
+
case POINTER_PLUS_EXPR:
{
+do_pointer_plus_expr_check:
if (!POINTER_TYPE_P (rhs1_type)
|| !useless_type_conversion_p (lhs_type, rhs1_type)
|| !useless_type_conversion_p (sizetype, rhs2_type))
@@ -3625,21 +3669,6 @@ verify_gimple_assign_binary (gimple stmt)
connected to the operand types. */
return verify_gimple_comparison (lhs_type, rhs1, rhs2);
- case PLUS_EXPR:
- case MINUS_EXPR:
- {
- if (POINTER_TYPE_P (lhs_type)
- || POINTER_TYPE_P (rhs1_type)
- || POINTER_TYPE_P (rhs2_type))
- {
- error ("invalid (pointer) operands to plus/minus");
- return true;
- }
-
- /* Continue with generic binary expression handling. */
- break;
- }
-
case WIDEN_SUM_EXPR:
case WIDEN_MULT_EXPR:
case VEC_WIDEN_MULT_HI_EXPR: