public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/54505] New: RFE: Inline function tables
@ 2012-09-06 16:52 avi at redhat dot com
  2012-09-06 17:29 ` [Bug tree-optimization/54505] " steven at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: avi at redhat dot com @ 2012-09-06 16:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54505

             Bug #: 54505
           Summary: RFE: Inline function tables
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: avi@redhat.com


It is common to see code such as

  static const int (*ftable[])(struct context *) = { 
      [V1] = f1,
      [V2] = f2,
      ...
  };

  ...

  {
      ftable[nr](context);
  }

However, this is less efficient than an equivalent switch () statement since
the calling convention must be observed.  Some registers are clobbered, others
must be set to the arguments, and the functions must have a prolog and an
epilogue.

It is easy to recognize the pattern though and convert it into an equivalent
switch:

  switch (nr) {
  case V1:
      f1(context);
      break;
  case V2:
      f2(context);
      break;
  ...
  }


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-09-09 21:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-06 16:52 [Bug tree-optimization/54505] New: RFE: Inline function tables avi at redhat dot com
2012-09-06 17:29 ` [Bug tree-optimization/54505] " steven at gcc dot gnu.org
2012-09-06 17:31 ` steven at gcc dot gnu.org
2012-09-06 19:25 ` pinskia at gcc dot gnu.org
2012-09-09 11:13 ` avi at redhat dot com
2012-09-09 21:27 ` steven at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).