Skip to content

Commit b4abb8a

Browse files
kazutakahiratatgymnich
authored andcommitted
[llvm] Proofread ProgrammersManual.rst (llvm#151853)
Co-authored-by: Tim Gymnich <[email protected]>
1 parent 80e5f7b commit b4abb8a

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

llvm/docs/ProgrammersManual.rst

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ Success values are very cheap to construct and return - they have minimal
486486
impact on program performance.
487487

488488
Failure values are constructed using ``make_error<T>``, where ``T`` is any class
489-
that inherits from the ErrorInfo utility, E.g.:
489+
that inherits from the ``ErrorInfo`` utility, E.g.:
490490

491491
.. code-block:: c++
492492

@@ -1351,7 +1351,7 @@ The ``llvm/Support/DebugCounter.h`` (`doxygen
13511351
provides a class named ``DebugCounter`` that can be used to create
13521352
command-line counter options that control execution of parts of your code.
13531353

1354-
Define your DebugCounter like this:
1354+
Define your ``DebugCounter`` like this:
13551355

13561356
.. code-block:: c++
13571357

@@ -1677,7 +1677,7 @@ page and one extra indirection when accessing elements with their positional
16771677
index.
16781678

16791679
In order to minimise the memory footprint of this container, it's important to
1680-
balance the PageSize so that it's not too small (otherwise the overhead of the
1680+
balance the ``PageSize`` so that it's not too small (otherwise the overhead of the
16811681
pointer per page might become too high) and not too big (otherwise the memory
16821682
is wasted if the page is not fully used).
16831683

@@ -2203,17 +2203,17 @@ inserting elements into both a set-like container and the sequential container,
22032203
using the set-like container for uniquing and the sequential container for
22042204
iteration.
22052205

2206-
The difference between SetVector and other sets is that the order of iteration
2207-
is guaranteed to match the order of insertion into the SetVector. This property
2206+
The difference between ``SetVector`` and other sets is that the order of iteration
2207+
is guaranteed to match the order of insertion into the ``SetVector``. This property
22082208
is really important for things like sets of pointers. Because pointer values
22092209
are non-deterministic (e.g. vary across runs of the program on different
22102210
machines), iterating over the pointers in the set will not be in a well-defined
22112211
order.
22122212

2213-
The drawback of SetVector is that it requires twice as much space as a normal
2213+
The drawback of ``SetVector`` is that it requires twice as much space as a normal
22142214
set and has the sum of constant factors from the set-like container and the
22152215
sequential container that it uses. Use it **only** if you need to iterate over
2216-
the elements in a deterministic order. SetVector is also expensive to delete
2216+
the elements in a deterministic order. ``SetVector`` is also expensive to delete
22172217
elements out of (linear time), unless you use its "pop_back" method, which is
22182218
faster.
22192219

@@ -2369,22 +2369,22 @@ llvm/IR/ValueMap.h
23692369

23702370
ValueMap is a wrapper around a :ref:`DenseMap <dss_densemap>` mapping
23712371
``Value*``\ s (or subclasses) to another type. When a Value is deleted or
2372-
RAUW'ed, ValueMap will update itself so the new version of the key is mapped to
2372+
RAUW'ed, ``ValueMap`` will update itself so the new version of the key is mapped to
23732373
the same value, just as if the key were a WeakVH. You can configure exactly how
23742374
this happens, and what else happens on these two events, by passing a ``Config``
2375-
parameter to the ValueMap template.
2375+
parameter to the ``ValueMap`` template.
23762376

23772377
.. _dss_intervalmap:
23782378

23792379
llvm/ADT/IntervalMap.h
23802380
^^^^^^^^^^^^^^^^^^^^^^
23812381

2382-
IntervalMap is a compact map for small keys and values. It maps key intervals
2382+
``IntervalMap`` is a compact map for small keys and values. It maps key intervals
23832383
instead of single keys, and it will automatically coalesce adjacent intervals.
23842384
When the map only contains a few intervals, they are stored in the map object
23852385
itself to avoid allocations.
23862386

2387-
The IntervalMap iterators are quite big, so they should not be passed around as
2387+
The ``IntervalMap`` iterators are quite big, so they should not be passed around as
23882388
STL iterators. The heavyweight iterators allow a smaller data structure.
23892389

23902390
.. _dss_intervaltree:
@@ -2396,7 +2396,7 @@ llvm/ADT/IntervalTree.h
23962396
allows finding all intervals that overlap with any given point. At this time,
23972397
it does not support any deletion or rebalancing operations.
23982398

2399-
The IntervalTree is designed to be set up once, and then queried without any
2399+
The ``IntervalTree`` is designed to be set up once, and then queried without any
24002400
further additions.
24012401

24022402
.. _dss_map:
@@ -2435,10 +2435,10 @@ necessary to remove elements, it's best to remove them in bulk using
24352435
llvm/ADT/IntEqClasses.h
24362436
^^^^^^^^^^^^^^^^^^^^^^^
24372437

2438-
IntEqClasses provides a compact representation of equivalence classes of small
2438+
``IntEqClasses`` provides a compact representation of equivalence classes of small
24392439
integers. Initially, each integer in the range 0..n-1 has its own equivalence
24402440
class. Classes can be joined by passing two class representatives to the
2441-
join(a, b) method. Two integers are in the same class when findLeader() returns
2441+
``join(a, b)`` method. Two integers are in the same class when ``findLeader()`` returns
24422442
the same representative.
24432443

24442444
Once all equivalence classes are formed, the map can be compressed so each
@@ -2451,11 +2451,11 @@ it can be edited again.
24512451
llvm/ADT/ImmutableMap.h
24522452
^^^^^^^^^^^^^^^^^^^^^^^
24532453

2454-
ImmutableMap is an immutable (functional) map implementation based on an AVL
2454+
``ImmutableMap`` is an immutable (functional) map implementation based on an AVL
24552455
tree. Adding or removing elements is done through a Factory object and results
2456-
in the creation of a new ImmutableMap object. If an ImmutableMap already exists
2456+
in the creation of a new ``ImmutableMap`` object. If an ``ImmutableMap`` already exists
24572457
with the given key set, then the existing one is returned; equality is compared
2458-
with a FoldingSetNodeID. The time and space complexity of add or remove
2458+
with a ``FoldingSetNodeID``. The time and space complexity of add or remove
24592459
operations is logarithmic in the size of the original map.
24602460

24612461
.. _dss_othermap:
@@ -2490,11 +2490,11 @@ somehow. In any case, please don't use it.
24902490
BitVector
24912491
^^^^^^^^^
24922492

2493-
The BitVector container provides a dynamic size set of bits for manipulation.
2493+
The ``BitVector`` container provides a dynamic size set of bits for manipulation.
24942494
It supports individual bit setting/testing, as well as set operations. The set
24952495
operations take time O(size of bitvector), but operations are performed one word
2496-
at a time, instead of one bit at a time. This makes the BitVector very fast for
2497-
set operations compared to other containers. Use the BitVector when you expect
2496+
at a time, instead of one bit at a time. This makes the ``BitVector`` very fast for
2497+
set operations compared to other containers. Use the ``BitVector`` when you expect
24982498
the number of set bits to be high (i.e. a dense set).
24992499

25002500
.. _dss_smallbitvector:
@@ -2516,29 +2516,29 @@ its operator[] does not provide an assignable lvalue.
25162516
SparseBitVector
25172517
^^^^^^^^^^^^^^^
25182518

2519-
The SparseBitVector container is much like BitVector, with one major difference:
2520-
Only the bits that are set, are stored. This makes the SparseBitVector much
2521-
more space efficient than BitVector when the set is sparse, as well as making
2519+
The ``SparseBitVector`` container is much like ``BitVector``, with one major difference:
2520+
Only the bits that are set, are stored. This makes the ``SparseBitVector`` much
2521+
more space efficient than ``BitVector`` when the set is sparse, as well as making
25222522
set operations O(number of set bits) instead of O(size of universe). The
2523-
downside to the SparseBitVector is that setting and testing of random bits is
2524-
O(N), and on large SparseBitVectors, this can be slower than BitVector. In our
2523+
downside to the ``SparseBitVector`` is that setting and testing of random bits is
2524+
O(N), and on large ``SparseBitVectors``, this can be slower than ``BitVector``. In our
25252525
implementation, setting or testing bits in sorted order (either forwards or
25262526
reverse) is O(1) worst case. Testing and setting bits within 128 bits (depends
25272527
on size) of the current bit is also O(1). As a general statement,
2528-
testing/setting bits in a SparseBitVector is O(distance away from last set bit).
2528+
testing/setting bits in a ``SparseBitVector`` is O(distance away from last set bit).
25292529

25302530
.. _dss_coalescingbitvector:
25312531

25322532
CoalescingBitVector
25332533
^^^^^^^^^^^^^^^^^^^
25342534

2535-
The CoalescingBitVector container is similar in principle to a SparseBitVector,
2535+
The ``CoalescingBitVector`` container is similar in principle to a ``SparseBitVector``,
25362536
but is optimized to represent large contiguous ranges of set bits compactly. It
25372537
does this by coalescing contiguous ranges of set bits into intervals. Searching
2538-
for a bit in a CoalescingBitVector is O(log(gaps between contiguous ranges)).
2538+
for a bit in a ``CoalescingBitVector`` is O(log(gaps between contiguous ranges)).
25392539

2540-
CoalescingBitVector is a better choice than BitVector when gaps between ranges
2541-
of set bits are large. It's a better choice than SparseBitVector when find()
2540+
``CoalescingBitVector`` is a better choice than ``BitVector`` when gaps between ranges
2541+
of set bits are large. It's a better choice than ``SparseBitVector`` when find()
25422542
operations must have fast, predictable performance. However, it's not a good
25432543
choice for representing sets which have lots of very short ranges. E.g. the set
25442544
`{2*x : x \in [0, n)}` would be a pathological input.
@@ -2773,7 +2773,7 @@ Turning an iterator into a class pointer (and vice-versa)
27732773

27742774
Sometimes, it'll be useful to grab a reference (or pointer) to a class instance
27752775
when all you've got at hand is an iterator. Well, extracting a reference or a
2776-
pointer from an iterator is very straight-forward. Assuming that ``i`` is a
2776+
pointer from an iterator is very straightforward. Assuming that ``i`` is a
27772777
``BasicBlock::iterator`` and ``j`` is a ``BasicBlock::const_iterator``:
27782778

27792779
.. code-block:: c++
@@ -2805,7 +2805,7 @@ Say that you're writing a FunctionPass and would like to count all the locations
28052805
in the entire module (that is, across every ``Function``) where a certain
28062806
function (i.e., some ``Function *``) is already in scope. As you'll learn
28072807
later, you may want to use an ``InstVisitor`` to accomplish this in a much more
2808-
straight-forward manner, but this example will allow us to explore how you'd do
2808+
straightforward manner, but this example will allow us to explore how you'd do
28092809
it if you didn't have ``InstVisitor`` around. In pseudo-code, this is what we
28102810
want to do:
28112811

@@ -2932,7 +2932,7 @@ Creating and inserting new ``Instruction``\ s
29322932

29332933
*Instantiating Instructions*
29342934

2935-
Creation of ``Instruction``\ s is straight-forward: simply call the constructor
2935+
Creation of ``Instruction``\ s is straightforward: simply call the constructor
29362936
for the kind of instruction to instantiate and provide the necessary parameters.
29372937
For example, an ``AllocaInst`` only *requires* a (const-ptr-to) ``Type``. Thus:
29382938

@@ -3050,7 +3050,7 @@ Deleting Instructions
30503050
^^^^^^^^^^^^^^^^^^^^^
30513051

30523052
Deleting an instruction from an existing sequence of instructions that form a
3053-
BasicBlock_ is very straight-forward: just call the instruction's
3053+
``BasicBlock`` is very straightforward: just call the instruction's
30543054
``eraseFromParent()`` method. For example:
30553055

30563056
.. code-block:: c++
@@ -3850,16 +3850,16 @@ Important Subclasses of Constant
38503850
any width.
38513851

38523852
* ``const APInt& getValue() const``: Returns the underlying
3853-
value of this constant, an APInt value.
3853+
value of this constant, an ``APInt`` value.
38543854

38553855
* ``int64_t getSExtValue() const``: Converts the underlying APInt value to an
3856-
int64_t via sign extension. If the value (not the bit width) of the APInt
3857-
is too large to fit in an int64_t, an assertion will result. For this
3856+
``int64_t`` via sign extension. If the value (not the bit width) of the APInt
3857+
is too large to fit in an ``int64_t``, an assertion will result. For this
38583858
reason, use of this method is discouraged.
38593859

3860-
* ``uint64_t getZExtValue() const``: Converts the underlying APInt value
3861-
to a uint64_t via zero extension. IF the value (not the bit width) of the
3862-
APInt is too large to fit in a uint64_t, an assertion will result. For this
3860+
* ``uint64_t getZExtValue() const``: Converts the underlying ``APInt`` value
3861+
to a ``uint64_t`` via zero extension. If the value (not the bit width) of the
3862+
APInt is too large to fit in a ``uint64_t``, an assertion will result. For this
38633863
reason, use of this method is discouraged.
38643864

38653865
* ``static ConstantInt* get(const APInt& Val)``: Returns the ConstantInt
@@ -4148,7 +4148,7 @@ Important Public Members of the ``BasicBlock`` class
41484148
new block, and a :ref:`Function <c_Function>` to insert it into. If the
41494149
``Parent`` parameter is specified, the new ``BasicBlock`` is automatically
41504150
inserted at the end of the specified :ref:`Function <c_Function>`, if not
4151-
specified, the BasicBlock must be manually inserted into the :ref:`Function
4151+
specified, the ``BasicBlock`` must be manually inserted into the :ref:`Function
41524152
<c_Function>`.
41534153

41544154
* | ``BasicBlock::iterator`` - Typedef for instruction list iterator

0 commit comments

Comments
 (0)