[all-commits] [llvm/llvm-project] 5f1547: [JITLink] Add convenience methods for creating blo...

lhames via All-commits all-commits at lists.llvm.org
Tue Oct 18 16:26:01 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5f154795efc999cb0b6c15e82bbdf55ec15d1cac
      https://github.com/llvm/llvm-project/commit/5f154795efc999cb0b6c15e82bbdf55ec15d1cac
  Author: Lang Hames <lhames at gmail.com>
  Date:   2022-10-18 (Tue, 18 Oct 2022)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
    M llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp

  Log Message:
  -----------
  [JITLink] Add convenience methods for creating block readers / writers.

This saves clients some boilerplate compared to setting up the readers and
writers manually.

To obtain a BinaryStreamWriter / BinaryStreamReader for a given block, B,
clients can now write:

auto Reader = G.getBlockContentReader(B);

and

auto Writer = G.getBlockContentWriter(B);

The latter will trigger a copy to mutable memory allocated on the graph's
allocator if the block is currently marked as backed by read-only memory.

This commit also introduces a new createMutableContentBlock overload that
creates a block with a given size and zero-filled content (by default --
passing false for the ZeroInitialize bypasses initialization entirely).
This overload is intended to be used with getBlockContentWriter above when
creating new content for the graph.




More information about the All-commits mailing list