+ Patch to 1.1

This commit is contained in:
michael 2000-07-14 05:11:48 +00:00
parent 665c1f6410
commit 2949824a69
12 changed files with 60 additions and 174 deletions

View File

@ -21,12 +21,6 @@
**************************************************************************** ****************************************************************************
} }
{$ifdef newOptimizations}
{$define foropt}
{$define replacereg}
{$define arithopt}
{$define foldarithops}
{$endif newOptimizations}
Unit aopt386; Unit aopt386;
@ -101,7 +95,10 @@ End.
{ {
$Log$ $Log$
Revision 1.2 2000-07-13 11:32:31 michael Revision 1.3 2000-07-14 05:11:48 michael
+ Patch to 1.1
Revision 1.2 2000/07/13 11:32:31 michael
+ removed logs + removed logs
} }

View File

@ -53,9 +53,7 @@ implementation
procedure secondmoddiv(var p : ptree); procedure secondmoddiv(var p : ptree);
var var
hreg1 : tregister; hreg1 : tregister;
{$ifdef newOptimizations}
hreg2 : tregister; hreg2 : tregister;
{$endif}
shrdiv, andmod, pushed,popeax,popedx : boolean; shrdiv, andmod, pushed,popeax,popedx : boolean;
power : longint; power : longint;
@ -140,7 +138,6 @@ implementation
"Cardinal($ffffffff) div 16" overflows! (JM)} "Cardinal($ffffffff) div 16" overflows! (JM)}
If is_signed(p^.left^.resulttype) Then If is_signed(p^.left^.resulttype) Then
Begin Begin
{$ifdef newOptimizations}
If (aktOptProcessor <> class386) and If (aktOptProcessor <> class386) and
not(CS_LittleSize in aktglobalswitches) then not(CS_LittleSize in aktglobalswitches) then
{ use a sequence without jumps, saw this in { use a sequence without jumps, saw this in
@ -180,7 +177,6 @@ implementation
emit_const_reg(A_SAR,S_L,power,hreg1); emit_const_reg(A_SAR,S_L,power,hreg1);
end end
else else
{$endif newOptimizations}
begin begin
{ a jump, but less operations } { a jump, but less operations }
emit_reg_reg(A_TEST,S_L,hreg1,hreg1); emit_reg_reg(A_TEST,S_L,hreg1,hreg1);
@ -990,7 +986,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.2 2000-07-13 11:32:35 michael Revision 1.3 2000-07-14 05:11:48 michael
+ Patch to 1.1
Revision 1.2 2000/07/13 11:32:35 michael
+ removed logs + removed logs
} }

View File

@ -26,12 +26,6 @@
} }
unit cpubase; unit cpubase;
{$ifdef newOptimizations}
{$define foropt}
{$define replacereg}
{$define arithopt}
{$define foldarithops}
{$endif newOptimizations}
interface interface
{$ifdef TP} {$ifdef TP}
@ -606,33 +600,16 @@ Type
{modify the contents of a register with the purpose of using {modify the contents of a register with the purpose of using
this changed content afterwards (add/sub/..., but e.g. not rep this changed content afterwards (add/sub/..., but e.g. not rep
or movsd)} or movsd)}
{$ifdef arithopt}
Ch_MEAX, Ch_MECX, Ch_MEDX, Ch_MEBX, Ch_MESP, Ch_MEBP, Ch_MESI, Ch_MEDI, Ch_MEAX, Ch_MECX, Ch_MEDX, Ch_MEBX, Ch_MESP, Ch_MEBP, Ch_MESI, Ch_MEDI,
{$endif arithopt}
Ch_CDirFlag {clear direction flag}, Ch_SDirFlag {set dir flag}, Ch_CDirFlag {clear direction flag}, Ch_SDirFlag {set dir flag},
Ch_RFlags, Ch_WFlags, Ch_RWFlags, Ch_FPU, Ch_RFlags, Ch_WFlags, Ch_RWFlags, Ch_FPU,
Ch_Rop1, Ch_Wop1, Ch_RWop1,{$ifdef arithopt}Ch_Mop1,{$endif} Ch_Rop1, Ch_Wop1, Ch_RWop1,Ch_Mop1,
Ch_Rop2, Ch_Wop2, Ch_RWop2,{$ifdef arithopt}Ch_Mop2,{$endif} Ch_Rop2, Ch_Wop2, Ch_RWop2,Ch_Mop2,
Ch_Rop3, Ch_WOp3, Ch_RWOp3,{$ifdef arithopt}Ch_Mop3,{$endif} Ch_Rop3, Ch_WOp3, Ch_RWOp3,Ch_Mop3,
Ch_WMemEDI, Ch_WMemEDI,
Ch_All Ch_All
); );
{$ifndef arithopt}
Const
Ch_MEAX = Ch_RWEAX;
Ch_MECX = Ch_RWECX;
Ch_MEDX = Ch_RWEDX;
Ch_MEBX = Ch_RWEBX;
Ch_MESP = Ch_RWESP;
Ch_MEBP = Ch_RWEBP;
Ch_MESI = Ch_RWESI;
Ch_MEDI = Ch_RWEDI;
Ch_Mop1 = Ch_RWOp1;
Ch_Mop2 = Ch_RWOp2;
Ch_Mop3 = Ch_RWOp3;
{$endif arithopt}
const const
MaxCh = 3; { Max things a instruction can change } MaxCh = 3; { Max things a instruction can change }
@ -919,7 +896,10 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.2 2000-07-13 11:32:39 michael Revision 1.3 2000-07-14 05:11:48 michael
+ Patch to 1.1
Revision 1.2 2000/07/13 11:32:39 michael
+ removed logs + removed logs
} }

View File

@ -23,12 +23,6 @@
} }
Unit CSOpt386; Unit CSOpt386;
{$ifdef newOptimizations}
{$define foropt}
{$define replacereg}
{$define arithopt}
{$define foldarithops}
{$endif newOptimizations}
Interface Interface
@ -384,7 +378,6 @@ begin
{$endif replaceregdebug} {$endif replaceregdebug}
end; end;
{$ifdef replacereg}
function FindRegDealloc(reg: tregister; p: pai): boolean; function FindRegDealloc(reg: tregister; p: pai): boolean;
{ assumes reg is a 32bit register } { assumes reg is a 32bit register }
begin begin
@ -739,9 +732,7 @@ begin
end; end;
{$endif replaceregdebug} {$endif replaceregdebug}
End; End;
{$endif replacereg}
{$ifdef arithopt}
Function FindRegWithConst(p: Pai; size: topsize; l: longint; Var Res: TRegister): Boolean; Function FindRegWithConst(p: Pai; size: topsize; l: longint; Var Res: TRegister): Boolean;
{Finds a register which contains the constant l} {Finds a register which contains the constant l}
Var Counter: TRegister; Var Counter: TRegister;
@ -773,7 +764,6 @@ Begin
res := counter; res := counter;
FindRegWithConst := tmpResult; FindRegWithConst := tmpResult;
End; End;
{$endif arithopt}
Procedure DoCSE(AsmL: PAasmOutput; First, Last: Pai); Procedure DoCSE(AsmL: PAasmOutput; First, Last: Pai);
{marks the instructions that can be removed by RemoveInstructs. They're not {marks the instructions that can be removed by RemoveInstructs. They're not
@ -782,13 +772,7 @@ Procedure DoCSE(AsmL: PAasmOutput; First, Last: Pai);
Var Cnt, Cnt2: Longint; Var Cnt, Cnt2: Longint;
p, hp1, hp2: Pai; p, hp1, hp2: Pai;
hp3, hp4: pai; hp3, hp4: pai;
{$ifdef replacereg}
hp5 : pai; hp5 : pai;
{$else}
{$ifdef csdebug}
hp5 : pai;
{$endif}
{$endif}
RegInfo: TRegInfo; RegInfo: TRegInfo;
RegCounter: TRegister; RegCounter: TRegister;
TmpState: Byte; TmpState: Byte;
@ -888,21 +872,17 @@ Begin
{old reg new reg} {old reg new reg}
(RegInfo.New2OldReg[RegCounter] <> RegCounter) Then (RegInfo.New2OldReg[RegCounter] <> RegCounter) Then
Begin Begin
{$ifdef replacereg}
getLastInstruction(p,hp3); getLastInstruction(p,hp3);
If not(regCounter in usableRegs + [R_EDI,R_ESI]) or If not(regCounter in usableRegs + [R_EDI,R_ESI]) or
not ReplaceReg(asmL,RegInfo.New2OldReg[RegCounter], not ReplaceReg(asmL,RegInfo.New2OldReg[RegCounter],
regCounter,hp3, regCounter,hp3,
PPaiProp(hp4^.optInfo)^.Regs[regCounter],true,hp5) then PPaiProp(hp4^.optInfo)^.Regs[regCounter],true,hp5) then
begin begin
{$endif replacereg}
hp3 := New(Paicpu,Op_Reg_Reg(A_MOV, S_L, hp3 := New(Paicpu,Op_Reg_Reg(A_MOV, S_L,
{old reg new reg} {old reg new reg}
RegInfo.New2OldReg[RegCounter], RegCounter)); RegInfo.New2OldReg[RegCounter], RegCounter));
InsertLLItem(AsmL, Pai(hp2^.previous), hp2, hp3); InsertLLItem(AsmL, Pai(hp2^.previous), hp2, hp3);
{$ifdef replacereg}
end end
{$endif replacereg}
End End
Else Else
{ imagine the following code: } { imagine the following code: }
@ -1019,7 +999,6 @@ Begin
End; End;
End; End;
End; End;
{$ifdef replacereg}
top_Reg: top_Reg:
{ try to replace the new reg with the old reg } { try to replace the new reg with the old reg }
if not(PPaiProp(p^.optInfo)^.canBeRemoved) and if not(PPaiProp(p^.optInfo)^.canBeRemoved) and
@ -1043,7 +1022,6 @@ Begin
end; end;
end end
end; end;
{$endif replacereg}
top_symbol,Top_Const: top_symbol,Top_Const:
Begin Begin
Case Paicpu(p)^.oper[1].typ Of Case Paicpu(p)^.oper[1].typ Of
@ -1060,7 +1038,6 @@ Begin
allocRegBetween(asmL,regCounter,startMod,p); allocRegBetween(asmL,regCounter,startMod,p);
end; end;
End; End;
{$ifdef arithopt}
Top_Ref: Top_Ref:
if (paicpu(p)^.oper[0].typ = top_const) and if (paicpu(p)^.oper[0].typ = top_const) and
getLastInstruction(p,hp1) and getLastInstruction(p,hp1) and
@ -1070,7 +1047,6 @@ Begin
allocRegBetween(AsmL,reg32(regCounter), allocRegBetween(AsmL,reg32(regCounter),
PPaiProp(hp1^.optinfo)^.regs[regCounter].startMod,p); PPaiProp(hp1^.optinfo)^.regs[regCounter].startMod,p);
end; end;
{$endif arithopt}
End; End;
End; End;
End; End;
@ -1140,7 +1116,10 @@ End.
{ {
$Log$ $Log$
Revision 1.2 2000-07-13 11:32:39 michael Revision 1.3 2000-07-14 05:11:48 michael
+ Patch to 1.1
Revision 1.2 2000/07/13 11:32:39 michael
+ removed logs + removed logs
} }

View File

@ -29,13 +29,6 @@
Unit DAOpt386; Unit DAOpt386;
{$ifdef newOptimizations}
{$define foropt}
{$define replacereg}
{$define arithopt}
{$define foldarithops}
{$endif newOptimizations}
Interface Interface
Uses Uses
@ -809,21 +802,21 @@ begin
RegReadByInstruction := true; RegReadByInstruction := true;
exit exit
end; end;
Ch_RWOp1,Ch_ROp1{$ifdef arithopt},Ch_MOp1{$endif}: Ch_RWOp1,Ch_ROp1,Ch_MOp1:
if (p^.oper[0].typ = top_reg) and if (p^.oper[0].typ = top_reg) and
(reg32(p^.oper[0].reg) = reg) then (reg32(p^.oper[0].reg) = reg) then
begin begin
RegReadByInstruction := true; RegReadByInstruction := true;
exit exit
end; end;
Ch_RWOp2,Ch_ROp2{$ifdef arithopt},Ch_MOp2{$endif}: Ch_RWOp2,Ch_ROp2,Ch_MOp2:
if (p^.oper[1].typ = top_reg) and if (p^.oper[1].typ = top_reg) and
(reg32(p^.oper[1].reg) = reg) then (reg32(p^.oper[1].reg) = reg) then
begin begin
RegReadByInstruction := true; RegReadByInstruction := true;
exit exit
end; end;
Ch_RWOp3,Ch_ROp3{$ifdef arithopt},Ch_MOp3{$endif}: Ch_RWOp3,Ch_ROp3,Ch_MOp3:
if (p^.oper[2].typ = top_reg) and if (p^.oper[2].typ = top_reg) and
(reg32(p^.oper[2].reg) = reg) then (reg32(p^.oper[2].reg) = reg) then
begin begin
@ -934,13 +927,13 @@ Begin
Case InstrProp.Ch[Cnt] Of Case InstrProp.Ch[Cnt] Of
Ch_WEAX..Ch_MEDI: Ch_WEAX..Ch_MEDI:
TmpResult := Reg = TCh2Reg(InstrProp.Ch[Cnt]); TmpResult := Reg = TCh2Reg(InstrProp.Ch[Cnt]);
Ch_RWOp1,Ch_WOp1{$ifdef arithopt},Ch_Mop1{$endif arithopt}: Ch_RWOp1,Ch_WOp1,Ch_Mop1:
TmpResult := (paicpu(p1)^.oper[0].typ = top_reg) and TmpResult := (paicpu(p1)^.oper[0].typ = top_reg) and
(Reg32(paicpu(p1)^.oper[0].reg) = reg); (Reg32(paicpu(p1)^.oper[0].reg) = reg);
Ch_RWOp2,Ch_WOp2{$ifdef arithopt},Ch_Mop2{$endif arithopt}: Ch_RWOp2,Ch_WOp2,Ch_Mop2:
TmpResult := (paicpu(p1)^.oper[1].typ = top_reg) and TmpResult := (paicpu(p1)^.oper[1].typ = top_reg) and
(Reg32(paicpu(p1)^.oper[1].reg) = reg); (Reg32(paicpu(p1)^.oper[1].reg) = reg);
Ch_RWOp3,Ch_WOp3{$ifdef arithopt},Ch_Mop3{$endif arithopt}: Ch_RWOp3,Ch_WOp3,Ch_Mop3:
TmpResult := (paicpu(p1)^.oper[2].typ = top_reg) and TmpResult := (paicpu(p1)^.oper[2].typ = top_reg) and
(Reg32(paicpu(p1)^.oper[2].reg) = reg); (Reg32(paicpu(p1)^.oper[2].reg) = reg);
Ch_FPU: TmpResult := Reg in [R_ST..R_ST7,R_MM0..R_MM7]; Ch_FPU: TmpResult := Reg in [R_ST..R_ST7,R_MM0..R_MM7];
@ -1680,7 +1673,6 @@ Begin
DFAPass1 := BlockEnd; DFAPass1 := BlockEnd;
End; End;
{$ifdef arithopt}
Procedure AddInstr2RegContents({$ifdef statedebug} asml: paasmoutput; {$endif} Procedure AddInstr2RegContents({$ifdef statedebug} asml: paasmoutput; {$endif}
p: paicpu; reg: TRegister); p: paicpu; reg: TRegister);
{$ifdef statedebug} {$ifdef statedebug}
@ -1730,7 +1722,6 @@ Begin
DestroyOp(p, oper); DestroyOp(p, oper);
End End
End; End;
{$endif arithopt}
Procedure DoDFAPass2( Procedure DoDFAPass2(
{$Ifdef StateDebug} {$Ifdef StateDebug}
@ -2107,22 +2098,13 @@ Begin
DestroyReg(CurProp, R_EDX, true) DestroyReg(CurProp, R_EDX, true)
End End
Else Else
{$ifdef arithopt}
AddInstr2OpContents( AddInstr2OpContents(
{$ifdef statedebug}asml,{$endif} {$ifdef statedebug}asml,{$endif}
Paicpu(p), Paicpu(p)^.oper[1]) Paicpu(p), Paicpu(p)^.oper[1])
{$else arithopt}
DestroyOp(p, Paicpu(p)^.oper[1])
{$endif arithopt}
Else Else
{$ifdef arithopt}
AddInstr2OpContents({$ifdef statedebug}asml,{$endif} AddInstr2OpContents({$ifdef statedebug}asml,{$endif}
Paicpu(p), Paicpu(p)^.oper[2]); Paicpu(p), Paicpu(p)^.oper[2]);
{$else arithopt}
DestroyOp(p, Paicpu(p)^.oper[2]);
{$endif arithopt}
End; End;
{$ifdef arithopt}
A_LEA: A_LEA:
begin begin
readop(curprop,paicpu(p)^.oper[0]); readop(curprop,paicpu(p)^.oper[0]);
@ -2139,7 +2121,6 @@ Begin
destroyreg(curprop,paicpu(p)^.oper[1].reg,true); destroyreg(curprop,paicpu(p)^.oper[1].reg,true);
end; end;
end; end;
{$endif arithopt}
Else Else
Begin Begin
Cnt := 1; Cnt := 1;
@ -2159,11 +2140,9 @@ Begin
{$endif statedebug} {$endif statedebug}
DestroyReg(CurProp, TCh2Reg(InstrProp.Ch[Cnt]), true); DestroyReg(CurProp, TCh2Reg(InstrProp.Ch[Cnt]), true);
End; End;
{$ifdef arithopt}
Ch_MEAX..Ch_MEDI: Ch_MEAX..Ch_MEDI:
AddInstr2RegContents({$ifdef statedebug} asml,{$endif} AddInstr2RegContents({$ifdef statedebug} asml,{$endif}
Paicpu(p),TCh2Reg(InstrProp.Ch[Cnt])); Paicpu(p),TCh2Reg(InstrProp.Ch[Cnt]));
{$endif arithopt}
Ch_CDirFlag: CurProp^.DirFlag := F_NotSet; Ch_CDirFlag: CurProp^.DirFlag := F_NotSet;
Ch_SDirFlag: CurProp^.DirFlag := F_Set; Ch_SDirFlag: CurProp^.DirFlag := F_Set;
Ch_Rop1: ReadOp(CurProp, Paicpu(p)^.oper[0]); Ch_Rop1: ReadOp(CurProp, Paicpu(p)^.oper[0]);
@ -2175,33 +2154,27 @@ Begin
ReadOp(CurProp, Paicpu(p)^.oper[0]); ReadOp(CurProp, Paicpu(p)^.oper[0]);
DestroyOp(p, Paicpu(p)^.oper[0]); DestroyOp(p, Paicpu(p)^.oper[0]);
End; End;
{$ifdef arithopt}
Ch_Mop1: Ch_Mop1:
AddInstr2OpContents({$ifdef statedebug} asml, {$endif} AddInstr2OpContents({$ifdef statedebug} asml, {$endif}
Paicpu(p), Paicpu(p)^.oper[0]); Paicpu(p), Paicpu(p)^.oper[0]);
{$endif arithopt}
Ch_Wop2..Ch_RWop2: Ch_Wop2..Ch_RWop2:
Begin Begin
If (InstrProp.Ch[Cnt] = Ch_RWop2) Then If (InstrProp.Ch[Cnt] = Ch_RWop2) Then
ReadOp(CurProp, Paicpu(p)^.oper[1]); ReadOp(CurProp, Paicpu(p)^.oper[1]);
DestroyOp(p, Paicpu(p)^.oper[1]); DestroyOp(p, Paicpu(p)^.oper[1]);
End; End;
{$ifdef arithopt}
Ch_Mop2: Ch_Mop2:
AddInstr2OpContents({$ifdef statedebug} asml, {$endif} AddInstr2OpContents({$ifdef statedebug} asml, {$endif}
Paicpu(p), Paicpu(p)^.oper[1]); Paicpu(p), Paicpu(p)^.oper[1]);
{$endif arithopt}
Ch_WOp3..Ch_RWOp3: Ch_WOp3..Ch_RWOp3:
Begin Begin
If (InstrProp.Ch[Cnt] = Ch_RWOp3) Then If (InstrProp.Ch[Cnt] = Ch_RWOp3) Then
ReadOp(CurProp, Paicpu(p)^.oper[2]); ReadOp(CurProp, Paicpu(p)^.oper[2]);
DestroyOp(p, Paicpu(p)^.oper[2]); DestroyOp(p, Paicpu(p)^.oper[2]);
End; End;
{$ifdef arithopt}
Ch_Mop3: Ch_Mop3:
AddInstr2OpContents({$ifdef statedebug} asml, {$endif} AddInstr2OpContents({$ifdef statedebug} asml, {$endif}
Paicpu(p), Paicpu(p)^.oper[2]); Paicpu(p), Paicpu(p)^.oper[2]);
{$endif arithopt}
Ch_WMemEDI: Ch_WMemEDI:
Begin Begin
ReadReg(CurProp, R_EDI); ReadReg(CurProp, R_EDI);
@ -2337,7 +2310,10 @@ End.
{ {
$Log$ $Log$
Revision 1.2 2000-07-13 11:32:40 michael Revision 1.3 2000-07-14 05:11:48 michael
+ Patch to 1.1
Revision 1.2 2000/07/13 11:32:40 michael
+ removed logs + removed logs
} }

View File

@ -152,7 +152,6 @@ Type
TInstrSinceLastMod); TInstrSinceLastMod);
{ destroy the contents of all registers } { destroy the contents of all registers }
Procedure DestroyAllRegs(var InstrSinceLastMod: TInstrSinceLastMod); Procedure DestroyAllRegs(var InstrSinceLastMod: TInstrSinceLastMod);
{$ifdef arithopt}
{ a register's contents are modified, but not destroyed (the new value } { a register's contents are modified, but not destroyed (the new value }
{ depends on the old one) } { depends on the old one) }
Procedure ModifyReg(reg: TRegister; var InstrSinceLastMod: Procedure ModifyReg(reg: TRegister; var InstrSinceLastMod:
@ -161,7 +160,6 @@ Type
{ depends on the old one) } { depends on the old one) }
Procedure ModifyOp(const oper: TOper; var InstrSinceLastMod: Procedure ModifyOp(const oper: TOper; var InstrSinceLastMod:
TInstrSinceLastMod); TInstrSinceLastMod);
{$endif arithopt}
{ increase the write state of a register (call every time a register is } { increase the write state of a register (call every time a register is }
{ written to) } { written to) }
@ -558,7 +556,6 @@ Begin
End; End;
End; End;
{$ifdef arithopt}
Procedure TPaiProp.ModifyReg(reg: TRegister; Var InstrSinceLastMod: Procedure TPaiProp.ModifyReg(reg: TRegister; Var InstrSinceLastMod:
TInstrSinceLastMod); TInstrSinceLastMod);
Begin Begin
@ -589,7 +586,6 @@ Begin
DestroyOp(oper, InstrSinceLastMod); DestroyOp(oper, InstrSinceLastMod);
End End
End; End;
{$endif arithopt}
Procedure TPaiProp.IncWState(Reg: TRegister);{$ifdef inl} inline;{$endif inl} Procedure TPaiProp.IncWState(Reg: TRegister);{$ifdef inl} inline;{$endif inl}
Begin Begin
@ -791,7 +787,10 @@ End.
{ {
$Log$ $Log$
Revision 1.1 2000-07-13 06:30:07 michael Revision 1.2 2000-07-14 05:11:49 michael
+ Patch to 1.1
Revision 1.1 2000/07/13 06:30:07 michael
+ Initial import + Initial import
Revision 1.8 2000/01/07 01:14:52 peter Revision 1.8 2000/01/07 01:14:52 peter

View File

@ -75,17 +75,9 @@ Begin
CurProp^.DestroyReg(R_EDX, InstrSinceLastMod) CurProp^.DestroyReg(R_EDX, InstrSinceLastMod)
End End
Else Else
{$ifdef arithopt}
CurProp^.ModifyOp(p^.oper[1], InstrSinceLastMod) CurProp^.ModifyOp(p^.oper[1], InstrSinceLastMod)
{$else arithopt}
CurProp^.DestroyOp(p^.oper[1], InstrSinceLastMod)
{$endif arithopt}
Else Else
{$ifdef arithopt}
CurProp^.ModifyOp(p^.oper[2], InstrSinceLastMod); CurProp^.ModifyOp(p^.oper[2], InstrSinceLastMod);
{$else arithopt}
CurProp^.DestroyOp(p^.oper[2], InstrsinceLastMod);
{$endif arithopt}
End; End;
A_XOR: A_XOR:
Begin Begin
@ -100,11 +92,7 @@ Begin
CurProp^.Regs[RegMaxSize(p^.oper[0].reg)].StartMod := Pointer(0) CurProp^.Regs[RegMaxSize(p^.oper[0].reg)].StartMod := Pointer(0)
End End
Else Else
{$Ifdef ArithOpt}
CurProp^.ModifyOp(p^.oper[1], InstrSinceLastMod); CurProp^.ModifyOp(p^.oper[1], InstrSinceLastMod);
{$Else ArithOpt}
CurProp^.DestroyOp(p^.oper[1], InstrSinceLastMod);
{$EndIf ArithOpt}
End End
Else Else
Begin Begin
@ -122,10 +110,8 @@ Begin
CurProp^.ReadReg(TCh2Reg(InstrProp.Ch[Cnt])); CurProp^.ReadReg(TCh2Reg(InstrProp.Ch[Cnt]));
CurProp^.DestroyReg(TCh2Reg(InstrProp.Ch[Cnt]),InstrSinceLastMod); CurProp^.DestroyReg(TCh2Reg(InstrProp.Ch[Cnt]),InstrSinceLastMod);
End; End;
{$ifdef arithopt}
Ch_MEAX..Ch_MEDI: Ch_MEAX..Ch_MEDI:
CurProp^.ModifyReg(TCh2Reg(InstrProp.Ch[Cnt]), InstrSinceLastMod); CurProp^.ModifyReg(TCh2Reg(InstrProp.Ch[Cnt]), InstrSinceLastMod);
{$endif arithopt}
Ch_CDirFlag: CurProp^.CondRegs.ClearFlag(DirFlag); Ch_CDirFlag: CurProp^.CondRegs.ClearFlag(DirFlag);
Ch_SDirFlag: CurProp^.CondRegs.SetFlag(DirFlag); Ch_SDirFlag: CurProp^.CondRegs.SetFlag(DirFlag);
Ch_Rop1: CurProp^.ReadOp(p^.oper[0]); Ch_Rop1: CurProp^.ReadOp(p^.oper[0]);
@ -137,30 +123,24 @@ Begin
CurProp^.ReadOp(p^.oper[0]); CurProp^.ReadOp(p^.oper[0]);
CurProp^.DestroyOp(p^.oper[0], InstrSinceLastMod); CurProp^.DestroyOp(p^.oper[0], InstrSinceLastMod);
End; End;
{$ifdef arithopt}
Ch_Mop1: Ch_Mop1:
CurProp^.ModifyOp(p^.oper[0], InstrSinceLastMod); CurProp^.ModifyOp(p^.oper[0], InstrSinceLastMod);
{$endif arithopt}
Ch_Wop2..Ch_RWop2: Ch_Wop2..Ch_RWop2:
Begin Begin
If (InstrProp.Ch[Cnt] = Ch_RWop2) Then If (InstrProp.Ch[Cnt] = Ch_RWop2) Then
CurProp^.ReadOp(p^.oper[1]); CurProp^.ReadOp(p^.oper[1]);
CurProp^.DestroyOp(p^.oper[1], InstrSinceLastMod); CurProp^.DestroyOp(p^.oper[1], InstrSinceLastMod);
End; End;
{$ifdef arithopt}
Ch_Mop2: Ch_Mop2:
CurProp^.ModifyOp(p^.oper[1], InstrSinceLastMod); CurProp^.ModifyOp(p^.oper[1], InstrSinceLastMod);
{$endif arithopt}
Ch_Wop3..Ch_RWop3: Ch_Wop3..Ch_RWop3:
Begin Begin
If (InstrProp.Ch[Cnt] = Ch_RWop3) Then If (InstrProp.Ch[Cnt] = Ch_RWop3) Then
CurProp^.ReadOp(p^.oper[2]); CurProp^.ReadOp(p^.oper[2]);
CurProp^.DestroyOp(p^.oper[2], InstrSinceLastMod); CurProp^.DestroyOp(p^.oper[2], InstrSinceLastMod);
End; End;
{$ifdef arithopt}
Ch_Mop3: Ch_Mop3:
CurProp^.ModifyOp(p^.oper[2], InstrSinceLastMod); CurProp^.ModifyOp(p^.oper[2], InstrSinceLastMod);
{$endif arithopt}
Ch_WMemEDI: Ch_WMemEDI:
Begin Begin
CurProp^.ReadReg(R_EDI); CurProp^.ReadReg(R_EDI);
@ -211,15 +191,13 @@ Begin
Begin Begin
Case InstrProp.Ch[Cnt] Of Case InstrProp.Ch[Cnt] Of
Ch_REAX..Ch_REDI,Ch_RWEAX..Ch_RWEDI Ch_REAX..Ch_REDI,Ch_RWEAX..Ch_RWEDI
{$ifdef arithopt}
,Ch_MEAX..Ch_MEDI ,Ch_MEAX..Ch_MEDI
{$endif arithopt}:
TmpResult := Reg = TCh2Reg(InstrProp.Ch[Cnt]); TmpResult := Reg = TCh2Reg(InstrProp.Ch[Cnt]);
Ch_ROp1,Ch_RWOp1{$ifdef arithopt},Ch_Mop1{$endif arithopt}: Ch_ROp1,Ch_RWOp1,Ch_Mop1:
TmpResult := RegInOp(Reg,PInstr(p)^.oper[0]); TmpResult := RegInOp(Reg,PInstr(p)^.oper[0]);
Ch_ROp2,Ch_RWOp2{$ifdef arithopt},Ch_Mop2{$endif arithopt}: Ch_ROp2,Ch_RWOp2,Ch_Mop2:
TmpResult := RegInOp(Reg,PInstr(p)^.oper[1]); TmpResult := RegInOp(Reg,PInstr(p)^.oper[1]);
Ch_ROp3,Ch_RWOp3{$ifdef arithopt},Ch_Mop3{$endif arithopt}: Ch_ROp3,Ch_RWOp3,Ch_Mop3:
TmpResult := RegInOp(Reg,PInstr(p)^.oper[2]); TmpResult := RegInOp(Reg,PInstr(p)^.oper[2]);
Ch_WOp1: TmpResult := (PInstr(p)^.oper[0].typ = top_ref) And Ch_WOp1: TmpResult := (PInstr(p)^.oper[0].typ = top_ref) And
RegInRef(Reg,PInstr(p)^.oper[0].ref^); RegInRef(Reg,PInstr(p)^.oper[0].ref^);
@ -257,7 +235,10 @@ End.
{ {
$Log$ $Log$
Revision 1.1 2000-07-13 06:30:10 michael Revision 1.2 2000-07-14 05:11:49 michael
+ Patch to 1.1
Revision 1.1 2000/07/13 06:30:10 michael
+ Initial import + Initial import
Revision 1.5 2000/01/07 01:14:57 peter Revision 1.5 2000/01/07 01:14:57 peter

View File

@ -1204,7 +1204,6 @@ begin
disable_configfile:=false; disable_configfile:=false;
{ default defines } { default defines }
def_symbol(target_info.short_name); def_symbol(target_info.short_name);
def_symbol('FPK');
def_symbol('FPC'); def_symbol('FPC');
def_symbol('VER'+version_nr); def_symbol('VER'+version_nr);
def_symbol('VER'+version_nr+'_'+release_nr); def_symbol('VER'+version_nr+'_'+release_nr);
@ -1214,14 +1213,6 @@ begin
{$endif} {$endif}
{ Temporary defines, until things settle down } { Temporary defines, until things settle down }
def_symbol('INT64');
def_symbol('HASRESOURCESTRINGS');
def_symbol('HASSAVEREGISTERS');
def_symbol('NEWVMTOFFSET');
def_symbol('HASINTERNMATH');
def_symbol('SYSTEMTVARREC');
def_symbol('INCLUDEOK');
def_symbol('NEWMM');
def_symbol('HASWIDECHAR'); def_symbol('HASWIDECHAR');
{$ifdef SUPPORT_FIXED} {$ifdef SUPPORT_FIXED}
@ -1233,8 +1224,6 @@ begin
{ for the RTL } { for the RTL }
def_symbol('CARDINALMULFIXED'); def_symbol('CARDINALMULFIXED');
{$endif cardinalmulfix} {$endif cardinalmulfix}
def_symbol('CORRECTFLDCW');
def_symbol('ENHANCEDRAISE');
{ New since 1.09 } { New since 1.09 }
def_symbol('HASOUT'); def_symbol('HASOUT');
@ -1491,7 +1480,10 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.3 2000-07-13 12:08:26 michael Revision 1.4 2000-07-14 05:11:48 michael
+ Patch to 1.1
Revision 1.3 2000/07/13 12:08:26 michael
+ patched to 1.1.0 with former 1.09patch from peter + patched to 1.1.0 with former 1.09patch from peter
Revision 1.2 2000/07/13 11:32:44 michael Revision 1.2 2000/07/13 11:32:44 michael

View File

@ -581,11 +581,7 @@ unit pdecl;
if export_aktvarsym then if export_aktvarsym then
begin begin
inc(aktvarsym^.refs); inc(aktvarsym^.refs);
{$ifdef INCLUDEOK}
include(aktvarsym^.varoptions,vo_is_exported); include(aktvarsym^.varoptions,vo_is_exported);
{$else}
aktvarsym^.varoptions:=aktvarsym^.varoptions+[vo_is_exported];
{$endif}
end; end;
if extern_aktvarsym then if extern_aktvarsym then
include(aktvarsym^.varoptions,vo_is_external); include(aktvarsym^.varoptions,vo_is_external);
@ -1236,7 +1232,10 @@ unit pdecl;
end. end.
{ {
$Log$ $Log$
Revision 1.3 2000-07-13 12:08:26 michael Revision 1.4 2000-07-14 05:11:49 michael
+ Patch to 1.1
Revision 1.3 2000/07/13 12:08:26 michael
+ patched to 1.1.0 with former 1.09patch from peter + patched to 1.1.0 with former 1.09patch from peter
Revision 1.2 2000/07/13 11:32:44 michael Revision 1.2 2000/07/13 11:32:44 michael

View File

@ -22,12 +22,6 @@
} }
Unit POpt386; Unit POpt386;
{$ifdef newOptimizations}
{$define foropt}
{$define replacereg}
{$define arithopt}
{$define foldarithops}
{$endif newOptimizations}
Interface Interface
@ -109,9 +103,7 @@ Procedure PeepHoleOptPass1(Asml: PAasmOutput; BlockStart, BlockEnd: Pai);
Var Var
l : longint; l : longint;
p,hp1,hp2 : pai; p,hp1,hp2 : pai;
{$ifdef foropt}
hp3,hp4: pai; hp3,hp4: pai;
{$endif foropt}
TmpBool1, TmpBool2: Boolean; TmpBool1, TmpBool2: Boolean;
TmpRef: TReference; TmpRef: TReference;
@ -387,7 +379,6 @@ Begin
If (Paicpu(p)^.oper[0].typ = top_const) And If (Paicpu(p)^.oper[0].typ = top_const) And
(Paicpu(p)^.oper[1].typ in [top_reg,top_ref]) And (Paicpu(p)^.oper[1].typ in [top_reg,top_ref]) And
(Paicpu(p)^.oper[0].val = 0) Then (Paicpu(p)^.oper[0].val = 0) Then
{$ifdef foropt}
If GetNextInstruction(p, hp1) And If GetNextInstruction(p, hp1) And
(hp1^.typ = ait_instruction) And (hp1^.typ = ait_instruction) And
(Paicpu(hp1)^.is_jmp) and (Paicpu(hp1)^.is_jmp) and
@ -422,7 +413,6 @@ Begin
continue; continue;
End End
Else Else
{$endif foropt}
{change "cmp $0, %reg" to "test %reg, %reg"} {change "cmp $0, %reg" to "test %reg, %reg"}
If (Paicpu(p)^.oper[1].typ = top_reg) Then If (Paicpu(p)^.oper[1].typ = top_reg) Then
Begin Begin
@ -749,14 +739,9 @@ Begin
{changes "lea (%reg1), %reg2" into "mov %reg1, %reg2"} {changes "lea (%reg1), %reg2" into "mov %reg1, %reg2"}
If (Paicpu(p)^.oper[0].ref^.Base In [R_EAX..R_EDI]) And If (Paicpu(p)^.oper[0].ref^.Base In [R_EAX..R_EDI]) And
(Paicpu(p)^.oper[0].ref^.Index = R_NO) And (Paicpu(p)^.oper[0].ref^.Index = R_NO) And
{$ifndef newOptimizations}
(Paicpu(p)^.oper[0].ref^.Offset = 0) And
{$endif newOptimizations}
(Not(Assigned(Paicpu(p)^.oper[0].ref^.Symbol))) Then (Not(Assigned(Paicpu(p)^.oper[0].ref^.Symbol))) Then
If (Paicpu(p)^.oper[0].ref^.Base <> Paicpu(p)^.oper[1].reg) If (Paicpu(p)^.oper[0].ref^.Base <> Paicpu(p)^.oper[1].reg)
{$ifdef newOptimizations}
and (Paicpu(p)^.oper[0].ref^.Offset = 0) and (Paicpu(p)^.oper[0].ref^.Offset = 0)
{$endif newOptimizations}
Then Then
Begin Begin
hp1 := New(Paicpu, op_reg_reg(A_MOV, S_L,Paicpu(p)^.oper[0].ref^.Base, hp1 := New(Paicpu, op_reg_reg(A_MOV, S_L,Paicpu(p)^.oper[0].ref^.Base,
@ -767,9 +752,7 @@ Begin
Continue; Continue;
End End
Else Else
{$ifdef newOptimizations}
if (Paicpu(p)^.oper[0].ref^.Offset = 0) then if (Paicpu(p)^.oper[0].ref^.Offset = 0) then
{$endif newOptimizations}
Begin Begin
hp1 := Pai(p^.Next); hp1 := Pai(p^.Next);
AsmL^.Remove(p); AsmL^.Remove(p);
@ -777,7 +760,6 @@ Begin
p := hp1; p := hp1;
Continue; Continue;
End End
{$ifdef newOptimizations}
else else
with Paicpu(p)^.oper[0].ref^ do with Paicpu(p)^.oper[0].ref^ do
if (Base = Paicpu(p)^.oper[1].reg) then if (Base = Paicpu(p)^.oper[1].reg) then
@ -799,7 +781,6 @@ Begin
end; end;
end; end;
end; end;
{$endif newOptimizations}
End; End;
A_MOV: A_MOV:
@ -1932,7 +1913,10 @@ End.
{ {
$Log$ $Log$
Revision 1.2 2000-07-13 11:32:45 michael Revision 1.3 2000-07-14 05:11:49 michael
+ Patch to 1.1
Revision 1.2 2000/07/13 11:32:45 michael
+ removed logs + removed logs
} }

View File

@ -843,14 +843,12 @@ implementation
calcregisters(p,0,0,0) calcregisters(p,0,0,0)
else else
calcregisters(p,1,0,0); calcregisters(p,1,0,0);
{$ifdef newoptimizations}
{$ifdef i386} {$ifdef i386}
{ not always necessary, only if it is not a constant char and } { not always necessary, only if it is not a constant char and }
{ not a regvar, but don't know how to check this here (JM) } { not a regvar, but don't know how to check this here (JM) }
if is_char(rd) then if is_char(rd) then
inc(p^.registers32); inc(p^.registers32);
{$endif i386} {$endif i386}
{$endif newoptimizations}
convdone:=true; convdone:=true;
end end
else else
@ -1280,7 +1278,10 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.2 2000-07-13 11:32:50 michael Revision 1.3 2000-07-14 05:11:49 michael
+ Patch to 1.1
Revision 1.2 2000/07/13 11:32:50 michael
+ removed logs + removed logs
} }

View File

@ -34,11 +34,7 @@ interface
{$ifdef newcg} {$ifdef newcg}
minorpatch = ' NCG'; minorpatch = ' NCG';
{$else newcg} {$else newcg}
{$ifdef newoptimizations}
minorpatch = ' OPT';
{$else}
minorpatch = ''; minorpatch = '';
{$endif}
{$endif newcg} {$endif newcg}
{ date string } { date string }
@ -98,7 +94,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.3 2000-07-13 12:08:28 michael Revision 1.4 2000-07-14 05:11:49 michael
+ Patch to 1.1
Revision 1.3 2000/07/13 12:08:28 michael
+ patched to 1.1.0 with former 1.09patch from peter + patched to 1.1.0 with former 1.09patch from peter
Revision 1.2 2000/07/13 11:32:54 michael Revision 1.2 2000/07/13 11:32:54 michael