This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch] fix in storing function return register in a temp when register classes are small
- To: <gcc-patches at gcc dot gnu dot org>
- Subject: [Patch] fix in storing function return register in a temp when register classes are small
- From: "Igor Shevlyakov" <igor dot shevlyakov at windriver dot com>
- Date: Thu, 19 Apr 2001 19:13:00 -0700
Hi folks,
I encountered a problem in SH codegeneration which could be fixed by
the patch. And it's correct to have that kind of check in general.
Code I fixed was inserting pseudo reg to hold function return values
if we have SMALL_REGISTER_CLASSES. It was looking for patterns like:
set r0 = call f
set blahh = r0
and changing it to
set ro = call f
set rtemp = r0
set blah = rtemp
But it fails to find a pattern
set r0 = call f
set sp = sp + const
set blahh = r0
So I fixed that:
diff:
Index: egcs/gcc/function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.264
diff -c -3 -p -r1.264 function.c
*** function.c 2001/04/15 08:37:34 1.264
--- function.c 2001/04/20 02:01:17
*************** fixup_var_refs_insn (insn, var, promoted
*** 1797,1802 ****
--- 1797,1808 ----
&& GET_CODE (PATTERN (insn)) == PARALLEL
&& GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == SET)
call_dest = SET_DEST (XVECEXP (PATTERN (insn), 0, 0));
+ call_dest = SET_DEST (XVECEXP (PATTERN (insn), 0, 0));
+ else if (call_dest !=0 && GET_CODE(insn) == INSN &&
+ GET_CODE(PATTERN(insn)) == SET &&
+ GET_CODE (XEXP (PATTERN (insn), 0)) == REG &&
+ REGNO(XEXP (PATTERN (insn), 0)) == STACK_POINTER_REGNUM)
+ ; //keep call_dest since it's set sp = sp + adj
else
call_dest = 0;
}
======================================
ChangeLog:
2001-04-19 Igor Shevlyakov <igor@windriver.com>
* function.c: (fixup_var_refs_insn): Not to stop the search for
usage of function return register on adjusting stack frame after call.
Regards,