Skip to content

Commit 8e1aea0

Browse files
committed
Renamed from defaultNull to Sentinel pointer value and updated the LangRef
1 parent 0f1412d commit 8e1aea0

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

llvm/docs/LangRef.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,13 +3062,14 @@ as follows:
30623062
this set are considered to support most general arithmetic operations
30633063
efficiently.
30643064
``z[n]:<value>``
3065-
This specifies the default null value for an address space. ``n`` denotes
3066-
the address space number, and if not specified, it is considered to be
3067-
for the unlisted address space. For unlisted address space, the default
3068-
null value is ``0``. ``value`` denotes the default null value for an
3069-
address space ``n``. To represent negatives values, prefix ``neg`` is
3070-
added to ``value``. for e.g., ``z0:neg1`` represents for ``0`` address
3071-
space ``-1`` is the default null value.
3065+
This specifies the sentinel pointer value for an address space. Sentinel
3066+
pointer value is the default non zero null value for a given address
3067+
space. ``n`` denotes the address space number, and if not specified, it
3068+
is considered to be for the unlisted address space. For unlisted address
3069+
space, the sentinel pointer value is ``0``. ``value`` denotes the sentinel
3070+
pointer value for an address space ``n``. To represent negatives values,
3071+
prefix ``neg`` is added to ``value``. for e.g., ``z0:neg1`` represents for
3072+
``0`` address space ``-1`` is the sentinel pointer value.
30723073
``ni:<address space0>:<address space1>:<address space2>...``
30733074
This specifies pointer types with the specified address spaces
30743075
as :ref:`Non-Integral Pointer Type <nointptrtype>` s. The ``0``

llvm/include/llvm/IR/DataLayout.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class DataLayout {
165165
/// well-defined bitwise representation.
166166
SmallVector<unsigned, 8> NonIntegralAddressSpaces;
167167

168-
DenseMap<unsigned, int64_t> AddrSpaceToNonZeroValueMap;
168+
DenseMap<unsigned, int64_t> AddrSpaceToSentinelValueMap;
169169

170170
/// Attempts to set the alignment of the given type. Returns an error
171171
/// description on failure.
@@ -302,15 +302,15 @@ class DataLayout {
302302
return ManglingMode == MM_WinCOFFX86;
303303
}
304304

305-
int64_t getDefaultNullPointerValue(unsigned AddrSpace) {
306-
auto It = AddrSpaceToNonZeroValueMap.find(AddrSpace);
307-
if (It == AddrSpaceToNonZeroValueMap.end())
305+
int64_t getSentinelPointerValue(unsigned AddrSpace) {
306+
auto It = AddrSpaceToSentinelValueMap.find(AddrSpace);
307+
if (It == AddrSpaceToSentinelValueMap.end())
308308
return 0;
309309
return It->second;
310310
}
311311

312-
void setDefaultNullPointerValue(unsigned AddrSpace, int64_t Value) {
313-
AddrSpaceToNonZeroValueMap[AddrSpace] = Value;
312+
void setSentinelPointerValue(unsigned AddrSpace, int64_t Value) {
313+
AddrSpaceToSentinelValueMap[AddrSpace] = Value;
314314
}
315315

316316
/// Returns true if symbols with leading question marks should not receive IR

llvm/lib/IR/DataLayout.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void DataLayout::reset(StringRef Desc) {
216216
if (Error Err = setPointerAlignmentInBits(0, Align(8), Align(8), 64, 64))
217217
return report_fatal_error(std::move(Err));
218218

219-
setDefaultNullPointerValue(INT_MAX, 0);
219+
setSentinelPointerValue(INT_MAX, 0);
220220

221221
if (Error Err = parseSpecifier(Desc))
222222
return report_fatal_error(std::move(Err));
@@ -527,7 +527,7 @@ Error DataLayout::parseSpecifier(StringRef Desc) {
527527
if (Tok.empty()) {
528528
if (Error Err = getIntForAddrSpace(Rest, Value))
529529
return Err;
530-
setDefaultNullPointerValue(INT_MAX, Value);
530+
setSentinelPointerValue(INT_MAX, Value);
531531
break;
532532
} else {
533533
if (Error Err = getInt(Tok, AddrSpace))
@@ -543,7 +543,7 @@ Error DataLayout::parseSpecifier(StringRef Desc) {
543543
return Err;
544544
if (Error Err = getIntForAddrSpace(Tok, Value))
545545
return Err;
546-
setDefaultNullPointerValue(AddrSpace, Value);
546+
setSentinelPointerValue(AddrSpace, Value);
547547
break;
548548
}
549549
case 'G': { // Default address space for global variables.

0 commit comments

Comments
 (0)