[LLVMdev] First class function pointers

Jon Harrop jon at ffconsultancy.com
Thu Feb 5 15:42:58 PST 2009


Unless I am mistaken, LLVM barfs if I try to pass an LLVM function to another 
function as an argument because functions are second class. However, if I 
const bitcast the LLVM function to a function pointer when it is defined then 
I can use that as a first-class function pointer. In particular, I can invoke 
it directly by emitting a "call" without having to cast it back beforehand.

Is that correct and, if so, why are functions not handled as first-class 
function pointers by default?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-dev mailing list