Commit Graph

24 Commits

Author SHA1 Message Date
Arthur Eubanks 05704e785a [docs] Fix typo 2022-06-17 11:29:07 -07:00
Arthur Eubanks 47bfc365fc [docs][OpaquePtr] Add detail to motivations behind opaque pointers
Reviewed By: #opaque-pointers, rnk, nikic

Differential Revision: https://reviews.llvm.org/D126309
2022-06-16 10:17:09 -07:00
Nikita Popov 10ac235b07 [Docs] Add version support information for opaque pointers (NFC)
I've seen a few people try to enable opaque pointers with LLVM 14
already. While LLVM 14 has pretty good baseline support, there are
enough missing pieces that you're definitely going to hit assertion
failures if you try this.

Add some wording to make it clear what the support (or planned
support) for opaque/typed pointers is across LLVM 14, 15, and 16.
2022-06-08 11:54:34 +02:00
Fangrui Song dfa9221aa7 [docs] Mention LLVMContext::setOpaquePointers for C++ API 2022-06-02 13:28:42 -07:00
Nikita Popov b0ce6a0ae5 [Docs] Update default in opaque pointer docs (NFC)
Also mention a relevant C API.
2022-06-02 12:29:07 +02:00
Nikita Popov 41d5033eb1 [IR] Enable opaque pointers by default
This enabled opaque pointers by default in LLVM. The effect of this
is twofold:

* If IR that contains *neither* explicit ptr nor %T* types is passed
  to tools, we will now use opaque pointer mode, unless
  -opaque-pointers=0 has been explicitly passed.
* Users of LLVM as a library will now default to opaque pointers.
  It is possible to opt-out by calling setOpaquePointers(false) on
  LLVMContext.

A cmake option to toggle this default will not be provided. Frontends
or other tools that want to (temporarily) keep using typed pointers
should disable opaque pointers via LLVMContext.

Differential Revision: https://reviews.llvm.org/D126689
2022-06-02 09:40:56 +02:00
Matthias Braun 850d53a197 LTO: Decide upfront whether to use opaque/non-opaque pointer types
LTO code may end up mixing bitcode files from various sources varying in
their use of opaque pointer types. The current strategy to decide
between opaque / typed pointers upon the first bitcode file loaded does
not work here, since we could be loading a non-opaque bitcode file first
and would then be unable to load any files with opaque pointer types
later.

So for LTO this:
- Adds an `lto::Config::OpaquePointer` option and enforces an upfront
  decision between the two modes.
- Adds `-opaque-pointers`/`-no-opaque-pointers` options to the gold
  plugin; disabled by default.
- `--opaque-pointers`/`--no-opaque-pointers` options with
  `-plugin-opt=-opaque-pointers`/`-plugin-opt=-no-opaque-pointers`
  aliases to lld; disabled by default.
- Adds an `-lto-opaque-pointers` option to the `llvm-lto2` tool.
- Changes the clang driver to pass `-plugin-opt=-opaque-pointers` to
  the linker in LTO modes when clang was configured with opaque
  pointers enabled by default.

This fixes https://github.com/llvm/llvm-project/issues/55377

Differential Revision: https://reviews.llvm.org/D125847
2022-06-01 18:05:53 -07:00
Nikita Popov 3d888b0491 [Docs] Clarify CLANG_ENABLE_OPAQUE_POINTERS behavior (NFC)
While it originally did, this option no longer affects the cc1
interface. For the cc1 interface, -no-opaque-pointers has to be
passed, there is no cmake option.
2022-05-10 10:02:01 +02:00
Nikita Popov 702d5de438 [Clang] Enable opaque pointers by default
Enable opaque pointers by default in clang, which can be disabled
either via cc1 option -no-opaque-pointers or cmake flag
-DCLANG_ENABLE_OPAQUE_POINTERS=OFF.

See https://llvm.org/docs/OpaquePointers.html for context.

Differential Revision: https://reviews.llvm.org/D123300
2022-04-11 11:13:45 +02:00
Nikita Popov d4d30d6bb1 [Docs] Update opaque pointers docs (NFC)
Point people to the cc1 instead of the mllvm flag, as the mllvm
flag will stop working for clang usage at some point.

Update transition state to mention that support in Clang/LLVM is
complete, and only the default switch is pending.
2022-04-05 12:10:36 +02:00
Nikita Popov 840bb72543 [lldb] Avoid pointer element type accesses 2022-03-24 13:09:23 +01:00
Nikita Popov c2b3a9abc8 [Docs] Update opaque pointers transition state (NFC)
Opaque pointer support in Clang is now complete.
2022-03-24 11:51:54 +01:00
Nikita Popov d04d2d43d7 [Docs] Update opaque pointers docs (NFC)
Mention automatic enablement of opaque pointers mode that was
recently implemented. Update wording in the transition state,
because it seems like my overly cautious wording has given some
people an incorrect impression of the state of opaque pointer
support in clang.
2022-03-21 10:13:09 +01:00
Nikita Popov 374bb6dd80 [docs] Update opaque pointers transition state (NFC)
Bitcode is now supported.
2022-03-11 09:35:38 +01:00
Nikita Popov dce3b403a7 [Docs] Use correct rst syntax 2022-02-17 14:08:46 +01:00
Nikita Popov 4846568191 [Docs] Update opaque pointers docs
Expand migration instructions.
2022-02-17 13:03:33 +01:00
Nikita Popov 5a43a278f7 [Docs] Update OpaquePointers transition state (NFC)
We're at a point where working optimized binaries can be produced
in opaque pointer mode.
2022-02-14 12:55:58 +01:00
Nikita Popov a2261e399a [Docs] Use anonymous reference (NFC)
Hopefully fixes the build failure. Also fix a typo.
2022-01-14 18:01:06 +01:00
Nikita Popov 3bbf7f5ed8 [Docs] Update opaque pointer docs (NFC)
Mention -opaque-pointers, write a bit more about migration pitfalls
and update the open issues.
2022-01-14 17:42:43 +01:00
Arthur Eubanks 3bf101f34c [docs][OpaquePtr] Remove finished task 2021-07-14 14:36:41 -07:00
Arthur Eubanks 0e31e22ed9 [docs][OpaquePtr] Shuffle around the transition plan section
Emphasize that this is basically an attempt to remove
``PointerType::getElementType`` and ``Type::getPointerElementType()``.

Add a couple more subtasks.

Differential Revision: https://reviews.llvm.org/D104151
2021-06-14 10:59:41 -07:00
Arthur Eubanks 06c3d52aa2 [docs][OpaquePtr] Add some specific examples of what needs to be done 2021-06-11 12:51:46 -07:00
Arthur Eubanks dce91f247d [docs] Explain address spaces a bit more in opaque pointers doc
Reviewed By: theraven

Differential Revision: https://reviews.llvm.org/D102523
2021-05-25 12:35:43 -07:00
Arthur Eubanks 772bdef6af [docs] Add page on opaque pointer types
Reviewed By: dblaikie, dexonsmith

Differential Revision: https://reviews.llvm.org/D102292
2021-05-13 15:10:27 -07:00