public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, score] : bug fixed for score backend
@ 2007-08-10  3:58 liqin
  2007-08-17  1:38 ` liqin
  0 siblings, 1 reply; 2+ messages in thread
From: liqin @ 2007-08-10  3:58 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

Dear All,

This patch is for gcc-4.2.x/gcc-trunk.

Changelog:
        * 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.
 
Best Regards
Liqin


[-- Attachment #2: score-20070810.diff --]
[-- Type: application/octet-stream, Size: 5176 bytes --]

Index: gcc/doc/contrib.texi
===================================================================
--- gcc/doc/contrib.texi	(revision 127313)
+++ gcc/doc/contrib.texi	(working copy)
@@ -514,6 +514,10 @@ patches.
 Robert Lipe for OpenServer support, new testsuites, testing, etc.
 
 @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.
 
 @item
Index: gcc/config/score/score.c
===================================================================
--- gcc/config/score/score.c	(revision 127313)
+++ gcc/config/score/score.c	(working copy)
@@ -751,30 +751,13 @@ score_initialize_trampoline (rtx ADDR, r
 #define FFCACHE          "_flush_cache"
 #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;
-  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);
-  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 (ptr_mode, pchain), CHAIN);
+  emit_move_insn (gen_rtx_MEM (SImode, pfunc), FUNC);
+  emit_move_insn (gen_rtx_MEM (SImode, pchain), CHAIN);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, FFCACHE),
                      0, VOIDmode, 2,
                      ADDR, Pmode,
@@ -1301,8 +1284,11 @@ score_print_operand_address (FILE *file,
                          INTVAL (addr.offset));
                 break;
               default:
-                fprintf (file, "[%s,%ld]", reg_names[REGNO (addr.reg)],
-                         INTVAL (addr.offset));
+                if (INTVAL(addr.offset) == 0)
+                  fprintf(file, "[%s]", reg_names[REGNO (addr.reg)]);
+                else 
+                  fprintf(file, "[%s, %ld]", reg_names[REGNO (addr.reg)], 
+                          INTVAL(addr.offset));
                 break;
               }
           }
Index: gcc/config/score/score.h
===================================================================
--- gcc/config/score/score.h	(revision 127313)
+++ gcc/config/score/score.h	(working copy)
@@ -546,7 +546,7 @@ enum reg_class
    If `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect
    of this macro is to determine whether the space is included in
    `current_function_outgoing_args_size'.  */
-#define OUTGOING_REG_PARM_STACK_SPACE   1
+#define OUTGOING_REG_PARM_STACK_SPACE
 
 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
 
@@ -629,12 +629,25 @@ typedef struct score_args
   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.  */
-#define TRAMPOLINE_INSNS                8
+#define TRAMPOLINE_INSNS                6
 
 /* A C expression for the size in bytes of the trampoline, as an integer.  */
-#define TRAMPOLINE_SIZE \
-  (TRAMPOLINE_INSNS * GET_MODE_SIZE (SImode) + GET_MODE_SIZE (ptr_mode) * 2)
+#define TRAMPOLINE_SIZE                (24 + GET_MODE_SIZE (ptr_mode) * 2)
 
 /* A C statement to initialize the variable parts of a trampoline.
    ADDR is an RTX for the address of the trampoline; FNADDR is an
Index: gcc/config/score/score.md
===================================================================
--- gcc/config/score/score.md	(revision 127313)
+++ gcc/config/score/score.md	(working copy)
@@ -1430,8 +1430,6 @@
    (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]));
   DONE;
 })

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, score] : bug fixed for score backend
  2007-08-10  3:58 [PATCH, score] : bug fixed for score backend liqin
@ 2007-08-17  1:38 ` liqin
  0 siblings, 0 replies; 2+ messages in thread
From: liqin @ 2007-08-17  1:38 UTC (permalink / raw)
  To: liqin; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

commited on gcc-4.2.x/gcc-trunk

gcc-patches-owner@gcc.gnu.org 写于 08/10/2007 11:57:27 AM:

> Dear All,
> 
> This patch is for gcc-4.2.x/gcc-trunk.
> 
> Changelog:
>         * 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.
> 
> Best Regards
> Liqin
> 


[-- Attachment #2: score-20070817.diff --]
[-- Type: application/octet-stream, Size: 4816 bytes --]

Index: gcc/doc/contrib.texi
===================================================================
--- gcc/doc/contrib.texi	(revision 127575)
+++ gcc/doc/contrib.texi	(working copy)
@@ -514,6 +514,10 @@ patches.
 Robert Lipe for OpenServer support, new testsuites, testing, etc.
 
 @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.
 
 @item
Index: gcc/config/score/score.c
===================================================================
--- gcc/config/score/score.c	(revision 127575)
+++ gcc/config/score/score.c	(working copy)
@@ -751,30 +751,13 @@ score_initialize_trampoline (rtx ADDR, r
 #define FFCACHE          "_flush_cache"
 #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;
-  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);
-  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 (ptr_mode, pchain), CHAIN);
+  emit_move_insn (gen_rtx_MEM (SImode, pfunc), FUNC);
+  emit_move_insn (gen_rtx_MEM (SImode, pchain), CHAIN);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, FFCACHE),
                      0, VOIDmode, 2,
                      ADDR, Pmode,
@@ -1301,8 +1284,11 @@ score_print_operand_address (FILE *file,
                          INTVAL (addr.offset));
                 break;
               default:
-                fprintf (file, "[%s,%ld]", reg_names[REGNO (addr.reg)],
-                         INTVAL (addr.offset));
+                if (INTVAL(addr.offset) == 0)
+                  fprintf(file, "[%s]", reg_names[REGNO (addr.reg)]);
+                else 
+                  fprintf(file, "[%s, %ld]", reg_names[REGNO (addr.reg)], 
+                          INTVAL(addr.offset));
                 break;
               }
           }
Index: gcc/config/score/score.h
===================================================================
--- gcc/config/score/score.h	(revision 127575)
+++ gcc/config/score/score.h	(working copy)
@@ -629,12 +629,25 @@ typedef struct score_args
   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.  */
-#define TRAMPOLINE_INSNS                8
+#define TRAMPOLINE_INSNS                6
 
 /* A C expression for the size in bytes of the trampoline, as an integer.  */
-#define TRAMPOLINE_SIZE \
-  (TRAMPOLINE_INSNS * GET_MODE_SIZE (SImode) + GET_MODE_SIZE (ptr_mode) * 2)
+#define TRAMPOLINE_SIZE                (24 + GET_MODE_SIZE (ptr_mode) * 2)
 
 /* A C statement to initialize the variable parts of a trampoline.
    ADDR is an RTX for the address of the trampoline; FNADDR is an
Index: gcc/config/score/score.md
===================================================================
--- gcc/config/score/score.md	(revision 127575)
+++ gcc/config/score/score.md	(working copy)
@@ -1430,8 +1430,6 @@
    (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]));
   DONE;
 })

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-17  1:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-10  3:58 [PATCH, score] : bug fixed for score backend liqin
2007-08-17  1:38 ` liqin

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).