When compiling the files in the attachment for PR22574 using the command line:

gcc -fwhole-program --combine -march=i686 -O2 button.i charproc.i charsets.i
cursor.i data.i doublechr.i fontutils.i input.i main.i menu.i misc.i print.i
ptydata.i screen.i scrollbar.i tabs.i util.i xstrings.i VTPrsTbl.i -S

the function ClearLeft looks like:

ClearLeft.221553:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    3748(%eax), %ecx
        movl    3752(%eax), %edx
        movl    $0, (%esp)        ; <- 0 is passed on the stack
        incl    %ecx
        movl    %ecx, 4(%esp)
        call    ClearInLine.221545
        leave
        ret

When compiling just the file util.i that contains ClearLeft using 
-march=i686 -O2 the assembly is:

ClearLeft:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    3748(%eax), %ecx
        movl    3752(%eax), %edx
        incl    %ecx
        movl    %ecx, (%esp)
        xorl    %ecx, %ecx   ; 0 is passed in a register
        call    ClearInLine
        leave
        ret

When using -fwhole-program --combine the parameter "0" to the ClearInLine
function is passed on the stack instead of being passed in a register. 

Is there a reason for that? Shouldn't it be more better to pass it in a 
register?

-- 
           Summary: local calling convention not used when using -fwhole-
                    program --combine
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnus


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23828

Reply via email to