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 Working, but still needs work code that uses this 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.
This is a space-saving improvement, so putting these routines here make sense, even if they need clang to compile.
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 )