Hello,
the docs for -fno-function-cse says:
`-fno-function-cse'
Do not put function addresses in registers; make each instruction
that calls a constant function contain the function's address
explicitly.
This option results in less efficient code, but some strange hacks
that alter the assembler output may be confused by the
optimizations performed when this option is not used.
The default is `-ffunction-cse'
But when I tried (replacing in Gujin some calll by lcallw based on which
function
is called) it did not work as I expected it. For instance, -fno-function-cse
seem
ignored here:
[EMAIL PROTECTED] ~]$ cat tmp.c
int (*fct) (int i);
int test_function_cse (int j) {
if (j 0)
return fct(j - 1);
else
return fct(j + 1);
}
[EMAIL PROTECTED] ~]$ gcc -Os -S tmp.c
[EMAIL PROTECTED] ~]$ cat tmp.s
.file tmp.c
.text
.globl test_function_cse
.type test_function_cse, @function
test_function_cse:
pushl %ebp
movlfct, %ecx
movl%esp, %ebp
movl8(%ebp), %eax
testl %eax, %eax
jle .L2
decl%eax
jmp .L6
.L2:
incl%eax
.L6:
movl%eax, 8(%ebp)
popl%ebp
jmp *%ecx
.size test_function_cse, .-test_function_cse
.comm fct,4,4
.ident GCC: (GNU) 4.1.0 20060304 (Red Hat 4.1.0-3)
.section.note.GNU-stack,,@progbits
[EMAIL PROTECTED] ~]$ gcc -Os -fno-function-cse -S tmp.c
[EMAIL PROTECTED] ~]$ cat tmp.s
.file tmp.c
.text
.globl test_function_cse
.type test_function_cse, @function
test_function_cse:
pushl %ebp
movlfct, %ecx
movl%esp, %ebp
movl8(%ebp), %eax
testl %eax, %eax
jle .L2
decl%eax
jmp .L6
.L2:
incl%eax
.L6:
movl%eax, 8(%ebp)
popl%ebp
jmp *%ecx
.size test_function_cse, .-test_function_cse
.comm fct,4,4
.ident GCC: (GNU) 4.1.0 20060304 (Red Hat 4.1.0-3)
.section.note.GNU-stack,,@progbits
[EMAIL PROTECTED] ~]$ gcc -Os -fno-function-cse -fno-optimize-sibling-calls -S
tmp.c
[EMAIL PROTECTED] ~]$ cat tmp.s
.file tmp.c
.text
.globl test_function_cse
.type test_function_cse, @function
test_function_cse:
pushl %ebp
movlfct, %edx
movl%esp, %ebp
movl8(%ebp), %eax
testl %eax, %eax
jle .L2
decl%eax
jmp .L6
.L2:
incl%eax
.L6:
pushl %eax
call*%edx
popl%edx
leave
ret
.size test_function_cse, .-test_function_cse
.comm fct,4,4
.ident GCC: (GNU) 4.1.0 20060304 (Red Hat 4.1.0-3)
.section.note.GNU-stack,,@progbits
[EMAIL PROTECTED] ~]$
Thanks,
Etienne.
___
Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos
services préférés : vérifiez vos nouveaux mails, lancez vos recherches et
suivez l'actualité en temps réel.
Rendez-vous sur http://fr.yahoo.com/set