[clang] [llvm] [DataLayout] Introduce sentinel pointer value (PR #131557)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 17 08:39:59 PDT 2025
================
@@ -3143,7 +3143,10 @@ as follows:
specified, the default index size is equal to the pointer size. All sizes
are in bits. The address space, ``n``, is optional, and if not specified,
denotes the default address space 0. The value of ``n`` must be
- in the range [1,2^24).
+ in the range [1,2^24). The fifth parameter ``<sentinel>`` specifies the
+ sentinel value of the pointer for the corresponding address space. It
+ currently accepts two values: ``0`` for an all-zero value and ``f`` for a
+ full-bit set value. The default sentinel pointer value is all-zero.
----------------
shiltian wrote:
> We also should be able to specify the default for unlisted address spaces (I thought the old PR had that part implemented?)
The implementation has it set to 0 at the moment by default if nothing is specified. I will mention this here.
> I'm also not sure if we should just allow an arbitrary bit pattern here.
We could extend it in the future IMHO. There is nothing practical in the upstream use. There is indeed one comment used in downstream in the RFC mentioned arbitrary bit for nullptr.
> This also should define what the sentinel pointer means. Also clarify how this interacts with null_pointer_is_valid and the various flavors of nonnull
I'll resolve them next.
https://github.com/llvm/llvm-project/pull/131557
More information about the llvm-commits
mailing list