Hi everyone,<div>I am writing a pass that finds all uses of global variables (my goal is to find the uses of strings, and strings are defined as global variables). So, I can iterate over global vars by </div><div>for(Module::global_iterator gi = M.global_begin(), gend = M.global_end(); gi != gend; ++gi) ......</div>
<div>But if I use its def-use chain</div><div>for(Value::use_iterator i = gi->use_begin(), e = F->use_end; i!=e; ++i) </div><div>it is not actually able to find its uses, as it gives <null> instructions!</div>
<div>I have even tried to iterate over instructions in the module, then find the use-def of each instruction</div><div>for(User::op_iterator I = theInstruction->op_begin(), E=theInstruction->op_end(); I!=E; ++I) </div>
<div>After it I have tried to check whether this "theInstruction" is one of global vars (one of the "gi"-s).</div><div>But that doesn't work either, as LLVM does not think that the global vars, which are used in an instruction, are operands of that instruction!</div>
<div>So anyway, how can I find the def-uses of global variables??</div><div>---Schuhmacher</div>