<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi, I'm learning to use llvm api to generate IR code, I got two good tutorials, <a href="https://llvm.org/docs/tutorial/">https://llvm.org/docs/tutorial/</a> and <a href="https://www.ibm.com/developerworks/library/os-createcompilerllvm1/index.html">https://www.ibm.com/developerworks/library/os-createcompilerllvm1/index.html</a>, but non of those showed how to implement a function pointer(or at least there is but I didn't find out). </div><div dir="ltr"><br></div><div>For example I got a c style code like this: </div><div><br></div><div><div>int foo(int i) {</div><div>  return ++i;</div><div>}</div><div><br></div><div>int (*p)(int);</div><div><br></div><div>int main() {</div><div>  p = foo;</div><div>  p(3);</div><div>}</div></div><div><br></div><div>I turn it into IR code and found the sytex of a function pointer is:</div><div>@p = global i32 (i32)* null, align 8</div><div>I tried play with llvm::PointerType but I cannot get the sytex, so could anyone teach me how to do this?</div></div></div></div></div></div>