mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-06 00:58:28 +02:00
* skip instructions containing a reference with a segment prefix (fixes
mantis #18113) git-svn-id: trunk@16619 -
This commit is contained in:
parent
c8115921f1
commit
d10f46ec59
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10907,6 +10907,7 @@ tests/webtbs/tw18075.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw18082.pp svneol=native#text/plain
|
tests/webtbs/tw18082.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw18085.pp svneol=native#text/pascal
|
tests/webtbs/tw18085.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw18086.pp svneol=native#text/pascal
|
tests/webtbs/tw18086.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw18113.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw18123.pp svneol=native#text/pascal
|
tests/webtbs/tw18123.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw18127.pp svneol=native#text/pascal
|
tests/webtbs/tw18127.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw18131.pp svneol=native#text/pascal
|
tests/webtbs/tw18131.pp svneol=native#text/pascal
|
||||||
|
@ -128,6 +128,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ returns true if p contains a memory operand with a segment set }
|
||||||
|
function InsContainsSegRef(p: taicpu): boolean;
|
||||||
|
var
|
||||||
|
i: longint;
|
||||||
|
begin
|
||||||
|
result:=true;
|
||||||
|
for i:=0 to p.opercnt-1 do
|
||||||
|
if (p.oper[i]^.typ=top_ref) and
|
||||||
|
(p.oper[i]^.ref^.segment<>NR_NO) then
|
||||||
|
exit;
|
||||||
|
result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure PrePeepHoleOpts(asml: TAsmList; BlockStart, BlockEnd: tai);
|
procedure PrePeepHoleOpts(asml: TAsmList; BlockStart, BlockEnd: tai);
|
||||||
var
|
var
|
||||||
p,hp1: tai;
|
p,hp1: tai;
|
||||||
@ -140,6 +154,11 @@ begin
|
|||||||
case p.Typ Of
|
case p.Typ Of
|
||||||
Ait_Instruction:
|
Ait_Instruction:
|
||||||
begin
|
begin
|
||||||
|
if InsContainsSegRef(taicpu(p)) then
|
||||||
|
begin
|
||||||
|
p := tai(p.next);
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
case taicpu(p).opcode Of
|
case taicpu(p).opcode Of
|
||||||
A_IMUL:
|
A_IMUL:
|
||||||
{changes certain "imul const, %reg"'s to lea sequences}
|
{changes certain "imul const, %reg"'s to lea sequences}
|
||||||
@ -606,6 +625,11 @@ begin
|
|||||||
case p.Typ Of
|
case p.Typ Of
|
||||||
ait_instruction:
|
ait_instruction:
|
||||||
begin
|
begin
|
||||||
|
if InsContainsSegRef(taicpu(p)) then
|
||||||
|
begin
|
||||||
|
p := tai(p.next);
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
{ Handle Jmp Optimizations }
|
{ Handle Jmp Optimizations }
|
||||||
if taicpu(p).is_jmp then
|
if taicpu(p).is_jmp then
|
||||||
begin
|
begin
|
||||||
@ -1779,6 +1803,11 @@ begin
|
|||||||
case p.Typ Of
|
case p.Typ Of
|
||||||
Ait_Instruction:
|
Ait_Instruction:
|
||||||
begin
|
begin
|
||||||
|
if InsContainsSegRef(taicpu(p)) then
|
||||||
|
begin
|
||||||
|
p := tai(p.next);
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
case taicpu(p).opcode Of
|
case taicpu(p).opcode Of
|
||||||
A_Jcc:
|
A_Jcc:
|
||||||
begin
|
begin
|
||||||
@ -2065,6 +2094,11 @@ begin
|
|||||||
case p.Typ Of
|
case p.Typ Of
|
||||||
Ait_Instruction:
|
Ait_Instruction:
|
||||||
begin
|
begin
|
||||||
|
if InsContainsSegRef(taicpu(p)) then
|
||||||
|
begin
|
||||||
|
p := tai(p.next);
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
case taicpu(p).opcode Of
|
case taicpu(p).opcode Of
|
||||||
A_CALL:
|
A_CALL:
|
||||||
if (current_settings.optimizecputype < cpu_Pentium2) and
|
if (current_settings.optimizecputype < cpu_Pentium2) and
|
||||||
|
22
tests/webtbs/tw18113.pp
Normal file
22
tests/webtbs/tw18113.pp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{ %target=go32v2 }
|
||||||
|
{ %interactive }
|
||||||
|
|
||||||
|
{ check whether this program writes '*' }
|
||||||
|
|
||||||
|
Procedure Confuse;
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Procedure TestBug(chr:word);
|
||||||
|
begin
|
||||||
|
Confuse; {if you comment it, everything is fine even in Level 2}
|
||||||
|
Mem[$B800:0]:=byte(chr);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
writeln(#13#10#13#10);
|
||||||
|
TestBug(42); {should print '*'}
|
||||||
|
readln;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user