Book Image

Getting started with LLVM core libraries

Book Image

Getting started with LLVM core libraries

Overview of this book

Table of Contents (17 chapters)
Getting Started with LLVM Core Libraries
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Getting to know the LLVM JIT engine basics


The LLVM JIT compiler is function-based because it is able to compile a single function at a time. This defines the granularity at which the compiler works, which is an important decision of a JIT system. By compiling functions on demand, the system will only work on the functions that are actually used in this program invocation. For example, if your program has several functions but you supplied wrong command-line arguments while launching it, a function-based JIT system will only compile the function that prints the help message instead of the whole program.

Note

In theory, we can push the granularity even further and compile only the traces, which are specific paths of the function. By doing this, you are already leveraging an important advantage of JIT systems: knowledge about which program paths deserve more compilation effort than others in a program invocation with a given input. However, the LLVM JIT system does not support trace-based compilation...