[LLVMdev] Using LLVM for a dynamically typed language
ejones at uwaterloo.ca
Thu Apr 21 08:54:37 PDT 2005
On Thu, 2005-21-04 at 11:34 -0400, Vyacheslav Akhmechet wrote:
> I disagree. If I could push a bunch of arguments on a stack (or
> specify a list of arguments, etc.) and just use a "call" instruction
> with a pointer to a memory address I wouldn't run into this problem.
> This is a specific challenge with LLVM because it is strictly typed.
Ah! Right. You can't manually construct a function call on the stack
with LLVM. However, an alternative worth considering would be to use
varargs functions. This would basically compile to native code that just
stuffs a bunch of things on the stack.
As in your example, the function itself knows the number and type of
parameters that are expected. Before executing the "body" of the
function, it can verify that things are being passed as expected and
raise an exception if the are not.
This is basically similar to Chris's suggestion of using a structure to
pass the arguments, except you don't actually need to construct the
More information about the llvm-dev