[LLVMdev] Vtables for non c++ languages

Samuel Crow samuraileumas at yahoo.com
Thu May 12 09:34:03 PDT 2011


Hello Timothy,

If you are basing your language on the Clang source base then it will be able to do VTables.  If you're basing it on LLVM by itself, there are no intrinsics for doing VTables.  You just have to do a Load on the VPtr in your class, GetElementPtr on the array pointed to by the VPtr, and then execute the method pointer you just retrieved.

I hope this helps you,

--Sam Crow


>________________________________
>From: Timothy Baldridge <tbaldridge at gmail.com>
>To: llvmdev at cs.uiuc.edu
>Sent: Wednesday, May 11, 2011 10:54 PM
>Subject: [LLVMdev] Vtables for non c++ languages
>
>
>I'm working on implementing a simple functional language in LLVM. It's statically typed, but I'd like to a have some simple multimethods involved. Does LLVM have some intrinsics for handling something like C++ vtables? Or do I need to implement my own way of handling single-dispatch functions?
>
>Thanks,
>
>Timothy
>




More information about the llvm-dev mailing list