Bug#97904: gcc-3.0: Pointless moving
Package: gcc-3.0
Version: 1:3.0-0pre010427
Severity: normal
I was wondering if gcc-3.0 can decrease the size of ash since it combines
those esp additions/subtractions. Unfortunately, it actually ends up being
bigger. Part of the reason for that may be this:
findstring:
pushl %ebp
movl %esp, %ebp
subl $20, %esp
pushl $pstrcmp
pushl $4
pushl 16(%ebp)
leal 8(%ebp), %edx
pushl 12(%ebp)
movl %edx, %eax
pushl %eax
call bsearch
leave
ret
Notice the line "movl %edx, %eax" is unnecessary if we push edx instead of
eax, or if we lea into eax instead of edx. The source of this is:
#include <stdlib.h>
int pstrcmp(const void *, const void *);
const char *const *findstring(
const char *s, const char *const *array, size_t nmemb
) {
return bsearch(&s, array, nmemb, sizeof(const char *), pstrcmp);
}
-- System Information
Debian Release: testing/unstable
Kernel Version: Linux gondolin 2.4.4-686-smp #1 SMP Sun Apr 29 12:50:30 EST 2001 i686 unknown
Versions of the packages gcc-3.0 depends on:
ii binutils 2.11.90.0.7-2 The GNU assembler, linker and binary utiliti
ii cpp-3.0 3.0-0pre010403 The GNU C preprocessor.
ii gcc-3.0-base 3.0-0pre010403 The GNU compiler collection (base package).
ii libc6 2.2.3-1 GNU C Library: Shared libraries and Timezone
ii libgcc0 3.0-0pre010427 Shared libgcc.
Reply to: