<div dir="ltr">For background on opaque pointer types, see [1] and many other patches/threads searchable with "opaque pointers".<br><br>While there's been lots of work around making opaque pointers work, we don't actually have a type like that in LLVM yet. <a href="https://reviews.llvm.org/D101704">https://reviews.llvm.org/D101704</a> introduces the opaque pointer type within LLVM so we can start playing around with the opaque pointer type and see what goes wrong. Much of the patch above is based on TNorthover's branch from a couple years ago [2].<br><br>The opaque pointer type is essentially just a PointerType with a null pointee type. Calling getElementType() on an opaque pointer asserts.<br><br>Since the bitcode representation for non-opaque pointers contains the pointee type, we need a new bitcode type code for opaque pointers, which only contains the address space.<br><br>For the textual IR representation, the current proposal is to represent an opaque pointer type with "ptr" with an optional "addrspace(N)". This seems consistent with existing uses of "addrspace(N)" and "ptr" seems right.<br>There are a couple alternatives. TNorthover's version uses "pN" where "N" is the address space, so most pointers would be "p0", and a pointer in address space #5 would be "p5". I initially attempted something like "ptr(N)", but the spelling is slightly ambiguous with function types. We could also simply use a void pointer, which LLVM currently does not allow [3].<br>Feel free to bikeshed.<br><br>[1]: <a href="https://lists.llvm.org/pipermail/llvm-dev/2015-February/081822.html">https://lists.llvm.org/pipermail/llvm-dev/2015-February/081822.html</a><br>[2]: <a href="https://lists.llvm.org/pipermail/llvm-dev/2019-December/137684.html">https://lists.llvm.org/pipermail/llvm-dev/2019-December/137684.html</a><br>[3]: <a href="https://llvm.org/docs/LangRef.html#pointer-type">https://llvm.org/docs/LangRef.html#pointer-type</a><br></div>