[Tablegen] Collect all global state into one managed static
Tablegen uses copious amounts of global state for uniquing various records. This was fine under the original vision where tablegen was a tool, and not a library, but there are various usages of tablegen that want to use it as a library. One concrete example is that downstream we have a kythe indexer for tablegen constructs that allows for IDEs to serve go-to-definition/references/and more. We currently (kind of hackily) keep the tablegen parts in a shared library that gets loaded/unloaded. This revision starts to remedy this by globbing all of the static state into a managed static so that they can at least be unloaded with llvm_shutdown. A better solution would be to feed in a context variable (much like how the IR in LLVM/MLIR do), but that is a more invasive change that can come later. Differential Revision: https://reviews.llvm.org/D108934
Loading
Please sign in to comment