Upgrading to llvm-2.9

Hi,

Is the RegisterPass interface still supported, or do we have to use the INITIALIZE_PASS construct to register passes?

Thanks,
Arushi

namespace llvm {
class PassRegistry;
void initializeFooPass(PassRegistry&);
}

using namespace llvm;

namespace {
class Foo : public ModulePass {
public:
static char ID;
Foo() : ModulePass(ID) {
initializeFooPass(*PassRegistry::getPassRegistry());
}

bool runOnModule(Module& M) {
M.dump();
return false;
}
};
}

char Foo::ID = 0;
INITIALIZE_PASS(Foo, “foo”, “DUMP MODULE”, false, false)

I have the above pass written for llvm 2.9. When I load the module with opt, I get
Unknown command line argument ‘-foo’.

Am I missing some intialization step.

Thanks,
Arushi

Hi Arushi,

INITIALIZE_PASS(Foo, "foo", "DUMP MODULE", false, false)

INITIALIZE_PASS doesn't work with dynamically loaded passes. Check out
Hello.cpp in lib/Transforms/Hello/ to see how to do it.

Ciao, Duncan.