[LLVMdev] Calling C++ from LLVM Asm via JIT

samuraileumas at yahoo.com samuraileumas at yahoo.com
Tue May 5 12:06:26 PDT 2009


I'm helping to write a parser generator that uses LLVM bitcode as its destination type.  Unlike most parser generators, it's written in C++ and is interpreted.  The "actions" defined in it are to be written in LLVM Assembly.

In order to support symbol table lookups, there is a function call to a C++ library, saved as bitcode and loaded to a module at startup, that must be JITed while the parser generator parses.  The signature of all of these immediately executed actions is a boolean output indicating whether the lookup failed or not.  All other information handled by the subroutine is done via a global stack defined in the startup code.

Does the name-mangling scheme of LLVM-GCC affect global functions in my library and can they be called without a C binding?  If not, how hard is it to write a C binding for a C++ function?

--Samuel Crow


More information about the llvm-dev mailing list