[PATCH] D108934: [Tablegen] Collect all global state into one managed static

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 30 12:06:20 PDT 2021


rriddle created this revision.
rriddle added reviewers: csigg, lattner.
Herald added subscribers: Chia-hungDuan, bollu, hiraditya.
rriddle requested review of this revision.
Herald added subscribers: llvm-commits, stephenneuendorffer.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108934

Files:
  llvm/include/llvm/TableGen/Record.h
  llvm/lib/TableGen/Record.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108934.369514.patch
Type: text/x-patch
Size: 25785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210830/f1010b50/attachment.bin>


More information about the llvm-commits mailing list