Re: Compute all gimple statements in which a var is used
On April 5, 2016 5:03:54 PM GMT+02:00, Jeff Lawwrote: >On 04/05/2016 08:59 AM, Cristina Georgiana Opriceana wrote: >> On Mon, Mar 28, 2016 at 10:55 PM, Richard Biener >> wrote: >>> On March 28, 2016 7:23:26 PM GMT+02:00, Cristina Georgiana Opriceana > wrote: Hello, In order to compute all the statements where a variable is used, is >it enough to rely on the SSA analysis? I tried to do something like >this: FOR_EACH_LOCAL_DECL (cfun, i, var) { for (unsigned int i = 0; i < num_ssa_names; i++) { if (ssa_name(i) && SSA_NAME_VAR (ssa_name(i)) == var) { tree ssa_node = ssa_name(i); FOR_EACH_IMM_USE_FAST (use_op, imm_iter, ssa_node) >{ gimple * use_stmt = USE_STMT(use_op); ... } >>> >>> No, you'll miss variables not in SSA form. >>> >> >> Could you give me more details on this or maybe some reading >material? >> As far as I understand, all the VAR_DECL, PARAM_DECL and RESULT_DECL >> will be in SSA form. >Only non-addressable _DECL nodes will be in SSA form. > >ie, arrays, or objects which have had their address taken will not be >in >SSA form. All aggregates will not be in SSA form. Richard. >jeff
Re: Compute all gimple statements in which a var is used
On 04/05/2016 08:59 AM, Cristina Georgiana Opriceana wrote: On Mon, Mar 28, 2016 at 10:55 PM, Richard Bienerwrote: On March 28, 2016 7:23:26 PM GMT+02:00, Cristina Georgiana Opriceana wrote: Hello, In order to compute all the statements where a variable is used, is it enough to rely on the SSA analysis? I tried to do something like this: FOR_EACH_LOCAL_DECL (cfun, i, var) { for (unsigned int i = 0; i < num_ssa_names; i++) { if (ssa_name(i) && SSA_NAME_VAR (ssa_name(i)) == var) { tree ssa_node = ssa_name(i); FOR_EACH_IMM_USE_FAST (use_op, imm_iter, ssa_node) { gimple * use_stmt = USE_STMT(use_op); ... } No, you'll miss variables not in SSA form. Could you give me more details on this or maybe some reading material? As far as I understand, all the VAR_DECL, PARAM_DECL and RESULT_DECL will be in SSA form. Only non-addressable _DECL nodes will be in SSA form. ie, arrays, or objects which have had their address taken will not be in SSA form. jeff
Re: Compute all gimple statements in which a var is used
On Mon, Mar 28, 2016 at 10:55 PM, Richard Bienerwrote: > On March 28, 2016 7:23:26 PM GMT+02:00, Cristina Georgiana Opriceana > wrote: >>Hello, >> >>In order to compute all the statements where a variable is used, is it >>enough to rely on the SSA analysis? I tried to do something like this: >> >>FOR_EACH_LOCAL_DECL (cfun, i, var) { >>for (unsigned int i = 0; i < num_ssa_names; i++) { >>if (ssa_name(i) && SSA_NAME_VAR (ssa_name(i)) == var) { >>tree ssa_node = ssa_name(i); >>FOR_EACH_IMM_USE_FAST (use_op, imm_iter, ssa_node) { >>gimple * use_stmt = USE_STMT(use_op); >>... >>} > > No, you'll miss variables not in SSA form. > Could you give me more details on this or maybe some reading material? As far as I understand, all the VAR_DECL, PARAM_DECL and RESULT_DECL will be in SSA form. Thanks, Cristina > Richard. > >>Thanks, >>Cristina > >
Re: Compute all gimple statements in which a var is used
On March 28, 2016 7:23:26 PM GMT+02:00, Cristina Georgiana Opriceanawrote: >Hello, > >In order to compute all the statements where a variable is used, is it >enough to rely on the SSA analysis? I tried to do something like this: > >FOR_EACH_LOCAL_DECL (cfun, i, var) { >for (unsigned int i = 0; i < num_ssa_names; i++) { >if (ssa_name(i) && SSA_NAME_VAR (ssa_name(i)) == var) { >tree ssa_node = ssa_name(i); >FOR_EACH_IMM_USE_FAST (use_op, imm_iter, ssa_node) { >gimple * use_stmt = USE_STMT(use_op); >... >} No, you'll miss variables not in SSA form. Richard. >Thanks, >Cristina