diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 673ddb2b7d3..0d9e6fc5b04 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -219,12 +219,7 @@ expand_prologue () emit_insn (gen_store_movm ()); if (frame_pointer_needed) - { - emit_move_insn (frame_pointer_rtx, stack_pointer_rtx); - emit_insn (gen_addsi3 (frame_pointer_rtx, - frame_pointer_rtx, - GEN_INT (20))); - } + emit_move_insn (frame_pointer_rtx, stack_pointer_rtx); if (size) emit_insn (gen_addsi3 (stack_pointer_rtx, @@ -240,9 +235,6 @@ expand_epilogue () /* Cut back the stack. */ if (frame_pointer_needed) { - emit_insn (gen_addsi3 (frame_pointer_rtx, - frame_pointer_rtx, - GEN_INT (-20))); emit_move_insn (stack_pointer_rtx, frame_pointer_rtx); size = 0; } diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h index 64f0a629b32..0f1074cf645 100644 --- a/gcc/config/mn10300/mn10300.h +++ b/gcc/config/mn10300/mn10300.h @@ -337,13 +337,13 @@ enum reg_class { first local allocated. Otherwise, it is the offset to the BEGINNING of the first local allocated. */ -#define STARTING_FRAME_OFFSET -20 +#define STARTING_FRAME_OFFSET 0 /* Offset of first parameter from the argument pointer register value. */ /* Is equal to the size of the saved fp + pc, even if an fp isn't saved since the value is used before we know. */ -#define FIRST_PARM_OFFSET(FNDECL) 0 +#define FIRST_PARM_OFFSET(FNDECL) (-4 + 20) /* Specify the registers used for certain standard purposes. The values of these macros are register numbers. */ @@ -374,7 +374,7 @@ enum reg_class { as of the start of the function body. This depends on the layout of the fixed parts of the stack frame and on how registers are saved. */ -#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0 +#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 20 /* A guess for the MN10300. */ #define PROMOTE_PROTOTYPES 1 @@ -388,6 +388,17 @@ enum reg_class { #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 +/* On the mn10300, the caller is responsible for allocating and deallocating + a stack slot for the "call" and "calls" instructions to save their return + pointer. We used to do this in the "call" and "call_value" expanders, + but that generated poor code. + + Now we pretend that we have an outgoing register parameter space so that + the generic function calling code will allocate the slot. */ + +#define REG_PARM_STACK_SPACE(FNDECL) 4 +#define OUTGOING_REG_PARM_STACK_SPACE + /* 1 if N is a possible register number for function argument passing. On the MN10300, no registers are used in this way. */ diff --git a/gcc/config/mn10300/mn10300.md b/gcc/config/mn10300/mn10300.md index ebf41e54279..52546c85a56 100644 --- a/gcc/config/mn10300/mn10300.md +++ b/gcc/config/mn10300/mn10300.md @@ -1,5 +1,5 @@ ;; GCC machine description for Matsushita MN10300 -;; Copyright (C) 1996 Free Software Foundation, Inc. +;; Copyright (C) 1996, 1997 Free Software Foundation, Inc. ;; Contributed by Jeff Law (law@cygnus.com). @@ -469,7 +469,7 @@ || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LT)) return 0; - return \"b%B1 .+8\\n\\tjmp %0\\n\"; + return \"b%b1 %0\"; }" [(set_attr "cc" "none")]) @@ -488,7 +488,7 @@ || GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LT)) return 0; - return \"b%b1 .+8\\n\\tjmp %0\\n\"; + return \"b%B1 %0\"; }" [(set_attr "cc" "none")]) @@ -522,15 +522,9 @@ "" " { - emit_insn (gen_addsi3 (stack_pointer_rtx, - stack_pointer_rtx, - GEN_INT (-4))); if (! call_address_operand (XEXP (operands[0], 0))) XEXP (operands[0], 0) = force_reg (SImode, XEXP (operands[0], 0)); emit_call_insn (gen_call_internal (XEXP (operands[0], 0), operands[1])); - emit_insn (gen_addsi3 (stack_pointer_rtx, - stack_pointer_rtx, - GEN_INT (4))); DONE; }") @@ -551,17 +545,11 @@ "" " { - emit_insn (gen_addsi3 (stack_pointer_rtx, - stack_pointer_rtx, - GEN_INT (-4))); if (! call_address_operand (XEXP (operands[1], 0))) XEXP (operands[1], 0) = force_reg (SImode, XEXP (operands[1], 0)); emit_call_insn (gen_call_value_internal (operands[0], XEXP (operands[1], 0), operands[2])); - emit_insn (gen_addsi3 (stack_pointer_rtx, - stack_pointer_rtx, - GEN_INT (4))); DONE; }")