From 264ddbaa683da65a254b012d178149830339d502 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 14 Jan 2001 01:08:51 -0800 Subject: [PATCH] vax.h (RETURN_POPS_ARGS): Max at 255 arguments. * 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 | 5 +++ gcc/config/vax/vax.h | 5 +-- gcc/config/vax/vax.md | 87 ++++++++++++++++++++++++++------------------------- 3 files changed, 53 insertions(+), 44 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5df9dd7..a07f54b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 * config/i386/i386.c (ix86_split_fp_branch): Remove unused diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h index fe8f845..06b6d21 100644 --- a/gcc/config/vax/vax.h +++ b/gcc/config/vax/vax.h @@ -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). diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md index 7faab34..edca8bb 100644 --- a/gcc/config/vax/vax.md +++ b/gcc/config/vax/vax.md @@ -1823,63 +1823,66 @@ ;; 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. -- 2.7.4