This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
tablejump index
- From: Momchil Velikov <velco at fadata dot bg>
- To: gcc at gcc dot gnu dot org
- Date: 30 Jul 2002 14:06:48 +0300
- Subject: tablejump index
How about having a mode where the operand 0 of the tablejump expander
is an index into the jump table, instead of jump target address? This
would allow for insns, which do the whole work of dereferencing and
jumping by itself.
I propose something like the following (untested) patch, with
TABLEJUMP_INDEX being a new target macro, which evaluates to zero by
default.
Comments ?
~velco
--- expr.c Mon Jul 29 09:41:13 2002
+++ expr.c.new Tue Jul 30 14:01:16 2002
@@ -10768,6 +10768,10 @@ do_tablejump (index, mode, range, table_
if (mode != Pmode)
index = convert_to_mode (Pmode, index, 1);
+ if (TABLEJUMP_INDEX)
+ temp = index;
+ else
+ {
/* Don't let a MEM slip thru, because then INDEX that comes
out of PIC_CASE_VECTOR_ADDRESS won't be a valid address,
and break_out_memory_refs will go to work on it and mess it up. */
@@ -10798,6 +10802,7 @@ do_tablejump (index, mode, range, table_
vector = gen_rtx_MEM (CASE_VECTOR_MODE, index);
RTX_UNCHANGING_P (vector) = 1;
convert_move (temp, vector, 0);
+ }
emit_jump_insn (gen_tablejump (temp, table_label));