Sai Prajeeth wrote:> Hi list,
>
> I am writing a pass that requires simplification, constant propagation
> and folding to be performed before my pass is run. How can i accomplish
> this?
For the most part, a pass can't demand that the IR have a certain shape
before it runs. Don't worry about that! This is a deliberate decision to
force a separation of concerns.
In your pass, focus on the task at hand and not other simplifications
and assume the other passes will have run first. To run your pass,
somebody will need to construct a PassManager and insert passes into it.
Maybe it's 'clang -O2' or 'opt' or some other program.
Supposing you run your pass with 'opt -mypass' then instead state that
you need to run 'opt -O2 -mypass' to ensure that your pass will get
optimized IR to start with.
Nick