Commit c26de36d by Richard Biener Committed by Richard Biener

gimple-fold.h (gimple_build): Remove optional valueize arguments.

2015-04-20  Richard Biener  <rguenther@suse.de>

	* gimple-fold.h (gimple_build): Remove optional valueize arguments.
	* gimple-fold.c (gimple_build_valueize): New function.
	(gimple_build): Always use gimple_build_valueize as valueize hook.

From-SVN: r222231
parent 9adc2d48
2015-04-20 Richard Biener <rguenther@suse.de>
* gimple-fold.h (gimple_build): Remove optional valueize arguments.
* gimple-fold.c (gimple_build_valueize): New function.
(gimple_build): Always use gimple_build_valueize as valueize hook.
2015-04-20 Alan Lawrence <alan.lawrence@arm.com> 2015-04-20 Alan Lawrence <alan.lawrence@arm.com>
PR target/64134 PR target/64134
......
...@@ -6078,18 +6078,28 @@ rewrite_to_defined_overflow (gimple stmt) ...@@ -6078,18 +6078,28 @@ rewrite_to_defined_overflow (gimple stmt)
} }
/* The valueization hook we use for the gimple_build API simplification.
This makes us match fold_buildN behavior by only combining with
statements in the sequence(s) we are currently building. */
static tree
gimple_build_valueize (tree op)
{
if (gimple_bb (SSA_NAME_DEF_STMT (op)) == NULL)
return op;
return NULL_TREE;
}
/* Build the expression CODE OP0 of type TYPE with location LOC, /* Build the expression CODE OP0 of type TYPE with location LOC,
simplifying it first if possible using VALUEIZE if not NULL. simplifying it first if possible. Returns the built
OP0 is expected to be valueized already. Returns the built
expression value and appends statements possibly defining it expression value and appends statements possibly defining it
to SEQ. */ to SEQ. */
tree tree
gimple_build (gimple_seq *seq, location_t loc, gimple_build (gimple_seq *seq, location_t loc,
enum tree_code code, tree type, tree op0, enum tree_code code, tree type, tree op0)
tree (*valueize)(tree))
{ {
tree res = gimple_simplify (code, type, op0, seq, valueize); tree res = gimple_simplify (code, type, op0, seq, gimple_build_valueize);
if (!res) if (!res)
{ {
if (gimple_in_ssa_p (cfun)) if (gimple_in_ssa_p (cfun))
...@@ -6110,17 +6120,15 @@ gimple_build (gimple_seq *seq, location_t loc, ...@@ -6110,17 +6120,15 @@ gimple_build (gimple_seq *seq, location_t loc,
} }
/* Build the expression OP0 CODE OP1 of type TYPE with location LOC, /* Build the expression OP0 CODE OP1 of type TYPE with location LOC,
simplifying it first if possible using VALUEIZE if not NULL. simplifying it first if possible. Returns the built
OP0 and OP1 are expected to be valueized already. Returns the built
expression value and appends statements possibly defining it expression value and appends statements possibly defining it
to SEQ. */ to SEQ. */
tree tree
gimple_build (gimple_seq *seq, location_t loc, gimple_build (gimple_seq *seq, location_t loc,
enum tree_code code, tree type, tree op0, tree op1, enum tree_code code, tree type, tree op0, tree op1)
tree (*valueize)(tree))
{ {
tree res = gimple_simplify (code, type, op0, op1, seq, valueize); tree res = gimple_simplify (code, type, op0, op1, seq, gimple_build_valueize);
if (!res) if (!res)
{ {
if (gimple_in_ssa_p (cfun)) if (gimple_in_ssa_p (cfun))
...@@ -6135,18 +6143,16 @@ gimple_build (gimple_seq *seq, location_t loc, ...@@ -6135,18 +6143,16 @@ gimple_build (gimple_seq *seq, location_t loc,
} }
/* Build the expression (CODE OP0 OP1 OP2) of type TYPE with location LOC, /* Build the expression (CODE OP0 OP1 OP2) of type TYPE with location LOC,
simplifying it first if possible using VALUEIZE if not NULL. simplifying it first if possible. Returns the built
OP0, OP1 and OP2 are expected to be valueized already. Returns the built
expression value and appends statements possibly defining it expression value and appends statements possibly defining it
to SEQ. */ to SEQ. */
tree tree
gimple_build (gimple_seq *seq, location_t loc, gimple_build (gimple_seq *seq, location_t loc,
enum tree_code code, tree type, tree op0, tree op1, tree op2, enum tree_code code, tree type, tree op0, tree op1, tree op2)
tree (*valueize)(tree))
{ {
tree res = gimple_simplify (code, type, op0, op1, op2, tree res = gimple_simplify (code, type, op0, op1, op2,
seq, valueize); seq, gimple_build_valueize);
if (!res) if (!res)
{ {
if (gimple_in_ssa_p (cfun)) if (gimple_in_ssa_p (cfun))
...@@ -6167,17 +6173,15 @@ gimple_build (gimple_seq *seq, location_t loc, ...@@ -6167,17 +6173,15 @@ gimple_build (gimple_seq *seq, location_t loc,
/* Build the call FN (ARG0) with a result of type TYPE /* Build the call FN (ARG0) with a result of type TYPE
(or no result if TYPE is void) with location LOC, (or no result if TYPE is void) with location LOC,
simplifying it first if possible using VALUEIZE if not NULL. simplifying it first if possible. Returns the built
ARG0 is expected to be valueized already. Returns the built
expression value (or NULL_TREE if TYPE is void) and appends expression value (or NULL_TREE if TYPE is void) and appends
statements possibly defining it to SEQ. */ statements possibly defining it to SEQ. */
tree tree
gimple_build (gimple_seq *seq, location_t loc, gimple_build (gimple_seq *seq, location_t loc,
enum built_in_function fn, tree type, tree arg0, enum built_in_function fn, tree type, tree arg0)
tree (*valueize)(tree))
{ {
tree res = gimple_simplify (fn, type, arg0, seq, valueize); tree res = gimple_simplify (fn, type, arg0, seq, gimple_build_valueize);
if (!res) if (!res)
{ {
tree decl = builtin_decl_implicit (fn); tree decl = builtin_decl_implicit (fn);
...@@ -6198,17 +6202,15 @@ gimple_build (gimple_seq *seq, location_t loc, ...@@ -6198,17 +6202,15 @@ gimple_build (gimple_seq *seq, location_t loc,
/* Build the call FN (ARG0, ARG1) with a result of type TYPE /* Build the call FN (ARG0, ARG1) with a result of type TYPE
(or no result if TYPE is void) with location LOC, (or no result if TYPE is void) with location LOC,
simplifying it first if possible using VALUEIZE if not NULL. simplifying it first if possible. Returns the built
ARG0 is expected to be valueized already. Returns the built
expression value (or NULL_TREE if TYPE is void) and appends expression value (or NULL_TREE if TYPE is void) and appends
statements possibly defining it to SEQ. */ statements possibly defining it to SEQ. */
tree tree
gimple_build (gimple_seq *seq, location_t loc, gimple_build (gimple_seq *seq, location_t loc,
enum built_in_function fn, tree type, tree arg0, tree arg1, enum built_in_function fn, tree type, tree arg0, tree arg1)
tree (*valueize)(tree))
{ {
tree res = gimple_simplify (fn, type, arg0, arg1, seq, valueize); tree res = gimple_simplify (fn, type, arg0, arg1, seq, gimple_build_valueize);
if (!res) if (!res)
{ {
tree decl = builtin_decl_implicit (fn); tree decl = builtin_decl_implicit (fn);
...@@ -6229,18 +6231,17 @@ gimple_build (gimple_seq *seq, location_t loc, ...@@ -6229,18 +6231,17 @@ gimple_build (gimple_seq *seq, location_t loc,
/* Build the call FN (ARG0, ARG1, ARG2) with a result of type TYPE /* Build the call FN (ARG0, ARG1, ARG2) with a result of type TYPE
(or no result if TYPE is void) with location LOC, (or no result if TYPE is void) with location LOC,
simplifying it first if possible using VALUEIZE if not NULL. simplifying it first if possible. Returns the built
ARG0 is expected to be valueized already. Returns the built
expression value (or NULL_TREE if TYPE is void) and appends expression value (or NULL_TREE if TYPE is void) and appends
statements possibly defining it to SEQ. */ statements possibly defining it to SEQ. */
tree tree
gimple_build (gimple_seq *seq, location_t loc, gimple_build (gimple_seq *seq, location_t loc,
enum built_in_function fn, tree type, enum built_in_function fn, tree type,
tree arg0, tree arg1, tree arg2, tree arg0, tree arg1, tree arg2)
tree (*valueize)(tree))
{ {
tree res = gimple_simplify (fn, type, arg0, arg1, arg2, seq, valueize); tree res = gimple_simplify (fn, type, arg0, arg1, arg2,
seq, gimple_build_valueize);
if (!res) if (!res)
{ {
tree decl = builtin_decl_implicit (fn); tree decl = builtin_decl_implicit (fn);
......
...@@ -57,8 +57,7 @@ extern gimple_seq rewrite_to_defined_overflow (gimple); ...@@ -57,8 +57,7 @@ extern gimple_seq rewrite_to_defined_overflow (gimple);
int the provided sequence, matching and simplifying them on-the-fly. int the provided sequence, matching and simplifying them on-the-fly.
Supposed to replace force_gimple_operand (fold_buildN (...), ...). */ Supposed to replace force_gimple_operand (fold_buildN (...), ...). */
extern tree gimple_build (gimple_seq *, location_t, extern tree gimple_build (gimple_seq *, location_t,
enum tree_code, tree, tree, enum tree_code, tree, tree);
tree (*valueize) (tree) = NULL);
inline tree inline tree
gimple_build (gimple_seq *seq, gimple_build (gimple_seq *seq,
enum tree_code code, tree type, tree op0) enum tree_code code, tree type, tree op0)
...@@ -66,8 +65,7 @@ gimple_build (gimple_seq *seq, ...@@ -66,8 +65,7 @@ gimple_build (gimple_seq *seq,
return gimple_build (seq, UNKNOWN_LOCATION, code, type, op0); return gimple_build (seq, UNKNOWN_LOCATION, code, type, op0);
} }
extern tree gimple_build (gimple_seq *, location_t, extern tree gimple_build (gimple_seq *, location_t,
enum tree_code, tree, tree, tree, enum tree_code, tree, tree, tree);
tree (*valueize) (tree) = NULL);
inline tree inline tree
gimple_build (gimple_seq *seq, gimple_build (gimple_seq *seq,
enum tree_code code, tree type, tree op0, tree op1) enum tree_code code, tree type, tree op0, tree op1)
...@@ -75,8 +73,7 @@ gimple_build (gimple_seq *seq, ...@@ -75,8 +73,7 @@ gimple_build (gimple_seq *seq,
return gimple_build (seq, UNKNOWN_LOCATION, code, type, op0, op1); return gimple_build (seq, UNKNOWN_LOCATION, code, type, op0, op1);
} }
extern tree gimple_build (gimple_seq *, location_t, extern tree gimple_build (gimple_seq *, location_t,
enum tree_code, tree, tree, tree, tree, enum tree_code, tree, tree, tree, tree);
tree (*valueize) (tree) = NULL);
inline tree inline tree
gimple_build (gimple_seq *seq, gimple_build (gimple_seq *seq,
enum tree_code code, tree type, tree op0, tree op1, tree op2) enum tree_code code, tree type, tree op0, tree op1, tree op2)
...@@ -84,8 +81,7 @@ gimple_build (gimple_seq *seq, ...@@ -84,8 +81,7 @@ gimple_build (gimple_seq *seq,
return gimple_build (seq, UNKNOWN_LOCATION, code, type, op0, op1, op2); return gimple_build (seq, UNKNOWN_LOCATION, code, type, op0, op1, op2);
} }
extern tree gimple_build (gimple_seq *, location_t, extern tree gimple_build (gimple_seq *, location_t,
enum built_in_function, tree, tree, enum built_in_function, tree, tree);
tree (*valueize) (tree) = NULL);
inline tree inline tree
gimple_build (gimple_seq *seq, gimple_build (gimple_seq *seq,
enum built_in_function fn, tree type, tree arg0) enum built_in_function fn, tree type, tree arg0)
...@@ -93,8 +89,7 @@ gimple_build (gimple_seq *seq, ...@@ -93,8 +89,7 @@ gimple_build (gimple_seq *seq,
return gimple_build (seq, UNKNOWN_LOCATION, fn, type, arg0); return gimple_build (seq, UNKNOWN_LOCATION, fn, type, arg0);
} }
extern tree gimple_build (gimple_seq *, location_t, extern tree gimple_build (gimple_seq *, location_t,
enum built_in_function, tree, tree, tree, enum built_in_function, tree, tree, tree);
tree (*valueize) (tree) = NULL);
inline tree inline tree
gimple_build (gimple_seq *seq, gimple_build (gimple_seq *seq,
enum built_in_function fn, tree type, tree arg0, tree arg1) enum built_in_function fn, tree type, tree arg0, tree arg1)
...@@ -102,8 +97,7 @@ gimple_build (gimple_seq *seq, ...@@ -102,8 +97,7 @@ gimple_build (gimple_seq *seq,
return gimple_build (seq, UNKNOWN_LOCATION, fn, type, arg0, arg1); return gimple_build (seq, UNKNOWN_LOCATION, fn, type, arg0, arg1);
} }
extern tree gimple_build (gimple_seq *, location_t, extern tree gimple_build (gimple_seq *, location_t,
enum built_in_function, tree, tree, tree, tree, enum built_in_function, tree, tree, tree, tree);
tree (*valueize) (tree) = NULL);
inline tree inline tree
gimple_build (gimple_seq *seq, gimple_build (gimple_seq *seq,
enum built_in_function fn, tree type, enum built_in_function fn, tree type,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment