* commented out some inactive code in csopt386

+ small improvement: lea is now handled the same as mov/zx/sx
This commit is contained in:
Jonas Maebe 2001-09-04 14:01:03 +00:00
parent 4bac905291
commit 1fd6a2c5f8
2 changed files with 33 additions and 6 deletions

View File

@ -385,6 +385,7 @@ Begin {CheckSequence}
(hp3.typ = ait_instruction) and (hp3.typ = ait_instruction) and
((Taicpu(hp3).opcode = A_MOV) or ((Taicpu(hp3).opcode = A_MOV) or
(Taicpu(hp3).opcode = A_MOVZX) or (Taicpu(hp3).opcode = A_MOVZX) or
(Taicpu(hp3).opcode = A_LEA) or
(Taicpu(hp3).opcode = A_MOVSX)) and (Taicpu(hp3).opcode = A_MOVSX)) and
(Taicpu(hp3).oper[1].typ = top_reg) and (Taicpu(hp3).oper[1].typ = top_reg) and
not(regInOp(Taicpu(hp3).oper[1].reg, not(regInOp(Taicpu(hp3).oper[1].reg,
@ -1291,7 +1292,8 @@ begin
(startmod.typ = ait_instruction) and (startmod.typ = ait_instruction) and
((Taicpu(startmod).opcode = A_MOV) or ((Taicpu(startmod).opcode = A_MOV) or
(Taicpu(startmod).opcode = A_MOVZX) or (Taicpu(startmod).opcode = A_MOVZX) or
(Taicpu(startmod).opcode = A_MOVSX)) and (Taicpu(startmod).opcode = A_MOVSX) or
(Taicpu(startmod).opcode = A_LEA)) and
(Taicpu(startmod).oper[0].typ = top_ref) and (Taicpu(startmod).oper[0].typ = top_ref) and
(Taicpu(startmod).oper[0].ref^.base = stack_pointer)) or (Taicpu(startmod).oper[0].ref^.base = stack_pointer)) or
not(reg in pTaiprop(hp1.optInfo)^.usedRegs) or not(reg in pTaiprop(hp1.optInfo)^.usedRegs) or
@ -1340,7 +1342,7 @@ Begin
A_CLD: If GetLastInstruction(p, hp1) And A_CLD: If GetLastInstruction(p, hp1) And
(PTaiProp(hp1.OptInfo)^.DirFlag = F_NotSet) Then (PTaiProp(hp1.OptInfo)^.DirFlag = F_NotSet) Then
PTaiProp(Tai(p).OptInfo)^.CanBeRemoved := True; PTaiProp(Tai(p).OptInfo)^.CanBeRemoved := True;
A_MOV, A_MOVZX, A_MOVSX: A_LEA, A_MOV, A_MOVZX, A_MOVSX:
Begin Begin
hp2 := p; hp2 := p;
Case Taicpu(p).oper[0].typ Of Case Taicpu(p).oper[0].typ Of
@ -1366,6 +1368,7 @@ Begin
If CheckSequence(p,prevSeq,Taicpu(p).oper[1].reg, Cnt, RegInfo, findPrevSeqs) And If CheckSequence(p,prevSeq,Taicpu(p).oper[1].reg, Cnt, RegInfo, findPrevSeqs) And
(Cnt > 0) Then (Cnt > 0) Then
Begin Begin
(*
hp1 := nil; hp1 := nil;
{ although it's perfectly ok to remove an instruction which doesn't contain } { although it's perfectly ok to remove an instruction which doesn't contain }
{ the register that we've just checked (CheckSequence takes care of that), } { the register that we've just checked (CheckSequence takes care of that), }
@ -1382,6 +1385,11 @@ Begin
{ movl 16(%ebp), %eax } { movl 16(%ebp), %eax }
{ movl 8(%edx), %edx } { movl 8(%edx), %edx }
{ movl 4(%eax), eax } { movl 4(%eax), eax }
*)
{ not anymore: if the start of a new sequence is found while checking (e.g. }
{ above that of eax while checking edx, this new sequence is automatically }
{ also checked }
Cnt2 := 1; Cnt2 := 1;
While Cnt2 <= Cnt Do While Cnt2 <= Cnt Do
Begin Begin
@ -1522,10 +1530,13 @@ Begin
hp2,hp3); hp2,hp3);
End; End;
End; End;
(*
If hp1 <> nil Then If hp1 <> nil Then
p := hp1; p := hp1;
*)
Continue; Continue;
End End
(*
Else Else
If (PTaiProp(p.OptInfo)^. If (PTaiProp(p.OptInfo)^.
regs[reg32(Taicpu(p).oper[1].reg)].typ regs[reg32(Taicpu(p).oper[1].reg)].typ
@ -1561,6 +1572,7 @@ Begin
PTaiProp(hp4.optInfo)^.Regs[regCounter], PTaiProp(hp4.optInfo)^.Regs[regCounter],
p,hp3); p,hp3);
end; end;
*)
End; End;
End; End;
{ try to replace the new reg with the old reg } { try to replace the new reg with the old reg }
@ -1730,7 +1742,11 @@ End.
{ {
$Log$ $Log$
Revision 1.17 2001-08-29 14:07:43 jonas Revision 1.18 2001-09-04 14:01:03 jonas
* commented out some inactive code in csopt386
+ small improvement: lea is now handled the same as mov/zx/sx
Revision 1.17 2001/08/29 14:07:43 jonas
* the optimizer now keeps track of flags register usage. This fixes some * the optimizer now keeps track of flags register usage. This fixes some
optimizer bugs with int64 calculations (because of the carry flag usage) optimizer bugs with int64 calculations (because of the carry flag usage)
* fixed another bug which caused wrong optimizations with complex * fixed another bug which caused wrong optimizations with complex

View File

@ -1451,7 +1451,8 @@ Begin {checks whether two Taicpu instructions are equal}
"<operator> <operand of type1>, <operand of type 2>"} "<operator> <operand of type1>, <operand of type 2>"}
If ((Taicpu(p1).opcode = A_MOV) or If ((Taicpu(p1).opcode = A_MOV) or
(Taicpu(p1).opcode = A_MOVZX) or (Taicpu(p1).opcode = A_MOVZX) or
(Taicpu(p1).opcode = A_MOVSX)) And (Taicpu(p1).opcode = A_MOVSX) or
(Taicpu(p1).opcode = A_LEA)) And
(Taicpu(p1).oper[0].typ = top_ref) {then .oper[1]t = top_reg} Then (Taicpu(p1).oper[0].typ = top_ref) {then .oper[1]t = top_reg} Then
If Not(RegInRef(Taicpu(p1).oper[1].reg, Taicpu(p1).oper[0].ref^)) Then If Not(RegInRef(Taicpu(p1).oper[1].reg, Taicpu(p1).oper[0].ref^)) Then
{the "old" instruction is a load of a register with a new value, not with {the "old" instruction is a load of a register with a new value, not with
@ -2309,11 +2310,17 @@ Begin
else else
begin begin
{$ifdef statedebug} {$ifdef statedebug}
hp := Tai_asm_comment.Create(strpnew('destroying '+ hp := Tai_asm_comment.Create(strpnew('destroying & initing'+
att_reg2str[Taicpu(p).oper[1].reg]))); att_reg2str[Taicpu(p).oper[1].reg])));
insertllitem(asml,p,p.next,hp); insertllitem(asml,p,p.next,hp);
{$endif statedebug} {$endif statedebug}
destroyreg(curprop,Taicpu(p).oper[1].reg,true); destroyreg(curprop,Taicpu(p).oper[1].reg,true);
with curprop^.regs[Taicpu(p).oper[1].reg] Do
begin
typ := con_ref;
startmod := p;
nrOfMods := 1;
end
end; end;
end; end;
Else Else
@ -2512,7 +2519,11 @@ End.
{ {
$Log$ $Log$
Revision 1.20 2001-08-29 14:07:43 jonas Revision 1.21 2001-09-04 14:01:04 jonas
* commented out some inactive code in csopt386
+ small improvement: lea is now handled the same as mov/zx/sx
Revision 1.20 2001/08/29 14:07:43 jonas
* the optimizer now keeps track of flags register usage. This fixes some * the optimizer now keeps track of flags register usage. This fixes some
optimizer bugs with int64 calculations (because of the carry flag usage) optimizer bugs with int64 calculations (because of the carry flag usage)
* fixed another bug which caused wrong optimizations with complex * fixed another bug which caused wrong optimizations with complex