0

I have two questions:

Part 1.

I am implementing common subexpression elimination. For that, I am planning to write two passes. First pass (CSDetectPass) will detect the common subexpressions. Second pass (CSEliminationPass) will be eliminating those redundancies. My detection pass is ready, Now I want to access it from the eliminating pass.

How can I do that?

This explains about the pass interactions. But I am facing some difficulties in relating this with my implementation.

I need to know how to connect these passes and how to access the data passed by the first pass with the help of some examples.

Part 2.

I want to scan input program twice using LLVM code. After one successful execution of runOnFunction() the entire input program code will be scanned once. What should I do if I want to go through each and every program statements again ?

AKA
  • 5,479
  • 4
  • 22
  • 36
  • 2
    Look at this http://stackoverflow.com/questions/9333726/how-do-i-use-an-exisiting-function-pass-from-my-llvm-pass – Chirag Patel Mar 10 '16 at 06:10
  • @lazyCoder I saw that question. But it is explained as how to use a built-in pass by including some header files and all. But in my case, I am using my own pass. And there is no explanation on how to use/access the data passed by the first pass. – AKA Mar 10 '16 at 08:16
  • can you post some of your code where you are getting issue? as per http://llvm.org/docs/WritingAnLLVMPass.html#the-getanalysis-and-getanalysisifavailable-methods getAnalysis<> method will give you access to the pass that you declared (in your case CSDetectPass) and returns a reference to that pass. – Chirag Patel Mar 10 '16 at 08:28
  • I didn't implement that. Because I don't know how to. Using that reference how can I access data collected in my detection pass ? – AKA Mar 10 '16 at 12:12

0 Answers0