Stream: cranelift

Topic: What's the semantic meaning of `Variable` and `def_var`?


view this post on Zulip Ivan Chinenov (Mar 27 2024 at 17:23):

My language doesn't really have traditional variables and is conceptually stack-based. So can I safely ignore def_var and just work with a manually managed stack of Values?

view this post on Zulip bjorn3 (Mar 27 2024 at 17:27):

Yes. def_var/use_var are helpers to construct SSA form. You are free to not use them if you don't need them.

view this post on Zulip Ivan Chinenov (Mar 27 2024 at 18:32):

How do I set the name of a function? Can't seem to find any relevant functions on FunctionBuilder or ctx.func.

view this post on Zulip Ivan Chinenov (Mar 27 2024 at 18:34):

Sorry i'm dumb, that's what module.declare_function is for Or maybe it isn't, since there's still no symbol named _start in the .o file.

view this post on Zulip Ivan Chinenov (Mar 27 2024 at 18:53):

Oh, i see. I first declare the function, then define it (i assume AFTER i'm done compiling it)

view this post on Zulip bjorn3 (Mar 28 2024 at 09:14):

After you have generated clif ir for the function you define it. The defining itself will compile it down to machine code.


Last updated: Dec 23 2024 at 12:05 UTC