}
/* References of size POLY_INT_CST to a fixed-size object must go
through memory. It's more efficient to force that here than
- to create temporary slots on the fly. */
- else if ((TREE_CODE (t) == MEM_REF || TREE_CODE (t) == TARGET_MEM_REF)
- && TYPE_SIZE (TREE_TYPE (t))
- && POLY_INT_CST_P (TYPE_SIZE (TREE_TYPE (t))))
+ to create temporary slots on the fly.
+ RTL expansion expectes TARGET_MEM_REF to always address actual memory. */
+ else if (TREE_CODE (t) == TARGET_MEM_REF
+ || (TREE_CODE (t) == MEM_REF
+ && TYPE_SIZE (TREE_TYPE (t))
+ && POLY_INT_CST_P (TYPE_SIZE (TREE_TYPE (t)))))
{
tree base = get_base_address (t);
if (base
{
if (TREE_CODE (rhs) == ADDR_EXPR)
ret |= visit_addr (stmt, TREE_OPERAND (rhs, 0), arg, data);
- else if (TREE_CODE (rhs) == TARGET_MEM_REF
- && TREE_CODE (TMR_BASE (rhs)) == ADDR_EXPR)
- ret |= visit_addr (stmt, TREE_OPERAND (TMR_BASE (rhs), 0), arg,
- data);
else if (TREE_CODE (rhs) == OBJ_TYPE_REF
&& TREE_CODE (OBJ_TYPE_REF_OBJECT (rhs)) == ADDR_EXPR)
ret |= visit_addr (stmt, TREE_OPERAND (OBJ_TYPE_REF_OBJECT (rhs),
TREE_OPERAND (OBJ_TYPE_REF_OBJECT (val),
0), arg, data);
}
- lhs = gimple_assign_lhs (stmt);
- if (TREE_CODE (lhs) == TARGET_MEM_REF
- && TREE_CODE (TMR_BASE (lhs)) == ADDR_EXPR)
- ret |= visit_addr (stmt, TREE_OPERAND (TMR_BASE (lhs), 0), lhs, data);
}
if (visit_load)
{
gcc_assert (TREE_CODE (ref) != WITH_SIZE_EXPR);
while (handled_component_p (ref))
ref = TREE_OPERAND (ref, 0);
- if (TREE_CODE (ref) == MEM_REF
+ if ((TREE_CODE (ref) == MEM_REF || TREE_CODE (ref) == TARGET_MEM_REF)
&& TREE_CODE (TREE_OPERAND (ref, 0)) == ADDR_EXPR)
ref = TREE_OPERAND (TREE_OPERAND (ref, 0), 0);
return !(DECL_P (ref)
gimple_set_has_volatile_ops (stmt, true);
/* First record the real operands. */
- get_expr_operands (&TMR_BASE (expr), opf_use | (flags & opf_no_vops));
+ get_expr_operands (&TMR_BASE (expr),
+ opf_non_addressable | opf_use
+ | (flags & (opf_no_vops|opf_not_non_addressable)));
get_expr_operands (&TMR_INDEX (expr), opf_use | (flags & opf_no_vops));
get_expr_operands (&TMR_INDEX2 (expr), opf_use | (flags & opf_no_vops));
return decl;
}
+ /* We cannot rewrite TARGET_MEM_REFs. */
+ if (TREE_CODE (base) == TARGET_MEM_REF
+ && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR)
+ {
+ tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
+ if (! DECL_P (decl))
+ return NULL_TREE;
+ return decl;
+ }
+
return NULL_TREE;
}