Compiler construction llvm中的def使用链

Compiler construction llvm中的def使用链,compiler-construction,llvm,Compiler Construction,Llvm,我在LLVM中通过以下代码提取Def_使用链: 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 <&l

我在LLVM中通过以下代码提取Def_使用链:

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";
  }
for(Value::use_iterator i=F->use_begin(),e=F->use_end();i!=e;++i)
if(指令*Inst=dyn_cast(*i)){

errs()只需确定哪个指令使用了您的值F以及如何使用。例如,如果使用的是load或store instr,则可以检查指令的操作数以检查F是否用作地址等