Commit c5106933 by James A. Morrison

treetree.c (tree_code_if_start): Use fold_buildN.

2005-03-22  James A. Morrison  <phython@gcc.gnu.org>

        * treetree.c (tree_code_if_start): Use fold_buildN.
        (tree_code_create_variable): Likewise.
        (tree_code_generate_return): Likewise.
        (tree_code_get_expression): Likewise.
        (tree_code_add_parameter): Likewise.

From-SVN: r96920
parent 52f9be18
2005-03-22 James A. Morrison <phython@gcc.gnu.org> 2005-03-22 James A. Morrison <phython@gcc.gnu.org>
* treetree.c (tree_code_if_start): Use fold_buildN.
(tree_code_create_variable): Likewise.
(tree_code_generate_return): Likewise.
(tree_code_get_expression): Likewise.
(tree_code_add_parameter): Likewise.
2005-03-22 James A. Morrison <phython@gcc.gnu.org>
* treelang.h (struct parameter_part): Skip WHERE_TO_PUT_VAR_TREE * treelang.h (struct parameter_part): Skip WHERE_TO_PUT_VAR_TREE
during GC. during GC.
......
...@@ -257,9 +257,9 @@ void ...@@ -257,9 +257,9 @@ void
tree_code_if_start (tree exp, location_t loc) tree_code_if_start (tree exp, location_t loc)
{ {
tree cond_exp, cond; tree cond_exp, cond;
cond_exp = fold (build2 (NE_EXPR, boolean_type_node, exp, cond_exp = fold_build2 (NE_EXPR, boolean_type_node, exp,
fold (build1 (CONVERT_EXPR, TREE_TYPE (exp), fold_build1 (CONVERT_EXPR, TREE_TYPE (exp),
integer_zero_node)))); integer_zero_node));
SET_EXPR_LOCATION (cond_exp, loc); SET_EXPR_LOCATION (cond_exp, loc);
cond = build3 (COND_EXPR, void_type_node, cond_exp, NULL_TREE, cond = build3 (COND_EXPR, void_type_node, cond_exp, NULL_TREE,
NULL_TREE); NULL_TREE);
...@@ -525,7 +525,7 @@ tree_code_create_variable (unsigned int storage_class, ...@@ -525,7 +525,7 @@ tree_code_create_variable (unsigned int storage_class,
/* 3a. Initialization. */ /* 3a. Initialization. */
if (init) if (init)
DECL_INITIAL (var_decl) = fold (build1 (CONVERT_EXPR, var_type, init)); DECL_INITIAL (var_decl) = fold_build1 (CONVERT_EXPR, var_type, init);
else else
DECL_INITIAL (var_decl) = NULL_TREE; DECL_INITIAL (var_decl) = NULL_TREE;
...@@ -583,9 +583,9 @@ tree_code_generate_return (tree type, tree exp) ...@@ -583,9 +583,9 @@ tree_code_generate_return (tree type, tree exp)
if (exp && TREE_TYPE (TREE_TYPE (current_function_decl)) != void_type_node) if (exp && TREE_TYPE (TREE_TYPE (current_function_decl)) != void_type_node)
{ {
setret = fold (build2 (MODIFY_EXPR, type, setret = fold_build2 (MODIFY_EXPR, type,
DECL_RESULT (current_function_decl), DECL_RESULT (current_function_decl),
fold (build1 (CONVERT_EXPR, type, exp)))); fold_build1 (CONVERT_EXPR, type, exp));
TREE_SIDE_EFFECTS (setret) = 1; TREE_SIDE_EFFECTS (setret) = 1;
TREE_USED (setret) = 1; TREE_USED (setret) = 1;
setret = build1 (RETURN_EXPR, type, setret); setret = build1 (RETURN_EXPR, type, setret);
...@@ -661,9 +661,8 @@ tree_code_get_expression (unsigned int exp_type, ...@@ -661,9 +661,8 @@ tree_code_get_expression (unsigned int exp_type,
case EXP_ASSIGN: case EXP_ASSIGN:
gcc_assert (op1 && op2); gcc_assert (op1 && op2);
operator = MODIFY_EXPR; operator = MODIFY_EXPR;
ret1 = fold (build2 (operator, void_type_node, op1, ret1 = fold_build2 (operator, void_type_node, op1,
fold (build1 (CONVERT_EXPR, TREE_TYPE (op1), fold_build1 (CONVERT_EXPR, TREE_TYPE (op1), op2));
op2))));
break; break;
...@@ -682,9 +681,9 @@ tree_code_get_expression (unsigned int exp_type, ...@@ -682,9 +681,9 @@ tree_code_get_expression (unsigned int exp_type,
/* Expand a binary expression. Ensure the operands are the right type. */ /* Expand a binary expression. Ensure the operands are the right type. */
binary_expression: binary_expression:
gcc_assert (op1 && op2); gcc_assert (op1 && op2);
ret1 = fold (build2 (operator, type, ret1 = fold_build2 (operator, type,
fold (build1 (CONVERT_EXPR, type, op1)), fold_build1 (CONVERT_EXPR, type, op1),
fold (build1 (CONVERT_EXPR, type, op2)))); fold_build1 (CONVERT_EXPR, type, op2));
break; break;
/* Reference to a variable. This is dead easy, just return the /* Reference to a variable. This is dead easy, just return the
...@@ -697,7 +696,7 @@ tree_code_get_expression (unsigned int exp_type, ...@@ -697,7 +696,7 @@ tree_code_get_expression (unsigned int exp_type,
if (type == TREE_TYPE (op1)) if (type == TREE_TYPE (op1))
ret1 = build1 (NOP_EXPR, type, op1); ret1 = build1 (NOP_EXPR, type, op1);
else else
ret1 = fold (build1 (CONVERT_EXPR, type, op1)); ret1 = fold_build1 (CONVERT_EXPR, type, op1);
break; break;
case EXP_FUNCTION_INVOCATION: case EXP_FUNCTION_INVOCATION:
...@@ -705,9 +704,10 @@ tree_code_get_expression (unsigned int exp_type, ...@@ -705,9 +704,10 @@ tree_code_get_expression (unsigned int exp_type,
{ {
tree fun_ptr; tree fun_ptr;
TREE_USED (op1) = 1; TREE_USED (op1) = 1;
fun_ptr = fold (build1 (ADDR_EXPR, fun_ptr = fold_build1 (ADDR_EXPR,
build_pointer_type (TREE_TYPE (op1)), op1)); build_pointer_type (TREE_TYPE (op1)), op1);
ret1 = build3 (CALL_EXPR, type, fun_ptr, nreverse (op2), NULL_TREE); ret1 = fold_build3 (CALL_EXPR, type, fun_ptr, nreverse (op2),
NULL_TREE);
} }
break; break;
...@@ -738,8 +738,8 @@ tree_code_add_parameter (tree list, tree proto_exp, tree exp) ...@@ -738,8 +738,8 @@ tree_code_add_parameter (tree list, tree proto_exp, tree exp)
{ {
tree new_exp; tree new_exp;
new_exp = tree_cons (NULL_TREE, new_exp = tree_cons (NULL_TREE,
fold (build1 (CONVERT_EXPR, TREE_TYPE (proto_exp), fold_build1 (CONVERT_EXPR, TREE_TYPE (proto_exp),
exp)), NULL_TREE); exp), NULL_TREE);
if (!list) if (!list)
return new_exp; return new_exp;
return chainon (new_exp, list); return chainon (new_exp, list);
......
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