This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: SH: remove -mbigtable option (PR c/4516)
- To: gniibe at m17n dot org (NIIBE Yutaka)
- Subject: Re: SH: remove -mbigtable option (PR c/4516)
- From: Joern Rennecke <amylaar at onetel dot net dot uk>
- Date: Fri, 12 Oct 2001 15:06:09 +0100 (BST)
- Cc: amylaar at onetel dot net dot uk (Joern Rennecke), gcc-patches at gcc dot gnu dot org, kkojima at rr dot iij4u dot or dot jp (kaz Kojima), rodrigc at gcc dot gnu dot org, aoliva at redhat dot com
> 2001-10-12 NIIBE Yutaka <gniibe@m17n.org>
>
> * doc/invoke.texi (Option Summary: SH Options): Remove -mbigtable.
>
> * config/sh/sh.md (*casesi_worker): Handle 0..65535. Set attribute
> "length" with shl_casesi_worker_length.
>
> * config/sh/sh.h (BIGTABLE_BIT, TARGET_BIGTABLE): Removed.
> (TARGET_SWITCHES): Remove -mbigtable option.
> (CASE_VECTOR_MODE): Default to SImode, QImode when optimized
> (ASM_OUTPUT_ADDR_VEC_ELT): Always emit .long.
> (CASE_VECTOR_SHORTEN_MODE): Handle 0..65535.
> (optimized_size): Declared.
>
> * config/sh/sh.c (shl_casesi_worker_length): New function.
> * config/sh/sh-protos.h (shl_casesi_worker_length): New function.
It's almost there. Except I forgot to mention that the branch shortening
won't look at the length attribute a second time unless you explicitly
mention (pc) or (match_dup <num>) somewhere in it. A match_dup in this
context expects an label or a label_ref, so you could use (match_dup 2).
You can look at the default definition of the length attribute for an
example of how to make this be a no-op.
When you use (pc), this will be translated into a call to
insn_current_reference_address, which is a bit on the costly side. OTOH,
you could avoid ever executing the call - and even have it optimized out -
by first using a test that is obviously constant for the C compiler, but
opaque for genattrtab, like (eq (symbol_ref "0") (const_int 0)).
Whatever you do, it probably deserves a comment.
> + /* Function to be used in the length attribute of the casesi_worker instruction */
Please add a comment to describe the return value. When I first looked at
this, I thought it was wrong, till I looked at the caller.
> + int
> + shl_casesi_worker_length (insn)