1 Index: compiler/popt386.pas
2 ===================================================================
3 RCS file: /FPC/CVS/fpc/compiler/Attic/popt386.pas,v
4 retrieving revision 1.1.2.7
5 retrieving revision 1.1.2.9
6 diff -u -r1.1.2.7 -r1.1.2.9
7 --- compiler/popt386.pas 2000/12/05 09:55:09 1.1.2.7
8 +++ compiler/popt386.pas 2001/01/10 10:27:55 1.1.2.9
13 Copyright (c) 1998-2000 by Florian Klaempfl and Jonas Maebe
15 This unit contains the peephole optimizer.
16 @@ -1510,16 +1510,16 @@
17 If (AktOptProcessor < ClassP6) And
18 GetNextInstruction(p, hp1) And
19 (hp1^.typ = ait_instruction) And
20 - (paicpu(hp1)^.opcode = A_JMP) Then
21 + (paicpu(hp1)^.opcode = A_JMP) And
22 + (paicpu(hp1)^.oper[0].typ = top_symbol) Then
24 - Inc(paicpu(hp1)^.oper[0].sym^.refs);
25 hp2 := New(Paicpu,op_sym(A_PUSH,S_L,paicpu(hp1)^.oper[0].sym));
26 InsertLLItem(AsmL, p^.previous, p, hp2);
27 Paicpu(p)^.opcode := A_JMP;
28 + Paicpu(p)^.is_jmp := true;
35 if (aktspecificoptprocessor=ClassP6) then
36 @@ -1760,6 +1760,12 @@
40 + Revision 1.1.2.9 2001/01/10 10:27:55 jonas
41 + * really fixed problems with -Op2 opts
43 + Revision 1.1.2.8 2001/01/07 15:46:36 jonas
44 + * fixed bug in call/jmp optimization with -Op1 and -Op2
46 Revision 1.1.2.7 2000/12/05 09:55:09 jonas
47 - removed all newoptimizations stuff since it will never be active under
49 Index: compiler/cpuasm.pas
50 ===================================================================
51 RCS file: /FPC/CVS/fpc/compiler/Attic/cpuasm.pas,v
52 retrieving revision 1.1.2.2
53 retrieving revision 1.1.2.5
54 diff -u -r1.1.2.2 -r1.1.2.5
55 --- compiler/cpuasm.pas 2000/10/15 10:51:15 1.1.2.2
56 +++ compiler/cpuasm.pas 2001/01/13 15:03:26 1.1.2.5
61 Copyright (c) 1998-2000 by Florian Klaempfl and Peter Vreman
63 Contains the assembler object for the i386
65 procedure CheckNonCommutativeOpcodes;
67 segprefix : tregister;
69 procedure init(op : tasmop;_size : topsize); { this need to be called by all constructor }
72 { the next will reset all instructions that can change in pass 2 }
74 + function CheckIfValid:boolean;
75 function Pass1(offset:longint):longint;virtual;
76 procedure Pass2;virtual;
92 - dec(PasmLabel(oper[0].sym)^.refs)
96 - if (oper[i-1].typ=top_ref) then
97 - dispose(oper[i-1].ref);
100 + dispose(oper[0].ref);
102 + dec(Pasmsymbol(oper[0].sym)^.refs);
105 + if (oper[i-1].typ=top_ref) then
106 + dispose(oper[i-1].ref);
116 { Fix the operands which are in AT&T style and we need them in Intel style }
126 { This check must be done with the operand in ATT order
127 @@ -932,20 +939,15 @@
131 -function taicpu.Pass1(offset:longint):longint;
132 +function taicpu.CheckIfValid:boolean;
137 -{ Save the old offset and set the new offset }
139 + CheckIfValid:=false;
140 { Things which may only be done once, not when a second pass is done to
144 - { Check if error last time then InsSize=-1 }
147 { We need intel style operands }
149 { create the .ot fields }
155 - { we are here in a second pass, check if the instruction can be optimized }
156 - if (InsEntry^.flags and IF_PASS2)=0 then
161 - { update the .ot fields, some top_const can be updated }
164 + { we've already an insentry so it's valid }
165 + CheckIfValid:=true;
168 { Lookup opcode in the table }
171 InsSize:=calcsize(insentry);
172 if (segprefix<>R_NO) then
175 - LastInsOffset:=InsOffset;
176 + CheckIfValid:=true;
181 { No instruction found, set insentry to nil and inssize to -1 }
188 +function taicpu.Pass1(offset:longint):longint;
191 +{ Save the old offset and set the new offset }
193 +{ Things which may only be done once, not when a second pass is done to
195 + if Insentry=nil then
197 + { Check if error last time then InsSize=-1 }
200 + { set the file postion }
201 + aktfilepos:=fileinfo;
206 + { we are here in a second pass, check if the instruction can be optimized }
207 + if (InsEntry^.flags and IF_PASS2)=0 then
212 + { update the .ot fields, some top_const can be updated }
216 +{ Check if it's a valid instruction }
217 + if CheckIfValid then
219 + LastInsOffset:=InsOffset;
226 @@ -1677,6 +1710,12 @@
230 + Revision 1.1.2.5 2001/01/13 15:03:26 jonas
231 + * fixed bug in taicpu.done regardin top_symbols
233 + Revision 1.1.2.4 2001/01/12 19:18:02 peter
234 + * check for valid asm instructions
236 Revision 1.1.2.2 2000/10/15 10:51:15 florian
237 * fixed xmm register access
239 @@ -1743,4 +1782,4 @@
240 Revision 1.17 1999/08/01 23:55:53 michael
244 \ No newline at end of file