[LLVMdev] how to write a local Pass Manager to control a few self-built passes

Chuck Zhao czhao at eecg.toronto.edu
Thu Oct 7 17:41:17 PDT 2010


My LLVM project has reached a point that the complexity and inter-pass 
dependency often cause circular dependencies using opt tool.

E.g.
I have the following individual/dependent/independent passes over opt:
-a:
-b:
-c:
-ab
-ac
-bc
...

I want to write a control pass (e.g., call it ABC pass) which can be 
used to precisely control the ordering of all my passes. When I say:
opt xyz.so -abc < input.bc > output.bc

It will actually create a pass manager, insert all individual passes, 
while precisely specifying the dependencies among them.
This way, I can avoid the circular dependency dead lock.
However, this (local) pass manager should still cooperate well with the 
rest of the LLVM system.

Could someone point me to a code sample, a tutorial section or a file 
currently under LLVM 2.7/2.8 release?


Thank you

Chuck





More information about the llvm-dev mailing list