This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Xtensa] fix a vararg bug


This fixes yet another bug related to Xtensa's use of the frame pointer (FP) register to pass a function argument. (There is no real conflict; the argument is simply copied elsewhere before setting up the FP value.) GCC handles the FP register as a special case and doesn't recognize when there is a live value in that register.

The specific problem is that the builtin_saveregs function calls move_block_from_reg to store some of the incoming argument registers to the stack, and the register allocator picks a7 to hold the destination address, despite the fact that a7 is one of the registers being stored. This is supposed to be avoided by storing a7 elsewhere as the very first thing in the function, but in the case of builtin_saveregs the code to save a7 was placed after the computation of the destination address. The patch fixes that.

Committed on the mainline. The same problem occurs on the 4.2 branch, so I will apply the patch there after I test it on the branch.

2007-09-12 Bob Wilson <bob.wilson@acm.org>

* config/xtensa/xtensa.c (machine_function): Add vararg_a7_copy.
(xtensa_copy_incoming_a7): Use start_sequence instead of
push_to_sequence. Stash insns in vararg_a7_copy for builtin_saveregs.
(xtensa_builtin_saveregs): Place code from vararg_a7_copy at the start
of the saveregs sequence.


Attachment: gcc-vararg-a7.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]