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

Chapter 7. The Just-in-Time Compiler

The LLVM Just-in-Time (JIT) compiler is a function-based dynamic translation engine. To understand what a JIT compiler is, let's go back to the original term. This term comes from Just-in-Time manufacturing, a business strategy where factories make or buy supplies on demand instead of working with inventories. In compilation, this analogy suits well because the JIT compiler does not store the program binaries on the disk (the inventory) but starts compiling program parts when you need them, during runtime. Despite the success of the business jargon, you might stumble upon other names as well, such as late or lazy compilation.

An advantage of the JIT strategy comes from knowing the precise machine and microarchitecture that the program will run on. This grants the JIT system the ability to tune code to your particular processor. Furthermore, there are compilers that will only know their input at runtime, in which case there is no other option besides implementing...