[LLVMdev] Programmatically converting LLVM IR to native code

Baris Aktemur baris.aktemur at ozyegin.edu.tr
Fri Sep 21 11:56:21 PDT 2012

On 20 Eyl 2012, at 12:57, Eli Friedman wrote:

> On Thu, Sep 20, 2012 at 2:42 AM, Baris Aktemur
> <baris.aktemur at ozyegin.edu.tr> wrote:
>> I am generating LLVM IR code and I would like to convert this IR code to
>> native code using the LLVM C++ API. This would be very similar to what's
>> done in the Kaleidoscope tutorial, but instead of relying on JIT
>> compilation, I'd like to emit native code -- the same native code that's
>> produced by llc, for instance.
>> I'm sure this is possible, but I wasn't able to find the resource I need.
>> Any help would be much appreciated.
> Have you looked at the source code for "llc" itself (in
> tools/llc/llc.cpp)?  The API you're looking for is
> TargetMachine::addPassesToEmitFile.
> -Eli

Thank you. I've started adapting this code.

-Baris Aktemur

More information about the llvm-dev mailing list