Open
Description
Consider the protosnirk program
fn main()
// empty
fn foo()
let bar = main
We emit
%load_main = load void (), void ()* @main
%bar = alloca void main
for the line let bar = main
.
From an LLVM perspective, we assume all variables can have alloca
s created for them and that they can be loaded from them. So we would need to handle the case of variable-sized types or a routine for determining the size of an alloca
.
From a usability standpoint, C is the only language that I can think of that supports function pointers but not closures, so it might be a good idea to wait until we have those first...