llvm pass INITIALIZE

Hello everyone,

Till now I have succesfully running passes using RegisterPass template. I have encountered a segfault in my pass.

Assertion `AA && “AA didn’t call InitializeAliasAnalysis in its run method!”’ failed.

Then, I tried to use INITIALIZE_PASS_XXXX or INITIALIZE_AG_PASS template, together with *llvm::createMyMemDepPrinter() and initializeMemDepPrinterPass(*PassRegistry::getPassRegistry()) methods. Therefore, I got two compilation errors:

MyMemDepPrinter.cpp:101:1: error: ‘void llvm::initializeMyMemDepPrinterPass(llvm::PassRegistry&)’ should have been declared inside ‘llvm’
MyMemDepPrinter.cpp:104:43: error: ‘llvm::FunctionPass* llvm::createMyMemDepPrinter()’ should have been declared inside ‘llvm’

So I added (void) llvm::createMyMemDepPrinter();to LinkAllPasses.h. initializeMyMemDepPrinterPass I don’t know yet where to add (maybe in a Analysis.cpp file).

However, I don’t know how to compile only those modified files and not the entire LLVM. I don’t think that is such a good idea to compile “by hand” using clang.

Can you tell me if this is the way I can solve the segfault and how do I do it?

Hi Alexandru,

Hello everyone,

Till now I have succesfully running passes using RegisterPass template. I have
encountered a segfault in my pass.

      Assertion `AA && "AA didn't call InitializeAliasAnalysis in its run
method!"' failed.

Then, I tried to use INITIALIZE_PASS_XXXX or INITIALIZE_AG_PASS template,
together with `*llvm::createMyMemDepPrinter()` and
`initializeMemDepPrinterPass(*PassRegistry::getPassRegistry())` methods.
Therefore, I got two compilation errors:

     MyMemDepPrinter.cpp:101:1: error: ‘void
llvm::initializeMyMemDepPrinterPass(llvm::PassRegistry&)’ should have been
declared inside ‘llvm’
     MyMemDepPrinter.cpp:104:43: error: ‘llvm::FunctionPass*
llvm::createMyMemDepPrinter()’ should have been declared inside ‘llvm’

maybe this is telling you that you should have written your pass like this:

namespace llvm {

    ... your stuff here...

}

Ciao, Duncan.