The whole use chain in llvm

I retrieve the Def_Use chain with the following code in LLVM:

for (Value::use_iterator i = F->use_begin(), e = F->use_end(); i != e; ++i)
  if (Instruction *Inst = dyn_cast<Instruction>(*i)) {
    errs() << "F is used in instruction:\n";
    errs() << *Inst << "\n";
  }

Now I want to distinguish between a register name or a memory variable that leads to this data dependency.

thank

+5
source share
1 answer

Just determine which instruction uses your F value and how. For instance. if Use loads or saves instr, you can check the operand of the instruction to see if F is used as an address, etc.

+3
source

All Articles