This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/54505] RFE: Inline function tables
- From: "avi at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 09 Sep 2012 11:12:53 +0000
- Subject: [Bug tree-optimization/54505] RFE: Inline function tables
- Auto-submitted: auto-generated
- References: <bug-54505-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54505
--- Comment #4 from Avi Kivity <avi at redhat dot com> 2012-09-09 11:12:53 UTC ---
(In reply to comment #2)
> I don't think this transformation would always be an improvement.
gcc should make the transformation when it improves the code (like all other
transformations).
> Had a
> developer wanted to use a switch, I'd think he/she would have used one. A
> dispatch table is much more code-size efficient compared to a switch.
gcc often transforms a switch to a dispatch table, with the difference that the
function call convention is not used. Instead, register values are maintained
across the call, and instead of call/ret, jmp/jmp (on x86) are used.
gcc should allow the programmer to write the code in the cleanest way, and
transform it to the most performing way. In the same way that gcc converts
some multiplies to a shift, it should convert some indirect function calls to a
non-function dispatch table. It's inlining but on a larger scale.