aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>1997-03-07 09:42:33 -0700
committerJeff Law <law@gcc.gnu.org>1997-03-07 09:42:33 -0700
commit6e86170d98445039d09630dd894e7a6cd08c1772 (patch)
treeff3c0572ea230bd4a6a7b115250a813bd7769903 /gcc
parente035031935a5160976ef3cf0b626701df1c3fd23 (diff)
downloadgcc-6e86170d98445039d09630dd894e7a6cd08c1772.zip
gcc-6e86170d98445039d09630dd894e7a6cd08c1772.tar.gz
gcc-6e86170d98445039d09630dd894e7a6cd08c1772.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/mn10300/mn10300.c10
-rw-r--r--gcc/config/mn10300/mn10300.h17
-rw-r--r--gcc/config/mn10300/mn10300.md18
3 files changed, 18 insertions, 27 deletions
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 673ddb2..0d9e6fc 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 64f0a62..0f1074c 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 ebf41e5..52546c8 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;
}")