I added a function in the pass phase and did some initialization, which I wanted to execute before main was called. In c++ I can do this by setting _attribute(constructor). In pass I want to do this by addfnattr, but I don’t seem to have constructor.
FunctionType *Ty = FunctionType::get(Type::getVoidTy(*Ctx), false);
static Function* new_func = llvm::Function::Create(Ty, Function::ExternalLinkage, "new_func", M);
fpconstructor.addFnAttr(Attribute::Constructor);