LLVM, what is it and how can I use it for cross compiling

I read here and there about llvm, which can be used to ease the pain in assembling cross-platforms in C ++, I tried to read documents, but I did not understand how I can use it in real development development problems, can someone please explain to me in simple words, how can I use it?

+6
c ++ cross-platform llvm
source share
5 answers

A key concept of LLVM is the low-level "intermediate" representation (IR) of your program. This IR is roughly at the level of assembler code, but it contains more information to facilitate optimization.

The power of LLVM is based on its ability to defer the compilation of this intermediate representation to a specific target machine until the moment the code is supposed to run. A just-in-time (JIT) compilation approach can be used by an application to create the code that it needs before it is needed.

In many cases, you have additional information during the operation of the program that you execute at the head office, so the program can be greatly optimized.

To get started, you can compile C ++ - a program for one intermediate representation, and then compile it on several platforms from this IR.

You can also try the Kaleidoscope demo, which will help you create a new language without having to write a compiler, just write IR.

In mission-critical applications, an application can essentially write its own code that needs to be run, just before it runs.

+6
source share

Why don't you upgrade to LLVM and check out all the documentation there. They explain in detail what LLVM is and how to use it. For example, they have a Getting Started page.

+2
source share

LLVM, because its name speaks of a low-level virtual machine that has a code generator. If you want to compile it, you can use either gcc front end or clang , which is the c / C ++ compiler for LLVM, which still works.

+1
source share

It is important to note that a lot of information about the target comes from the system header files that you use when compiling. LLVM does not postpone resolving issues such as "pointer size" or "byte layout", so if you are compiling with 64-bit headers for the little-endian platform, you cannot use this LLVM source code to target a 32-bit assembly to large end output pater.

+1
source share

The book has a good chapter that explains everything: www.aosabook.org/en/llvm.html

+1
source share

All Articles