This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Basic block construction on PA
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc at gcc dot gnu dot org
- Cc: rth at redhat dot com
- Date: Wed, 22 Jan 2003 18:57:28 -0500 (EST)
- Subject: Basic block construction on PA
I need help in trying to resolve this problem.
Recently, the v3 testsuite was changed to run with the CXXFLAGS "-O2 -g".
This caused a number of regressions on hppa64-hp-hpux11.11. I have
tracked this to a generic problem of pic code and exceptions.
The PA pic register is call clobbered and must be restored after
each call. In code that can't throw, the restore insn becomes
part of an in_post_call_group_p and is scheduled with the call.
However, when a call can throw or return to the nonlocal goto
handler, the basic block with the call is terminated after the
call, and there is no in_post_call_group_p group. The pic restore
insn lies in a new basic block and is no longer scheduled with
the call.
As a result, other instructions can be scheduled before the restore.
These instructions may have an implicit dependence on the pic
register (ie, there is nothing in the rtl to indicate such a
dependence) that only becomes explicit during reload. This of
course leads to disaster.
The only solution that I have found so far is to put a blockage
after the restore. This causes problems with detection of pure
and const functions when they contain a call. I am sure that the
blockage degrades scheduling as well. One would like it to go
away after reload.
Trying to restore the pic register during reload doesn't work
in all situations. I guess a call-saved register could be used
and the incoming pic register could be copied to it in the prologue.
However, we would only want to do the copy when the pic register
is actually used and I doubt reload would track this correctly.
I have the sense that the basic block should not terminate at the
call but after any insns that would form an in call group. Then,
the pic register restore would schedule with the call. However,
I am not sure this would work.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)