This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][mem-ref2] More adjustments
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 18 Jun 2010 15:34:16 +0200 (CEST)
- Subject: [PATCH][mem-ref2] More adjustments
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2010-06-18 Richard Guenther <rguenther@suse.de>
* tree-ssa.c (execute_update_addresses_taken): Fixup test
for partial accesses on the RHS.
* tree-cfg.c (verify_types_in_gimple_reference): Verify
that VIEW_CONVERT_EXPR of registers have matching size.
Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c (revision 160977)
--- gcc/tree-ssa.c (working copy)
*************** execute_update_addresses_taken (bool do_
*** 1859,1876 ****
/* A plain decl does not need it set. */
if (!DECL_P (rhs))
{
! if (handled_component_p (rhs))
! rhs = get_base_address (rhs);
! if (rhs
! && TREE_CODE (rhs) == MEM_REF
! && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR)
{
! tree decl = TREE_OPERAND (TREE_OPERAND (rhs, 0), 0);
if (DECL_P (decl)
! && (!integer_zerop (TREE_OPERAND (rhs, 1))
|| (DECL_SIZE (decl)
! != TYPE_SIZE (TREE_TYPE (rhs)))))
bitmap_set_bit (not_reg_needs, DECL_UID (decl));
}
}
--- 1859,1878 ----
/* A plain decl does not need it set. */
if (!DECL_P (rhs))
{
! tree base = rhs;
! while (handled_component_p (base))
! base = TREE_OPERAND (base, 0);
! /* But watch out for MEM_REFs we cannot lower to a
! VIEW_CONVERT_EXPR. */
! if (TREE_CODE (base) == MEM_REF
! && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR)
{
! tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
if (DECL_P (decl)
! && (!integer_zerop (TREE_OPERAND (base, 1))
|| (DECL_SIZE (decl)
! != TYPE_SIZE (TREE_TYPE (base)))))
bitmap_set_bit (not_reg_needs, DECL_UID (decl));
}
}
Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c (revision 160977)
--- gcc/tree-cfg.c (working copy)
*************** verify_types_in_gimple_reference (tree e
*** 2950,2955 ****
--- 2950,2962 ----
debug_generic_stmt (expr);
return true;
}
+ else if (TREE_CODE (op) == SSA_NAME
+ && TYPE_SIZE (TREE_TYPE (expr)) != TYPE_SIZE (TREE_TYPE (op)))
+ {
+ error ("Conversion of register to a different size.");
+ debug_generic_stmt (expr);
+ return true;
+ }
else if (!handled_component_p (op))
return false;
}