summaryrefslogtreecommitdiff
path: root/compiler/aoptobj.pas
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2013-08-18 18:56:56 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2013-08-18 18:56:56 +0000
commitf0d2081657382d23ca18c69a3793acd5c5db62f2 (patch)
treee1a5f6c6dcd3d76e4ca12f28cb04e95e4f554510 /compiler/aoptobj.pas
parent606224bb96df5a7901b15b483ffca1e6d8b2ed05 (diff)
downloadfpc-f0d2081657382d23ca18c69a3793acd5c5db62f2.tar.gz
+ FindRegAllocBackward
* search reg. allocations backward in RemoveSuperfluousMove because the changed instruction could be the first one in a list git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@25289 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/aoptobj.pas')
-rw-r--r--compiler/aoptobj.pas41
1 files changed, 39 insertions, 2 deletions
diff --git a/compiler/aoptobj.pas b/compiler/aoptobj.pas
index 4f78498501..664fc993d2 100644
--- a/compiler/aoptobj.pas
+++ b/compiler/aoptobj.pas
@@ -289,13 +289,23 @@ Unit AoptObj;
{ returns true if the operands o1 and o2 are completely equal }
Function OpsEqual(const o1,o2:toper): Boolean;
- { Returns the next ait_alloc object with ratype ra_dealloc for
+ { Returns the next ait_alloc object with ratype ra_alloc for
Reg is found in the block
of Tai's starting with StartPai and ending with the next "real"
instruction. If none is found, it returns
- nil }
+ nil
+ }
Function FindRegAlloc(Reg: TRegister; StartPai: Tai): tai_regalloc;
+ { Returns the last ait_alloc object with ratype ra_alloc for
+ Reg is found in the block
+ of Tai's starting with StartPai and ending with the next "real"
+ instruction. If none is found, it returns
+ nil
+ }
+ Function FindRegAllocBackward(Reg : TRegister; StartPai : Tai) : tai_regalloc;
+
+
{ Returns the next ait_alloc object with ratype ra_dealloc
for Reg which is found in the block of Tai's starting with StartPai
and ending with the next "real" instruction. If none is found, it returns
@@ -1048,6 +1058,33 @@ Unit AoptObj;
End;
+ Function TAOptObj.FindRegAllocBackward(Reg: TRegister; StartPai: Tai): tai_regalloc;
+ Begin
+ Result:=nil;
+ Repeat
+ While Assigned(StartPai) And
+ ((StartPai.typ in (SkipInstr - [ait_regAlloc])) Or
+ ((StartPai.typ = ait_label) and
+ Not(Tai_Label(StartPai).labsym.Is_Used))) Do
+ StartPai := Tai(StartPai.Previous);
+ If Assigned(StartPai) And
+ (StartPai.typ = ait_regAlloc) Then
+ Begin
+ if (tai_regalloc(StartPai).ratype=ra_alloc) and
+ (getregtype(tai_regalloc(StartPai).Reg) = getregtype(Reg)) and
+ (getsupreg(tai_regalloc(StartPai).Reg) = getsupreg(Reg)) then
+ begin
+ Result:=tai_regalloc(StartPai);
+ exit;
+ end;
+ StartPai := Tai(StartPai.Previous);
+ End
+ else
+ exit;
+ Until false;
+ End;
+
+
function TAOptObj.FindRegDeAlloc(Reg: TRegister; StartPai: Tai): tai_regalloc;
Begin
Result:=nil;