I wrote a machine function pass to run with llc. But I get this error while building:
“/home/erdem/llvm/lib/CodeGen/CodeGen.cpp:80: error: undefined reference to ‘llvm::initializeNoopInserterPass(llvm::PassRegistry&)’”
NoopInserter is the name of my pass. I already added this line to InitializePasses.h: “void initializeNoopInserterPass(PassRegistry&);”.
Can anyone tell me what the problem is?
Thanks in advance,
The code probably misses the INITIALIZE_PASS macro, see bottom of BarrierNoopPass.cpp
INITIALIZE_PASS(BarrierNoop, “barrier”, “A No-Op Barrier Pass”,
I had INITIALIZE_PASS_BEGIN and INITIALIZE_PASS_END macros. I replaced them with INITIALIZE_PASS but I get the same error. If I understand correctly, I need to modify Passes.h, InitializePasses.h, and Codegen.cpp files to register my pass, right? Another question is: Is it necessary to have the createNoopInserterPass function?
Stupid question, was the source file added to CMakeLists.txt?