where does gcc generate float param passing code before function call?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm building a arm-linux-gcc toolchain with soft-vfp support(provided by
nico.pitre)
But rushing into a problem that gcc doesn't produce right code, it uses wrong
registers sequence to pass float argument to function()
for example, here is my foo.c
-----   begin
void main()
{
        float i=1.0;
        foo(i);
}
void foo( float i )
{
        return i;
}
-----  end

here is foo.s produced by arm-linux-gcc -S foo.c -o foo.s
--------   begin
main:
        @ args = 0, pretend = 0, frame = 4
        @ frame_needed = 1, uses_anonymous_args = 0
        mov     ip, sp
        stmfd   sp!, {r4, fp, ip, lr, pc}
        sub     fp, ip, #4
        sub     sp, sp, #4
        ldr     r3, .L2 @ float
        str     r3, [fp, #-20]  @ float
        ldr     r0, [fp, #-20]  @ float
        bl      __extendsfdf2
        mov     r4, r1
        mov     r3, r0
        mov     r1, r4       /* these two lines are wrong!!!*/
        mov     r0, r3
        bl      foo
        ldmea   fp, {r4, fp, sp, pc}
.L3:
        .align  2
.L2:
        .word   1065353216
        .size   main, .-main
        .align  2
        .global foo
        .type   foo, %function
foo:
        @ args = 0, pretend = 0, frame = 4
        @ frame_needed = 1, uses_anonymous_args = 0
<sniz>
---------- end

the two lines asm code before "bl foo" is wrong, it should be:
mov	r2, r3
mov	r3, r4

I'm not a expert of gcc, so anybody can point out which file in gcc source
tree generate the "mov" codes before "bl foo"? I need to find a place to
begin.

	





--http://www.eyou.com
--Îȶ¨¿É¿¿µÄµç×ÓÐÅÏä  ÓïÒôÓʼþ  Òƶ¯ÊéÇ©  ÈÕÀú·þÎñ  ÍøÂç´æ´¢...ÒÚÓÊδ¾¡

--http://vip.eyou.com
--¿ì¿ìµÇ¼ÒÚÓÊVIPÐÅÏä  ×¢²áÄúÖÐÒâµÄÓû§Ãû



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux