[clang][bytecode] Add `PtrView` for non-tracking pointers (#184129) Currently, when creating a `Pointer` (of block type, which I will assume here), the pointer will add itself (via its address) to its block's pointer list. This way, a block always knows what pointers point to it. That's important so we can handle the case when a block (which was e.g. created for a local variable) is destroyed and we now need to update its pointers. However, since always do this for all `Pointer` instances, it creates a weird performance problem where we do this dance all the time for no reason, e.g. consider `Pointer::stripBaseCasts()`: https://github.com/llvm/llvm-project/blob/88693c49d9ac58a33af5978d31f6c70fe1d5b45b/clang/lib/AST/ByteCode/Pointer.h#L778-L783 This will add and remove the newly created pointer from the block's pointer list every iteration. Other offenders are `Pointer::toRValue()`, `EvaluationResult::checkFullyInitialized()` or `Pointer::computeOffsetForComparison()`. This commit introduces a `PtrView` struct, which is like a `BlockPointer`, but without the prev/next next links to other `Pointer`s in the block's pointer list. It also moves a lot of the accessors from `Pointer` to `PtrView` (e.g. `isRoot()` or `getFieldDesc()`, etc.). compile-time-tracker: https://llvm-compile-time-tracker.com/compare.php?from=4716dc8c51719cbcc82928cd00e41a29e5b9adff&to=28d69d4ec16e77370938675826b07752e108eede&stat=instructions:u
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.