vax.h (RETURN_POPS_ARGS): Max at 255 arguments.
authorRichard Henderson <rth@redhat.com>
Sun, 14 Jan 2001 09:08:51 +0000 (01:08 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 14 Jan 2001 09:08:51 +0000 (01:08 -0800)
        * config/vax/vax.h (RETURN_POPS_ARGS): Max at 255 arguments.
        * config/vax/vax.md (call_pop): Turn into an expander.
        (call_value_pop): Likewise.
        (call, call_value): New.

From-SVN: r39004

gcc/ChangeLog
gcc/config/vax/vax.h
gcc/config/vax/vax.md

index 5df9dd73bfa03fbab49842fb13361a86fdd2d81c..a07f54b87baa239baac26af4b375f1f3ec7aca82 100644 (file)
@@ -5,6 +5,11 @@
 
        * config/vax/vax.md (indirect_jump): Use register_operand.
 
+       * config/vax/vax.h (RETURN_POPS_ARGS): Max at 255 arguments.
+       * config/vax/vax.md (call_pop): Turn into an expander.
+       (call_value_pop): Likewise.
+       (call, call_value): New.
+
 2001-01-14  Andreas Jaeger  <aj@suse.de>
 
        * config/i386/i386.c (ix86_split_fp_branch): Remove unused
index fe8f845903340bc5337e2dac15bedf619802e070..06b6d219d7702ef78f5040660e68cd2ed40d10ae 100644 (file)
@@ -369,9 +369,10 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
    or for a library call it is an identifier node for the subroutine name.
    SIZE is the number of bytes of arguments passed on the stack.
 
-   On the Vax, the RET insn always pops all the args for any function.  */
+   On the Vax, the RET insn pops a maximum of 255 args for any function.  */
 
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) (SIZE)
+#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
+  ((SIZE) > 255*4 ? 0 : (SIZE))
 
 /* Define how to find the value returned by a function.
    VALTYPE is the data type of the value (as a tree).
index 7faab34a97392cd97876982000c0f4170ba8ccb7..edca8bb5b572216d03b567ba2847213f71915fb3 100644 (file)
 ;; It is used in the call instruction as a byte, but in the addl2 as
 ;; a word.  Since the only time we actually use it in the call instruction
 ;; is when it is a constant, SImode (for addl2) is the proper mode.
-(define_insn "call_pop"
+(define_expand "call_pop"
+  [(parallel [(call (match_operand:QI 0 "memory_operand" "")
+                   (match_operand:SI 1 "const_int_operand" ""))
+             (set (reg:SI 14)
+                  (plus:SI (reg:SI 14)
+                           (match_operand:SI 3 "immediate_operand" "")))])]
+  ""
+  "
+{
+  if (INTVAL (operands[1]) > 255 * 4)
+    abort ();
+  operands[1] = GEN_INT ((INTVAL (operands[1]) + 3)/ 4);
+}")
+
+(define_insn "*call_pop"
   [(call (match_operand:QI 0 "memory_operand" "m")
         (match_operand:SI 1 "const_int_operand" "n"))
    (set (reg:SI 14) (plus:SI (reg:SI 14)
-                            (match_operand:SI 3 "immediate_operand" "i")))]
+                            (match_operand:SI 2 "immediate_operand" "i")))]
   ""
-  "*
-  if (INTVAL (operands[1]) > 255 * 4)
-    /* Vax `calls' really uses only one byte of #args, so pop explicitly.  */
-    return \"calls $0,%0\;addl2 %1,sp\";
-  operands[1] = GEN_INT ((INTVAL (operands[1]) + 3)/ 4);
-  return \"calls %1,%0\";
-")
+  "calls %1,%0")
+
+(define_expand "call_value_pop"
+  [(parallel [(set (match_operand 0 "" "")
+                  (call (match_operand:QI 1 "memory_operand" "")
+                        (match_operand:SI 2 "const_int_operand" "")))
+             (set (reg:SI 14)
+                  (plus:SI (reg:SI 14)
+                           (match_operand:SI 4 "immediate_operand" "")))])]
+  ""
+  "
+{
+  if (INTVAL (operands[2]) > 255 * 4)
+    abort ();      
+  operands[2] = GEN_INT ((INTVAL (operands[2]) + 3)/ 4);
+}")
 
-(define_insn "call_value_pop"
-  [(set (match_operand 0 "" "=g")
+(define_insn "*call_value_pop"
+  [(set (match_operand 0 "" "")
        (call (match_operand:QI 1 "memory_operand" "m")
              (match_operand:SI 2 "const_int_operand" "n")))
    (set (reg:SI 14) (plus:SI (reg:SI 14)
-                            (match_operand:SI 4 "immediate_operand" "i")))]
+                            (match_operand:SI 3 "immediate_operand" "i")))]
   ""
-  "*
-  if (INTVAL (operands[2]) > 255 * 4)
-    /* Vax `calls' really uses only one byte of #args, so pop explicitly.  */
-    return \"calls $0,%1\;addl2 %2,sp\";
-  operands[2] = GEN_INT ((INTVAL (operands[2]) + 3)/ 4);
-  return \"calls %2,%1\";
-")
+  "calls %2,%1")
 
-;; Define another set of these for the case of functions with no
-;; operands.  In that case, combine may simplify the adjustment of sp.
-(define_insn ""
+;; Define another set of these for the case of functions with no operands.
+;; These will allow the optimizers to do a slightly better job.
+(define_insn "call"
   [(call (match_operand:QI 0 "memory_operand" "m")
-        (match_operand:SI 1 "const_int_operand" "n"))
-   (set (reg:SI 14) (reg:SI 14))]
+        (const_int 0))]
   ""
-  "*
-  if (INTVAL (operands[1]) > 255 * 4)
-    /* Vax `calls' really uses only one byte of #args, so pop explicitly.  */
-    return \"calls $0,%0\;addl2 %1,sp\";
-  operands[1] = GEN_INT ((INTVAL (operands[1]) + 3)/ 4);
-  return \"calls %1,%0\";
-")
+  "calls $0,%0")
 
-(define_insn ""
-  [(set (match_operand 0 "" "=g")
+(define_insn "call_value"
+  [(set (match_operand 0 "" "")
        (call (match_operand:QI 1 "memory_operand" "m")
-             (match_operand:SI 2 "const_int_operand" "n")))
-   (set (reg:SI 14) (reg:SI 14))]
+             (const_int 0)))]
   ""
-  "*
-  if (INTVAL (operands[2]) > 255 * 4)
-    /* Vax `calls' really uses only one byte of #args, so pop explicitly.  */
-    return \"calls $0,%1\;addl2 %2,sp\";
-  operands[2] = GEN_INT ((INTVAL (operands[2]) + 3)/ 4);
-  return \"calls %2,%1\";
-")
+  "calls $0,%1")
 
 ;; Call subroutine returning any type.