tree-ssa-sccvn.c (copy_reference_ops_from_ref): Record TMR_ORIGINAL.

2009-05-22  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Record
	TMR_ORIGINAL.  Always either record TMR_SYMBOL or TMR_BASE.
	* tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle
	TARGET_MEM_REF.
	(create_expression_by_pieces): Only convert if necessary.
	* gimplify.c (gimplify_expr): Handle TARGET_MEM_REF.
	* tree-ssa-loop-im.c (gen_lsm_tmp_name): Handle INTEGER_CST.

From-SVN: r147779
This commit is contained in:
Richard Guenther 2009-05-21 22:43:19 +00:00 committed by Richard Biener
parent 9a2b090ce0
commit 150e39291c
5 changed files with 82 additions and 11 deletions

View File

@ -1,3 +1,13 @@
2009-05-22 Richard Guenther <rguenther@suse.de>
* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Record
TMR_ORIGINAL. Always either record TMR_SYMBOL or TMR_BASE.
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle
TARGET_MEM_REF.
(create_expression_by_pieces): Only convert if necessary.
* gimplify.c (gimplify_expr): Handle TARGET_MEM_REF.
* tree-ssa-loop-im.c (gen_lsm_tmp_name): Handle INTEGER_CST.
2009-05-21 Adam Nemet <anemet@caviumnetworks.com>
* config/mips/mips.md (*extzv_trunc<mode>_exts): Turn into a

View File

@ -6769,6 +6769,24 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
}
break;
case TARGET_MEM_REF:
{
enum gimplify_status r0 = GS_ALL_DONE, r1 = GS_ALL_DONE;
if (TMR_SYMBOL (*expr_p))
r0 = gimplify_expr (&TMR_SYMBOL (*expr_p), pre_p,
post_p, is_gimple_lvalue, fb_either);
else if (TMR_BASE (*expr_p))
r0 = gimplify_expr (&TMR_BASE (*expr_p), pre_p,
post_p, is_gimple_val, fb_either);
if (TMR_INDEX (*expr_p))
r1 = gimplify_expr (&TMR_INDEX (*expr_p), pre_p,
post_p, is_gimple_val, fb_rvalue);
/* TMR_STEP and TMR_OFFSET are always integer constants. */
ret = MIN (r0, r1);
}
break;
case NON_LVALUE_EXPR:
/* This should have been stripped above. */
gcc_unreachable ();

View File

@ -1794,6 +1794,10 @@ gen_lsm_tmp_name (tree ref)
lsm_tmp_name_add ("R");
break;
case INTEGER_CST:
/* Nothing. */
break;
default:
gcc_unreachable ();
}

View File

@ -2647,6 +2647,36 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
return folded;
}
break;
case TARGET_MEM_REF:
{
vn_reference_op_t nextop = VEC_index (vn_reference_op_s, ref->operands,
*operand);
pre_expr op0expr;
tree genop0 = NULL_TREE;
tree baseop = create_component_ref_by_pieces_1 (block, ref, operand,
stmts, domstmt);
if (!baseop)
return NULL_TREE;
if (currop->op0)
{
op0expr = get_or_alloc_expr_for (currop->op0);
genop0 = find_or_generate_expression (block, op0expr,
stmts, domstmt);
if (!genop0)
return NULL_TREE;
}
if (DECL_P (baseop))
return build6 (TARGET_MEM_REF, currop->type,
baseop, NULL_TREE,
genop0, currop->op1, currop->op2,
unshare_expr (nextop->op1));
else
return build6 (TARGET_MEM_REF, currop->type,
NULL_TREE, baseop,
genop0, currop->op1, currop->op2,
unshare_expr (nextop->op1));
}
break;
case ADDR_EXPR:
if (currop->op0)
{
@ -2902,8 +2932,8 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
gimple_seq *stmts, gimple domstmt, tree type)
{
tree temp, name;
tree folded, newexpr;
gimple_seq forced_stmts;
tree folded;
gimple_seq forced_stmts = NULL;
unsigned int value_id;
gimple_stmt_iterator gsi;
tree exprtype = type ? type : get_expr_type (expr);
@ -2975,13 +3005,16 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
default:
return NULL_TREE;
}
folded = fold_convert (exprtype, folded);
if (!useless_type_conversion_p (exprtype, TREE_TYPE (folded)))
folded = fold_convert (exprtype, folded);
/* Force the generated expression to be a sequence of GIMPLE
statements.
We have to call unshare_expr because force_gimple_operand may
modify the tree we pass to it. */
newexpr = force_gimple_operand (unshare_expr (folded), &forced_stmts,
false, NULL);
folded = force_gimple_operand (unshare_expr (folded), &forced_stmts,
false, NULL);
/* If we have any intermediate expressions to the value sets, add them
to the value sets and chain them in the instruction stream. */
@ -3025,7 +3058,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
|| TREE_CODE (exprtype) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (temp) = 1;
newstmt = gimple_build_assign (temp, newexpr);
newstmt = gimple_build_assign (temp, folded);
name = make_ssa_name (temp, newstmt);
gimple_assign_set_lhs (newstmt, name);
gimple_set_plf (newstmt, NECESSARY, false);

View File

@ -488,20 +488,26 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
if (TREE_CODE (ref) == TARGET_MEM_REF)
{
vn_reference_op_s temp;
tree base;
base = TMR_SYMBOL (ref) ? TMR_SYMBOL (ref) : TMR_BASE (ref);
if (!base)
base = build_int_cst (ptr_type_node, 0);
memset (&temp, 0, sizeof (temp));
/* We do not care for spurious type qualifications. */
temp.type = TYPE_MAIN_VARIANT (TREE_TYPE (ref));
temp.opcode = TREE_CODE (ref);
temp.op0 = TMR_SYMBOL (ref) ? TMR_SYMBOL (ref) : TMR_BASE (ref);
temp.op1 = TMR_INDEX (ref);
temp.op0 = TMR_INDEX (ref);
temp.op1 = TMR_STEP (ref);
temp.op2 = TMR_OFFSET (ref);
VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
memset (&temp, 0, sizeof (temp));
temp.type = NULL_TREE;
temp.opcode = TREE_CODE (ref);
temp.op0 = TMR_STEP (ref);
temp.op1 = TMR_OFFSET (ref);
temp.opcode = TREE_CODE (base);
temp.op0 = base;
temp.op1 = TMR_ORIGINAL (ref);
VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
return;
}