LLVMContext

This class manages the core “global” data of LLVM’s core infrastructure. We can use it to operate multiple, isolated instances of LLVM within the same address space.

LLVMContext provides isolation, every LLVM entity (Types, Values, Module..) belongs to an LLVMContext.

In Tiger Compiler we are only using one, and it represents a container of global state in LLVM, such as global type and constant uniquing tables.

As it is a class that opaquely owns and manages the data, we are not supposed to know what’s inside. The important point is to understand that we need to pass it to every function who needs it in LLVM-IR.

For more information about LLVM Context Class Implementation