Add get_bitmask to prange_storage for efficiency
New function extracts bitmasks directly from range storage, improving efficiency.
A new get_bitmask method has been added to prange_storage in GCC. This function allows for the efficient extraction of a bitmask directly from the storage, avoiding the overhead of constructing a full prange object. This optimization is utilized in get_nonzero_bits_1 and get_ptr_info_alignment to improve performance.
In Details
The prange_storage class now has a get_bitmask() member function, implemented in value-range-storage.cc. This allows direct extraction of a bitmask representation from the internal prange_storage data structure, circumventing the need to instantiate a full prange object. Functions like get_nonzero_bits_1 and get_ptr_info_alignment in tree-ssanames.cc are updated to use this more efficient method, particularly benefiting analyses that require bitmask information from pointer range analyses.
- prange_storage
- A data structure within GCC used to store information about ranges of values, potentially for pointer analysis or optimization. It's part of the value-range propagation (VRP) infrastructure.
- bitmask
- A sequence of bits used to perform bitwise operations, often to check, set, or clear specific bits within a larger data word. In compiler analysis, bitmasks can represent properties or states.
- SSA
- Static Single Assignment form is an intermediate representation in compilers where every variable is assigned a value exactly once. This simplifies many compiler optimizations and analyses.
- Value Range Propagation (VRP)
- A compiler analysis technique that computes the possible range of values for variables. This information is used to optimize code and detect errors.
prange_storageis part of this system.