[llvm] [RFC][DataLayout] Add null pointer value infrastructure (PR #183207)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 27 17:02:41 PDT 2026
================
@@ -95,6 +96,9 @@ class DataLayout {
bool HasExternalState;
// Symbolic name of the address space.
std::string AddrSpaceName;
+ /// The null pointer bit representation for this address space.
+ /// If absent, this address space uses the default null pointer value.
+ std::optional<APInt> NullPtrValue;
----------------
shiltian wrote:
This value has the correct pointer size, so to have it as a `std::optional<APInt>` would be convenient, since we can directly take the value in the query. However, the default one can be indeed changed to `enum class NullPtrValue { Zero, AllOnes}` to avoid using an `APInt(1)` and then do the 0/1 check.
https://github.com/llvm/llvm-project/pull/183207
More information about the llvm-commits
mailing list