On 21/01/2014 23:27, Martin Frb wrote:
On 21/01/2014 21:28, Florian Klämpfl wrote:
Am 20.01.2014 01:18, schrieb Martin:

It used
(taicpu(p).oper[1]^.reg<>taicpu(hp1).oper[0]^^.ref^.base) and
(taicpu(p).oper[1]^.reg<>taicpu(hp1).oper[0]^^.ref^.index) then
but should only compare the supregister part
I replaced that
not(RegInOp(getsupreg(taicpu(p).oper[1]^.reg),taicpu(hp1).oper[0]^)) then

uncommented, and tested.
It does catch a big lot of occurrences.
Can you post some example code? It might be worth to think about
improving this already in at the node level.



I will try to find some. (I just enabled it, and put a writeln in there, to see, if it was triggered. Then run the tests and buli Lazarus.

There are 100 or 1000nds of matches when compiling the IDE, not sure how many are triggered by the below, or by which other condition.


2 examples in below, but they only happen with -O- or -O1
In TFoo.Bar move the comment to the other statement, for 2nd example
(if init is called within Init, then different code is produced)

In both cases the 2nd register should not be needed at all. (but if present, is better loaded from

program project1; {$mode objfpc}
type  TFoo = class
    a,b : Integer;
    function Bar: Boolean;
    procedure Init; virtual;
  end;

function TFoo.Bar: Boolean;
begin
  Result := a = b;
//  Init;
end;
procedure TFoo.Init;  begin  end;
begin
end.

////////////   Result := a = b;
.section .text.n_p$project1$_$tfoo_$__$$_bar$$boolean,"x"
    .balign 16,0x90
.globl    P$PROJECT1$_$TFOO_$__$$_BAR$$BOOLEAN
P$PROJECT1$_$TFOO_$__$$_BAR$$BOOLEAN:
# Temps allocated between ebp-8 and ebp-8
# [project1.lpr]
# [14] begin
    pushl    %ebp
    movl    %esp,%ebp
    leal    -8(%esp),%esp
# Var $self located at ebp-4
# Var $result located at ebp-8
    movl    %eax,-4(%ebp)
# [15] Init;
    movl    -4(%ebp),%eax  // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    movl    -4(%ebp),%edx // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    movl    (%edx),%edx
    call    *100(%edx)
# [16] end;
    leave
    ret

///////////// INIT
.section .text.n_p$project1$_$tfoo_$__$$_bar$$boolean,"x"
    .balign 16,0x90
.globl    P$PROJECT1$_$TFOO_$__$$_BAR$$BOOLEAN
P$PROJECT1$_$TFOO_$__$$_BAR$$BOOLEAN:
# Temps allocated between ebp-8 and ebp-8
# [project1.lpr]
# [14] begin
    pushl    %ebp
    movl    %esp,%ebp
    leal    -8(%esp),%esp
# Var $self located at ebp-4
# Var $result located at ebp-8
    movl    %eax,-4(%ebp)
# [15] Init;
    movl    -4(%ebp),%eax
    movl    -4(%ebp),%edx
    movl    (%edx),%edx
    call    *100(%edx)
# [16] end;
    leave
    ret

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to