On Tue, Jun 27, 2023 at 11:36 AM Pierrick Philippe <pierrick.phili...@irisa.fr> wrote: > > Hi everyone, > > I'm trying to get the gimple * associated to the definition of a given > var_decl. > Basically, I am iterating over the locals of a function (through the > local_decls member) and I need to be able to get the gimple * of its > definition within the function's gimple_seq. > > Does any of you have an idea on how this could be achieved ?
You need to walk the body of the function looking for defining stmts. Note the VAR_DECL might be in SSA form in which case you can also walk all SSA names and check those whose SSA_NAME_VAR is the specific VAR_DECL. But then SSA names can "lose" their associated decks so when a variable is in SSA form the set of original assignments cannot always be recovered easily. Richard. > Thanks, > > Pierrick >