19

What is actually the LLVM Context? Is it the environment such as bitsize in which the code runs? What are the mwmbers of LLVMContext class? I went through http://llvm.org/docs/doxygen/html/classllvm_1_1LLVMContext.html . But Couldn't understand much.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
ViG
  • 455
  • 5
  • 8

1 Answers1

16

From the link you included:

This is an important class for using LLVM in a threaded context. It (opaquely) owns and manages the core "global" data of LLVM's core infrastructure, including the type and constant uniquing tables.

Since it says "opaquely" you're not supposed to know what it contains, what it does or what's used for. Just think of it as a reference to the core LLVM "engine" that you should pass to the various methods that require a LLVMContext.

edit: just to clarify: no, it doesn't contain things such as bitsize - those are defined in TargetData.

CAFxX
  • 28,060
  • 6
  • 41
  • 66
  • 1
    Normal llvm users may not need to know what it is, but language implementors may want to know what exactly `LLVMContext` is. – Jay Nov 18 '20 at 21:30
  • Technically speaking, if you're a language implementor you are only supposed to use the public interfaces exposed by LLVM core - and these are listed and documented in the link in the OP question. My answer, while definitely succinct, describes how to think of LLVMContext and gives a pointer to where the data OP is looking for actually is located. – CAFxX Dec 13 '20 at 03:14