[cfe-dev] limiting inlining

Török Edwin edwintorok at gmail.com
Fri Sep 25 01:36:24 PDT 2009


On 2009-09-25 10:52, Roman Divacky wrote:
> On Thu, Sep 24, 2009 at 02:31:10PM -0700, Mike Stump wrote:
>   
>> On Sep 24, 2009, at 2:10 PM, Roman Divacky wrote:
>>     
>>> we need that for our bootloader... it needs to fit into a given size.
>>>       
>> Would -Os be better?
>>     
>
> this is what we have currently:
>
> clang -Os  -fno-guess-branch-probability  -fomit-frame-pointer  -mno-align-long-strings  -mrtd  -mno-mmx
> -mno-3dnow -mno-sse -mno-sse2 -mno-sse3  -DUFS1_AND_UFS2  -DFLAGS=0x80  -DSIOPRT=0x3f8  -DSIOFMT=0x3
> -DSIOSPD=9600  -I/usr/src/sys/boot/i386/boot2/../../common  -I/usr/src/sys/boot/i386/boot2/../btx/lib -I.  -Wall
> -Waggregate-return -Wbad-function-cast -Wcast-align  -Wmissing-declarations -Wmissing-prototypes -Wnested-externs
> -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings  -Winline --param max-inline-insns-single=100 -mllvm
> -inline-threshold=1000 -ffreestanding -mllvm -inline-threshold=1000 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
> -mno-sse3 -m32 -march=i386  -S -o boot2.s.tmp /usr/src/sys/boot/i386/boot2/boot2.c
>
> ie. -Os is already there. I wonder why  the -inline-threshold has no effect.
>
> can I disable inlining completely somehow?
>   

Adding noinline attribute to memcpy and xfsread seems to help somewhat,
.o file is 10336 bytes, still
larger than gcc's 9312.

~/builds/linux-2.6/scripts/bloat-o-meter boot2.o.gcc boot2.o.clang
add/remove: 5/9 grow/shrink: 11/3 up/down: 1322/-584 (738)
function                                     old     new   delta
static.fsread                                  -     404    +404
parse                                        640     810    +170
static.load                                    -     144    +144
printf                                       159     300    +141
fsread                                      1273    1403    +130
load                                         865     971    +106
main                                         639     697     +58
lookup                                       371     408     +37
dskread                                      433     469     +36
memcpy                                         -      30     +30
static.dsk                                     -      28     +28
drvread                                      185     199     +14
xfsread                                       46      54      +8
keyhit                                        77      85      +8
xputc                                         80      84      +4
static.drvread                                 -       4      +4
xgetc                                        146     145      -1
putchar                                       28      27      -1
exit                                           3       1      -2
static.inomap                                  4       -      -4
static.c                                       4       -      -4
static.indmap                                  8       -      -8
static.blkmap                                  8       -      -8
dsk                                           28       -     -28
static.ep                                     64       -     -64
static.es                                     80       -     -80
static.dp1                                   128       -    -128
static.dp2                                   256       -    -256


Best regards,
--Edwin



More information about the cfe-dev mailing list