Apply optimization passes with short names

Hi all,

I apologize for bothering you, but even after many efforts, I can't solve my issue.

There is a great command-line optimizer tool, "opt", which can apply optimization passes to the IR code :
opt -mem2reg -S myFile.ll -o myFile.ll

With that tool, an optimization pass is referred as its "short name" (mem2reg), and these passes are pretty well documented, for instance here: http://llvm.org/docs/Passes.html

However, if I want to apply the same optimization pass in a C++ code, I have to call a specific function, such as:
myPassManager->add(createPromoteMemoryToRegisterPass());

The link between the "mem2reg" short name and the "createPromoteMemoryToRegister" function is pretty obvious, but not completely straightforward.
Is there any dictionary, or at least a comprehensive documentation about these translations?

Thanks a lot in advance!

Have a great day,

AD

Adrien Dégrange
Recherche & Développement

If you look for all the calls to the INITIALIZE_PASS_BEGIN macro in LLVM (all in lib/{Transforms,Analysis}/**/*.cpp) you should find all the short/long name pairs, I think.