This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc code bloat again



this is gcc 2.95.1 on arm linux
I wonder if someone could kindly explain why gcc produces this output for
the constructor of an object and maybe give some suggestions how to avoid
it.
The size of the constructor code is 300 bytes!  The source  compiled with
-O2 -fomit-frame-pointer flags
By contrast, the code produced by Metrowerks 68k compiler is 46 bytes ( see
the disassembly below)

TIA , Andy

#objdump -d -r CResDataSource.o

CResDataSource.o:     file format elf32-arm
Disassembly of section .text:

00000000 <__14CResDataSourceP9CResource>:
   0:   e1a0c00d        mov     ip, sp
   4:   e92ddff0        stmdb   sp!, {r4, r5, r6, r7, r8, r9, sl, fp, ip,
lr, pc}
   8:   e24cb004        sub     fp, ip, #4
   c:   ed2d420c        sfm     f4, 4, [sp, -#48]!
  10:   e24dd03c        sub     sp, sp, #3c
  14:   e50b008c        str     r0, [fp, -#140]
  18:   e50b1090        str     r1, [fp, -#144]
  1c:   ebfffffe        bl      1c <__14CResDataSourceP9CResource+0x1c>
                        1c: R_ARM_PC24  __get_eh_context
  20:   e50b0094        str     r0, [fp, -#148]
  24:   e1a03000        mov     r3, r0
  28:   e51b008c        ldr     r0, [fp, -#140]
  2c:   ebfffffe        bl      2c <__14CResDataSourceP9CResource+0x2c>
                        2c: R_ARM_PC24  __11CDataSource
  30:   e51b2094        ldr     r2, [fp, -#148]
  34:   e5921004        ldr     r1, [r2, #4]
  38:   e3a03000        mov     r3, #0
  3c:   e50b306c        str     r3, [fp, -#108]
  40:   e24b3058        sub     r3, fp, #58
  44:   e50b3068        str     r3, [fp, -#104]
  48:   e59f20cc        ldr     r2, 11c <__14CResDataSourceP9CResource+0x11c>
  4c:   e50b1070        str     r1, [fp, -#112]
  50:   e24b3068        sub     r3, fp, #68
  54:   e9832004        stmib   r3, {r2, sp}
  58:   e51b3094        ldr     r3, [fp, -#148]
  5c:   e2832004        add     r2, r3, #4
  60:   ea000001        b       6c <__14CResDataSourceP9CResource+0x6c>
  64:   e28bb058        add     fp, fp, #58
  68:   ea000010        b       b0 <__14CResDataSourceP9CResource+0xb0>
  6c:   e24b3070        sub     r3, fp, #70
  70:   e5823000        str     r3, [r2]
  74:   e51b308c        ldr     r3, [fp, -#140]
  78:   e51b008c        ldr     r0, [fp, -#140]
  7c:   e3a02000        mov     r2, #0
  80:   e5832014        str     r2, [r3, #20]
  84:   e51b2090        ldr     r2, [fp, -#144]
  88:   e5832018        str     r2, [r3, #24]
  8c:   e59f308c        ldr     r3, 120 <__14CResDataSourceP9CResource+0x120>
  90:   e51b208c        ldr     r2, [fp, -#140]
  94:   e5823010        str     r3, [r2, #16]
  98:   e51b3094        ldr     r3, [fp, -#148]
  9c:   e5932004        ldr     r2, [r3, #4]
  a0:   e5923000        ldr     r3, [r2]
  a4:   e51b2094        ldr     r2, [fp, -#148]
  a8:   e5823004        str     r3, [r2, #4]
  ac:   ea00001d        b       128 <__14CResDataSourceP9CResource+0x128>
  b0:   e51b3094        ldr     r3, [fp, -#148]
  b4:   e5931004        ldr     r1, [r3, #4]
  b8:   e3a03000        mov     r3, #0
  bc:   e50b3084        str     r3, [fp, -#132]
  c0:   e24b2058        sub     r2, fp, #58
  c4:   e50b2080        str     r2, [fp, -#128]
  c8:   e59f2054        ldr     r2, 124 <__14CResDataSourceP9CResource+0x124>
  cc:   e50b1088        str     r1, [fp, -#136]
  d0:   e24b3080        sub     r3, fp, #80
  d4:   e9832004        stmib   r3, {r2, sp}
  d8:   e51b3094        ldr     r3, [fp, -#148]
  dc:   e2832004        add     r2, r3, #4
  e0:   ea000001        b       ec <__14CResDataSourceP9CResource+0xec>
  e4:   e28bb058        add     fp, fp, #58
  e8:   ea00000a        b       118 <__14CResDataSourceP9CResource+0x118>
  ec:   e24b3088        sub     r3, fp, #88
  f0:   e51b008c        ldr     r0, [fp, -#140]
  f4:   e3a01000        mov     r1, #0
  f8:   e5823000        str     r3, [r2]
  fc:   ebfffffe        bl      fc <__14CResDataSourceP9CResource+0xfc>
                        fc: R_ARM_PC24  _._11CDataSource
 100:   e51b2094        ldr     r2, [fp, -#148]
 104:   e5923004        ldr     r3, [r2, #4]
 108:   e5932000        ldr     r2, [r3]
 10c:   e51b3094        ldr     r3, [fp, -#148]
 110:   e5832004        str     r2, [r3, #4]
 114:   ebfffffe        bl      114 <__14CResDataSourceP9CResource+0x114>
                        114: R_ARM_PC24 __sjthrow
 118:   ebfffffe        bl      118 <__14CResDataSourceP9CResource+0x118>
                        118: R_ARM_PC24 __terminate
 11c:   00000064        andeq   r0, r0, r4, rrx
                        11c: R_ARM_ABS32        .text
 120:   00000000        andeq   r0, r0, r0
                        120: R_ARM_ABS32        __vt_14CResDataSource
 124:   000000e4        andeq   r0, r0, r4, ror #1
                        124: R_ARM_ABS32        .text
 128:   ed1b4216        lfm     f4, 4, [fp, -#88]
 12c:   e91baff0        ldmdb   fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc}

/*********/
This is the CW 68K compiler disassembly for the same constructor:
Hunk:	Kind=HUNK_GLOBAL_CODE  Name="__ct__14CResDataSourceFP9CResource"(6)
Size=46
00000000: 4E56 0000          link      a6,#0
00000004: 2F0A               move.l    a2,-(a7)
00000006: 246E 0008          movea.l   8(a6),a2
0000000A: 2F0A               move.l    a2,-(a7)
0000000C: 61FF 0000 0000     bsr.l     __ct__11CDataSourceFv
00000012: 41F9 0000 0000     lea       __vt__14CResDataSource,a0
00000018: 2488               move.l    a0,(a2)
0000001A: 42AA 0012          clr.l     18(a2)
0000001E: 256E 000C 0016     move.l    12(a6),22(a2)
00000024: 204A               movea.l   a2,a0
00000026: 584F               addq.w    #4,a7
00000028: 245F               movea.l   (a7)+,a2
0000002A: 4E5E               unlk      a6
0000002C: 4E75               rts



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]