aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-edge.cc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2022-06-10 14:59:40 +0200
committerAldy Hernandez <aldyh@redhat.com>2022-07-03 08:42:32 +0200
commita26f3eb26832b33703fcdb0bda3bafb560c7db90 (patch)
tree70fba2d1e0fb215a27827c532aa50e76078fb317 /gcc/gimple-range-edge.cc
parentf150dc1bd11802b70277f0fa209f2d23695a1095 (diff)
downloadgcc-a26f3eb26832b33703fcdb0bda3bafb560c7db90.zip
gcc-a26f3eb26832b33703fcdb0bda3bafb560c7db90.tar.gz
gcc-a26f3eb26832b33703fcdb0bda3bafb560c7db90.tar.bz2
Implement class vrange_storage to stream ranges to long term memory.
This patch implements a storage class that will be used to stream out ranges to long term storage, initially in SSA_NAME_RANGE_INFO, but it is flexible enough to use with our obstack allocator. For instance, in the future we could use it in the ranger cache to save memory. The current size of range_info_def which is used in SSA_NAME_RANGE_INFO is 16 bytes. With this patch, the size of the slot (irange_storage_slot) will be 24 bytes. But we'll have the ability to be able to store up to 5 pairs of sub-ranges if necessary. If we ever need to save more (say for switches), we could explore a trailing_wide_ints structure with a pointer to the m_len[N] bits as Jakub has suggested. In follow-up patches I will contribute the SSA_NAME_RANGE_INFO changes as well as changes storing the nonzero bits within an irange. For reference, the main interface is rather simple: class vrange_storage { public: vrange_storage (vrange_allocator *alloc) : m_alloc (alloc) { } void *alloc_slot (const vrange &r); void free (void *slot); void get_vrange (const void *slot, vrange &r, tree type); void set_vrange (void *slot, const vrange &r); static bool fits_p (const void *slot, const vrange &r); }; The above class will have the knowledge to stream out the different ranges we support (currently only irange_storage_slot). As has been discussed, the irange storage will use trailing wide ints: class GTY ((variable_size)) irange_storage_slot { <snip> <snip> // This is the maximum number of wide_int's allowed in the trailing // ints structure, without going over 16 bytes (128 bits) in the // control word that preceeds the HOST_WIDE_INTs in // trailing_wide_ints::m_val[]. static const unsigned MAX_INTS = 12; // Maximum number of range pairs we can handle, considering the // nonzero bits take one wide_int. static const unsigned MAX_PAIRS = (MAX_INTS - 1) / 2; trailing_wide_ints<MAX_INTS> m_ints; }; Tested on x86-64 Linux. gcc/ChangeLog: * Makefile.in (OBJS): Add value-range-storage.o. (GTFILES): Add value-range-storage.h. * gengtype.cc (open_base_files): Add value-range-storage.h. * value-range-storage.cc: New file. * value-range-storage.h: New file.
Diffstat (limited to 'gcc/gimple-range-edge.cc')
0 files changed, 0 insertions, 0 deletions