csopt386.pas 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. {
  2. $Id$
  3. Copyright (c) 1997-98 by Jonas Maebe
  4. This unit contains the common subexpression elimination procedure.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. Unit CSOpt386;
  19. Interface
  20. Uses aasm;
  21. {Procedure CSOpt386(First, Last: Pai);}
  22. Procedure CSE(AsmL: PAasmOutput; First, Last: Pai);
  23. Implementation
  24. Uses
  25. CObjects, verbose, hcodegen, globals,cpubase,cpuasm,DAOpt386;
  26. {
  27. Function PaiInSequence(P: Pai; Const Seq: TContent): Boolean;
  28. Var P1: Pai;
  29. Counter: Byte;
  30. TmpResult: Boolean;
  31. Begin
  32. TmpResult := False;
  33. P1 := Seq.StartMod;
  34. Counter := 1;
  35. While Not(TmpResult) And
  36. (Counter <= Seq.NrOfMods) Do
  37. Begin
  38. If (P = P1) Then TmpResult := True;
  39. Inc(Counter);
  40. p1 := Pai(p1^.Next);
  41. End;
  42. PaiInSequence := TmpResult;
  43. End;
  44. }
  45. Function CheckSequence(p: Pai; Reg: TRegister; Var Found: Longint; Var RegInfo: TRegInfo): Boolean;
  46. {checks whether the current instruction sequence (starting with p) and the
  47. one between StartMod and EndMod of Reg are the same. If so, the number of
  48. instructions that match is stored in Found and true is returned, otherwise
  49. Found holds the number of instructions between StartMod and EndMod and false
  50. is returned}
  51. Var hp2, hp3{, EndMod}: Pai;
  52. PrevNonRemovablePai: Pai;
  53. Cnt, OldNrOfMods: Longint;
  54. OrgRegInfo, HighRegInfo: TRegInfo;
  55. HighFound, OrgRegFound: Byte;
  56. RegCounter: TRegister;
  57. OrgRegResult: Boolean;
  58. TmpResult: Boolean;
  59. TmpState: Byte;
  60. Begin {CheckSequence}
  61. Reg := Reg32(Reg);
  62. TmpResult := False;
  63. FillChar(OrgRegInfo, SizeOf(OrgRegInfo), 0);
  64. OrgRegFound := 0;
  65. HighFound := 0;
  66. OrgRegResult := False;
  67. RegCounter := R_EAX;
  68. GetLastInstruction(p, PrevNonRemovablePai);
  69. While (RegCounter <= R_EDI) And
  70. (PPaiProp(PrevNonRemovablePai^.OptInfo)^.Regs[RegCounter].Typ <> Con_Ref) Do
  71. Inc(RegCounter);
  72. While (RegCounter <= R_EDI) Do
  73. Begin
  74. FillChar(RegInfo, SizeOf(RegInfo), 0);
  75. RegInfo.NewRegsEncountered := [procinfo^.FramePointer, R_ESP];
  76. RegInfo.OldRegsEncountered := RegInfo.NewRegsEncountered;
  77. RegInfo.New2OldReg[procinfo^.FramePointer] := procinfo^.FramePointer;
  78. RegInfo.New2OldReg[R_ESP] := R_ESP;
  79. Found := 0;
  80. hp2 := PPaiProp(PrevNonRemovablePai^.OptInfo)^.Regs[RegCounter].StartMod;
  81. If (PrevNonRemovablePai <> PPaiProp(PrevNonRemovablePai^.OptInfo)^.Regs[RegCounter].StartMod)
  82. Then OldNrOfMods := PPaiProp(PrevNonRemovablePai^.OptInfo)^.Regs[RegCounter].NrOfMods
  83. Else OldNrOfMods := 1;
  84. hp3 := p;
  85. While (Found <> OldNrOfMods) And
  86. { old new }
  87. InstructionsEquivalent(hp2, hp3, RegInfo) Do
  88. Begin
  89. GetNextInstruction(hp2, hp2);
  90. GetNextInstruction(hp3, hp3);
  91. Inc(Found)
  92. End;
  93. If (Found <> OldNrOfMods) Then
  94. Begin
  95. TmpResult := False;
  96. If (found > 0) then
  97. {this is correct because we only need to turn off the CanBeRemoved flag
  98. when an instruction has already been processed by CheckSequence
  99. (otherwise CanBeRemoved can't be true and thus can't have to be turned off).
  100. If it has already been processed by CheckSequence and flagged to be
  101. removed, it means that it has been checked against a previous sequence
  102. and that it was equal (otherwise CheckSequence would have returned false
  103. and the instruction wouldn't have been removed). If this "If found > 0"
  104. check is left out, incorrect optimizations are performed.}
  105. Found := PPaiProp(Pai(p)^.OptInfo)^.Regs[Reg].NrOfMods
  106. End
  107. Else TmpResult := True;
  108. If TmpResult And
  109. (Found > HighFound)
  110. Then
  111. Begin
  112. HighFound := Found;
  113. HighRegInfo := RegInfo;
  114. End;
  115. If (RegCounter = Reg) Then
  116. Begin
  117. OrgRegFound := Found;
  118. OrgRegResult := TmpResult;
  119. OrgRegInfo := RegInfo
  120. End;
  121. Repeat
  122. Inc(RegCounter);
  123. Until (RegCounter > R_EDI) or
  124. ((PPaiProp(PrevNonRemovablePai^.OptInfo)^.Regs[RegCounter].Typ = Con_Ref) {And
  125. ((Regcounter = Reg) Or
  126. Not(PaiInSequence(p, PPaiProp(PrevNonRemovablePai^.OptInfo)^.Regs[RegCounter]))) }
  127. );
  128. End;
  129. If (HighFound > 0) And
  130. (Not(OrgRegResult) Or
  131. (HighFound > OrgRegFound))
  132. Then
  133. Begin
  134. {$ifndef fpc}
  135. TmpResult := True;
  136. {$else fpc}
  137. CheckSequence := True;
  138. {$endif fpc}
  139. RegInfo := HighRegInfo;
  140. Found := HighFound
  141. End
  142. Else
  143. Begin
  144. {$ifndef fpc}
  145. TmpResult := OrgRegResult;
  146. {$else fpc}
  147. CheckSequence := OrgRegResult;
  148. {$endif fpc}
  149. Found := OrgRegFound;
  150. RegInfo := OrgRegInfo;
  151. End;
  152. { sometimes, registers in RegsLoadedForRef (which normally aren't/shouldn't }
  153. { be used anymore after the sequence, are still used nevertheless (when }
  154. { range checking is on for instance, because this is not "normal" generated }
  155. { code, but more or less manually inserted) }
  156. {$ifndef fpc}
  157. If TmpResult Then
  158. {$else fpc}
  159. If CheckSequence And (Found > 0) Then
  160. {$endif fpc}
  161. For RegCounter := R_EAX to R_EDI Do
  162. If (RegCounter in RegInfo.RegsLoadedForRef) And
  163. (RegInfo.New2OldReg[RegCounter] <> RegCounter) Then
  164. Begin
  165. OldNrOfMods := PPaiProp(PrevNonRemovablePai^.OptInfo)^.
  166. Regs[RegInfo.New2OldReg[RegCounter]].NrOfMods;
  167. hp2 := p;
  168. For Cnt := 1 to Pred(OldNrOfMods) Do
  169. GetNextInstruction(hp2, hp2);
  170. { hp2 now containts the last instruction of the sequence }
  171. { get the writestate at this point of the register in TmpState }
  172. TmpState := PPaiProp(hp2^.OptInfo)^.Regs[RegCounter].WState;
  173. { hp3 := first instruction after the sequence }
  174. GetNextInstruction(hp2, hp2);
  175. { now, even though reg is in RegsLoadedForRef, sometimes it's still used }
  176. { afterwards. It is not if either it is not in usedregs anymore after the }
  177. { sequence, or if it is loaded with a new value right after the sequence }
  178. If (TmpState = PPaiProp(hp2^.OptInfo)^.Regs[RegCounter].WState) And
  179. (RegCounter in PPaiProp(hp2^.OptInfo)^.UsedRegs) Then
  180. { it is still used, so remove it from RegsLoadedForRef }
  181. Begin
  182. {$ifdef regrefdebug}
  183. hp3 := new(pai_asm_comment,init(strpnew(att_reg2str[regcounter]+
  184. ' removed from regsloadedforref')));
  185. hp3^.fileinfo := hp2^.fileinfo;
  186. hp3^.next := hp2^.next;
  187. hp3^.previous := hp2;
  188. hp2^.next := hp3;
  189. If assigned(hp3^.next) then
  190. Pai(hp3^.next)^.previous := hp3;
  191. {$endif regrefdebug}
  192. Exclude(RegInfo.RegsLoadedForRef,RegCounter);
  193. End;
  194. End;
  195. {$ifndef fpc}
  196. CheckSequence := TmpResult;
  197. {$endif fpc}
  198. End; {CheckSequence}
  199. Procedure DoCSE(AsmL: PAasmOutput; First, Last: Pai);
  200. {marks the instructions that can be removed by RemoveInstructs. They're not
  201. removed immediately because sometimes an instruction needs to be checked in
  202. two different sequences}
  203. Var Cnt, Cnt2: Longint;
  204. p, hp1, hp2: Pai;
  205. hp3, hp4: Pai;
  206. {$ifdef csdebug}
  207. hp5: pai;
  208. {$endif csdebug}
  209. RegInfo: TRegInfo;
  210. RegCounter: TRegister;
  211. TmpState: Byte;
  212. Begin
  213. p := First;
  214. SkipHead(p);
  215. First := p;
  216. While (p <> Last) Do
  217. Begin
  218. Case p^.typ Of
  219. ait_instruction:
  220. Begin
  221. Case Paicpu(p)^.opcode Of
  222. A_CLD: If GetLastInstruction(p, hp1) And
  223. (PPaiProp(hp1^.OptInfo)^.DirFlag = F_NotSet) Then
  224. PPaiProp(Pai(p)^.OptInfo)^.CanBeRemoved := True;
  225. A_MOV, A_MOVZX, A_MOVSX:
  226. Begin
  227. Case Paicpu(p)^.oper[0].typ Of
  228. Top_Ref:
  229. Begin {destination is always a register in this case}
  230. With PPaiProp(p^.OptInfo)^.Regs[Reg32(Paicpu(p)^.oper[1].reg)] Do
  231. Begin
  232. If (p = StartMod) And
  233. GetLastInstruction (p, hp1) And
  234. (hp1^.typ <> ait_marker)
  235. Then
  236. {so we don't try to check a sequence when p is the first instruction of the block}
  237. If CheckSequence(p, Paicpu(p)^.oper[1].reg, Cnt, RegInfo) And
  238. (Cnt > 0) Then
  239. Begin
  240. hp1 := nil;
  241. { although it's perfectly ok to remove an instruction which doesn't contain }
  242. { the register that we've just checked (CheckSequence takes care of that), }
  243. { the sequence containing this other register should also be completely }
  244. { checked and removed, otherwise we may get situations like this: }
  245. { }
  246. { movl 12(%ebp), %edx movl 12(%ebp), %edx }
  247. { movl 16(%ebp), %eax movl 16(%ebp), %eax }
  248. { movl 8(%edx), %edx movl 8(%edx), %edx }
  249. { movl (%eax), eax movl (%eax), eax }
  250. { cmpl %eax, %edx cmpl %eax, %edx }
  251. { jnz l123 getting converted to jnz l123 }
  252. { movl 12(%ebp), %edx movl 4(%eax), eax }
  253. { movl 16(%ebp), %eax }
  254. { movl 8(%edx), %edx }
  255. { movl 4(%eax), eax }
  256. hp2 := p;
  257. Cnt2 := 1;
  258. While Cnt2 <= Cnt Do
  259. Begin
  260. If (hp1 = nil) And
  261. Not(RegInInstruction(Paicpu(hp2)^.oper[1].reg, p) Or
  262. RegInInstruction(Reg32(Paicpu(hp2)^.oper[1].reg), p)) And
  263. Not((p^.typ = ait_instruction) And
  264. (paicpu(p)^.OpCode = A_MOV) And
  265. (paicpu(p)^.Oper[0].typ = top_ref) And
  266. (PPaiProp(p^.OptInfo)^.Regs[Reg32(paicpu(p)^.Oper[1].reg)].NrOfMods
  267. <= (Cnt - Cnt2 + 1)))
  268. Then hp1 := p;
  269. {$ifndef noremove}
  270. PPaiProp(p^.OptInfo)^.CanBeRemoved := True;
  271. {$endif noremove}
  272. Inc(Cnt2);
  273. GetNextInstruction(p, p);
  274. End;
  275. hp3 := New(Pai_Marker,Init(NoPropInfoStart));
  276. InsertLLItem(AsmL, Pai(hp2^.Previous), hp2, hp3);
  277. {hp4 is used to get the contents of the registers before the sequence}
  278. GetLastInstruction(hp2, hp4);
  279. { If some registers were different in the old and the new sequence, move }
  280. { the contents of those old registers to the new ones }
  281. {$IfDef CSDebug}
  282. For RegCounter := R_EAX To R_EDI Do
  283. If (RegCounter in RegInfo.RegsLoadedForRef) Then
  284. Begin
  285. hp5 := new(pai_asm_comment,init(strpnew('New: '+att_reg2str[RegCounter]+', Old: '+
  286. att_reg2str[RegInfo.New2OldReg[RegCounter]])));
  287. InsertLLItem(AsmL, Pai(hp2^.previous), hp2, hp5);
  288. End;
  289. {$EndIf CSDebug}
  290. For RegCounter := R_EAX To R_EDI Do
  291. Begin
  292. If (RegInfo.New2OldReg[RegCounter] <> R_NO) Then
  293. If Not(RegCounter In RegInfo.RegsLoadedForRef) And
  294. {old reg new reg}
  295. (RegInfo.New2OldReg[RegCounter] <> RegCounter) Then
  296. Begin
  297. hp3 := New(Paicpu,Op_Reg_Reg(A_MOV, S_L,
  298. {old reg new reg}
  299. RegInfo.New2OldReg[RegCounter], RegCounter));
  300. hp3^.fileinfo := hp2^.fileinfo;
  301. InsertLLItem(AsmL, Pai(hp2^.previous), hp2, hp3);
  302. End
  303. Else
  304. { imagine the following code: }
  305. { normal wrong optimized }
  306. { movl 8(%ebp), %eax movl 8(%ebp), %eax }
  307. { movl (%eax), %eax movl (%eax), %eax }
  308. { cmpl 8(%ebp), %eax cmpl 8(%ebp), %eax }
  309. { jne l1 jne l1 }
  310. { movl 8(%ebp), %eax }
  311. { movl (%eax), %edi movl %eax, %edi }
  312. { movl %edi, -4(%ebp) movl %edi, -4(%ebp) }
  313. { movl 8(%ebp), %eax }
  314. { pushl 70(%eax) pushl 70(%eax) }
  315. { }
  316. { The error is that at the moment that the last instruction is executed, }
  317. { %eax doesn't contain 8(%ebp) anymore. Solution: the contents of }
  318. { registers that are completely removed from a sequence (= registers in }
  319. { RegLoadedForRef, have to be changed to their contents from before the }
  320. { sequence. }
  321. Begin
  322. {load Cnt2 with the total number of instructions of this sequence}
  323. Cnt2 := PPaiProp(hp4^.OptInfo)^.
  324. Regs[RegInfo.New2OldReg[RegCounter]].NrOfMods;
  325. hp3 := hp2;
  326. For Cnt := 1 to Pred(Cnt2) Do
  327. GetNextInstruction(hp3, hp3);
  328. TmpState := PPaiProp(hp3^.OptInfo)^.Regs[RegCounter].WState;
  329. GetNextInstruction(hp3, hp3);
  330. {$ifdef csdebug}
  331. Writeln('Cnt2: ',Cnt2);
  332. hp5 := new(pai_asm_comment,init(strpnew('starting here...')));
  333. InsertLLItem(AsmL, Pai(hp2^.previous), hp2, hp5);
  334. {$endif csdebug}
  335. hp3 := hp2;
  336. {first change the contents of the register inside the sequence}
  337. For Cnt := 1 to Cnt2 Do
  338. Begin
  339. {save the WState of the last pai object of the sequence for later use}
  340. TmpState := PPaiProp(hp3^.OptInfo)^.Regs[RegCounter].WState;
  341. {$ifdef csdebug}
  342. hp5 := new(pai_asm_comment,init(strpnew('WState for '+att_reg2str[Regcounter]+': '
  343. +tostr(tmpstate))));
  344. InsertLLItem(AsmL, hp3, pai(hp3^.next), hp5);
  345. {$endif csdebug}
  346. PPaiProp(hp3^.OptInfo)^.Regs[RegCounter] :=
  347. PPaiProp(hp4^.OptInfo)^.Regs[RegCounter];
  348. GetNextInstruction(hp3, hp3);
  349. End;
  350. {here, hp3 = p = Pai object right after the sequence, TmpState = WState of
  351. RegCounter at the last Pai object of the sequence}
  352. GetLastInstruction(hp3, hp3);
  353. While GetNextInstruction(hp3, hp3) And
  354. (PPaiProp(hp3^.OptInfo)^.Regs[RegCounter].WState
  355. = TmpState) Do
  356. {$ifdef csdebug}
  357. begin
  358. hp5 := new(pai_asm_comment,init(strpnew('WState for '+att_reg2str[Regcounter]+': '+
  359. tostr(PPaiProp(hp3^.OptInfo)^.Regs[RegCounter].WState))));
  360. InsertLLItem(AsmL, hp3, pai(hp3^.next), hp5);
  361. {$endif csdebug}
  362. PPaiProp(hp3^.OptInfo)^.Regs[RegCounter] :=
  363. PPaiProp(hp4^.OptInfo)^.Regs[RegCounter];
  364. {$ifdef csdebug}
  365. end;
  366. {$endif csdebug}
  367. {$ifdef csdebug}
  368. hp5 := new(pai_asm_comment,init(strpnew('stopping here...')));
  369. InsertLLItem(AsmL, hp3, pai(hp3^.next), hp5);
  370. {$endif csdebug}
  371. End;
  372. End;
  373. hp3 := New(Pai_Marker,Init(NoPropInfoEnd));
  374. InsertLLItem(AsmL, Pai(hp2^.Previous), hp2, hp3);
  375. If hp1 <> nil Then p := hp1;
  376. Continue;
  377. End
  378. Else
  379. If (Cnt > 0) And
  380. (PPaiProp(p^.OptInfo)^.
  381. Regs[Reg32(Paicpu(p)^.oper[1].reg)].Typ = Con_Ref) And
  382. (PPaiProp(p^.OptInfo)^.CanBeRemoved) Then
  383. Begin
  384. hp2 := p;
  385. Cnt2 := 1;
  386. While Cnt2 <= Cnt Do
  387. Begin
  388. If RegInInstruction(Paicpu(hp2)^.oper[1].reg, p) Or
  389. RegInInstruction(Reg32(Paicpu(hp2)^.oper[1].reg), p) Then
  390. PPaiProp(p^.OptInfo)^.CanBeRemoved := False;
  391. Inc(Cnt2);
  392. GetNextInstruction(p, p);
  393. End;
  394. Continue;
  395. End;
  396. End;
  397. End;
  398. Top_Const:
  399. Begin
  400. Case Paicpu(p)^.oper[1].typ Of
  401. Top_Reg:
  402. Begin
  403. If GetLastInstruction(p, hp1) Then
  404. With PPaiProp(hp1^.OptInfo)^.Regs[Reg32(Paicpu(p)^.oper[1].reg)] Do
  405. If (Typ = Con_Const) And
  406. (StartMod = p) Then
  407. PPaiProp(p^.OptInfo)^.CanBeRemoved := True;
  408. End;
  409. { Top_Ref:;}
  410. End;
  411. End;
  412. End;
  413. End;
  414. A_STD: If GetLastInstruction(p, hp1) And
  415. (PPaiProp(hp1^.OptInfo)^.DirFlag = F_Set) Then
  416. PPaiProp(Pai(p)^.OptInfo)^.CanBeRemoved := True;
  417. A_XOR:
  418. Begin
  419. If (Paicpu(p)^.oper[0].typ = top_reg) And
  420. (Paicpu(p)^.oper[0].typ = top_reg) And
  421. (Paicpu(p)^.oper[1].reg = Paicpu(p)^.oper[1].reg) And
  422. GetLastInstruction(p, hp1) And
  423. (PPaiProp(hp1^.OptInfo)^.Regs[Reg32(Paicpu(p)^.oper[1].reg)].typ = con_const) And
  424. (PPaiProp(hp1^.OptInfo)^.Regs[Reg32(Paicpu(p)^.oper[1].reg)].StartMod = nil)
  425. Then PPaiProp(p^.OptInfo)^.CanBeRemoved := True
  426. End
  427. End
  428. End;
  429. End;
  430. GetNextInstruction(p, p);
  431. End;
  432. End;
  433. Procedure RemoveInstructs(AsmL: PAasmOutput; First, Last: Pai);
  434. {Removes the marked instructions and disposes the PPaiProps of the other
  435. instructions, restoring their line number}
  436. Var p, hp1: Pai;
  437. {$IfDef TP}
  438. TmpLine: Longint;
  439. {$EndIf TP}
  440. InstrCnt: Longint;
  441. Begin
  442. p := First;
  443. SkipHead(P);
  444. InstrCnt := 1;
  445. While (p <> Last) Do
  446. Begin
  447. {$ifndef noinstremove}
  448. If PPaiProp(p^.OptInfo)^.CanBeRemoved
  449. Then
  450. Begin
  451. {$IfDef TP}
  452. Dispose(PPaiProp(p^.OptInfo));
  453. {$EndIf}
  454. GetNextInstruction(p, hp1);
  455. AsmL^.Remove(p);
  456. Dispose(p, Done);
  457. p := hp1;
  458. Inc(InstrCnt);
  459. End
  460. Else
  461. {$endif noinstremove}
  462. Begin
  463. {$IfDef TP}
  464. Dispose(PPaiProp(p^.OptInfo));
  465. {$EndIf TP}
  466. p^.OptInfo := nil;
  467. GetNextInstruction(p, p);
  468. Inc(InstrCnt);
  469. End;
  470. End;
  471. {$IfNDef TP}
  472. FreeMem(PaiPropBlock, NrOfPaiObjs*(((SizeOf(TPaiProp)+3)div 4)*4))
  473. {$EndIf TP}
  474. End;
  475. Procedure CSE(AsmL: PAasmOutput; First, Last: Pai);
  476. Begin
  477. DoCSE(AsmL, First, Last);
  478. RemoveInstructs(AsmL, First, Last);
  479. End;
  480. End.
  481. {
  482. $Log$
  483. Revision 1.26 1999-09-30 14:43:13 jonas
  484. * fixed small efficiency which caused some missed optimizations (saves 1
  485. assembler instruction on the whole compiler/RTL source tree! :)
  486. Revision 1.25 1999/09/27 23:44:50 peter
  487. * procinfo is now a pointer
  488. * support for result setting in sub procedure
  489. Revision 1.24 1999/08/25 11:59:58 jonas
  490. * changed pai386, paippc and paiapha (same for tai*) to paicpu (taicpu)
  491. Revision 1.23 1999/08/04 00:22:58 florian
  492. * renamed i386asm and i386base to cpuasm and cpubase
  493. Revision 1.22 1999/06/03 15:45:08 jonas
  494. * sequences are now checked only once (previously, some long ones were
  495. checked once completely and then several times partially)
  496. Revision 1.21 1999/05/08 20:38:03 jonas
  497. * seperate OPTimizer INFO pointer field in tai object
  498. Revision 1.20 1999/05/01 13:24:19 peter
  499. * merged nasm compiler
  500. * old asm moved to oldasm/
  501. Revision 1.2 1999/03/29 16:05:45 peter
  502. * optimizer working for ag386bin
  503. Revision 1.1 1999/03/26 00:01:09 peter
  504. * first things for optimizer (compiles but cycle crashes)
  505. Revision 1.19 1999/02/26 00:48:17 peter
  506. * assembler writers fixed for ag386bin
  507. Revision 1.18 1998/12/29 18:48:22 jonas
  508. + optimize pascal code surrounding assembler blocks
  509. Revision 1.17 1998/12/17 16:37:39 jonas
  510. + extra checks in RegsEquivalent so some more optimizations can be done (which
  511. where disabled by the second fix from revision 1.22)
  512. Revision 1.16 1998/12/02 16:23:31 jonas
  513. * changed "if longintvar in set" to case or "if () or () .." statements
  514. * tree.pas: changed inlinenumber (and associated constructor/vars) to a byte
  515. Revision 1.15 1998/11/24 19:47:24 jonas
  516. * fixed problems posiible with 3 operand instructions
  517. Revision 1.14 1998/11/09 19:40:48 jonas
  518. * fixed comments from last commit (apparently there's still a 255 char limit :( )
  519. Revision 1.13 1998/11/09 19:33:39 jonas
  520. * changed specific bugfix (which was actually wrong implemented, but
  521. did the right thing in most cases nevertheless) to general bugfix
  522. * fixed bug that caused
  523. mov (ebp), edx mov (ebp), edx
  524. mov (edx), edx mov (edx), edx
  525. ... being changed to ...
  526. mov (ebp), edx mov edx, eax
  527. mov (eax), eax
  528. but this disabled another small correct optimization...
  529. Revision 1.12 1998/10/20 09:32:54 peter
  530. * removed some unused vars
  531. Revision 1.11 1998/10/07 16:24:52 jonas
  532. * changed state to WState (WriteState), added RState for future use in
  533. instruction scheduling
  534. Revision 1.10 1998/10/02 17:29:23 jonas
  535. * much better interregister CSE
  536. Revision 1.9 1998/10/01 20:21:49 jonas
  537. * inter-register CSE, still requires some tweaks (peepholeoptpass2, better RegAlloc)
  538. Revision 1.8 1998/09/21 08:45:09 pierre
  539. + added vmt_offset in tobjectdef.write for fututre use
  540. (first steps to have objects without vmt if no virtual !!)
  541. + added fpu_used field for tabstractprocdef :
  542. sets this level to 2 if the functions return with value in FPU
  543. (is then set to correct value at parsing of implementation)
  544. THIS MIGHT refuse some code with FPU expression too complex
  545. that were accepted before and even in some cases
  546. that don't overflow in fact
  547. ( like if f : float; is a forward that finally in implementation
  548. only uses one fpu register !!)
  549. Nevertheless I think that it will improve security on
  550. FPU operations !!
  551. * most other changes only for UseBrowser code
  552. (added symtable references for record and objects)
  553. local switch for refs to args and local of each function
  554. (static symtable still missing)
  555. UseBrowser still not stable and probably broken by
  556. the definition hash array !!
  557. Revision 1.7 1998/09/20 17:12:35 jonas
  558. * small fix for uncertain optimizations & more cleaning up
  559. Revision 1.5 1998/09/16 17:59:59 jonas
  560. * optimizer now completely dependant on GetNext/GetLast instruction, works again with -dRegAlloc
  561. Revision 1.4 1998/08/06 19:40:27 jonas
  562. * removed $ before and after Log in comment
  563. Revision 1.3 1998/08/05 16:00:12 florian
  564. * some fixes for ansi strings
  565. * log to Log changed
  566. }