mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 00:09:31 +02:00
* aopt386 compiles with TP
* correct line number is displayed, if a #0 is in the input
This commit is contained in:
parent
c681f66590
commit
8cb9f5ea5b
@ -785,53 +785,53 @@ Var LoLab, HiLab, LabDif: Longint;
|
||||
End;
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
hp1 := pai(p^.next^.next);
|
||||
If (Pai386(p)^.op1t = top_ref) And
|
||||
(Pai386(p)^.op2t = top_reg) And
|
||||
(Pai386(p^.next)^.op1t = top_reg) And
|
||||
(Pai386(p^.next)^.op1 = Pai386(p)^.op2) And
|
||||
(Pai386(p^.next)^.op2t = top_ref) And
|
||||
Assigned(hp1) And
|
||||
(Pai(hp1)^.typ = ait_instruction) And
|
||||
(Pai386(hp1)^._operator = A_MOV) And
|
||||
(Pai386(hp1)^.op2t = top_reg) And
|
||||
(Pai386(hp1)^.op1t = top_ref) And
|
||||
RefsEqual(TReference(Pai386(hp1)^.op1^),
|
||||
TReference(Pai386(p^.next)^.op2^))
|
||||
Then
|
||||
{ mov mem1, reg1
|
||||
mov reg1, mem2
|
||||
mov mem2, reg2
|
||||
to:
|
||||
mov mem1, reg2
|
||||
mov reg2, mem2}
|
||||
If (TRegister(Pai386(p)^.op2) <> R_ESI)
|
||||
Then
|
||||
Begin
|
||||
Pai386(p)^.op2 := Pai386(hp1)^.op2;
|
||||
Pai386(p^.next)^.op1 := Pai386(hp1)^.op2;
|
||||
AsmL^.Remove(hp1);
|
||||
Dispose(hp1,Done);
|
||||
End
|
||||
Else
|
||||
{ mov mem1, esi
|
||||
mov esi, mem2
|
||||
mov mem2, reg2
|
||||
to:
|
||||
mov mem1, esi
|
||||
mov mem1, reg2
|
||||
mov esi, mem2}
|
||||
Begin
|
||||
Pai386(p^.next)^.opxt := top_ref + top_reg shl 4;
|
||||
Pai386(p^.next)^.op1 := Pai386(p)^.op2;
|
||||
TReference(Pai386(p^.next)^.op1^) := TReference(Pai386(p)^.op1^);
|
||||
Pai386(p^.next)^.op2 := Pai386(hp1)^.op2;
|
||||
Pai386(hp1)^.opxt := top_reg + top_ref shl 4;
|
||||
Pai386(hp1)^.op2 := Pai386(hp1)^.op1;
|
||||
Pai386(hp1)^.op1 := Pointer(R_ESI)
|
||||
End;
|
||||
End;
|
||||
Begin
|
||||
hp1 := pai(p^.next^.next);
|
||||
If (Pai386(p)^.op1t = top_ref) And
|
||||
(Pai386(p)^.op2t = top_reg) And
|
||||
(Pai386(p^.next)^.op1t = top_reg) And
|
||||
(Pai386(p^.next)^.op1 = Pai386(p)^.op2) And
|
||||
(Pai386(p^.next)^.op2t = top_ref) And
|
||||
Assigned(hp1) And
|
||||
(Pai(hp1)^.typ = ait_instruction) And
|
||||
(Pai386(hp1)^._operator = A_MOV) And
|
||||
(Pai386(hp1)^.op2t = top_reg) And
|
||||
(Pai386(hp1)^.op1t = top_ref) And
|
||||
RefsEqual(TReference(Pai386(hp1)^.op1^),
|
||||
TReference(Pai386(p^.next)^.op2^))
|
||||
Then
|
||||
{ mov mem1, reg1
|
||||
mov reg1, mem2
|
||||
mov mem2, reg2
|
||||
to:
|
||||
mov mem1, reg2
|
||||
mov reg2, mem2}
|
||||
If (TRegister(Pai386(p)^.op2) <> R_ESI)
|
||||
Then
|
||||
Begin
|
||||
Pai386(p)^.op2 := Pai386(hp1)^.op2;
|
||||
Pai386(p^.next)^.op1 := Pai386(hp1)^.op2;
|
||||
AsmL^.Remove(hp1);
|
||||
Dispose(hp1,Done);
|
||||
End
|
||||
Else
|
||||
{ mov mem1, esi
|
||||
mov esi, mem2
|
||||
mov mem2, reg2
|
||||
to:
|
||||
mov mem1, esi
|
||||
mov mem1, reg2
|
||||
mov esi, mem2}
|
||||
Begin
|
||||
Pai386(p^.next)^.opxt := top_ref + top_reg shl 4;
|
||||
Pai386(p^.next)^.op1 := Pai386(p)^.op2;
|
||||
TReference(Pai386(p^.next)^.op1^) := TReference(Pai386(p)^.op1^);
|
||||
Pai386(p^.next)^.op2 := Pai386(hp1)^.op2;
|
||||
Pai386(hp1)^.opxt := top_reg + top_ref shl 4;
|
||||
Pai386(hp1)^.op2 := Pai386(hp1)^.op1;
|
||||
Pai386(hp1)^.op1 := Pointer(R_ESI)
|
||||
End;
|
||||
End;
|
||||
End
|
||||
Else
|
||||
(* { movl [mem1],reg1
|
||||
@ -1478,7 +1478,11 @@ end;
|
||||
End.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-03-28 23:09:53 florian
|
||||
Revision 1.3 1998-03-29 17:27:58 florian
|
||||
* aopt386 compiles with TP
|
||||
* correct line number is displayed, if a #0 is in the input
|
||||
|
||||
Revision 1.2 1998/03/28 23:09:53 florian
|
||||
* secondin bugfix (m68k and i386)
|
||||
* overflow checking bugfix (m68k and i386) -- pretty useless in
|
||||
secondadd, since everything is done using 32-bit
|
||||
|
@ -199,7 +199,7 @@ for the last instruction of an include file !}
|
||||
|
||||
var
|
||||
readsize : word;
|
||||
i : longint;
|
||||
i,saveline,count : longint;
|
||||
|
||||
begin
|
||||
if filehaschanged then
|
||||
@ -232,15 +232,29 @@ for the last instruction of an include file !}
|
||||
blockread(current_module^.current_inputfile^.f,inputbuffer^,
|
||||
current_module^.current_inputfile^.bufsize-1,readsize);
|
||||
{ check if non-empty file }
|
||||
|
||||
{ this is an aweful hack FK }
|
||||
if readsize > 0 then
|
||||
begin
|
||||
{ check if null character before readsize }
|
||||
{ this mixed up the scanner.. }
|
||||
for i:=0 to (readsize-1) do
|
||||
begin
|
||||
if inputbuffer[i] = #0 then
|
||||
Message(scan_f_illegal_char);
|
||||
end;
|
||||
|
||||
{ force proper line counting }
|
||||
saveline:=current_module^.current_inputfile^.line_no;
|
||||
i:=0;
|
||||
while i<readsize do
|
||||
begin
|
||||
if inputbuffer[i] in [#10,#13] then
|
||||
begin
|
||||
if (byte(inputbuffer[i+1])+byte(inputbuffer[i])=23) then
|
||||
inc(i);
|
||||
inc(current_module^.current_inputfile^.line_no);
|
||||
end;
|
||||
if inputbuffer[i] = #0 then
|
||||
Message(scan_f_illegal_char);
|
||||
inc(i);
|
||||
end;
|
||||
current_module^.current_inputfile^.line_no:=saveline;
|
||||
end;
|
||||
|
||||
inputbuffer[readsize]:=#0;
|
||||
@ -2073,7 +2087,11 @@ for the last instruction of an include file !}
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-03-28 23:09:57 florian
|
||||
Revision 1.3 1998-03-29 17:27:59 florian
|
||||
* aopt386 compiles with TP
|
||||
* correct line number is displayed, if a #0 is in the input
|
||||
|
||||
Revision 1.2 1998/03/28 23:09:57 florian
|
||||
* secondin bugfix (m68k and i386)
|
||||
* overflow checking bugfix (m68k and i386) -- pretty useless in
|
||||
secondadd, since everything is done using 32-bit
|
||||
|
Loading…
Reference in New Issue
Block a user