[LLVMdev] Running a pass

Chris Lattner sabre at nondot.org
Wed Aug 13 17:05:03 PDT 2003

> I assume that since each pass is in its own anonymous
> namespace, we cannot directly create a new pass object;
> looking at the code for 'opt' utility, it seems we need a
> PassInfo object, using which we create a new pass object.
> I tried the following code (which I wrote after looking at
> the code for bugpoint), but the list of passes seems to be
> empty:

Being in an anonymous namespace just means you cannot invoke the methods
of the pass directly.  Given a pointer to an object of that pass, however,
you can invoke virtual methods and otherwise use the pass.

To get a pointer to an instance of the mem2reg pass, just call
createPromoteMemoryToRegister(), declared in

> >I'm not sure what is causing this problem, if main is not even executing
> >yet, then it shouldn't matter what your main does.  :)
> This is apparently caused by the linking the 'ipo' library.
> I removed that from my Makefile, and it does not happen any
> more.

I'm not sure what could possibly cause this.  If you send me details
(off-list) I would be happy to look into it.



More information about the llvm-dev mailing list