expr *e = static_cast<expr *> (op);
id_base *id = e->operation;
unsigned n_ops = e->ops.length ();
+ unsigned n_braces = 0;
for (unsigned i = 0; i < n_ops; ++i)
{
"if ((TREE_CODE (%s) == SSA_NAME\n",
child_opname);
fprintf_indent (f, indent,
- " || is_gimple_min_invariant (%s))\n",
+ " || is_gimple_min_invariant (%s)))\n",
child_opname);
- fprintf_indent (f, indent,
- " && (%s = do_valueize (valueize, %s)))\n",
- child_opname, child_opname);
fprintf_indent (f, indent,
" {\n");
indent += 4;
+ n_braces++;
+ fprintf_indent (f, indent,
+ "%s = do_valueize (valueize, %s);\n",
+ child_opname, child_opname);
continue;
}
else
"tree %s = gimple_call_arg (def, %u);\n",
child_opname, i);
fprintf_indent (f, indent,
- "if ((%s = do_valueize (valueize, %s)))\n",
+ "%s = do_valueize (valueize, %s);\n",
child_opname, child_opname);
- fprintf_indent (f, indent, " {\n");
- indent += 4;
}
/* While the toplevel operands are canonicalized by the caller
after valueizing operands of sub-expressions we have to
}
}
- return n_ops;
+ return n_braces;
}
/* Generate GENERIC matching code for the decision tree operand. */
fprintf_indent (f, indent,
"case SSA_NAME:\n");
fprintf_indent (f, indent,
- " if (do_valueize (valueize, %s) != NULL_TREE)\n",
+ " if (gimple *def_stmt = get_def (valueize, %s))\n",
kid_opname);
fprintf_indent (f, indent,
" {\n");
- fprintf_indent (f, indent,
- " gimple *def_stmt = SSA_NAME_DEF_STMT (%s);\n",
- kid_opname);
-
indent += 6;
if (exprs_len)
{
do_valueize (tree (*valueize)(tree), tree op)
{
if (valueize && TREE_CODE (op) == SSA_NAME)
- return valueize (op);
+ {
+ tree tem = valueize (op);
+ if (tem)
+ return tem;
+ }
return op;
}
+/* Helper for the autogenerated code, get at the definition of NAME when
+ VALUEIZE allows that. */
+
+inline gimple *
+get_def (tree (*valueize)(tree), tree name)
+{
+ if (valueize && ! valueize (name))
+ return NULL;
+ return SSA_NAME_DEF_STMT (name);
+}
+
/* Routine to determine if the types T1 and T2 are effectively
the same for GIMPLE. If T1 or T2 is not a type, the test
applies to their TREE_TYPE. */