This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Is regs_ever_live valid in prologue? (SPARC quirk?)
- From: "Antonio Cunei" <ack at cunei dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Apr 2002 18:49:10 -0600
- Subject: Is regs_ever_live valid in prologue? (SPARC quirk?)
Hi, I am relatively new to GCC, and I need some advice,
or some advice regarding where to ask for advice.
Thank you for your suggestions! :)
The question, in a nutshell, is: is regs_ever_live[]
supposed to be valid during the prologue generation?
I am encountering, using the SPARC back end, cases
when some registers are marked as live when in fact
they are unused. Details are appended at the end of
this message.
Should I use a different method to extract the used
registers? Help! :)
---
I am also having troubles extracting, while in the
prologue, the machine mode of all the parameters
passed in registers. I used the following:
for (arg=DECL_ARGUMENTS(current_function_decl);
arg!=0; arg=TREE_CHAIN(arg))
{
rtx parm=DECL_INCOMING_RTL(arg);
int regn;
if (REG_P(parm)) {
enum machine_mode regmode = GET_MODE (parm);
regn=REGNO(parm); // names used in the body
// do something with regn and regmode
}
}
Would you use a different technique? This code doesn't
work 100% of the times, for me...
Thank you!!!! :)
Toni
_______________________________________________________________________
_____ ___ _ _ ___
|_ _!/ _ \| \| |_ _| Antonio Cunei - University of Glasgow
| | | (_) | .` || | - Room F152, Dept. of Computing Science
!_! \___/!_|\_!___| 17 Lilybank Gardens, Glasgow G12 8QQ
------------------------------------------------------------
Details of the anomaly:
compiling with -O3 the following, using the snapshot
20020422 (but I tried 3.0.4 as well)):
int correct(int a,int b)
{
return a-b-a-b;
}
int incorrect(int a,int b)
{
return b-a-b-a;
}
The results are as follows:
correct:
regs_ever_live: %g1 %o0 %o1
sub %g0, %o1, %g1
retl
sub %g1, %o1, %o0
Registers %o0 and %o1 are used for the two parameters,
so regs_ever_live is correct.
------
incorrect:
regs_ever_live: %g1 %o0 %i1 <<<<<
sub %g0, %o0, %g1
retl
sub %g1, %o0, %o0
%i1 appears in regs_ever_live instead of %o1 (a wrong
register window adjustment, maybe?)
------------------------------------------------------------