llvm-project
b9a6994a - [DataLayout] Add null pointer value infrastructure

Commit
16 hours ago
[DataLayout] Add null pointer value infrastructure Add support for specifying the null pointer bit representation per address space in DataLayout via new pointer spec flags: - 'z': null pointer is all-zeros (assumed if unspecified) - 'o': null pointer is all-ones - 'c': custom/unknown null value (LLVM will not fold) This adds: - `std::optional<APInt> NullPtrValue` field to `PointerSpec` - Parsing of z/o/c flags in pointer spec strings - `getNullPtrValue(unsigned AS)` query API - `isNullPointerAllZeroes(unsigned AS)` convenience method - LangRef documentation for the new flags - Unit tests for all new functionality No target DataLayout strings are updated in this change. This is pure infrastructure for a future ConstantPointerNull semantic change to support targets with non-zero null pointers (e.g. AMDGPU).
References
Author
Committer
Parents
Loading