c++ - Static code generation using the LLVM API -


starting llvm module *mod containing ir: how use specific back-end generate target-specific assembler it? unfortunately kaleidoscope tutorial not detail on this. uses execution engine jit compile program (on build, target architecture), not select specific back-end generate target-specific assembler. neither llvm tutorials, not detailing on building static compiler, assume. thus, question can provide missing piece of information.

since want build static compiler, don't want use command line tools llc, etc. accomplish job. want use llvm api.

to make more concrete, let's start code:

llvmcontext &context = getglobalcontext(); smdiagnostic err; module *mod = parseirfile(argv[1], err, context); 

the filename (given 1st argument) parsed ir. let's skip optimization passes , create assembler specific back-end, e.g. ptx backend (available since version 3.2).

just in source code of tools/llc/llc.cpp. that, , it's pretty short , not hard understand. if have specific questions things don't understand, feel free ask.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -