[PATCH] D122433: [Support] Add OpauqeDataStore
Chris Bieneman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 24 13:54:57 PDT 2022
beanz created this revision.
Herald added subscribers: dexonsmith, hiraditya, mgorny.
Herald added a project: All.
beanz requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
There are places in LLVM where data needs to be communicated between
layers that lack a good place to store the data. This leads to leaky
abstractions, or sometimes just using void*.
This data type can provide a type-safe alternative. The OpaqueDataStore
stores elements by type and can regurgitate them on demand. The object
holding the OpaqueDataStore requires no visibility to the types stored
within it, the classes for the stored data are only required to be
available at the points where the data is accessed.
I intend to use this in a subsequent patch to attach data to the
LLVMContext from inside the DirectX backend. The data being attached
should have the same lifetime as the LLVMContext, does not invalidate
(unless the context is destroyed), and should not be part of the IR
library.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122433
Files:
llvm/include/llvm/Support/OpaqueDataStore.h
llvm/lib/Support/CMakeLists.txt
llvm/lib/Support/OpaqueDataStore.cpp
llvm/unittests/Support/CMakeLists.txt
llvm/unittests/Support/OpaqueDataStoreTests.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122433.418037.patch
Type: text/x-patch
Size: 7446 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220324/d72dacbc/attachment.bin>
More information about the llvm-commits
mailing list