public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: pmw@uk.research.att.com (Paul Webster)
To: gcc-help@gcc.gnu.org
Subject: CASESI: GCC is  optimising away my cases
Date: Tue, 14 Dec 1999 09:20:00 -0000	[thread overview]
Message-ID: <199912141720.RAA11121@rocoto> (raw)

Hi all,

I'm trying to port the GCC compiler to a new machine description. I've got the 
basics working and am now trying to optimise case statements when using a 
dispatch table.

I've created a `casesi' pattern which outputs code for jumping via the table.
This produces the expected code. However, when I run the compiler with any
optimisation enabled, it removes the blocks of code referred to in the dispatch
table.

What it looks like is happening is that the jump optimisation cannot find a
jump which refers to the routines (as they are done indirectly via the dispatch
table), so it decides it can happily remove the code as it can never be called.
The label entries are still in the dispatch table, but are no longer defined.
If I have a default case, this is still maintained, as my bounds-checking branch
refers to this.

I've looked through the supplied machine descriptions and headers and cannot
see anything obvious that I am missing. What I think I need to do is mark the
case routines as being used by the main body of the code. I've seen comments
to the effect that this can be done by generating dummy jumps to each of the
cases, but I cannot find a clear example of how I can do this. If I remove the
`casesi' pattern and define a `tablejump' pattern the cases are not optimised
away, but the jump code is then non-optimal!

Could anyone offer any suggestions on the best way I can stop GCC optimising
this code away!

Thanks in advance,

    Paul


==============================================================================
                          AT&T Laboratories Cambridge
------------------------------------------------------------------------------
    Dr. Paul Webster, 24a Trumpington Street, Cambridge, CB2 1QA, England.
==============================================================================

WARNING: multiple messages have this Message-ID
From: pmw@uk.research.att.com (Paul Webster)
To: gcc-help@gcc.gnu.org
Subject: CASESI: GCC is  optimising away my cases
Date: Fri, 31 Dec 1999 22:24:00 -0000	[thread overview]
Message-ID: <199912141720.RAA11121@rocoto> (raw)
Message-ID: <19991231222400.e1lwVMfFIczSHEGQ6az8YeyWeN0uWnL0d_zXZ4V-nf4@z> (raw)

Hi all,

I'm trying to port the GCC compiler to a new machine description. I've got the 
basics working and am now trying to optimise case statements when using a 
dispatch table.

I've created a `casesi' pattern which outputs code for jumping via the table.
This produces the expected code. However, when I run the compiler with any
optimisation enabled, it removes the blocks of code referred to in the dispatch
table.

What it looks like is happening is that the jump optimisation cannot find a
jump which refers to the routines (as they are done indirectly via the dispatch
table), so it decides it can happily remove the code as it can never be called.
The label entries are still in the dispatch table, but are no longer defined.
If I have a default case, this is still maintained, as my bounds-checking branch
refers to this.

I've looked through the supplied machine descriptions and headers and cannot
see anything obvious that I am missing. What I think I need to do is mark the
case routines as being used by the main body of the code. I've seen comments
to the effect that this can be done by generating dummy jumps to each of the
cases, but I cannot find a clear example of how I can do this. If I remove the
`casesi' pattern and define a `tablejump' pattern the cases are not optimised
away, but the jump code is then non-optimal!

Could anyone offer any suggestions on the best way I can stop GCC optimising
this code away!

Thanks in advance,

    Paul


==============================================================================
                          AT&T Laboratories Cambridge
------------------------------------------------------------------------------
    Dr. Paul Webster, 24a Trumpington Street, Cambridge, CB2 1QA, England.
==============================================================================

             reply	other threads:[~1999-12-14  9:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-14  9:20 Paul Webster [this message]
1999-12-14  9:51 ` Jeffrey A Law
1999-12-31 22:24   ` Jeffrey A Law
1999-12-31 22:24 ` Paul Webster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199912141720.RAA11121@rocoto \
    --to=pmw@uk.research.att.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).