Commit 6e86170d by Jeff Law

mn10300.c (expand_prologue): Rework to avoid unnecessary "add" operations.

        * mn10300/mn10300.c (expand_prologue): Rework to avoid unnecessary
        "add" operations.
        (expand_epilogue): Likewise.
        * mn10300/mn10300.h (STARTING_FRAME_OFFSET): Is zero after the last
        round of prologue/epilogue changes.
        (FIRST_PARM_OFFSET): Is now 16 (-4 for REG_PARM_STACK_SPACE + 20 for
        register save area).
        (REG_PARM_STACK_SPACE): Define as 4 bytes.
        (OUTGOING_REG_PARM_STACK_SPACE): Define so caller allocates it.
        * mn10300/mn10300.md (call expander): Don't emit insns to adjust the
        stack here anymore.
        (call_value expander): Likewise.

        * mn10300/mn10300.md (bCC patterns): Just use "bCC target" now that
        the assembler handles relaxing.

From-SVN: r13696
parent e0350319
...@@ -219,12 +219,7 @@ expand_prologue () ...@@ -219,12 +219,7 @@ expand_prologue ()
emit_insn (gen_store_movm ()); emit_insn (gen_store_movm ());
if (frame_pointer_needed) if (frame_pointer_needed)
{ emit_move_insn (frame_pointer_rtx, stack_pointer_rtx);
emit_move_insn (frame_pointer_rtx, stack_pointer_rtx);
emit_insn (gen_addsi3 (frame_pointer_rtx,
frame_pointer_rtx,
GEN_INT (20)));
}
if (size) if (size)
emit_insn (gen_addsi3 (stack_pointer_rtx, emit_insn (gen_addsi3 (stack_pointer_rtx,
...@@ -240,9 +235,6 @@ expand_epilogue () ...@@ -240,9 +235,6 @@ expand_epilogue ()
/* Cut back the stack. */ /* Cut back the stack. */
if (frame_pointer_needed) 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); emit_move_insn (stack_pointer_rtx, frame_pointer_rtx);
size = 0; size = 0;
} }
......
...@@ -337,13 +337,13 @@ enum reg_class { ...@@ -337,13 +337,13 @@ enum reg_class {
first local allocated. Otherwise, it is the offset to the BEGINNING first local allocated. Otherwise, it is the offset to the BEGINNING
of the first local allocated. */ 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. */ /* 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 /* 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. */ 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. /* Specify the registers used for certain standard purposes.
The values of these macros are register numbers. */ The values of these macros are register numbers. */
...@@ -374,7 +374,7 @@ enum reg_class { ...@@ -374,7 +374,7 @@ enum reg_class {
as of the start of the function body. This depends on the layout 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. */ 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. */ /* A guess for the MN10300. */
#define PROMOTE_PROTOTYPES 1 #define PROMOTE_PROTOTYPES 1
...@@ -388,6 +388,17 @@ enum reg_class { ...@@ -388,6 +388,17 @@ enum reg_class {
#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 #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. /* 1 if N is a possible register number for function argument passing.
On the MN10300, no registers are used in this way. */ On the MN10300, no registers are used in this way. */
......
;; GCC machine description for Matsushita MN10300 ;; 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). ;; Contributed by Jeff Law (law@cygnus.com).
...@@ -469,7 +469,7 @@ ...@@ -469,7 +469,7 @@
|| GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LE
|| GET_CODE (operands[1]) == LT)) || GET_CODE (operands[1]) == LT))
return 0; return 0;
return \"b%B1 .+8\\n\\tjmp %0\\n\"; return \"b%b1 %0\";
}" }"
[(set_attr "cc" "none")]) [(set_attr "cc" "none")])
...@@ -488,7 +488,7 @@ ...@@ -488,7 +488,7 @@
|| GET_CODE (operands[1]) == LE || GET_CODE (operands[1]) == LE
|| GET_CODE (operands[1]) == LT)) || GET_CODE (operands[1]) == LT))
return 0; return 0;
return \"b%b1 .+8\\n\\tjmp %0\\n\"; return \"b%B1 %0\";
}" }"
[(set_attr "cc" "none")]) [(set_attr "cc" "none")])
...@@ -522,15 +522,9 @@ ...@@ -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))) if (! call_address_operand (XEXP (operands[0], 0)))
XEXP (operands[0], 0) = force_reg (SImode, 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_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; DONE;
}") }")
...@@ -551,17 +545,11 @@ ...@@ -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))) if (! call_address_operand (XEXP (operands[1], 0)))
XEXP (operands[1], 0) = force_reg (SImode, XEXP (operands[1], 0)); XEXP (operands[1], 0) = force_reg (SImode, XEXP (operands[1], 0));
emit_call_insn (gen_call_value_internal (operands[0], emit_call_insn (gen_call_value_internal (operands[0],
XEXP (operands[1], 0), XEXP (operands[1], 0),
operands[2])); operands[2]));
emit_insn (gen_addsi3 (stack_pointer_rtx,
stack_pointer_rtx,
GEN_INT (4)));
DONE; DONE;
}") }")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment