Add a pass to opt

Dear there,

What I was trying to do is to create my own library in lib/Transform
folder and compile it into an LLVM library. And use opt to invoke that
the pass in my library by:
opt -mypass <*.bc>
I copied the CMakeList and LLVMBuild from lib/Transform/ObjCARC.
I managed to add my pass in LinkAllPasses.h and InitializePasses.h and
compiled successfully.
However, opt does not recognize my pass (-help does not list it at all).

Can anyone point me a possible way to add a built-in pass for opt?


Hi Xiaochu,

There is one more step. You need to call initializeYourPassNamePass function in opt.cpp.