TableGen: Introduce `llvm::TableGen::Emitter` to register backends
authorNAKAMURA Takumi <geek4civic@gmail.com>
Thu, 16 Feb 2023 23:24:07 +0000 (08:24 +0900)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 21 Mar 2023 07:21:27 +0000 (16:21 +0900)
commit4178ef43b2f12171639e3ef2bf02e5b7efd34688
treeaa08ded6209a0ff2e4aa8a2f085b49e3e56f6d05
parentf675ec6165ab6add5e57cd43a2e9fa1a9bc21d81
TableGen: Introduce `llvm::TableGen::Emitter` to register backends

`Opt(flag, func, desc)` registers an option into `Action`.

`OptClass<EmitterC>` is also available if `EmitterC(RK).run(OS)` is capable.

`Action` is defined as `ManagedStatic<cl::opt>` to guarantee to be created
when each registration of emitter is invoked.

`llvm::TableGenMain(argv0, MainFn)` invokes `Action` instead of `MainFn`

Differential Revision: https://reviews.llvm.org/D144351
llvm/docs/TableGen/BackGuide.rst
llvm/include/llvm/TableGen/TableGenBackend.h
llvm/lib/TableGen/Main.cpp
llvm/lib/TableGen/TableGenBackend.cpp
llvm/lib/TableGen/TableGenBackendSkeleton.cpp