Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有兴趣分析 C/C++ 程序的 CFG,其中 CFG 的节点包含 LLVM IR 指令。有没有办法利用 LLVM 来提取这个 CFG 的持久内存对象?我不想在编译器中实现传递;我希望 CFG 在我自己的程序中进行分析。
LLVM IR 内存表示适合 CFG 分析,因为所有基本块都已组织为图。在一个基本块中,指令序列是线性的。LLVM 中一些有趣的函数内 CFG 相关代码是:lib/Analysis/CFG.cpp和lib/Analysis/CFGPrinter.cpp
lib/Analysis/CFG.cpp
lib/Analysis/CFGPrinter.cpp