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 ?