How to figure out if particular LLVM instruction depends on the other?

▼魔方 西西 提交于 2019-12-12 12:11:55

问题


I'm trying to write an LLVM optimization pass. And I need a way to determine if one LLVM instruction affects the other (or depends on the other).

These dependencies can have different nature:

  1. first instruction creates a value, the other uses it as operand
  2. first instructions writes to memory location, the other reads from there
  3. other possibilities?

In short, first instruction must always be executed before the other in order to preserve code correctness. Three-way answer (depends, may depend, doesn't depend) will also do.

I understand that I can use use-def chains to find dependencies of type 1, and AliasAnalysis can help me with dependencies of type 2. But I'm afraid there can be other dependency types...

Does LLVM provide any general mechanism for that?

来源:https://stackoverflow.com/questions/9376958/how-to-figure-out-if-particular-llvm-instruction-depends-on-the-other

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!