mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 13:06:18 +02:00
* fix findlohilabel
git-svn-id: trunk@3299 -
This commit is contained in:
parent
a9df7aa81a
commit
89f5d65784
@ -57,6 +57,7 @@ Unit aopt;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
globtype, globals,
|
globtype, globals,
|
||||||
|
verbose,
|
||||||
aoptda,aoptcpu,aoptcpud;
|
aoptda,aoptcpu,aoptcpud;
|
||||||
|
|
||||||
Constructor TAsmOptimizer.create(_AsmL: TAsmList);
|
Constructor TAsmOptimizer.create(_AsmL: TAsmList);
|
||||||
@ -85,22 +86,20 @@ Unit aopt;
|
|||||||
((P.typ <> Ait_Marker) Or
|
((P.typ <> Ait_Marker) Or
|
||||||
(tai_Marker(P).Kind <> mark_AsmBlockStart)) Do
|
(tai_Marker(P).Kind <> mark_AsmBlockStart)) Do
|
||||||
Begin
|
Begin
|
||||||
If (p.typ = ait_label) Then
|
If (p.typ = ait_label) and
|
||||||
If (tai_Label(p).labsym.is_used) Then
|
(tai_Label(p).labsym.labeltype=alt_jump) and
|
||||||
Begin
|
(tai_Label(p).labsym.is_used) Then
|
||||||
LabelFound := True;
|
Begin
|
||||||
If (tai_Label(p).labsym.labelnr < LowLabel) Then
|
LabelFound := True;
|
||||||
LowLabel := tai_Label(p).labsym.labelnr;
|
If (tai_Label(p).labsym.labelnr < LowLabel) Then
|
||||||
If (tai_Label(p).labsym.labelnr > HighLabel) Then
|
LowLabel := tai_Label(p).labsym.labelnr;
|
||||||
HighLabel := tai_Label(p).labsym.labelnr
|
If (tai_Label(p).labsym.labelnr > HighLabel) Then
|
||||||
End;
|
HighLabel := tai_Label(p).labsym.labelnr
|
||||||
|
End;
|
||||||
prev := p;
|
prev := p;
|
||||||
GetNextInstruction(p, p)
|
GetNextInstruction(p, p)
|
||||||
End;
|
End;
|
||||||
if (prev.typ = ait_marker) and
|
blockend:=p;
|
||||||
(tai_marker(prev).kind = mark_AsmBlockStart) then
|
|
||||||
blockend := prev
|
|
||||||
else blockend := nil;
|
|
||||||
If LabelFound
|
If LabelFound
|
||||||
Then LabelDif := HighLabel-LowLabel+1
|
Then LabelDif := HighLabel-LowLabel+1
|
||||||
Else LabelDif := 0
|
Else LabelDif := 0
|
||||||
@ -112,6 +111,7 @@ Unit aopt;
|
|||||||
{ Also fixes some RegDeallocs like "# %eax released; push (%eax)" }
|
{ Also fixes some RegDeallocs like "# %eax released; push (%eax)" }
|
||||||
Var p, hp1, hp2: tai;
|
Var p, hp1, hp2: tai;
|
||||||
UsedRegs: TRegSet;
|
UsedRegs: TRegSet;
|
||||||
|
LabelIdx : longint;
|
||||||
Begin
|
Begin
|
||||||
UsedRegs := [];
|
UsedRegs := [];
|
||||||
With LabelInfo^ Do
|
With LabelInfo^ Do
|
||||||
@ -124,8 +124,16 @@ Unit aopt;
|
|||||||
Begin
|
Begin
|
||||||
Case p.typ Of
|
Case p.typ Of
|
||||||
ait_Label:
|
ait_Label:
|
||||||
If tai_label(p).labsym.is_used Then
|
begin
|
||||||
LabelTable^[tai_label(p).labsym.labelnr-LowLabel].PaiObj := p;
|
If tai_label(p).labsym.is_used and
|
||||||
|
(tai_Label(p).labsym.labeltype=alt_jump) then
|
||||||
|
begin
|
||||||
|
LabelIdx:=tai_label(p).labsym.labelnr-LowLabel;
|
||||||
|
if LabelIdx>LabelDif then
|
||||||
|
internalerror(200604202);
|
||||||
|
LabelTable^[LabelIdx].PaiObj := p;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
ait_regAlloc:
|
ait_regAlloc:
|
||||||
begin
|
begin
|
||||||
{!!!!!!!!!
|
{!!!!!!!!!
|
||||||
@ -178,11 +186,14 @@ Unit aopt;
|
|||||||
|
|
||||||
procedure tasmoptimizer.clear;
|
procedure tasmoptimizer.clear;
|
||||||
begin
|
begin
|
||||||
if LabelInfo^.labeldif <> 0 then
|
if assigned(LabelInfo^.labeltable) then
|
||||||
begin
|
begin
|
||||||
freemem(LabelInfo^.labeltable);
|
freemem(LabelInfo^.labeltable);
|
||||||
LabelInfo^.labeltable := nil;
|
LabelInfo^.labeltable := nil;
|
||||||
end;
|
end;
|
||||||
|
LabelInfo^.labeldif:=0;
|
||||||
|
LabelInfo^.lowlabel:=high(AWord);
|
||||||
|
LabelInfo^.highlabel:=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure tasmoptimizer.pass_1;
|
procedure tasmoptimizer.pass_1;
|
||||||
|
Loading…
Reference in New Issue
Block a user