Edd Barrett <vex...@gmail.com> writes: > I would be really interested to know how GCC: > * Decides whether or not to embed tables in the data segment of the binary. > * Selects the comparisons in the above tree.
The relevant code is expand_case and friends in gcc/stmt.c. Where a jump table should go is decided on a target by target basis by the backend macro JUMP_TABLES_IN_TEXT_SECTION. > Perhaps someone knows of a good paper/book on this topic which could > be of use, or a relevant section of code in the GCC sources (at the > moment I am overwhelmed by the source tree). You may be interested in reading Roger Sayle's paper in the 2008 gcc summit, linked from http://ols.fedoraproject.org/GCC/Reprints-2008/ . Ian