This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Why the bulk
- From: "Trond" <tsg at genialt dot zzn dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 19 Nov 105 12:36:02 +0100
- Subject: Why the bulk
Someone asked me this:
>Why all this for a hello world program?
>
>What are all these loads and compares for?
>
>Is this all junk from iostream? After 3 minutes of looking through
>this mess without using the find function I still haven't figured out
>what section of the code relates to what I'm trying to do....
>
>
>Code:
me@computer[111] gcc -S example.cpp
me@computer[112] cat example.s
.file "example.cpp"
.section ".text"
.align 4
.type _ZSt17__verify_groupingPKcjRKSs, #function
.proc 04
_ZSt17__verify_groupingPKcjRKSs:
.LLFB1319:
!#PROLOGUE# 0
save %sp, -144, %sp
.LLCFI0:
!#PROLOGUE# 1
st %i0, [%fp+68]
st %i1, [%fp+72]
st %i2, [%fp+76]
ld [%fp+76], %o0
call _ZNKSs4sizeEv, 0
nop
mov %o0, %g1
add %g1, -1, %g1
st %g1, [%fp-20]
add %fp, -20, %o5
ld [%fp+72], %g1
add %g1, -1, %g1
st %g1, [%fp-28]
add %fp, -28, %g1
mov %o5, %o0
mov %g1, %o1
call _ZSt3minIjERKT_S2_S2_, 0
nop
mov %o0, %g1
ld [%g1], %g1
st %g1, [%fp-24]
ld [%fp-20], %g1
st %g1, [%fp-32]
mov 1, %g1
stb %g1, [%fp-33]
st %g0, [%fp-40]
.LL2:
ld [%fp-40], %o5
ld [%fp-24], %g1
cmp %o5, %g1
bgeu .LL5
nop
ldub [%fp-33], %g1
and %g1, 0xff, %g1
cmp %g1, 0
be .LL5
nop
ld [%fp+76], %o0
ld [%fp-32], %o1
call _ZNKSsixEj, 0
nop
mov %o0, %o4
ld [%fp+68], %o5
ld [%fp-40], %g1
add %o5, %g1, %o5
ldub [%o4], %g1
sll %g1, 24, %g1
sra %g1, 24, %o4
ldub [%o5], %g1
sll %g1, 24, %g1
sra %g1, 24, %g1
xor %o4, %g1, %g1
subcc %g0, %g1, %g0
subx %g0, -1, %g1
stb %g1, [%fp-33]
ld [%fp-32], %g1
add %g1, -1, %g1
st %g1, [%fp-32]
ld [%fp-40], %g1
add %g1, 1, %g1
st %g1, [%fp-40]
b .LL2
nop
.LL5:
ld [%fp-32], %g1
cmp %g1, 0
be .LL6
nop
ldub [%fp-33], %g1
and %g1, 0xff, %g1
cmp %g1, 0
be .LL6
nop
ld [%fp+76], %o0
ld [%fp-32], %o1
call _ZNKSsixEj, 0
nop
mov %o0, %o4
ld [%fp+68], %o5
ld [%fp-24], %g1
add %o5, %g1, %o5
ldub [%o4], %g1
sll %g1, 24, %g1
sra %g1, 24, %o4
ldub [%o5], %g1
sll %g1, 24, %g1
sra %g1, 24, %g1
xor %o4, %g1, %g1
subcc %g0, %g1, %g0
subx %g0, -1, %g1
stb %g1, [%fp-33]
ld [%fp-32], %g1
add %g1, -1, %g1
st %g1, [%fp-32]
b .LL5
nop
.LL6:
ld [%fp+76], %o0
mov 0, %o1
call _ZNKSsixEj, 0
nop
mov %o0, %o4
ld [%fp+68], %o5
ld [%fp-24], %g1
add %o5, %g1, %o5
ldub [%o4], %g1
sll %g1, 24, %g1
sra %g1, 24, %o4
ldub [%o5], %g1
sll %g1, 24, %g1
sra %g1, 24, %g1
cmp %o4, %g1
bg .LL8
nop
ldub [%fp-33], %g1
and %g1, 0xff, %g1
and %g1, 1, %g1
stb %g1, [%fp-41]
b .LL9
nop
.LL8:
stb %g0, [%fp-41]
.LL9:
ldub [%fp-41], %g1
stb %g1, [%fp-33]
ldub [%fp-33], %g1
and %g1, 0xff, %g1
mov %g1, %i0
ret
restore
.LLFE1319:
.size _ZSt17__verify_groupingPKcjRKSs, .-_ZSt17__verify_groupingPKcjRKSs
.local _ZSt8__ioinit
.common _ZSt8__ioinit,1,1
.section ".rodata"
.align 8
.LLC0:
.asciz "Hello World\n"
.section ".text"
.align 4
.global main
.type main, #function
.proc 04
main:
.LLFB1400:
!#PROLOGUE# 0
save %sp, -112, %sp
.LLCFI1:
!#PROLOGUE# 1
sethi %hi(_ZSt4cout), %g1
or %g1, %lo(_ZSt4cout), %o0
sethi %hi(.LLC0), %g1
or %g1, %lo(.LLC0), %o1
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc, 0
nop
mov 0, %g1
mov %g1, %i0
ret
restore
.LLFE1400:
.size main, .-main
.section ".gnu.linkonce.t._ZSt3minIjERKT_S2_S2_",#alloc,#execinstr
.align 4
.weak _ZSt3minIjERKT_S2_S2_
.type _ZSt3minIjERKT_S2_S2_, #function
.proc 0116
_ZSt3minIjERKT_S2_S2_:
.LLFB1401:
!#PROLOGUE# 0
save %sp, -120, %sp
.LLCFI2:
!#PROLOGUE# 1
st %i0, [%fp+68]
st %i1, [%fp+72]
ld [%fp+72], %g1
ld [%fp+68], %i5
ld [%g1], %i4
ld [%i5], %g1
cmp %i4, %g1
bgeu .LL12
nop
ld [%fp+72], %g1
st %g1, [%fp-20]
b .LL11
nop
.LL12:
ld [%fp+68], %g1
st %g1, [%fp-20]
.LL11:
ld [%fp-20], %i0
ret
restore
.LLFE1401:
.size _ZSt3minIjERKT_S2_S2_, .-_ZSt3minIjERKT_S2_S2_
.section ".text"
.align 4
.type _Z41__static_initialization_and_destruction_0ii, #function
.proc 020
_Z41__static_initialization_and_destruction_0ii:
.LLFB1407:
!#PROLOGUE# 0
save %sp, -112, %sp
.LLCFI3:
!#PROLOGUE# 1
st %i0, [%fp+68]
st %i1, [%fp+72]
ld [%fp+72], %g1
sethi %hi(64512), %o5
or %o5, 1023, %o5
cmp %g1, %o5
bne .LL14
nop
ld [%fp+68], %g1
cmp %g1, 1
bne .LL14
nop
sethi %hi(_ZSt8__ioinit), %g1
or %g1, %lo(_ZSt8__ioinit), %o0
call _ZNSt8ios_base4InitC1Ev, 0
nop
.LL14:
ld [%fp+72], %g1
sethi %hi(64512), %o5
or %o5, 1023, %o5
cmp %g1, %o5
bne .LL13
nop
ld [%fp+68], %g1
cmp %g1, 0
bne .LL13
nop
sethi %hi(_ZSt8__ioinit), %g1
or %g1, %lo(_ZSt8__ioinit), %o0
call _ZNSt8ios_base4InitD1Ev, 0
nop
.LL13:
nop
ret
restore
.LLFE1407:
.size _Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii
.align 4
.type _GLOBAL__I_main, #function
.proc 020
_GLOBAL__I_main:
.LLFB1408:
!#PROLOGUE# 0
save %sp, -112, %sp
.LLCFI4:
!#PROLOGUE# 1
mov 1, %o0
sethi %hi(64512), %g1
or %g1, 1023, %o1
call _Z41__static_initialization_and_destruction_0ii, 0
nop
nop
ret
restore
.LLFE1408:
.size _GLOBAL__I_main, .-_GLOBAL__I_main
.section ".ctors",#alloc,#write
.align 4
.long _GLOBAL__I_main
.section ".text"
.align 4
.type _GLOBAL__D_main, #function
.proc 020
_GLOBAL__D_main:
.LLFB1409:
!#PROLOGUE# 0
save %sp, -112, %sp
.LLCFI5:
!#PROLOGUE# 1
mov 0, %o0
sethi %hi(64512), %g1
or %g1, 1023, %o1
call _Z41__static_initialization_and_destruction_0ii, 0
nop
nop
ret
restore
.LLFE1409:
.size _GLOBAL__D_main, .-_GLOBAL__D_main
.section ".dtors",#alloc,#write
.align 4
.long _GLOBAL__D_main
.weak pthread_mutex_unlock
.weak pthread_mutex_trylock
.weak pthread_mutex_lock
.weak pthread_create
.weak pthread_setspecific
.weak pthread_getspecific
.weak pthread_key_delete
.weak pthread_key_create
.weak pthread_once
.section ".eh_frame",#alloc
.LLframe1:
.uaword .LLECIE1-.LLSCIE1
.LLSCIE1:
.uaword 0x0
.byte 0x1
.asciz "zP"
.uleb128 0x1
.sleb128 -4
.byte 0xf
.uleb128 0x5
.byte 0x0
.uaword __gxx_personality_v0
.byte 0xc
.uleb128 0xe
.uleb128 0x0
.align 4
.LLECIE1:
.LLSFDE1:
.uaword .LLEFDE1-.LLASFDE1
.LLASFDE1:
.uaword .LLASFDE1-.LLframe1
.uaword .LLFB1319
.uaword .LLFE1319-.LLFB1319
.uleb128 0x0
.byte 0x4
.uaword .LLCFI0-.LLFB1319
.byte 0xd
.uleb128 0x1e
.byte 0x2d
.byte 0x9
.uleb128 0xf
.uleb128 0x1f
.align 4
.LLEFDE1:
.LLSFDE3:
.uaword .LLEFDE3-.LLASFDE3
.LLASFDE3:
.uaword .LLASFDE3-.LLframe1
.uaword .LLFB1400
.uaword .LLFE1400-.LLFB1400
.uleb128 0x0
.byte 0x4
.uaword .LLCFI1-.LLFB1400
.byte 0xd
.uleb128 0x1e
.byte 0x2d
.byte 0x9
.uleb128 0xf
.uleb128 0x1f
.align 4
.LLEFDE3:
.LLSFDE7:
.uaword .LLEFDE7-.LLASFDE7
.LLASFDE7:
.uaword .LLASFDE7-.LLframe1
.uaword .LLFB1407
.uaword .LLFE1407-.LLFB1407
.uleb128 0x0
.byte 0x4
.uaword .LLCFI3-.LLFB1407
.byte 0xd
.uleb128 0x1e
.byte 0x2d
.byte 0x9
.uleb128 0xf
.uleb128 0x1f
.align 4
.LLEFDE7:
.LLSFDE9:
.uaword .LLEFDE9-.LLASFDE9
.LLASFDE9:
.uaword .LLASFDE9-.LLframe1
.uaword .LLFB1408
.uaword .LLFE1408-.LLFB1408
.uleb128 0x0
.byte 0x4
.uaword .LLCFI4-.LLFB1408
.byte 0xd
.uleb128 0x1e
.byte 0x2d
.byte 0x9
.uleb128 0xf
.uleb128 0x1f
.align 4
.LLEFDE9:
.LLSFDE11:
.uaword .LLEFDE11-.LLASFDE11
.LLASFDE11:
.uaword .LLASFDE11-.LLframe1
.uaword .LLFB1409
.uaword .LLFE1409-.LLFB1409
.uleb128 0x0
.byte 0x4
.uaword .LLCFI5-.LLFB1409
.byte 0xd
.uleb128 0x1e
.byte 0x2d
.byte 0x9
.uleb128 0xf
.uleb128 0x1f
.align 4
.LLEFDE11:
.ident "GCC: (GNU) 3.4.1"
End code.
So what IS all that junk? Is it strictly neccessary? If yes, why? If no, why don't anyone remove it?
It would be nice to get some comments from persons who actually are involved with the compiler on this.
Få din gratis e-post hos http://genialt.zzn.com
____________________________________________________________
Få din egen Web-baserte e-post tjeneste hos http://www.zzn.com