aboutsummaryrefslogtreecommitdiff
path: root/llvm/docs/ProgrammersManual.rst
AgeCommit message (Collapse)AuthorFilesLines
2025-05-06[ProgrammersManual] Update report_fatal_error docs (#138502)Nikita Popov1-3/+12
Update docs for https://github.com/llvm/llvm-project/pull/138251. Mention reportFatalInternalError and reportFatalUsageError in the respective sections of the documentation.
2025-04-17[llvm][docs] Replace `Optional<T>` with `std::optional<T>`Jan Svoboda1-2/+2
The `llvm::Optional` template is no more. Remove it from the error-handling section of LLVM the programmer's manual and the ASTImporter documentation.
2025-01-03Updating broken/outdated links in the ProgrammerManual (#119472)jmriesen1-3/+3
Fixes llvm/llvm-project#117897
2024-08-22[NFC] [Docs] add missing spaceFlorian Mayer1-1/+1
2024-08-15[llvm][Docs] `_or_null` -> `_if_present` in Programmer's Manual (#98586)Yanzuo Liu1-6/+6
`cast_or_null` is deprecated. https://github.com/llvm/llvm-project/blob/062844615db5e141da118c1ad780bf102537f40a/llvm/include/llvm/Support/Casting.h#L717-L722
2024-07-26[docs] Fix code-block formating (#100772)Vitaly Buka1-0/+2
2024-06-27[SmallPtrSet] Don't leave tombstones in small mode (#96762)Nikita Popov1-2/+4
When erasing elements in small mode, we currently leave behind tombstones. This means that insertion into the SmallPtrSet also has to check for these, making the operation more expensive than it really should be. We don't really need the tombstones in small mode, because we can just replace with the last element in the set instead. This changes the order, but SmallPtrSet order is fundamentally unstable anyway. However, not leaving tombstones means that the erase() operation now invalidates iterators. This means that consumers that want to remove elements while iterating over the set have to use remove_if() instead. If they fail to do so, there will be an assertion failure thanks to debug epochs, so any such cases are easy to detect (and I have already fixed all cases inside llvm at least).
2024-05-28[DebugCounter] Add support for non-continous ranges. (#89470)Ralender1-8/+30
2023-12-14[docs] remove some out-of-date content in LLVM Programmer's Manual (#74989)Yuhao Gu1-30/+0
Remove the part about implicit conversion from an iterator to a pointer. This part of the manual was written 14 years ago, in: https://github.com/llvm/llvm-project/commit/37027c30ec526afe3bb571df6f8701bf0d322f22 There do exist a type casting operator in `ilist` then: https://github.com/llvm/llvm-project/blob/37027c30ec526afe3bb571df6f8701bf0d322f22/llvm/include/llvm/ADT/ilist.h#L192-L194 But it has been remove since 2016: https://github.com/llvm/llvm-project/commit/f197b1f78f854d8513ef617b8cfc61860f7b4b84 So I think it makes sense to remove this part to avoid mislead new contributors.
2023-11-06[llvm][docs]: fix typos (#71303)GoodDaisy1-2/+2
2023-10-30[docs] mention that DenseMap has a SmallDenseMap variant (#70677)Nick Desaulniers1-0/+4
via https://github.com/llvm/llvm-project/pull/67699/files#r1375105711
2023-09-30Introduce paged vector (#66430)Giulio Eulisse1-0/+34
The goal of the class is to be an (almost) drop in replacement for SmallVector and std::vector when those are presized and filled later, as it happens in SourceManager and ASTReader. By doing so, sparsely accessed PagedVector can profit from reduced memory footprint.
2023-05-12[llvm] Fix typos in documentationKazu Hirata1-1/+1
2023-03-30[docs] Add section on iteration utilities (`zip` & `enumerate`)Jakub Kuderski1-0/+93
Since these are not in C++17, mention them in the programmers manual. Reviewed By: kazu Differential Revision: https://reviews.llvm.org/D147199
2023-02-14Recommit: [NFC][IR] Make Module::getGlobalList() privateVasileios Porpodas1-6/+3
This reverts commit cb5f239363a3c94db5425c105fcd45e77d2a16a9.
2023-02-14Revert "[NFC][IR] Make Module::getGlobalList() private"Vasileios Porpodas1-3/+6
This reverts commit ed3e3ee9e30dfbffd2170a770a49b36a7f444916.
2023-02-14[NFC][IR] Make Module::getGlobalList() privateVasileios Porpodas1-6/+3
This patch adds several missing GlobalList modifier functions, like removeGlobalVariable(), eraseGlobalVariable() and insertGlobalVariable(). There is no longer need to access the list directly so it also makes getGlobalList() private. Differential Revision: https://reviews.llvm.org/D144027
2023-01-30[Doc] Removes extra argument of ReplaceInstWithValue()Vasileios Porpodas1-2/+1
Differential Revision: https://reviews.llvm.org/D142944
2022-12-15[docs] Update docs since getBasicBlockList() is now privateVasileios Porpodas1-7/+2
Differential Revision: https://reviews.llvm.org/D140163
2022-12-15[NFC] Rename Instruction::insertAt() to Instruction::insertInto(), to be ↵Vasileios Porpodas1-1/+1
consistent with BasicBlock::insertInto() Differential Revision: https://reviews.llvm.org/D140085
2022-12-14[docs] Updates ProgrammersManual to reflect the change that ↵Vasileios Porpodas1-48/+7
BasicBlock::getInstList() is private. Differential Revision: https://reviews.llvm.org/D140054
2022-09-27[ADT] Add IntervalTree - light tree data structure to hold intervals.Carlos Alberto Enciso1-0/+12
It allows finding all intervals that overlap with any given point. At this time, it does not support any deletion or rebalancing operations. The IntervalTree is designed to be set up once, and then queried without any further additions. Reviewed By: psamolysov, probinson Differential Revision: https://reviews.llvm.org/D125776
2022-07-27Update ProgrammersManual STL docsRenato Golin1-9/+9
The SGI page doesn't exist anymore and isn't really relevant at this day and age. While at it, added the "other" main C++ website and moved all URLs to HTTPS.
2022-06-07Update the ProgrammersManual explanation for ilist and iplistNathan Lanza1-15/+5
They are now `using` aliases and thus the comments about iplist are now incorrect. Remove them here. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D95210
2022-01-25[docs] There are more than three bit storage containers.Hsiangkai Wang1-2/+2
To avoid listing all the bit containers in the title and do not use the specific number for the number of bit containers. Differential Revision: https://reviews.llvm.org/D117849
2022-01-25[docs] Refine the description in Set-Like and Map-Like container options.Hsiangkai Wang1-8/+6
In "Other Set-Like Container Options": * Drops the references to C++ TR1 and SGI and hash_set. * Drops the worry about portability (this was a problem with hash_set, but std::unordered_set has worked portably since LLVM started depending on C++11). It is similar in "Other Map-Like Container Options" section. Differential Revision: https://reviews.llvm.org/D117858
2022-01-20[docs] Fix typo in the example code in ProgrammersManual.Hsiangkai Wang1-1/+1
Differential Revision: https://reviews.llvm.org/D117665
2022-01-20[docs] Put define DEBUG_TYPE after include directives.Hsiangkai Wang1-1/+1
Differential Revision: https://reviews.llvm.org/D117666
2021-12-16[llvm] Fix small typos in Programmer's Manual and Chrono.h.Noah Shutty1-1/+1
The Programmer's Manual guidance on the StringRef class (https://llvm.org/docs/ProgrammersManual.html#the-stringref-class) refers to `iterator StringRef::find(StringRef Key)` which does not exist. Based on context this is surely a small typo meant to be `iterator StringMap::find(StringRef Key)`. This also corrects some small typos in the comments of llvm/include/llvm/Support/Chrono.h Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D113462
2021-11-15[NFC] Trim trailing whitespace in *.rstShao-Ce SUN1-15/+13
2021-10-22Support: Add Expected<T>::moveInto() to avoid extra namesDuncan P. N. Exon Smith1-0/+40
Expected<T>::moveInto() takes as an out parameter any `OtherT&` that's assignable from `T&&`. It moves any stored value before returning takeError(). Since moveInto() consumes both the Error and the value, it's only anticipated that we'd use call it on temporaries/rvalues, with naming the Expected first likely to be an anti-pattern of sorts (either you want to deal with both at the same time, or you don't). As such, starting it out as `&&`-qualified... but it'd probably be fine to drop that if there's a good use case for lvalues that appears. There are two common patterns that moveInto() cleans up: ``` // If the variable is new: Expected<std::unique_ptr<int>> ExpectedP = makePointer(); if (!ExpectedP) return ExpectedP.takeError(); std::unique_ptr<int> P = std::move(*ExpectedP); // If the target variable already exists: if (Expected<T> ExpectedP = makePointer()) P = std::move(*ExpectedP); else return ExpectedP.takeError(); ``` moveInto() takes less typing and avoids needing to name (or leak into the scope) an extra variable. ``` // If the variable is new: std::unique_ptr<int> P; if (Error E = makePointer().moveInto(P)) return E; // If the target variable already exists: if (Error E = makePointer().moveInto(P)) return E; ``` It also seems useful for unit tests, to log errors (but continue) when there's an unexpected failure. E.g.: ``` // Crash on error, or undefined in non-asserts builds. std::unique_ptr<MemoryBuffer> MB = cantFail(makeMemoryBuffer()); // Avoid crashing on error without moveInto() :(. Expected<std::unique_ptr<MemoryBuffer>> ExpectedMB = makeMemoryBuffer(); ASSERT_THAT_ERROR(ExpectedMB.takeError(), Succeeded()); std::unique_ptr<MemoryBuffer> MB = std::move(ExpectedMB); // Avoid crashing on error with moveInto() :). std::unique_ptr<MemoryBuffer> MB; ASSERT_THAT_ERROR(makeMemoryBuffer().moveInto(MB), Succeeded()); ``` Differential Revision: https://reviews.llvm.org/D112278
2021-02-27[llvm] Fix typos in documentation (NFC)Kazu Hirata1-1/+1
2020-12-03[SmallVector] Allow SmallVector<T>Sean Silva1-0/+6
This patch adds a capability to SmallVector to decide a number of inlined elements automatically. The policy is: - A minimum of 1 inlined elements, with more as long as sizeof(SmallVector<T>) <= 64. - If sizeof(T) is "too big", then trigger a static_assert: this dodges the more pathological cases This is expected to systematically improve SmallVector use in the LLVM codebase, which has historically been plagued by semi-arbitrary / cargo culted N parameters, often leading to bad outcomes due to excessive sizeof(SmallVector<T, N>). This default also makes programming more convenient by avoiding edit/rebuild cycles due to forgetting to type the N parameter. Differential Revision: https://reviews.llvm.org/D92522
2020-12-02Switch from llvm::is_trivially_copyable to std::is_trivially_copyableFangrui Song1-1/+1
GCC<5 did not support std::is_trivially_copyable. Now LLVM builds require 5.1 we can migrate to std::is_trivially_copyable. The Optional.h change made MSVC choke (https://buildkite.com/llvm-project/premerge-checks/builds/18587#cd1bb616-ffdc-4581-9795-b42c284196de) so I leave it out for now. Differential Revision: https://reviews.llvm.org/D92514
2020-12-02Revert "Use std::is_trivially_copyable", breaks MSVC buildReid Kleckner1-1/+1
Revert "Delete llvm::is_trivially_copyable and CMake variable HAVE_STD_IS_TRIVIALLY_COPYABLE" This reverts commit 4d4bd40b578d77b8c5bc349ded405fb58c333c78. This reverts commit 557b00e0afb2dc1776f50948094ca8cc62d97be4.
2020-12-02Use std::is_trivially_copyableFangrui Song1-1/+1
GCC<5 did not support std::is_trivially_copyable. Now LLVM builds require 5.1 we can migrate to std::is_trivially_copyable.
2020-10-06docs: Emphasize ArrayRef over SmallVectorImplDuncan P. N. Exon Smith1-12/+25
The section on SmallVector has a note about preferring SmallVectorImpl for APIs but doesn't mention ArrayRef. Although ArrayRef is discussed elsewhere, let's re-emphasize here. Differential Revision: https://reviews.llvm.org/D49881
2020-04-23[CallSite removal] Remove the text describing CallSite from the manual.James Y Knight1-27/+6
2020-04-23[llvm] NFC: Fix trivial typo in rst and td filesKazuaki Ishizaki1-2/+2
Differential Revision: https://reviews.llvm.org/D77469
2020-04-17[NFC] Remove waymarking because it improves performancesTyker1-134/+0
Summary: This patch remove waymarking and replaces it with storing a pointer to the User in the Use. here are the results on the measurements for the CTMark tests of the test suite. ``` Metric: instructions_count Program baseline patched diff test-suite :: CTMark/ClamAV/clamscan.test 72557942065 71733653521 -1.1% test-suite :: CTMark/sqlite3/sqlite3.test 76281422939 75484840636 -1.0% test-suite :: CTMark/consumer-typeset/consumer-typeset.test 51364676366 50862185614 -1.0% test-suite :: CTMark/SPASS/SPASS.test 60476106505 59908437767 -0.9% test-suite :: CTMark/tramp3d-v4/tramp3d-v4.test 112578442329 111725050856 -0.8% test-suite :: CTMark/mafft/pairlocalalign.test 50846133013 50473644539 -0.7% test-suite :: CTMark/kimwitu++/kc.test 54692641250 54349070299 -0.6% test-suite :: CTMark/7zip/7zip-benchmark.test 182216614747 181216091230 -0.5% test-suite :: CTMark/Bullet/bullet.test 123459210616 122905866767 -0.4% Geomean difference -0.8% Metric: peak_memory_use Program baseline patched diff test-suite :: CTMark/tramp3d-v4/tramp3d-v4.test 326864 338524 3.6% test-suite :: CTMark/sqlite3/sqlite3.test 216412 221240 2.2% test-suite :: CTMark/7zip/7zip-benchmark.test 11808284 12022604 1.8% test-suite :: CTMark/Bullet/bullet.test 6831752 6945988 1.7% test-suite :: CTMark/SPASS/SPASS.test 2682552 2721820 1.5% test-suite :: CTMark/ClamAV/clamscan.test 5037256 5107936 1.4% test-suite :: CTMark/consumer-typeset/consumer-typeset.test 2752728 2790768 1.4% test-suite :: CTMark/mafft/pairlocalalign.test 1517676 1537244 1.3% test-suite :: CTMark/kimwitu++/kc.test 1090748 1103448 1.2% Geomean difference 1.8% Metric: compile_time Program baseline patched diff test-suite :: CTMark/consumer-typeset/consumer-typeset.test 14.71 14.38 -2.2% test-suite :: CTMark/sqlite3/sqlite3.test 23.18 22.73 -2.0% test-suite :: CTMark/7zip/7zip-benchmark.test 57.96 56.99 -1.7% test-suite :: CTMark/ClamAV/clamscan.test 20.75 20.49 -1.2% test-suite :: CTMark/kimwitu++/kc.test 18.35 18.15 -1.1% test-suite :: CTMark/SPASS/SPASS.test 18.72 18.57 -0.8% test-suite :: CTMark/mafft/pairlocalalign.test 14.09 14.00 -0.6% test-suite :: CTMark/Bullet/bullet.test 37.38 37.19 -0.5% test-suite :: CTMark/tramp3d-v4/tramp3d-v4.test 33.81 33.76 -0.2% Geomean difference -1.1% ``` i believe that it is worth trading +1.8% peak memory use for -1.1% compile time. also this patch removes waymarking which simplifies the Use and User classes. Reviewers: nikic, lattner Reviewed By: lattner Subscribers: russell.gallop, foad, ggreif, rriddle, ekatz, fhahn, lebedev.ri, mgorny, hiraditya, george.burgess.iv, asbirlea, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77144
2020-03-22Doc: Links should use httpsSylvestre Ledru1-41/+41
2020-03-06Correct the Bjarne Stroustrup's C++ Page linkShivam Gupta1-1/+1
Summary: Bjarne Stroustrup's C++ Page link pointing to wrong AT&T page. Reviewers: jyknight, sanjoy, silvas, hubert.reinterpretcast Reviewed By: hubert.reinterpretcast Subscribers: hubert.reinterpretcast, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D75709
2020-02-27[ADT] Add CoalescingBitVector, implemented using IntervalMap [1/3]Vedant Kumar1-4/+20
Add CoalescingBitVector to ADT. This is part 1 of a 3-part series to address a compile-time explosion issue in LiveDebugValues. --- CoalescingBitVector is a bitvector that, under the hood, relies on an IntervalMap to coalesce elements into intervals. CoalescingBitVector efficiently represents sets which predominantly contain contiguous ranges (e.g. the VarLocSets in LiveDebugValues, which are very long sequences that look like {1, 2, 3, ...}). OTOH, CoalescingBitVector isn't good at representing sets with lots of gaps between elements. The first N coalesced intervals of set bits are stored in-place (in the initial heap allocation). Compared to SparseBitVector, CoalescingBitVector offers more predictable performance for non-sequential find() operations. This provides a crucial speedup in LiveDebugValues. Differential Revision: https://reviews.llvm.org/D74984
2020-02-13Revert "Revert "Reland "[Support] make report_fatal_error `abort` instead of ↵Yuanfang Chen1-2/+2
`exit`""" This reverts commit 80a34ae31125aa46dcad47162ba45b152aed968d with fixes. Previously, since bots turning on EXPENSIVE_CHECKS are essentially turning on MachineVerifierPass by default on X86 and the fact that inline-asm-avx-v-constraint-32bit.ll and inline-asm-avx512vl-v-constraint-32bit.ll are not expected to generate functioning machine code, this would go down to `report_fatal_error` in MachineVerifierPass. Here passing `-verify-machineinstrs=0` to make the intent explicit.
2020-02-13Revert "Revert "Revert "Reland "[Support] make report_fatal_error `abort` ↵Yuanfang Chen1-2/+2
instead of `exit`"""" This reverts commit bb51d243308dbcc9a8c73180ae7b9e47b98e68fb.
2020-02-13Revert "Revert "Reland "[Support] make report_fatal_error `abort` instead of ↵Yuanfang Chen1-2/+2
`exit`""" This reverts commit 80a34ae31125aa46dcad47162ba45b152aed968d with fixes. On bots llvm-clang-x86_64-expensive-checks-ubuntu and llvm-clang-x86_64-expensive-checks-debian only, llc returns 0 for these two tests unexpectedly. I tweaked the RUN line a little bit in the hope that LIT is the culprit since this change is not in the codepath these tests are testing. llvm\test\CodeGen\X86\inline-asm-avx-v-constraint-32bit.ll llvm\test\CodeGen\X86\inline-asm-avx512vl-v-constraint-32bit.ll
2020-02-11Revert "Reland "[Support] make report_fatal_error `abort` instead of `exit`""Yuanfang Chen1-2/+2
This reverts commit rGcd5b308b828e, rGcd5b308b828e, rG8cedf0e2994c. There are issues to be investigated for polly bots and bots turning on EXPENSIVE_CHECKS.
2020-02-11Reland "[Support] make report_fatal_error `abort` instead of `exit`"Yuanfang Chen1-2/+2
Summary: Reland D67847 after D73742 is committed. Replace `sys::Process::Exit(1)` with `abort` in `report_fatal_error`. After this patch, for tools turning on `CrashRecoveryContext`, crash handler installed by `CrashRecoveryContext` is called unless they installed a non-returning handler using `llvm::install_fatal_error_handler` like `cc1_main` currently does. Reviewers: rnk, MaskRay, aganea, hans, espindola, jhenderson Subscribers: jholewinski, qcolombet, dschuff, jyknight, emaste, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, PkmX, rupprecht, jocewei, jsji, Jim, dmgreen, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, kerbowa, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D74456
2020-02-06[NFC] Fix error handling documentationMiloš Stojanović1-2/+2
The default Error constructor can't be used since rL286561. Differential Revision: https://reviews.llvm.org/D74069
2020-01-22[llvm] NFC: fix trivial typos in documentsKazuaki Ishizaki1-4/+4
Reviewers: hans, Jim Reviewed By: Jim Subscribers: jvesely, nhaehnle, mgorny, arphaman, bmahjour, kerbowa, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D73017