aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2007-05-29 00:13:00 +0000
committerAndrew Pinski <andrew_pinski@playstation.sony.com>2007-05-29 00:13:00 +0000
commit8dd7a25e89d95f3f7de733a34b5a7981949a3b7b (patch)
tree681bcc05c3a1bfda1d05258b22ba0aac7722a859
parent9eff1595a75a3f3bc80ab72e4a0df526dd138589 (diff)
2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
* fold-const.c (try_move_mult_to_index): Say why we strip the nops. (fold_unary <case NOP_EXPR>): Remove TODO as we cannot get that case. * tree-chrec.c (chrec_fold_plus): Cleanup the code to chose which tree code is used. (chrec_convert_rhs): Add comment on why the increment is sizetype for pointers. * tree-mudflap.c (mf_xform_derefs_1): Use size_int instead of build_int_cst. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Likewise. 2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com> * typeck.c (build_binary_op): Add a comment on why creating the tree in pieces while processing templates. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/pointer_plus@125151 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.ptr16
-rw-r--r--gcc/cp/ChangeLog.ptr5
-rw-r--r--gcc/cp/typeck.c4
-rw-r--r--gcc/fold-const.c4
-rw-r--r--gcc/tree-chrec.c14
-rw-r--r--gcc/tree-mudflap.c4
-rw-r--r--gcc/tree-ssa-loop-prefetch.c2
7 files changed, 39 insertions, 10 deletions
diff --git a/gcc/ChangeLog.ptr b/gcc/ChangeLog.ptr
index 2ef31ddad5b..f859a2df392 100644
--- a/gcc/ChangeLog.ptr
+++ b/gcc/ChangeLog.ptr
@@ -1,3 +1,19 @@
+2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * fold-const.c (try_move_mult_to_index):
+ Say why we strip the nops.
+ (fold_unary <case NOP_EXPR>): Remove
+ TODO as we cannot get that case.
+ * tree-chrec.c (chrec_fold_plus):
+ Cleanup the code to chose which
+ tree code is used.
+ (chrec_convert_rhs): Add comment on
+ why the increment is sizetype for
+ pointers.
+ * tree-mudflap.c (mf_xform_derefs_1):
+ Use size_int instead of build_int_cst.
+ * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Likewise.
+
2007-05-21 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/32015
diff --git a/gcc/cp/ChangeLog.ptr b/gcc/cp/ChangeLog.ptr
index 5556a10850a..dbf216e92f9 100644
--- a/gcc/cp/ChangeLog.ptr
+++ b/gcc/cp/ChangeLog.ptr
@@ -1,3 +1,8 @@
+2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * typeck.c (build_binary_op): Add a comment on why creating
+ the tree in pieces while processing templates.
+
2007-05-12 Andrew Pinski <andrew_pinski@playstation.sony.com>
* except.c (expand_start_catch_block): Do a
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 0f44b6580c0..6f896bbf6ec 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -3576,6 +3576,10 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
RESULT_TYPE. */
if (processing_template_decl)
{
+ /* Since the middle-end checks the type when doing a build2, we
+ need to build the tree in pieces. This built tree will never
+ get out of the front-end as we replace it when instantiating
+ the template. */
tree tmp = build2 (resultcode,
build_type ? build_type : result_type,
NULL_TREE, op1);
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 3232c93a09c..831185305fe 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6879,6 +6879,8 @@ try_move_mult_to_index (tree addr, tree op1)
tree ret, pos;
tree itype;
bool mdim = false;
+
+ /* Stip the nops that might be added when converting op1 to sizetype. */
STRIP_NOPS (op1);
/* Canonicalize op1 into a possibly non-constant delta
@@ -7856,8 +7858,6 @@ fold_unary (enum tree_code code, tree type, tree op0)
return fold_build2 (TREE_CODE (arg0), type, fold_convert (type, arg00),
fold_convert (sizetype, arg01));
}
- /* TODO: Add folding of (T1)((sizetype)X +/- Y) into (T1)X + (-)Y where
- T1 is a pointer type. */
/* Convert (T1)(~(T2)X) into ~(T1)X if T1 and T2 are integral types
of the same precision, and X is a integer type not narrower than
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index da7ab7a59c0..08060fcc3fa 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -335,6 +335,7 @@ chrec_fold_plus (tree type,
tree op0,
tree op1)
{
+ enum tree_code code;
if (automatically_generated_chrec_p (op0)
|| automatically_generated_chrec_p (op1))
return chrec_fold_automatically_generated_operands (op0, op1);
@@ -343,11 +344,13 @@ chrec_fold_plus (tree type,
return op1;
if (integer_zerop (op1))
return op0;
+
+ if (POINTER_TYPE_P (type))
+ code = POINTER_PLUS_EXPR;
+ else
+ code = PLUS_EXPR;
- return chrec_fold_plus_1 ((POINTER_TYPE_P (type)
- ? POINTER_PLUS_EXPR
- : PLUS_EXPR),
- type, op0, op1);
+ return chrec_fold_plus_1 (code, type, op0, op1);
}
/* Fold the subtraction of two chrecs. */
@@ -1225,7 +1228,8 @@ convert_affine_scev (struct loop *loop, tree type,
}
-/* Convert CHREC for the right hand side of a CREC. */
+/* Convert CHREC for the right hand side of a CREC.
+ The increment for a pointer type is always sizetype. */
tree
chrec_convert_rhs (tree type, tree chrec, tree at_stmt)
{
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index 799752a10f3..7fa04513b22 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -837,7 +837,7 @@ mf_xform_derefs_1 (block_stmt_iterator *iter, tree *tp,
limit = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node,
fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, base,
size),
- build_int_cst (sizetype, -1));
+ size_int (-1));
break;
case TARGET_MEM_REF:
@@ -846,7 +846,7 @@ mf_xform_derefs_1 (block_stmt_iterator *iter, tree *tp,
limit = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node,
fold_build2 (POINTER_PLUS_EXPR, ptr_type_node, base,
size),
- build_int_cst (sizetype, -1));
+ size_int (-1));
break;
case ARRAY_RANGE_REF:
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 2f395594678..2eb69b9a97f 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -835,7 +835,7 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
/* Determine the address to prefetch. */
delta = (ahead + ap * ref->prefetch_mod) * ref->group->step;
addr = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node,
- addr_base, build_int_cst (sizetype, delta));
+ addr_base, size_int (delta));
addr = force_gimple_operand_bsi (&bsi, unshare_expr (addr), true, NULL);
/* Create the prefetch instruction. */