Commit 8d3784af by Kazu Hirata Committed by Kazu Hirata

fold-const.c (fold): Constify "type".

	* fold-const.c (fold): Constify "type".
	Replace "TREE_TYPE (t)" with "type".

From-SVN: r79753
parent 7f5773c6
2004-03-20 Kazu Hirata <kazu@cs.umass.edu> 2004-03-20 Kazu Hirata <kazu@cs.umass.edu>
* fold-const.c (fold): Constify "type".
Replace "TREE_TYPE (t)" with "type".
2004-03-20 Kazu Hirata <kazu@cs.umass.edu>
* bb-reorder.c, bt-load.c, c-decl.c, cfgcleanup.c, coverage.c, * bb-reorder.c, bt-load.c, c-decl.c, cfgcleanup.c, coverage.c,
dwarf2asm.c, ifcvt.c, stor-layout.c, varasm.c: Replace calls dwarf2asm.c, ifcvt.c, stor-layout.c, varasm.c: Replace calls
via (*targetm.foo) () with targetm.foo (). via (*targetm.foo) () with targetm.foo ().
......
...@@ -5386,9 +5386,9 @@ tree ...@@ -5386,9 +5386,9 @@ tree
fold (tree expr) fold (tree expr)
{ {
const tree t = expr; const tree t = expr;
const tree type = TREE_TYPE (expr);
tree t1 = NULL_TREE; tree t1 = NULL_TREE;
tree tem; tree tem;
tree type = TREE_TYPE (expr);
tree arg0 = NULL_TREE, arg1 = NULL_TREE; tree arg0 = NULL_TREE, arg1 = NULL_TREE;
enum tree_code code = TREE_CODE (t); enum tree_code code = TREE_CODE (t);
int kind = TREE_CODE_CLASS (code); int kind = TREE_CODE_CLASS (code);
...@@ -5637,7 +5637,7 @@ fold (tree expr) ...@@ -5637,7 +5637,7 @@ fold (tree expr)
case FIX_TRUNC_EXPR: case FIX_TRUNC_EXPR:
case FIX_CEIL_EXPR: case FIX_CEIL_EXPR:
case FIX_FLOOR_EXPR: case FIX_FLOOR_EXPR:
if (TREE_TYPE (TREE_OPERAND (t, 0)) == TREE_TYPE (t)) if (TREE_TYPE (TREE_OPERAND (t, 0)) == type)
return TREE_OPERAND (t, 0); return TREE_OPERAND (t, 0);
/* Handle cases of two conversions in a row. */ /* Handle cases of two conversions in a row. */
...@@ -5646,7 +5646,7 @@ fold (tree expr) ...@@ -5646,7 +5646,7 @@ fold (tree expr)
{ {
tree inside_type = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 0), 0)); tree inside_type = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 0), 0));
tree inter_type = TREE_TYPE (TREE_OPERAND (t, 0)); tree inter_type = TREE_TYPE (TREE_OPERAND (t, 0));
tree final_type = TREE_TYPE (t); tree final_type = type;
int inside_int = INTEGRAL_TYPE_P (inside_type); int inside_int = INTEGRAL_TYPE_P (inside_type);
int inside_ptr = POINTER_TYPE_P (inside_type); int inside_ptr = POINTER_TYPE_P (inside_type);
int inside_float = FLOAT_TYPE_P (inside_type); int inside_float = FLOAT_TYPE_P (inside_type);
...@@ -5744,8 +5744,8 @@ fold (tree expr) ...@@ -5744,8 +5744,8 @@ fold (tree expr)
/* Convert (T)(x & c) into (T)x & (T)c, if c is an integer /* Convert (T)(x & c) into (T)x & (T)c, if c is an integer
constants (if x has signed type, the sign bit cannot be set constants (if x has signed type, the sign bit cannot be set
in c). This folds extension into the BIT_AND_EXPR. */ in c). This folds extension into the BIT_AND_EXPR. */
if (INTEGRAL_TYPE_P (TREE_TYPE (t)) if (INTEGRAL_TYPE_P (type)
&& TREE_CODE (TREE_TYPE (t)) != BOOLEAN_TYPE && TREE_CODE (type) != BOOLEAN_TYPE
&& TREE_CODE (TREE_OPERAND (t, 0)) == BIT_AND_EXPR && TREE_CODE (TREE_OPERAND (t, 0)) == BIT_AND_EXPR
&& TREE_CODE (TREE_OPERAND (TREE_OPERAND (t, 0), 1)) == INTEGER_CST) && TREE_CODE (TREE_OPERAND (TREE_OPERAND (t, 0), 1)) == INTEGER_CST)
{ {
...@@ -5754,7 +5754,7 @@ fold (tree expr) ...@@ -5754,7 +5754,7 @@ fold (tree expr)
int change = 0; int change = 0;
if (TREE_UNSIGNED (TREE_TYPE (and)) if (TREE_UNSIGNED (TREE_TYPE (and))
|| (TYPE_PRECISION (TREE_TYPE (t)) || (TYPE_PRECISION (type)
<= TYPE_PRECISION (TREE_TYPE (and)))) <= TYPE_PRECISION (TREE_TYPE (and))))
change = 1; change = 1;
else if (TYPE_PRECISION (TREE_TYPE (and1)) else if (TYPE_PRECISION (TREE_TYPE (and1))
...@@ -5779,12 +5779,12 @@ fold (tree expr) ...@@ -5779,12 +5779,12 @@ fold (tree expr)
#endif #endif
} }
if (change) if (change)
return fold (build (BIT_AND_EXPR, TREE_TYPE (t), return fold (build (BIT_AND_EXPR, type,
fold_convert (TREE_TYPE (t), and0), fold_convert (type, and0),
fold_convert (TREE_TYPE (t), and1))); fold_convert (type, and1)));
} }
tem = fold_convert_const (code, TREE_TYPE (t), arg0); tem = fold_convert_const (code, type, arg0);
return tem ? tem : t; return tem ? tem : t;
case VIEW_CONVERT_EXPR: case VIEW_CONVERT_EXPR:
...@@ -6223,8 +6223,8 @@ fold (tree expr) ...@@ -6223,8 +6223,8 @@ fold (tree expr)
{ {
/* The return value should always have /* The return value should always have
the same type as the original expression. */ the same type as the original expression. */
if (TREE_TYPE (t1) != TREE_TYPE (t)) if (TREE_TYPE (t1) != type)
t1 = fold_convert (TREE_TYPE (t), t1); t1 = fold_convert (type, t1);
return t1; return t1;
} }
...@@ -7931,7 +7931,7 @@ fold (tree expr) ...@@ -7931,7 +7931,7 @@ fold (tree expr)
has the same type as the COND_EXPR. This avoids optimizing has the same type as the COND_EXPR. This avoids optimizing
away "c ? x : throw", where the throw has a void type. */ away "c ? x : throw", where the throw has a void type. */
if (! VOID_TYPE_P (TREE_TYPE (tem)) if (! VOID_TYPE_P (TREE_TYPE (tem))
|| VOID_TYPE_P (TREE_TYPE (t))) || VOID_TYPE_P (type))
return pedantic_non_lvalue (tem); return pedantic_non_lvalue (tem);
return t; return t;
} }
......
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