[all-commits] [llvm/llvm-project] 7480ef: [Tablegen] Collect all global state into one manag...

River Riddle via All-commits all-commits at lists.llvm.org
Mon Nov 8 17:25:09 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7480efd6f08f4f06b5786f5cd5102a0a832ab68f
      https://github.com/llvm/llvm-project/commit/7480efd6f08f4f06b5786f5cd5102a0a832ab68f
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-11-09 (Tue, 09 Nov 2021)

  Changed paths:
    M llvm/include/llvm/TableGen/Record.h
    M llvm/lib/TableGen/Record.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list