I am trying to move towards much more space-efficient switch statements, using popcnt, as described in PR39013. This is the run-time component. See D60673 and D60982 Code that uses this is not ready for review, and is here: https://github.com/shawnl/llvm/tree/test
I am hoping on getting some feed-back on this implementation. compiler-rt is written to be very portable, and my patch depends on popcountll, a GNU extension, as well as eSymbolTypeResolver (IFUNC when using ELF). Also, I had planned to implement a dosparsejmp() that would directly jump after a tail call, instead of possibly just using __getsparse32/64 here, and that would require special code for every supported architecture. (but it will probably be necessary with non-integer pointer arches like Mill become part of LLVM)
This is a space-saving improvement, so putting these routines here make sense.
There are three versions, in 4 sizes (8 16 32 and 64 bits). The three versions are:
- normal: default is the same size as the elements of the table
- unreachable: default is unreachable, meaning some checks can be omitted
- code: default is code (gcc has this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58774 )