mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-15 02:26:07 +02:00
* changes to work with -dUSE_OP3
This commit is contained in:
parent
c7c74f2895
commit
e16f0f99db
@ -190,9 +190,11 @@ Type
|
||||
TLabelTable = Array[0..2500000] Of TLabelTableItem;
|
||||
{$Endif tp}
|
||||
PLabelTable = ^TLabelTable;
|
||||
{$IfNDef USE_OP3}
|
||||
TwoWords = Record
|
||||
Word1, Word2: Word;
|
||||
End;
|
||||
{$EndIf USE_OP3}
|
||||
|
||||
{******************************* Variables *******************************}
|
||||
|
||||
@ -1112,17 +1114,23 @@ Begin
|
||||
If Not(TmpResult) Then
|
||||
Case Pai386(p1)^.op2t Of
|
||||
Top_Reg:
|
||||
{$IfDef USE_OP3}
|
||||
TmpResult := Reg = TRegister(Pai386(p1)^.op2);
|
||||
{$Else USE_OP3}
|
||||
if Pai386(p1)^.op3t<>Top_reg
|
||||
then TmpResult := Reg = TRegister(Pai386(p1)^.op2)
|
||||
else TmpResult := longint(Reg) = twowords(Pai386(p1)^.op2).word1;
|
||||
{$EndIf USE_OP3}
|
||||
Top_Ref: TmpResult := RegInRef(Reg, TReference(Pai386(p1)^.op2^))
|
||||
End;
|
||||
If Not(TmpResult) Then
|
||||
Case Pai386(p1)^.op3t Of
|
||||
Top_Reg: TmpResult := longint(Reg) =twowords(Pai386(p1)^.op2).word2;
|
||||
Top_none:;
|
||||
else
|
||||
internalerror($Da);
|
||||
{$IfDef USE_OP3}
|
||||
Top_Reg: TmpResult := Reg = TRegister(Pai386(p1)^.op3);
|
||||
Top_Ref: TmpResult := RegInRef(Reg, TReference(Pai386(p1)^.op3^));
|
||||
{$Else USE_OP3}
|
||||
Top_Reg: TmpResult := longint(Reg) = twowords(Pai386(p1)^.op2).word2;
|
||||
{$EndIf USE_OP3}
|
||||
End
|
||||
End;
|
||||
RegInInstruction := TmpResult
|
||||
@ -1411,7 +1419,11 @@ Begin
|
||||
Case Pai386(p)^.op2t Of
|
||||
top_reg:
|
||||
If Not(TRegister(Pai386(p)^.op2) in [R_NO,R_ESP,ProcInfo.FramePointer]) Then
|
||||
If RegSet := RegSet + [TRegister(TwoWords(Pai386(p)^.op2).Word1];
|
||||
{$IfDef USE_OP3}
|
||||
RegSet := RegSet + [TRegister(Pai386(p)^.op2)];
|
||||
{$EndIf USE_OP3}
|
||||
RegSet := RegSet + [TRegister(TwoWords(Pai386(p)^.op2).Word1];
|
||||
{$EndIf USE_OP3}
|
||||
top_ref:
|
||||
With TReference(Pai386(p)^.op2^) Do
|
||||
Begin
|
||||
@ -1534,6 +1546,12 @@ Begin {checks whether two Pai386 instructions are equal}
|
||||
End
|
||||
Else
|
||||
{an instruction <> mov, movzx, movsx}
|
||||
{$IfDef USE_OP3}
|
||||
InstructionsEquivalent :=
|
||||
OpsEquivalent(Pai386(p1)^.op1t, Pai386(p1)^.op1, Pai386(p2)^.op1, RegInfo, OpAct_Unknown) And
|
||||
OpsEquivalent(Pai386(p1)^.op2t, Pai386(p1)^.op2, Pai386(p2)^.op2, RegInfo, OpAct_Unknown) And
|
||||
OpsEquivalent(Pai386(p1)^.op3t, Pai386(p1)^.op3, Pai386(p2)^.op3, RegInfo, OpAct_Unknown)
|
||||
{$Else USE_OP3}
|
||||
If (Pai386(p1)^.op3t = top_none) Then
|
||||
InstructionsEquivalent :=
|
||||
OpsEquivalent(Pai386(p1)^.op1t, Pai386(p1)^.op1, Pai386(p2)^.op1, RegInfo, OpAct_Unknown) And
|
||||
@ -1545,6 +1563,7 @@ Begin {checks whether two Pai386 instructions are equal}
|
||||
Pointer(Longint(TwoWords(Pai386(p2)^.op2).Word1)), RegInfo, OpAct_Unknown) And
|
||||
OpsEquivalent(Pai386(p1)^.op3t, Pointer(Longint(TwoWords(Pai386(p1)^.op2).Word2)),
|
||||
Pointer(Longint(TwoWords(Pai386(p2)^.op2).Word2)), RegInfo, OpAct_Unknown)
|
||||
{$EndIf USE_OP3}
|
||||
{the instructions haven't even got the same structure, so they're certainly
|
||||
not equivalent}
|
||||
Else InstructionsEquivalent := False;
|
||||
@ -2049,10 +2068,13 @@ Begin
|
||||
A_IMUL:
|
||||
Begin
|
||||
ReadOp(CurProp, Pai386(p)^.Op1t, Pai386(p)^.Op1);
|
||||
{$IfDef USE_OP3}
|
||||
ReadOp(CurProp, Pai386(p)^.Op2t, Pai386(p)^.Op2);
|
||||
{$Else USE_OP3}
|
||||
If (Pai386(p)^.Op2t = Top_Ref) Then
|
||||
ReadOp(CurProp, Pai386(p)^.Op2t, Pai386(p)^.Op2)
|
||||
Else ReadOp(CurProp, Pai386(p)^.Op2t, Pointer(Longint(TwoWords(Pai386(p)^.Op2).Word1)));
|
||||
ReadOp(CurProp, Pai386(p)^.Op3t, Pointer(LongInt(TwoWords(Pai386(p)^.Op2).Word2)));
|
||||
{$EndIf USE_OP3}
|
||||
If (Pai386(p)^.Op3t = top_none)
|
||||
Then
|
||||
If (Pai386(p)^.Op2t = top_none)
|
||||
@ -2062,7 +2084,11 @@ Begin
|
||||
DestroyReg(CurProp, R_EDX)
|
||||
End
|
||||
Else Destroy(p, Pai386(p)^.Op2t, Pai386(p)^.Op2)
|
||||
{$IfDef USE_OP3}
|
||||
Else Destroy(p, Pai386(p)^.Op3t, Pai386(p)^.Op3);
|
||||
{$Else USE_OP3}
|
||||
Else DestroyReg(CurProp, TRegister(longint(twowords(Pai386(p)^.Op2).word2)));
|
||||
{$EndIf USE_OP3}
|
||||
End;
|
||||
A_XOR:
|
||||
Begin
|
||||
@ -2096,16 +2122,35 @@ Begin
|
||||
C_CDirFlag: CurProp^.DirFlag := F_NotSet;
|
||||
C_SDirFlag: CurProp^.DirFlag := F_Set;
|
||||
C_ROp1: ReadOp(CurProp, Pai386(p)^.op1t, Pai386(p)^.op1);
|
||||
{$IfDef USE_OP3}
|
||||
C_ROp2: ReadOp(CurProp, Pai386(p)^.op2t, Pai386(p)^.op2);
|
||||
C_ROp3: ReadOp(CurProp, Pai386(p)^.op3t, Pai386(p)^.op3);
|
||||
{$Else USE_OP3}
|
||||
C_ROp2: If (Pai386(p)^.Op3t = top_none) Then
|
||||
ReadOp(CurProp, Pai386(p)^.op2t, Pai386(p)^.op2)
|
||||
Else ReadOp(CurProp, Pai386(p)^.op2t, Pointer(Longint(TwoWords(Pai386(p)^.op2).word1)));
|
||||
C_ROp3: ReadOp(CurProp, Pai386(p)^.op3t, Pointer(Longint(TwoWords(Pai386(p)^.op2).word2)));
|
||||
{$EndIf USE_OP3}
|
||||
C_WOp1..C_RWOp1:
|
||||
Begin
|
||||
If (InstrProp.Ch[Cnt] = C_RWOp1) Then
|
||||
ReadOp(CurProp, Pai386(p)^.op1t, Pai386(p)^.op1);
|
||||
Destroy(p, Pai386(p)^.op1t, Pai386(p)^.op1);
|
||||
End;
|
||||
{$IfDef USE_OP3}
|
||||
C_WOp2..C_RWOp2:
|
||||
Begin
|
||||
If (InstrProp.Ch[Cnt] = C_RWOp2) Then
|
||||
ReadOp(CurProp, Pai386(p)^.op2t, Pai386(p)^.op2);
|
||||
Destroy(p, Pai386(p)^.op2t, Pai386(p)^.op2);
|
||||
End;
|
||||
C_WOp3..C_RWOp3:
|
||||
Begin
|
||||
If (InstrProp.Ch[Cnt] = C_RWOp3) Then
|
||||
ReadOp(CurProp, Pai386(p)^.op3t, Pai386(p)^.op3);
|
||||
Destroy(p, Pai386(p)^.op3t, Pai386(p)^.op3);
|
||||
End;
|
||||
{$Else USE_OP3}
|
||||
C_WOp2..C_RWOp2:
|
||||
Begin
|
||||
If (InstrProp.Ch[Cnt] = C_RWOp2) Then
|
||||
@ -2122,6 +2167,7 @@ Begin
|
||||
ReadOp(CurProp, Pai386(p)^.op3t, Pointer(Longint(TwoWords(Pai386(p)^.op2).word2)));
|
||||
Destroy(p, Pai386(p)^.op3t, Pointer(Longint(TwoWords(Pai386(p)^.op2).word2)));
|
||||
End;
|
||||
{$EndIf USE_OP3}
|
||||
C_WMemEDI:
|
||||
Begin
|
||||
ReadReg(CurProp, R_EDI);
|
||||
@ -2240,7 +2286,10 @@ End.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.41 1999-04-16 13:42:33 jonas
|
||||
Revision 1.42 1999-04-16 15:16:31 jonas
|
||||
* changes to work with -dUSE_OP3
|
||||
|
||||
Revision 1.41 1999/04/16 13:42:33 jonas
|
||||
* more regalloc fixes (still not complete)
|
||||
|
||||
Revision 1.40 1999/04/16 11:49:41 peter
|
||||
|
@ -373,8 +373,13 @@ Begin
|
||||
Else
|
||||
{change "imul $1, reg1, reg2" to "mov reg1, reg2"}
|
||||
Begin
|
||||
{$IfDef USE_OP3}
|
||||
hp1 := New(Pai386, Op_Reg_Reg(A_MOV, S_L, TRegister(Pai386(p)^.op2),
|
||||
TRegister(Pai386(p)^.op3)));
|
||||
{$Else USE_OP3}
|
||||
hp1 := New(Pai386, Op_Reg_Reg(A_MOV, S_L, TRegister(TwoWords(Pai386(p)^.op2).Word1),
|
||||
TRegister(TwoWords(Pai386(p)^.op2).Word2)));
|
||||
{$EndIf USE_OP3}
|
||||
hp1^.fileinfo := p^.fileinfo;
|
||||
InsertLLItem(AsmL, p^.previous, p^.next, hp1);
|
||||
Dispose(p, Done);
|
||||
@ -401,13 +406,22 @@ Begin
|
||||
lea (reg1,reg1,2), reg2
|
||||
imul 3, reg1 to
|
||||
lea (reg1,reg1,2), reg1}
|
||||
{$IfDef USE_OP3}
|
||||
TmpRef^.base := TRegister(Pai386(p)^.op2);
|
||||
TmpRef^.Index := TRegister(Pai386(p)^.op2);
|
||||
{$Else USE_OP3}
|
||||
TmpRef^.base := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
TmpRef^.Index := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
{$EndIf USE_OP3}
|
||||
TmpRef^.ScaleFactor := 2;
|
||||
If (Pai386(p)^.op3t = Top_None)
|
||||
Then hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)))
|
||||
Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
|
||||
{$IfDef USE_OP3}
|
||||
TRegister(Pai386(p)^.op3)));
|
||||
{$Else USE_OP3}
|
||||
TRegister(twowords(Pai386(p)^.op2).word2)));
|
||||
{$EndIf USE_OP3}
|
||||
hp1^.fileinfo := p^.fileinfo;
|
||||
InsertLLItem(AsmL,p^.previous, p^.next, hp1);
|
||||
Dispose(p, Done);
|
||||
@ -418,13 +432,22 @@ Begin
|
||||
lea (reg1,reg1,4), reg2
|
||||
imul 5, reg1 to
|
||||
lea (reg1,reg1,4), reg1}
|
||||
{$IfDef USE_OP3}
|
||||
TmpRef^.base := TRegister(Pai386(p)^.op2);
|
||||
TmpRef^.Index := TRegister(Pai386(p)^.op2);
|
||||
{$Else USE_OP3}
|
||||
TmpRef^.base := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
TmpRef^.Index := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
{$EndIf USE_OP3}
|
||||
TmpRef^.ScaleFactor := 4;
|
||||
If (Pai386(p)^.op3t = Top_None)
|
||||
Then hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)))
|
||||
Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
|
||||
{$IfDef USE_OP3}
|
||||
TRegister(Pai386(p)^.op3)));
|
||||
{$Else USE_OP3}
|
||||
TRegister(twowords(Pai386(p)^.op2).word2)));
|
||||
{$EndIf USE_OP3}
|
||||
hp1^.fileinfo:= p^.fileinfo;
|
||||
InsertLLItem(AsmL,p^.previous, p^.next, hp1);
|
||||
Dispose(p, Done);
|
||||
@ -440,14 +463,26 @@ Begin
|
||||
If (aktoptprocessor <= Class386)
|
||||
Then
|
||||
Begin
|
||||
{$IfDef USE_OP3}
|
||||
TmpRef^.Index := TRegister(Pai386(p)^.op2);
|
||||
{$Else USE_OP3}
|
||||
TmpRef^.Index := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
{$EndIf USE_OP3}
|
||||
If (Pai386(p)^.op3t = Top_Reg)
|
||||
Then
|
||||
Begin
|
||||
{$IfDef USE_OP3}
|
||||
TmpRef^.base := TRegister(Pai386(p)^.op3);
|
||||
{$Else USE_OP3}
|
||||
TmpRef^.base := TRegister(twowords(Pai386(p)^.op2).word2);
|
||||
{$EndIf USE_OP3}
|
||||
TmpRef^.ScaleFactor := 4;
|
||||
hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
|
||||
{$IfDef USE_OP3}
|
||||
TRegister(Pai386(p)^.op3)));
|
||||
{$Else USE_OP3}
|
||||
TRegister(twowords(Pai386(p)^.op2).word2)));
|
||||
{$EndIf USE_OP3}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
@ -459,14 +494,22 @@ Begin
|
||||
InsertLLItem(AsmL,p, p^.next, hp1);
|
||||
New(TmpRef);
|
||||
Reset_reference(TmpRef^);
|
||||
{$IfDef USE_OP3}
|
||||
TmpRef^.Index := TRegister(Pai386(p)^.op2);
|
||||
{$Else USE_OP3}
|
||||
TmpRef^.Index := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
{$EndIf USE_OP3}
|
||||
TmpRef^.ScaleFactor := 2;
|
||||
If (Pai386(p)^.op3t = Top_Reg)
|
||||
Then
|
||||
Begin
|
||||
TmpRef^.base := R_NO;
|
||||
hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
|
||||
{$IfDef USE_OP3}
|
||||
TRegister(Pai386(p)^.op3)));
|
||||
{$Else USE_OP3}
|
||||
TRegister(twowords(Pai386(p)^.op2).word2)));
|
||||
{$EndIf USE_OP3}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
@ -485,13 +528,22 @@ Begin
|
||||
lea (reg1,reg1,8), reg2
|
||||
imul 9, reg1 to
|
||||
lea (reg1,reg1,8), reg1}
|
||||
{$IfDef USE_OP3}
|
||||
TmpRef^.base := TRegister(Pai386(p)^.op2);
|
||||
TmpRef^.Index := TRegister(Pai386(p)^.op2);
|
||||
{$Else USE_OP3}
|
||||
TmpRef^.base := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
TmpRef^.Index := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
{$EndIf USE_OP3}
|
||||
TmpRef^.ScaleFactor := 8;
|
||||
If (Pai386(p)^.op3t = Top_None)
|
||||
Then hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)))
|
||||
Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
|
||||
{$IfDef USE_OP3}
|
||||
TRegister(Pai386(p)^.op3)));
|
||||
{$Else USE_OP3}
|
||||
TRegister(twowords(Pai386(p)^.op2).word2)));
|
||||
{$EndIf USE_OP3}
|
||||
hp1^.fileinfo := p^.fileinfo;
|
||||
InsertLLItem(AsmL,p^.previous, p^.next, hp1);
|
||||
Dispose(p, Done);
|
||||
@ -509,19 +561,33 @@ Begin
|
||||
If (Pai386(p)^.op3t = Top_Reg)
|
||||
Then
|
||||
hp1 := New(Pai386, op_reg_reg(A_ADD, S_L,
|
||||
{$IfDef USE_OP3}
|
||||
Tregister(Pai386(p)^.op3),
|
||||
Tregister(Pai386(p)^.op3)))
|
||||
{$Else USE_OP3}
|
||||
Tregister(twowords(Pai386(p)^.op2).word2),
|
||||
Tregister(twowords(Pai386(p)^.op2).word2)))
|
||||
{$EndIf USE_OP3}
|
||||
Else hp1 := New(Pai386, op_reg_reg(A_ADD, S_L,
|
||||
TRegister(Pai386(p)^.op2), TRegister(Pai386(p)^.op2)));
|
||||
hp1^.fileinfo := p^.fileinfo;
|
||||
InsertLLItem(AsmL,p, p^.next, hp1);
|
||||
{$IfDef USE_OP3}
|
||||
TmpRef^.base := TRegister(Pai386(p)^.op2);
|
||||
TmpRef^.Index := TRegister(Pai386(p)^.op2);
|
||||
{$Else USE_OP3}
|
||||
TmpRef^.base := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
TmpRef^.Index := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
{$EndIf USE_OP3}
|
||||
TmpRef^.ScaleFactor := 4;
|
||||
If (Pai386(p)^.op3t = Top_Reg)
|
||||
Then
|
||||
hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
|
||||
{$IfDef USE_OP3}
|
||||
TRegister(Pai386(p)^.op3)))
|
||||
{$Else USE_OP3}
|
||||
TRegister(twowords(Pai386(p)^.op2).word2)))
|
||||
{$EndIf USE_OP3}
|
||||
Else
|
||||
hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
|
||||
TRegister(Pai386(p)^.op2)));
|
||||
@ -542,14 +608,26 @@ Begin
|
||||
If (aktoptprocessor <= Class386)
|
||||
Then
|
||||
Begin
|
||||
{$IfDef USE_OP3}
|
||||
TmpRef^.Index := TRegister(Pai386(p)^.op2);
|
||||
{$Else USE_OP3}
|
||||
TmpRef^.Index := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
{$EndIf USE_OP3}
|
||||
If (Pai386(p)^.op3t = Top_Reg)
|
||||
Then
|
||||
Begin
|
||||
{$IfDef USE_OP3}
|
||||
TmpRef^.base := TRegister(Pai386(p)^.op3);
|
||||
{$Else USE_OP3}
|
||||
TmpRef^.base := TRegister(twowords(Pai386(p)^.op2).word2);
|
||||
{$EndIf USE_OP3}
|
||||
TmpRef^.ScaleFactor := 8;
|
||||
hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
|
||||
{$IfDef USE_OP3}
|
||||
TRegister(Pai386(p)^.op3)));
|
||||
{$Else USE_OP3}
|
||||
TRegister(twowords(Pai386(p)^.op2).word2)));
|
||||
{$EndIf USE_OP3}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
@ -562,14 +640,22 @@ Begin
|
||||
InsertLLItem(AsmL,p, p^.next, hp1);
|
||||
New(TmpRef);
|
||||
Reset_reference(TmpRef^);
|
||||
{$IfDef USE_OP3}
|
||||
TmpRef^.Index := TRegister(Pai386(p)^.op2);
|
||||
{$Else USE_OP3}
|
||||
TmpRef^.Index := TRegister(twowords(Pai386(p)^.op2).Word1);
|
||||
{$EndIf USE_OP3}
|
||||
If (Pai386(p)^.op3t = Top_Reg)
|
||||
Then
|
||||
Begin
|
||||
TmpRef^.base := R_NO;
|
||||
TmpRef^.ScaleFactor := 4;
|
||||
hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
|
||||
{$IfDef USE_OP3}
|
||||
TRegister(Pai386(p)^.op3)));
|
||||
{$Else USE_OP3}
|
||||
TRegister(twowords(Pai386(p)^.op2).word2)));
|
||||
{$EndIf USE_OP3}
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
@ -1591,7 +1677,10 @@ End.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.42 1999-04-10 16:15:04 peter
|
||||
Revision 1.43 1999-04-16 15:16:29 jonas
|
||||
* changes to work with -dUSE_OP3
|
||||
|
||||
Revision 1.42 1999/04/10 16:15:04 peter
|
||||
* fixed browcol
|
||||
+ -ar to show regalloc info in .s file
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user