Hi,

I have the code like:
  a_2 = 5;                         g1
  b_3 = 6;                         g2
  d_4 = a_2 + b_3;            g3

And I'd like to insert "tmp.globe = a_2" just after the definition of
a_2 (after g1), so that the code will be:

  a_2 = 5;                         g1
  tmp.globe = a_2;             inserted code
  b_3 = 6;                         g2
  d_4 = a_2 + b_3;            g3

This pass is with SSA form, and I write code like:

tree use = make_ssa_name (var, NULL);  //create a_11
/* Set the DEF_P (referred to a_2) to be the DEF of the newly created USE.  */
SET_DEF (def_p, use);

But this will invalidate the original USE-DEF chain,  where the a_11 defined
in g1 will never match the use in g3 of a_2, and the code will look like:

  a_11 = 5;                       g1
  tmp.globe = a_11;           inserted code
  b_3 = 6;                         g2
  d_4 = a_2 + b_3;            g3

It seems that I have to update all the use of the original a_2 again and set
the use to a_11. Is there some solutions that I don't have to update the
def-use chains manually?

Thanks,
Feng

Reply via email to