This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/12284] New: Add feature of preserving processor state in functions written in C
- From: "mkgnu at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Sep 2003 05:29:25 -0000
- Subject: [Bug c/12284] New: Add feature of preserving processor state in functions written in C
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12284
Summary: Add feature of preserving processor state in functions
written in C
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mkgnu at gmx dot net
CC: gcc-bugs at gcc dot gnu dot org
I am requesting the feature of telling gcc that it should create code for a
function that will leave the state of the registers exactly
as it was originally when the function was entered. So if the caller was already
using certain registers this feature could offload the responsibility of
preserving those to the callee. Ideally I would like to generate "a chunk of
code" that does not mess with the state of the processor, just like I would if
the same code was written intuitively in asm.
The small example I can provide that further expains this is:
int a = 8;
int c = 5;
void test3()
{
c = a + c;
}
Dump of assembler code for function test3:
0x80483cc <test3>: push %ebp
0x80483cd <test3+1>: mov %esp,%ebp
0x80483cf <test3+3>: mov 0x80494f4,%eax
0x80483d4 <test3+8>: add %eax,0x80494f8
0x80483da <test3+14>: leave
0x80483db <test3+15>: ret
End of assembler dump.
I would like a way to flag function test3 so the value of the %eax register used
(or any other register that gcc may decide to use) will be preserved.
The need for this feature and possible approaches to implementing it are being
discussed in:
http://gcc.gnu.org/ml/gcc-bugs/2003-09/msg00946.html
Please check this thread or contact me for more details.