Creating new variable in tree level

Richard Guenther richard.guenther@gmail.com
Tue Jun 12 14:59:00 GMT 2007


On 6/12/07, Revital1 Eres <ERES@il.ibm.com> wrote:
>
> Hello,
>
> I appreciate your help in figuring what is considered a valid sequence
> of operations for creating a new variable in the tree level.
>
> Is the following sequence OK -
>
>  tmp_var = create_tmp_var (type, "_new_");
>  add_referenced_tmp_var (tmp_var);
>  mark_sym_for_renaming (tmp_var);
>
> Or should I also use ssa functions as follows:
>
> temp = create_tmp_var (TREE_TYPE (expr), "pretmp");
> add_referenced_tmp_var (temp);

> newexpr = build (MODIFY_EXPR, TREE_TYPE (expr), temp, newexpr);
> name = make_ssa_name (temp, newexpr);
> TREE_OPERAND (newexpr, 0) = name;

you need an SSA_NAME to assign to in this case, using mark_sym_for_renaming
does defer this to later so you can use tmp_var in the MODIFY_EXPR.  The
second form is prefered.

> tsi_link_after (&tsi, newexpr, TSI_CONTINUE_LINKING);

That's unrelated and just inserts the MODIFY_EXPR.

Richard.



More information about the Gcc mailing list