[GSoC] remove unnecessary temporaries

Richard Biener richard.guenther@gmail.com
Tue Jun 24 10:20:00 GMT 2014


On Tue, Jun 24, 2014 at 10:53 AM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> Hi,
>    This patch attempts to generate temporaries only when required.
>
> I have changed generation of operand names. All children of an expr-node
> are assigned at expr-node itself.
> Names are generated as follows at expr-node:
> o<level><child-pos> = rhs;
> where level is level of the expr-node in decision tree.
> This is done by dt_operand::gen_opname.
>
> Names are referred to as follows at child-node:
> o<parent-level><pos>.
> This is done by dt_operand::get_name.
>
> To do this, I changed the type of indexes array in dt_simplify to
> array of dt_operand *, so that each element points to the
> decision-tree node, instead of storing it's level.

Thanks, I have applied the patch but changed

+             dt_node *temp = new dt_operand (dt_node::DT_OPERAND, c->what, 0);
+             elm = decision_tree::find_node (p->kids, temp);
+             free (temp);

to

              dt_operand temp (dt_node::DT_OPERAND, c->what, 0);
              elm = decision_tree::find_node (p->kids, &temp);

Richard.

> * genmatch.c (operand::gen_gimple_transform): Remove 2nd argument.
>     (predicate::gen_gimple_transform): Likewise.
>     (expr::gen_gimple_transform): Likewise.
>     (c_expr::gen_gimple_transform): Likewise.
>     (capture::gen_gimple_transform): Likewise.
>     (dt_simplify::indexes): Change type to array of dt_operand *
>     (dt_simplify::dt_simplify): change type of 3rd argument to dt_operand **
>     (dt_simplify::gen_gimple): Remove 2nd argument in call to
>
> .gen_gimple_transform()
>     (dt_operand::get_name): New member function.
>     (dt_operand::gen_opname): New member function.
>     (dt_operand::match_dop): New member.
>     (dt_operand::temps): Remove.
>     (dt_operand::temp_count): Likewise.
>     (dt_operand::m_level): Likewise.
>     (dt_operand::dt_operand): Change type of 2nd argument to dt_operand *
>     (dt_operand::gen_gimple): Call get_name for getting operand name.
>     (dt_operand::gen_gimple_expr_fn): Replace call to sprintf,
>        by get_name (opname).
>     (dt_operand::gen_gimple_expr_expr): Likwise.
>     (dt_operand::gen_generic_expr_expr): Likewise.
>     (dt_operand::gen_generic_expr_fn): Likewise
>     (decision_tree::insert_operand): Change type of 3rd argument to
> dt_operand**.
>     (dt_node::append_simplify): Likewise.
>
> Thanks and Regards,
> Prathamesh



More information about the Gcc-patches mailing list