Accessing/Loading a new pass

Ok. So I took the source code from 1.5 for the LowerConstantExprs
pass and (hopefully) corrected all the bitrot. It now compiles. But
opt doesn't see it (when I run Release/bin/opt --help it doesn't show
up). So, I copy the Transform/Hello directory and compile it as a
dynamically loaded pass. When I run Release/bin/opt -load
Release/lib/LLVMLowerConstExps --help it shows up. Ok. Now I run
make install. Now if I run opt -load Release/lib/LLVMLowerConstExps I
get an error message. Specifically, I get:

Error opening 'lib/LLVMLowerConst': Can't open :lib/LLVMLowerConst:
dlopen(lib/LLVMLowerConst.0.dylib, 9): Symbol not found:
__ZN4llvm12FunctionPass11runOnModuleERNS_6ModuleE
  Referenced from:
/Users/benchambers/Documents/research/llvm/llvm-2.0/Release/lib/LLVMLowerConst.0.dylib
  Expected in: flat namespace

  -load request ignored.

What's going? I'd like to get it to be built into opt (so I'd like to
figure out why it wasn't showing up when I had it in
Transforms/Scalar), but lacking that I'd like to figure out how to get
it to load into opt after I install opt.

Thanks for your help,
Ben Chambers

Ok. So I took the source code from 1.5 for the LowerConstantExprs
pass and (hopefully) corrected all the bitrot. It now compiles. But
opt doesn't see it (when I run Release/bin/opt --help it doesn't show
up). So, I copy the Transform/Hello directory and compile it as a
dynamically loaded pass. When I run Release/bin/opt -load
Release/lib/LLVMLowerConstExps --help it shows up. Ok. Now I run
make install. Now if I run opt -load Release/lib/LLVMLowerConstExps I
get an error message. Specifically, I get:

I'd suggest adding it back to the scalar directory. Then make sure to add it to include/llvm/LinkAllPasses.h

-Chris

Error opening 'lib/LLVMLowerConst': Can't open :lib/LLVMLowerConst:
dlopen(lib/LLVMLowerConst.0.dylib, 9): Symbol not found:
__ZN4llvm12FunctionPass11runOnModuleERNS_6ModuleE
Referenced from:
/Users/benchambers/Documents/research/llvm/llvm-2.0/Release/lib/LLVMLowerConst.0.dylib
Expected in: flat namespace

-load request ignored.

What's going? I'd like to get it to be built into opt (so I'd like to
figure out why it wasn't showing up when I had it in
Transforms/Scalar), but lacking that I'd like to figure out how to get
it to load into opt after I install opt.

Thanks for your help,
Ben Chambers
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris

Ah, I was missing that include/llvm/LinkAllPasses.h change. Thanks!
Now I have it working, except for the fact that it doesn't seem to
generate fresh names for things. Or if it does, they're the empty
string (I suspect it is the latter, since when I create the new
instruction the empty string is passed in for the name of the
instruction). Is there some way to get a new name (like tmp155) and
have a high degree of confidence that it is actually unique?

-- Ben

Ah, I was missing that include/llvm/LinkAllPasses.h change. Thanks!
Now I have it working, except for the fact that it doesn't seem to
generate fresh names for things. Or if it does, they're the empty
string (I suspect it is the latter, since when I create the new
instruction the empty string is passed in for the name of the
instruction). Is there some way to get a new name (like tmp155) and
have a high degree of confidence that it is actually unique?

Sure. Just give every name "tmp" and it will autounique them.

-Chris

Thanks! It seems to be working now. If anyone wants a copy of the
updated LowerConstantExpression pass, let me know.

-- Ben Chambers