How to create a Function type @x = external global void ()*


I’m trying to generate LLVM IR that looks like:

@x = external global void ()*

I’ve spent some time looking and staring at LLVM docs, but can’t go from:

@x = external global void ()

to the desired * notation

And therefore when I try to call it, it fails, because I’ve added the global mapping for x to be a pointer location where the function I’m calling resides.

Here is the IR today, and I’m guessing the @x() call would be changed to load and then call indirect or something.

define double @sum(double, double) {
call void @x()
%tmp = fadd double %0, %1
ret double %tmp

Help much appreciated.