This is part 2 of the base patch for LLVM Support of basic block sections. Part 1 is here: https://reviews.llvm.org/D68063
- This patch supports creating sections for all basic blocks or a subset of basic blocks. The subset of basic blocks via a clang option -fbasicblock-sections=<list_file> which contains a list of functions and the basic block ids for which sections are desired.
Please see https://github.com/google/llvm-propeller/blob/plo-dev/Propeller_RFC.pdf for a detailed discussion on basic block sections.
Labeling Basic Blocks :
Every basic block is labelled with a unique symbol as this allows easy mapping of virtual addresses from PMU profiles back to the corresponding basic blocks. Since the number of basic blocks is large, the labeling bloats the symbol table sizes and the string table sizes significantly. While the binary size does increase this does not affect performance as the symbol table is not loaded in memory during run-timea, the string table size bloat is kept very minimal using a unary naming scheme that uses string suffix compression. The basic blocks for function foo are named "a.bb.foo", "aa.bb.foo", . . . This turns out to be very good for string table sizes and the bloat in the string table size for a very large binary is only 8 %.
I'd like to have MIR support for serializing/deserializing the SectionType, so we can test the BBSectionsPrepare pass separately from the passes that run after it and the asmprinter.