如何使用我的LLVM - 传递的exisiting函数传递? [英] How do I use an exisiting function pass from my LLVM - pass?

查看:198
本文介绍了如何使用我的LLVM - 传递的exisiting函数传递?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用LLVM,我很困惑如何使用不同的已经存在的传递自己的传递?确切地说,我的程序需要Dominance Frontier计算任何给定的指令。 LLVM已经具有作为函数传递实现的Dominance函数类。

I have been using LLVM and I was confused how to use a different already present pass from my own pass ? Precisely my program needs Dominance Frontier Calculation for any given instruction. LLVM already has the Dominance function Class that is implemented as a function pass. How can i invoke it/make use of it in my Module Pass ?

推荐答案

警告:我没有真实的经验,不正确或过时。 (它主要基于过时的LLVM源: version 1.3 。)

WARNING: I have no real experience and answer may be incorrect or outdated. (it is based largely on outdated LLVM sources: version 1.3.)

添加包含:

#include "llvm/Analysis/DominanceFrontier.h"

(如果没有实现):

virtual void getAnalysisUsage(AnalysisUsage &AU) const { }

并将其放入:

 AU.addRequired<DominanceFrontier>();


$ b <

Then, in your class runOnFunction method:

 DominanceFrontier *DF = &getAnalysis<DominanceFrontier>();

之后,您可以使用:

    BasicBlock *BB = /* some BB */;
    DominanceFrontier::iterator DFI = DF->find(BB);

这篇关于如何使用我的LLVM - 传递的exisiting函数传递?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆