Skip to content

Commit fe6ca54

Browse files
committed
[LangRef] Correct value ranges for address space, vector, and float bit sizes.
- The current implementation checks them for 24-bit inegers but the document says 23-bit one effectively by listing the range as [1,2^23). - Minor error message correction. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D144685
1 parent 17a2434 commit fe6ca54

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

llvm/docs/LangRef.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,23 +2770,23 @@ as follows:
27702770
specified, the default index size is equal to the pointer size. All sizes
27712771
are in bits. The address space, ``n``, is optional, and if not specified,
27722772
denotes the default address space 0. The value of ``n`` must be
2773-
in the range [1,2^23).
2773+
in the range [1,2^24).
27742774
``i<size>:<abi>[:<pref>]``
27752775
This specifies the alignment for an integer type of a given bit
2776-
``<size>``. The value of ``<size>`` must be in the range [1,2^23).
2776+
``<size>``. The value of ``<size>`` must be in the range [1,2^24).
27772777
``<pref>`` is optional and defaults to ``<abi>``.
27782778
For ``i8``, the ``<abi>`` value must equal 8,
27792779
that is, ``i8`` must be naturally aligned.
27802780
``v<size>:<abi>[:<pref>]``
27812781
This specifies the alignment for a vector type of a given bit
2782-
``<size>``. The value of ``<size>`` must be in the range [1,2^23).
2782+
``<size>``. The value of ``<size>`` must be in the range [1,2^24).
27832783
``<pref>`` is optional and defaults to ``<abi>``.
27842784
``f<size>:<abi>[:<pref>]``
27852785
This specifies the alignment for a floating-point type of a given bit
27862786
``<size>``. Only values of ``<size>`` that are supported by the target
27872787
will work. 32 (float) and 64 (double) are supported on all targets; 80
27882788
or 128 (different flavors of long double) are also supported on some
2789-
targets. The value of ``<size>`` must be in the range [1,2^23).
2789+
targets. The value of ``<size>`` must be in the range [1,2^24).
27902790
``<pref>`` is optional and defaults to ``<abi>``.
27912791
``a:<abi>[:<pref>]``
27922792
This specifies the alignment for an object of aggregate type.

llvm/lib/IR/DataLayout.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ Error DataLayout::parseSpecifier(StringRef Desc) {
305305
if (Error Err = getInt(Tok, AddrSpace))
306306
return Err;
307307
if (!isUInt<24>(AddrSpace))
308-
return reportError("Invalid address space, must be a 24bit integer");
308+
return reportError("Invalid address space, must be a 24-bit integer");
309309

310310
// Size.
311311
if (Rest.empty())
@@ -571,7 +571,7 @@ Error DataLayout::setAlignment(AlignTypeEnum AlignType, Align ABIAlign,
571571
// an assert. See D67400 for context.
572572
assert(Log2(ABIAlign) < 16 && Log2(PrefAlign) < 16 && "Alignment too big");
573573
if (!isUInt<24>(BitWidth))
574-
return reportError("Invalid bit width, must be a 24bit integer");
574+
return reportError("Invalid bit width, must be a 24-bit integer");
575575
if (PrefAlign < ABIAlign)
576576
return reportError(
577577
"Preferred alignment cannot be less than the ABI alignment");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
22
target datalayout = "i16777216:16:16"
3-
; CHECK: Invalid bit width, must be a 24bit integer
3+
; CHECK: Invalid bit width, must be a 24-bit integer
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
22
target datalayout = "p16777216:64:64:64"
3-
; CHECK: Invalid address space, must be a 24bit integer
3+
; CHECK: Invalid address space, must be a 24-bit integer

0 commit comments

Comments
 (0)