[PATCH] D137820: [MemoryBuffer] Allow optionally specifying desired buffer alignment

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 01:56:21 PST 2022


rriddle created this revision.
Herald added subscribers: bollu, hiraditya.
Herald added a project: All.
rriddle requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Underlying data may have requirements/expectations/etc. about
the run-time alignment. WritableMemoryBuffer currently uses
a 16 byte alignment, which works for many situations but not all.
Allowing a desired alignment makes it easier to reuse WritableMemoryBuffer
in situations of special alignment, and also removes a problem when
opening files with special alignment constraints. Large files generally
get mmaped, which has ~page alignment, but small files go through
WritableMemoryBuffer which has the much smaller alignment guarantee.

Depends on D137764 <https://reviews.llvm.org/D137764>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137820

Files:
  llvm/include/llvm/Support/MemoryBuffer.h
  llvm/lib/Support/MemoryBuffer.cpp
  llvm/unittests/Support/MemoryBufferTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137820.474693.patch
Type: text/x-patch
Size: 14481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221111/2de37fab/attachment.bin>


More information about the llvm-commits mailing list