Commit 64276d76 by Chen Liqin Committed by Chen Liqin

score.md: Update pattern tablejump.

2007-08-17  Chen Liqin  <liqin@sunnorth.com.cn>
        * config/score/score.md : Update pattern tablejump.
        * config/score/score.c : Update score_initialize_trampoline 
        function.
        * config/score/score.h (TRAMPOLINE_TEMPLATE): Added macro.
        (TRAMPOLINE_INSNS, TRAMPOLINE_SIZE) Update macro.
        * doc/contrib.texi: Add my entry.

From-SVN: r127577
parent 3a379d1b
2007-08-17 Chen Liqin <liqin@sunnorth.com.cn>
* config/score/score.md : Update pattern tablejump.
* config/score/score.c : Update score_initialize_trampoline
function.
* config/score/score.h (TRAMPOLINE_TEMPLATE): Added macro.
(TRAMPOLINE_INSNS, TRAMPOLINE_SIZE) Update macro.
* doc/contrib.texi: Add my entry.
2007-08-16 H.J. Lu <hongjiu.lu@intel.com> 2007-08-16 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.in (REVISION): New. * Makefile.in (REVISION): New.
......
...@@ -182,6 +182,9 @@ th_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, ...@@ -182,6 +182,9 @@ th_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* Pretend to be a post-reload pass while generating rtl. */ /* Pretend to be a post-reload pass while generating rtl. */
reload_completed = 1; reload_completed = 1;
/* Mark the end of the (empty) prologue. */
emit_note (NOTE_INSN_PROLOGUE_END);
/* We need two temporary registers in some cases. */ /* We need two temporary registers in some cases. */
temp1 = gen_rtx_REG (Pmode, 8); temp1 = gen_rtx_REG (Pmode, 8);
temp2 = gen_rtx_REG (Pmode, 9); temp2 = gen_rtx_REG (Pmode, 9);
...@@ -747,30 +750,13 @@ score_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN) ...@@ -747,30 +750,13 @@ score_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN)
#define FFCACHE "_flush_cache" #define FFCACHE "_flush_cache"
#define CODE_SIZE (TRAMPOLINE_INSNS * UNITS_PER_WORD) #define CODE_SIZE (TRAMPOLINE_INSNS * UNITS_PER_WORD)
unsigned int tramp[TRAMPOLINE_INSNS] = {
0x8103bc56, /* mv r8, r3 */
0x9000bc05, /* bl 0x0x8 */
0xc1238000 | (CODE_SIZE - 8), /* lw r9, &func */
0xc0038000
| (STATIC_CHAIN_REGNUM << 21)
| (CODE_SIZE - 4), /* lw static chain reg, &chain */
0x8068bc56, /* mv r3, r8 */
0x8009bc08, /* br r9 */
0x0,
0x0,
};
rtx pfunc, pchain; rtx pfunc, pchain;
int i;
for (i = 0; i < TRAMPOLINE_INSNS; i++)
emit_move_insn (gen_rtx_MEM (ptr_mode, plus_constant (ADDR, i << 2)),
GEN_INT (tramp[i]));
pfunc = plus_constant (ADDR, CODE_SIZE); pfunc = plus_constant (ADDR, CODE_SIZE);
pchain = plus_constant (ADDR, CODE_SIZE + GET_MODE_SIZE (ptr_mode)); pchain = plus_constant (ADDR, CODE_SIZE + GET_MODE_SIZE (SImode));
emit_move_insn (gen_rtx_MEM (ptr_mode, pfunc), FUNC); emit_move_insn (gen_rtx_MEM (SImode, pfunc), FUNC);
emit_move_insn (gen_rtx_MEM (ptr_mode, pchain), CHAIN); emit_move_insn (gen_rtx_MEM (SImode, pchain), CHAIN);
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, FFCACHE), emit_library_call (gen_rtx_SYMBOL_REF (Pmode, FFCACHE),
0, VOIDmode, 2, 0, VOIDmode, 2,
ADDR, Pmode, ADDR, Pmode,
...@@ -1172,7 +1158,7 @@ score_print_operand (FILE *file, rtx op, int c) ...@@ -1172,7 +1158,7 @@ score_print_operand (FILE *file, rtx op, int c)
{ {
rtx temp = gen_lowpart (SImode, op); rtx temp = gen_lowpart (SImode, op);
gcc_assert (GET_MODE (op) == SFmode); gcc_assert (GET_MODE (op) == SFmode);
fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (temp) & 0xffffffff); fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (temp) & 0xffffffff);
} }
else else
output_addr_const (file, op); output_addr_const (file, op);
...@@ -1297,8 +1283,11 @@ score_print_operand_address (FILE *file, rtx x) ...@@ -1297,8 +1283,11 @@ score_print_operand_address (FILE *file, rtx x)
INTVAL (addr.offset)); INTVAL (addr.offset));
break; break;
default: default:
fprintf (file, "[%s,%ld]", reg_names[REGNO (addr.reg)], if (INTVAL(addr.offset) == 0)
INTVAL (addr.offset)); fprintf(file, "[%s]", reg_names[REGNO (addr.reg)]);
else
fprintf(file, "[%s, %ld]", reg_names[REGNO (addr.reg)],
INTVAL(addr.offset));
break; break;
} }
} }
......
...@@ -628,12 +628,25 @@ typedef struct score_args ...@@ -628,12 +628,25 @@ typedef struct score_args
fprintf (FILE, " .set nor1 \n"); \ fprintf (FILE, " .set nor1 \n"); \
} }
#define TRAMPOLINE_TEMPLATE(STREAM) \
{ \
fprintf (STREAM, "\t.set r1\n"); \
fprintf (STREAM, "\tmv r31, r3\n"); \
fprintf (STREAM, "\tbl nextinsn\n"); \
fprintf (STREAM, "nextinsn:\n"); \
fprintf (STREAM, "\tlw r1, [r3, 6*4-8]\n"); \
fprintf (STREAM, "\tlw r23, [r3, 6*4-4]\n"); \
fprintf (STREAM, "\tmv r3, r31\n"); \
fprintf (STREAM, "\tbr! r1\n"); \
fprintf (STREAM, "\tnop!\n"); \
fprintf (STREAM, "\t.set nor1\n"); \
}
/* Trampolines for Nested Functions. */ /* Trampolines for Nested Functions. */
#define TRAMPOLINE_INSNS 8 #define TRAMPOLINE_INSNS 6
/* A C expression for the size in bytes of the trampoline, as an integer. */ /* A C expression for the size in bytes of the trampoline, as an integer. */
#define TRAMPOLINE_SIZE \ #define TRAMPOLINE_SIZE (24 + GET_MODE_SIZE (ptr_mode) * 2)
(TRAMPOLINE_INSNS * GET_MODE_SIZE (SImode) + GET_MODE_SIZE (ptr_mode) * 2)
/* A C statement to initialize the variable parts of a trampoline. /* A C statement to initialize the variable parts of a trampoline.
ADDR is an RTX for the address of the trampoline; FNADDR is an ADDR is an RTX for the address of the trampoline; FNADDR is an
......
...@@ -1429,8 +1429,6 @@ ...@@ -1429,8 +1429,6 @@
(use (label_ref (match_operand 1 "" "")))] (use (label_ref (match_operand 1 "" "")))]
"" ""
{ {
if (GET_MODE (operands[0]) != ptr_mode)
gcc_unreachable ();
emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1])); emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
DONE; DONE;
}) })
......
...@@ -514,6 +514,10 @@ patches. ...@@ -514,6 +514,10 @@ patches.
Robert Lipe for OpenServer support, new testsuites, testing, etc. Robert Lipe for OpenServer support, new testsuites, testing, etc.
@item @item
Chen Liqin for various S+core related fixes/improvement, and for
maintaining the S+core port.
@item
Weiwen Liu for testing and various bug fixes. Weiwen Liu for testing and various bug fixes.
@item @item
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment