This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [committed] Revamp casesi and jump table handling on PA


In message <200310292216.h9TMGJfc002211@hiauly1.hia.nrc.ca>, "John David Anglin
" writes:
 >It can to my attention that there was a problem with jump tables and
 >the "-mbig-switch" option on the PA.  The T' fixup was being used to
 >load the address of the branch target in each jump table element.
 >This was supposed to work for large, possibly computer generated,
 >case vectors.  However, the insn used with the T' fixup only supports
 >a 14 bit displacement.  Thus, it couldn't handle the large offsets
 >from the pic register that could occur with large branch tables.
Right.  Known limitation.


 >I tried the initial obvious fix to revamp the patterns to use a
 >two insn sequence to load the target address using the LT' and RT'
 >fixups.  This worked but then it occcured to me that it might be better
 >to use relative offsets in the table for big tables when generating
 >pic code, and just the absolute address for non-pic code.  This
 >patch implements that approach.
Excellent.   I spent quite a bit of time banging my head against this
problem several years ago.  Glad to see you've found a way to make it
work.

 >The first benefit is big switch tables are now one quarter the
 >previous size.  The second benefit is the insn sequences are shorter
 >in length for the non-pic case, equal (PA 2.0) or one insn longer for
 >the pic case (PA 1.x and 64-bit code).  Thirdly, we have one less
 >branch and the same number of memory accesses.  Finally, with the
 >jump table in the text section, there are no relocations needed for
 >the pic case, so this should help assembler and linker performance.
You might even argue that making -mbig-switch should be the default.  I've
never liked the idea that magic switches were necessary to compile
certain big nasty codes.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]