]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/13122 (h8300 - local variable gets corrupted by function call when ...
authorKazu Hirata <kazu@cs.umass.edu>
Mon, 15 Dec 2003 20:24:33 +0000 (20:24 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Mon, 15 Dec 2003 20:24:33 +0000 (20:24 +0000)
PR target/13122
* config/h8300/h8300.md (pushqi1_h8300hs_normal): New.
(pushqi1): Call gen_pushqi1_h8300hs_normal in normal mode.
(pushhi1_h8300hs_normal): New.
(pushhi1): Call gen_pushqi1_h8300hs_normal in normal mode.

* config/h8300/h8300.h (LINK_SPEC): Support normal mode.
* config/h8300/h8300.c (asm_file_start): Correctly output
an architecture directive.
* config/h8300/lib1funcs.asm: Correctly specify an
architecture directive.

From-SVN: r74646

gcc/ChangeLog
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.h
gcc/config/h8300/h8300.md
gcc/config/h8300/lib1funcs.asm

index 9c0fc93d0ccaef3434bd525e1924e67cfc6fb39a..ae7ab2656eebf6cdc62aa3288b3c4f225f91af19 100644 (file)
@@ -1,3 +1,17 @@
+2003-12-15  Kazu Hirata  <kazu@cs.umass.edu>
+
+       PR target/13122
+       * config/h8300/h8300.md (pushqi1_h8300hs_normal): New.
+       (pushqi1): Call gen_pushqi1_h8300hs_normal in normal mode.
+       (pushhi1_h8300hs_normal): New.
+       (pushhi1): Call gen_pushqi1_h8300hs_normal in normal mode.
+
+       * config/h8300/h8300.h (LINK_SPEC): Support normal mode.
+       * config/h8300/h8300.c (asm_file_start): Correctly output
+       an architecture directive.
+       * config/h8300/lib1funcs.asm: Correctly specify an
+       architecture directive.
+
 2003-12-12  Roger Sayle  <roger@eyesopen.com>
 
        PR optimization/13037
index 7f49e5c1078cebf55bc0eabfac9d947386e510d4..47ee80aa98558354f885772fab1ecff1765dedc4 100644 (file)
@@ -757,9 +757,9 @@ asm_file_start (file)
   else if (optimize)
     fprintf (file, "; -O%d\n", optimize);
   if (TARGET_H8300H)
-    fprintf (file, "\n\t.h8300h\n");
+    fprintf (file, TARGET_NORMAL_MODE ? "\n\t.h8300hn\n" : "\n\t.h8300h\n");
   else if (TARGET_H8300S)
-    fprintf (file, "\n\t.h8300s\n");
+    fprintf (file, TARGET_NORMAL_MODE ? "\n\t.h8300sn\n" : "\n\t.h8300s\n");
   else
     fprintf (file, "\n\n");
   output_file_directive (file, main_input_filename);
index 232038df080cead011853931d277f3a697718275..b9da422024f9669ec984f3a1ed46dd30be071d35 100644 (file)
@@ -70,7 +70,7 @@ extern const char * const *h8_reg_names;
     }                                                  \
   while (0)
 
-#define LINK_SPEC "%{mh:-m h8300h} %{ms:-m h8300s}"
+#define LINK_SPEC "%{mh:%{mn:-m h8300hn}} %{mh:%{!mn:-m h8300h}} %{ms:%{mn:-m h8300sn}} %{ms:%{!mn:-m h8300s}}"
 
 #define LIB_SPEC "%{mrelax:-relax} %{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
 
index dc47cac4cf5ab9fdf78ef42a861cd5e5c6f5aca5..07229b4f95f68d87370acaf57c0ba0814c92dda3 100644 (file)
   [(set_attr "length" "4")
    (set_attr "cc" "clobber")])
 
+(define_insn "pushqi1_h8300hs_normal"
+  [(parallel [(set (reg:HI SP_REG)
+                  (plus:HI (reg:HI SP_REG) (const_int -4)))
+             (set (mem:QI (plus:HI (reg:HI SP_REG) (const_int -3)))
+                  (match_operand:QI 0 "register_operand" "r"))])]
+  "(TARGET_H8300H || TARGET_H8300S)
+   && operands[0] != stack_pointer_rtx"
+  "mov.l\\t%S0,@-er7"
+  [(set_attr "length" "4")
+   (set_attr "cc" "clobber")])
+
 (define_expand "pushqi1"
   [(use (match_operand:QI 0 "register_operand" ""))]
   ""
 {
   if (TARGET_H8300)
     emit_insn (gen_pushqi1_h8300 (operands[0]));
-  else
+  else if (!TARGET_NORMAL_MODE)
     emit_insn (gen_pushqi1_h8300hs (operands[0]));
+  else
+    emit_insn (gen_pushqi1_h8300hs_normal (operands[0]));
   DONE;
 }")
 
   [(set_attr "length" "4")
    (set_attr "cc" "clobber")])
 
+(define_insn "pushhi1_h8300hs_normal"
+  [(parallel [(set (reg:HI SP_REG)
+                  (plus:HI (reg:HI SP_REG) (const_int -4)))
+             (set (mem:HI (plus:HI (reg:HI SP_REG) (const_int -2)))
+                  (match_operand:HI 0 "register_operand" "r"))])]
+  "(TARGET_H8300H || TARGET_H8300S)
+   && operands[0] != stack_pointer_rtx"
+  "mov.l\\t%S0,@-er7"
+  [(set_attr "length" "4")
+   (set_attr "cc" "clobber")])
+
 (define_expand "pushhi1"
   [(use (match_operand:HI 0 "register_operand" ""))]
   ""
 {
   if (TARGET_H8300)
     emit_insn (gen_pushhi1_h8300 (operands[0]));
-  else
+  else if (!TARGET_NORMAL_MODE)
     emit_insn (gen_pushhi1_h8300hs (operands[0]));
+  else
+    emit_insn (gen_pushhi1_h8300hs_normal (operands[0]));
   DONE;
 }")
 
index 2f62572f225a41be3bb93dc369a413d3eb503c8e..dc22e54d60e6829585b613f789f27d1542a1f218 100644 (file)
@@ -96,12 +96,20 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 #ifdef __H8300H__
+#ifdef __NORMAL_MODE__
+       .h8300hn
+#else
        .h8300h
 #endif
+#endif
 
 #ifdef __H8300S__
+#ifdef __NORMAL_MODE__
+       .h8300sn
+#else
        .h8300s
 #endif
+#endif
 
 #ifdef L_cmpsi2
 #ifdef __H8300__