llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.13k stars 12.02k forks source link

How to add c++ function to LLJIT? #55

Closed lanistor closed 4 years ago

lanistor commented 4 years ago

There is no addGlobalMapping in LLJIT, i found InProcessMemoryManager, but there is no demo to explain it, and also lack of docs.

lhames commented 4 years ago

Hi vifird. You should use LLJIT::defineAbsolute instead.

lanistor commented 4 years ago

@lhames Thanks a lot.

lanistor commented 4 years ago

@lhames And how to use it? how to get JITEvaluatedSymbol of c++ function? I cannot find any example in source code or stackoverflow.

lhames commented 4 years ago

defineAbsolute is just a wrapper for the absoluteSymbols function, which is documented in https://llvm.org/docs/ORCv2.html

lanistor commented 4 years ago

@lhames And i got another problem https://github.com/llvm/llvm-project/issues/81