rgcpu.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. This unit implements the i386 specific class for the register
  5. allocator
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit rgcpu;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. cpubase,
  24. cpuinfo,
  25. aasmbase,aasmtai,aasmcpu,
  26. cclasses,globtype,cgbase,cginfo,rgobj;
  27. type
  28. trgcpu = class(trgobj)
  29. fpuvaroffset : byte;
  30. { to keep the same allocation order as with the old routines }
  31. {$ifndef newra}
  32. function getregisterint(list:Taasmoutput;size:Tcgsize):Tregister;override;
  33. function getaddressregister(list:Taasmoutput):Tregister;override;
  34. procedure ungetregisterint(list:Taasmoutput;r:Tregister); override;
  35. function getexplicitregisterint(list:Taasmoutput;r:Tnewregister):Tregister;override;
  36. {$endif newra}
  37. function getregisterfpu(list: taasmoutput) : tregister; override;
  38. procedure ungetregisterfpu(list: taasmoutput; r : tregister); override;
  39. procedure ungetreference(list: taasmoutput; const ref : treference); override;
  40. {# Returns a subset register of the register r with the specified size.
  41. WARNING: There is no clearing of the upper parts of the register,
  42. if a 8-bit / 16-bit register is converted to a 32-bit register.
  43. It is up to the code generator to correctly zero fill the register
  44. }
  45. function makeregsize(reg: tregister; size: tcgsize): tregister; override;
  46. { pushes and restores registers }
  47. procedure pushusedintregisters(list:Taasmoutput;
  48. var pushed:Tpushedsavedint;
  49. const s:Tsupregset);
  50. {$ifdef SUPPORT_MMX}
  51. procedure pushusedotherregisters(list:Taasmoutput;
  52. var pushed:Tpushedsaved;
  53. const s:Tregisterset);
  54. {$endif SUPPORT_MMX}
  55. procedure popusedintregisters(list:Taasmoutput;
  56. const pushed:Tpushedsavedint);
  57. {$ifdef SUPPORT_MMX}
  58. procedure popusedotherregisters(list:Taasmoutput;
  59. const pushed:Tpushedsaved);
  60. {$endif SUPPORT_MMX}
  61. procedure saveusedintregisters(list:Taasmoutput;
  62. var saved:Tpushedsavedint;
  63. const s:Tsupregset);override;
  64. procedure saveusedotherregisters(list:Taasmoutput;
  65. var saved:Tpushedsaved;
  66. const s:Tregisterset);override;
  67. procedure restoreusedintregisters(list:Taasmoutput;
  68. const saved:Tpushedsavedint);override;
  69. procedure restoreusedotherregisters(list:Taasmoutput;
  70. const saved:Tpushedsaved);override;
  71. procedure resetusableregisters;override;
  72. { corrects the fpu stack register by ofs }
  73. function correct_fpuregister(r : tregister;ofs : byte) : tregister;
  74. end;
  75. implementation
  76. uses
  77. systems,
  78. globals,verbose,
  79. tgobj;
  80. {************************************************************************}
  81. { routine helpers }
  82. {************************************************************************}
  83. const
  84. reg2reg32 : array[firstreg..lastreg] of Toldregister = (R_NO,
  85. R_EAX,R_ECX,R_EDX,R_EBX,R_ESP,R_EBP,R_ESI,R_EDI,
  86. R_EAX,R_ECX,R_EDX,R_EBX,R_ESP,R_EBP,R_ESI,R_EDI,
  87. R_EAX,R_ECX,R_EDX,R_EBX,R_NO,R_NO,R_NO,R_NO,
  88. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  89. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  90. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  91. R_NO,R_NO,R_NO,R_NO,
  92. R_NO,R_NO,R_NO,R_NO,R_NO,
  93. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  94. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO
  95. );
  96. reg2reg16 : array[firstreg..lastreg] of Toldregister = (R_NO,
  97. R_AX,R_CX,R_DX,R_BX,R_SP,R_BP,R_SI,R_DI,
  98. R_AX,R_CX,R_DX,R_BX,R_SP,R_BP,R_SI,R_DI,
  99. R_AX,R_CX,R_DX,R_BX,R_NO,R_NO,R_NO,R_NO,
  100. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  101. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  102. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  103. R_NO,R_NO,R_NO,R_NO,
  104. R_NO,R_NO,R_NO,R_NO,R_NO,
  105. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  106. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO
  107. );
  108. reg2reg8 : array[firstreg..lastreg] of Toldregister = (R_NO,
  109. R_AL,R_CL,R_DL,R_BL,R_NO,R_NO,R_NO,R_NO,
  110. R_AL,R_CL,R_DL,R_BL,R_NO,R_NO,R_NO,R_NO,
  111. R_AL,R_CL,R_DL,R_BL,R_NO,R_NO,R_NO,R_NO,
  112. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  113. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  114. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  115. R_NO,R_NO,R_NO,R_NO,
  116. R_NO,R_NO,R_NO,R_NO,R_NO,
  117. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
  118. R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO
  119. );
  120. { convert a register to a specfied register size }
  121. function changeregsize(r:tregister;size:topsize):tregister;
  122. var
  123. reg : tregister;
  124. begin
  125. case size of
  126. S_B :
  127. reg.enum:=reg2reg8[r.enum];
  128. S_W :
  129. reg.enum:=reg2reg16[r.enum];
  130. S_L :
  131. reg.enum:=reg2reg32[r.enum];
  132. else
  133. internalerror(200204101);
  134. end;
  135. if reg.enum=R_NO then
  136. internalerror(200204102);
  137. changeregsize:=reg;
  138. end;
  139. {************************************************************************}
  140. { trgcpu }
  141. {************************************************************************}
  142. {$ifndef newra}
  143. function trgcpu.getregisterint(list:Taasmoutput;size:Tcgsize):Tregister;
  144. var subreg:Tsubregister;
  145. begin
  146. subreg:=cgsize2subreg(size);
  147. if countunusedregsint=0 then
  148. internalerror(10);
  149. result.enum:=R_INTREGISTER;
  150. {$ifdef TEMPREGDEBUG}
  151. if curptree^.usableregsint-countunusedregsint>curptree^.registers32 then
  152. internalerror(10);
  153. {$endif TEMPREGDEBUG}
  154. {$ifdef EXTTEMPREGDEBUG}
  155. if curptree^.usableregs-countunusedregistersint>curptree^^.reallyusedregs then
  156. curptree^.reallyusedregs:=curptree^^.usableregs-countunusedregistersint;
  157. {$endif EXTTEMPREGDEBUG}
  158. if RS_EAX in unusedregsint then
  159. begin
  160. dec(countunusedregsint);
  161. exclude(unusedregsint,RS_EAX);
  162. include(usedintinproc,RS_EAX);
  163. result.number:=RS_EAX shl 8 or subreg;
  164. {$ifdef TEMPREGDEBUG}
  165. reg_user[R_EAX]:=curptree^;
  166. {$endif TEMPREGDEBUG}
  167. exprasmlist.concat(tai_regalloc.alloc(result));
  168. end
  169. else if RS_EDX in unusedregsint then
  170. begin
  171. dec(countunusedregsint);
  172. exclude(unusedregsint,RS_EDX);
  173. include(usedintinproc,RS_EDX);
  174. result.number:=RS_EDX shl 8 or subreg;
  175. {$ifdef TEMPREGDEBUG}
  176. reg_user[R_EDX]:=curptree^;
  177. {$endif TEMPREGDEBUG}
  178. exprasmlist.concat(tai_regalloc.alloc(result));
  179. end
  180. else if RS_EBX in unusedregsint then
  181. begin
  182. dec(countunusedregsint);
  183. exclude(unusedregsint,RS_EBX);
  184. include(usedintinproc,RS_EBX);
  185. result.number:=RS_EBX shl 8 or subreg;
  186. {$ifdef TEMPREGDEBUG}
  187. reg_user[R_EBX]:=curptree^;
  188. {$endif TEMPREGDEBUG}
  189. exprasmlist.concat(tai_regalloc.alloc(result));
  190. end
  191. else if RS_ECX in unusedregsint then
  192. begin
  193. dec(countunusedregsint);
  194. exclude(unusedregsint,RS_ECX);
  195. include(usedintinproc,RS_ECX);
  196. result.number:=RS_ECX shl 8 or subreg;
  197. {$ifdef TEMPREGDEBUG}
  198. reg_user[R_ECX]:=curptree^;
  199. {$endif TEMPREGDEBUG}
  200. exprasmlist.concat(tai_regalloc.alloc(result));
  201. end
  202. else
  203. internalerror(10);
  204. {$ifdef TEMPREGDEBUG}
  205. testregisters;
  206. {$endif TEMPREGDEBUG}
  207. end;
  208. function trgcpu.getaddressregister(list:Taasmoutput):Tregister;
  209. begin
  210. if countunusedregsaddr>0 then
  211. begin
  212. result.enum:=R_INTREGISTER;
  213. {$ifdef TEMPREGDEBUG}
  214. if curptree^.usableregsaddr-countunusedregsaddr>curptree^.registers32 then
  215. internalerror(10);
  216. {$endif TEMPREGDEBUG}
  217. {$ifdef EXTTEMPREGDEBUG}
  218. if curptree^.usableregs-countunusedregistersaddr>curptree^^.reallyusedregs then
  219. curptree^.reallyusedregs:=curptree^^.usableregs-countunusedregistersaddr;
  220. {$endif EXTTEMPREGDEBUG}
  221. if RS_ESI in unusedregsaddr then
  222. begin
  223. dec(countunusedregsaddr);
  224. exclude(unusedregsaddr,RS_ESI);
  225. include(usedaddrinproc,RS_ESI);
  226. result.number:=NR_ESI;
  227. {$ifdef TEMPREGDEBUG}
  228. reg_user[R_ESI]:=curptree^;
  229. {$endif TEMPREGDEBUG}
  230. exprasmlist.concat(tai_regalloc.alloc(result));
  231. end
  232. else
  233. internalerror(10);
  234. end
  235. else
  236. result:=getregisterint(list,OS_ADDR);
  237. end;
  238. procedure trgcpu.ungetregisterint(list: taasmoutput; r : tregister);
  239. var supreg:Tsuperregister;
  240. begin
  241. if r.enum=R_NO then
  242. exit;
  243. if r.enum<>R_INTREGISTER then
  244. internalerror(200301234);
  245. supreg:=r.number shr 8;
  246. if (supreg in [RS_EDI]) then
  247. begin
  248. list.concat(tai_regalloc.DeAlloc(r));
  249. exit;
  250. end;
  251. if not(supreg in [RS_EAX,RS_EBX,RS_ECX,RS_EDX,RS_ESI]) then
  252. exit;
  253. inherited ungetregisterint(list,r);
  254. end;
  255. function trgcpu.getexplicitregisterint(list:Taasmoutput;r:Tnewregister):Tregister;
  256. var r2:Tregister;
  257. begin
  258. if (r shr 8) in [RS_EDI] then
  259. begin
  260. r2.enum:=R_INTREGISTER;
  261. r2.number:=r;
  262. list.concat(Tai_regalloc.alloc(r2));
  263. getexplicitregisterint:=r2;
  264. exit;
  265. end;
  266. result:=inherited getexplicitregisterint(list,r);
  267. end;
  268. {$endif newra}
  269. function trgcpu.getregisterfpu(list: taasmoutput) : tregister;
  270. begin
  271. { note: don't return R_ST0, see comments above implementation of }
  272. { a_loadfpu_* methods in cgcpu (JM) }
  273. result.enum := R_ST;
  274. end;
  275. procedure trgcpu.ungetregisterfpu(list : taasmoutput; r : tregister);
  276. begin
  277. { nothing to do, fpu stack management is handled by the load/ }
  278. { store operations in cgcpu (JM) }
  279. end;
  280. procedure trgcpu.ungetreference(list: taasmoutput; const ref : treference);
  281. begin
  282. if (ref.base.number<>NR_NO) and (ref.base.number<>NR_FRAME_POINTER_REG) then
  283. ungetregisterint(list,ref.base);
  284. if (ref.index.number<>NR_NO) and (ref.index.number<>NR_FRAME_POINTER_REG) then
  285. ungetregisterint(list,ref.index);
  286. end;
  287. procedure trgcpu.pushusedintregisters(list:Taasmoutput;
  288. var pushed:Tpushedsavedint;
  289. const s:Tsupregset);
  290. var r:Tsuperregister;
  291. r2:Tregister;
  292. begin
  293. usedintinproc:=usedintinproc+s;
  294. for r:=firstsaveintreg to lastsaveintreg do
  295. begin
  296. r2.enum:=R_INTREGISTER;
  297. r2.number:=r shl 8 or R_SUBWHOLE;
  298. pushed[r].pushed:=false;
  299. { if the register is used by the calling subroutine }
  300. if not(r in is_reg_var_int) and (r in s) and
  301. { and is present in use }
  302. not(r in unusedregsint) then
  303. begin
  304. { then save it }
  305. list.concat(Taicpu.Op_reg(A_PUSH,S_L,r2));
  306. include(unusedregsint,r);
  307. inc(countunusedregsint);
  308. pushed[r].pushed:=true;
  309. end;
  310. end;
  311. {$ifdef TEMPREGDEBUG}
  312. testregisters;
  313. {$endif TEMPREGDEBUG}
  314. end;
  315. {$ifdef SUPPORT_MMX}
  316. procedure trgcpu.pushusedotherregisters(list:Taasmoutput;
  317. var pushed:Tpushedsaved;
  318. const s:Tregisterset);
  319. var r:Toldregister;
  320. r2:Tregister;
  321. hr:Treference;
  322. begin
  323. usedinproc:=usedinproc+s;
  324. for r:=R_MM0 to R_MM6 do
  325. begin
  326. pushed[r].pushed:=false;
  327. { if the register is used by the calling subroutine }
  328. if not is_reg_var[r] and
  329. (r in s) and
  330. { and is present in use }
  331. not(r in unusedregsmm) then
  332. begin
  333. r2.enum:=R_ESP;
  334. list.concat(Taicpu.Op_const_reg(A_SUB,S_L,8,r2));
  335. reference_reset_base(hr,r2,0);
  336. r2.enum:=r;
  337. list.concat(Taicpu.Op_reg_ref(A_MOVQ,S_NO,r2,hr));
  338. include(unusedregsmm,r);
  339. inc(countunusedregsmm);
  340. pushed[r].pushed:=true;
  341. end;
  342. end;
  343. {$ifdef TEMPREGDEBUG}
  344. testregisters;
  345. {$endif TEMPREGDEBUG}
  346. end;
  347. {$endif SUPPORT_MMX}
  348. procedure trgcpu.popusedintregisters(list:Taasmoutput;
  349. const pushed:Tpushedsavedint);
  350. var r:Tsuperregister;
  351. r2:Tregister;
  352. begin
  353. { restore in reverse order: }
  354. for r:=lastsaveintreg downto firstsaveintreg do
  355. if pushed[r].pushed then
  356. begin
  357. r2.enum:=R_INTREGISTER;
  358. r2.number:=r shl 8 or R_SUBWHOLE;
  359. list.concat(Taicpu.op_reg(A_POP,S_L,r2));
  360. if not (r in unusedregsint) then
  361. { internalerror(10)
  362. in cg386cal we always restore regs
  363. that appear as used
  364. due to a unused tmep storage PM }
  365. else
  366. dec(countunusedregsint);
  367. exclude(unusedregsint,r);
  368. end;
  369. {$ifdef TEMPREGDEBUG}
  370. testregisters;
  371. {$endif TEMPREGDEBUG}
  372. end;
  373. {$ifdef SUPPORT_MMX}
  374. procedure trgcpu.popusedotherregisters(list:Taasmoutput;
  375. const pushed:Tpushedsaved);
  376. var r:Toldregister;
  377. r2,r3:Tregister;
  378. hr:Treference;
  379. begin
  380. { restore in reverse order: }
  381. for r:=R_MM6 downto R_MM0 do
  382. if pushed[r].pushed then
  383. begin
  384. r2.enum:=R_ESP;
  385. reference_reset_base(hr,r2,0);
  386. r3.enum:=r;
  387. list.concat(Taicpu.op_ref_reg(A_MOVQ,S_NO,hr,r3));
  388. list.concat(Taicpu.op_const_reg(A_ADD,S_L,8,r2));
  389. if not (r in unusedregsmm) then
  390. { internalerror(10)
  391. in cg386cal we always restore regs
  392. that appear as used
  393. due to a unused tmep storage PM }
  394. else
  395. dec(countunusedregsmm);
  396. exclude(unusedregsmm,r);
  397. end;
  398. {$ifdef TEMPREGDEBUG}
  399. testregisters;
  400. {$endif TEMPREGDEBUG}
  401. end;
  402. {$endif SUPPORT_MMX}
  403. procedure trgcpu.saveusedintregisters(list:Taasmoutput;
  404. var saved:Tpushedsavedint;
  405. const s:Tsupregset);
  406. begin
  407. if (aktoptprocessor in [class386,classP5]) or
  408. (CS_LittleSize in aktglobalswitches) then
  409. pushusedintregisters(list,saved,s)
  410. else
  411. inherited saveusedintregisters(list,saved,s);
  412. end;
  413. procedure trgcpu.saveusedotherregisters(list:Taasmoutput;var saved:Tpushedsaved;
  414. const s:tregisterset);
  415. begin
  416. {$ifdef SUPPORT_MMX}
  417. if (aktoptprocessor in [class386,classP5]) or
  418. (CS_LittleSize in aktglobalswitches) then
  419. pushusedotherregisters(list,saved,s)
  420. else
  421. {$endif SUPPORT_MMX}
  422. inherited saveusedotherregisters(list,saved,s);
  423. end;
  424. procedure trgcpu.restoreusedintregisters(list:Taasmoutput;
  425. const saved:tpushedsavedint);
  426. begin
  427. if (aktoptprocessor in [class386,classP5]) or
  428. (CS_LittleSize in aktglobalswitches) then
  429. popusedintregisters(list,saved)
  430. else
  431. inherited restoreusedintregisters(list,saved);
  432. end;
  433. procedure trgcpu.restoreusedotherregisters(list:Taasmoutput;
  434. const saved:tpushedsaved);
  435. begin
  436. {$ifdef SUPPORT_MMX}
  437. if (aktoptprocessor in [class386,classP5]) or
  438. (CS_LittleSize in aktglobalswitches) then
  439. popusedotherregisters(list,saved)
  440. else
  441. {$endif SUPPORT_MMX}
  442. inherited restoreusedotherregisters(list,saved);
  443. end;
  444. procedure trgcpu.resetusableregisters;
  445. begin
  446. inherited resetusableregisters;
  447. fpuvaroffset := 0;
  448. end;
  449. function trgcpu.correct_fpuregister(r : tregister;ofs : byte) : tregister;
  450. begin
  451. correct_fpuregister.enum:=Toldregister(longint(r.enum)+ofs);
  452. end;
  453. function trgcpu.makeregsize(reg: tregister; size: tcgsize): tregister;
  454. var
  455. _result : topsize;
  456. begin
  457. case size of
  458. OS_32,OS_S32:
  459. begin
  460. _result := S_L;
  461. end;
  462. OS_8,OS_S8:
  463. begin
  464. _result := S_B;
  465. end;
  466. OS_16,OS_S16:
  467. begin
  468. _result := S_W;
  469. end;
  470. else
  471. internalerror(2001092312);
  472. end;
  473. makeregsize := changeregsize(reg,_result);
  474. end;
  475. initialization
  476. rg := trgcpu.create(7); {We use 7 int registers on i386.}
  477. end.
  478. {
  479. $Log$
  480. Revision 1.19 2003-04-22 10:09:35 daniel
  481. + Implemented the actual register allocator
  482. + Scratch registers unavailable when new register allocator used
  483. + maybe_save/maybe_restore unavailable when new register allocator used
  484. Revision 1.18 2003/04/21 19:16:50 peter
  485. * count address regs separate
  486. Revision 1.17 2003/03/28 19:16:57 peter
  487. * generic constructor working for i386
  488. * remove fixed self register
  489. * esi added as address register for i386
  490. Revision 1.16 2003/03/17 15:52:57 peter
  491. * SUPPORT_MMX define compile fix
  492. Revision 1.15 2003/03/08 13:59:17 daniel
  493. * Work to handle new register notation in ag386nsm
  494. + Added newra version of Ti386moddivnode
  495. Revision 1.14 2003/03/08 08:59:07 daniel
  496. + $define newra will enable new register allocator
  497. + getregisterint will return imaginary registers with $newra
  498. + -sr switch added, will skip register allocation so you can see
  499. the direct output of the code generator before register allocation
  500. Revision 1.13 2003/03/07 21:57:53 daniel
  501. * Improved getregisterint
  502. Revision 1.12 2003/02/19 22:00:16 daniel
  503. * Code generator converted to new register notation
  504. - Horribily outdated todo.txt removed
  505. Revision 1.11 2003/01/08 18:43:57 daniel
  506. * Tregister changed into a record
  507. Revision 1.10 2002/10/05 12:43:29 carl
  508. * fixes for Delphi 6 compilation
  509. (warning : Some features do not work under Delphi)
  510. Revision 1.9 2002/08/17 09:23:48 florian
  511. * first part of procinfo rewrite
  512. Revision 1.8 2002/07/01 18:46:34 peter
  513. * internal linker
  514. * reorganized aasm layer
  515. Revision 1.7 2002/05/16 19:46:52 carl
  516. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  517. + try to fix temp allocation (still in ifdef)
  518. + generic constructor calls
  519. + start of tassembler / tmodulebase class cleanup
  520. Revision 1.6 2002/05/12 16:53:18 peter
  521. * moved entry and exitcode to ncgutil and cgobj
  522. * foreach gets extra argument for passing local data to the
  523. iterator function
  524. * -CR checks also class typecasts at runtime by changing them
  525. into as
  526. * fixed compiler to cycle with the -CR option
  527. * fixed stabs with elf writer, finally the global variables can
  528. be watched
  529. * removed a lot of routines from cga unit and replaced them by
  530. calls to cgobj
  531. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  532. u32bit then the other is typecasted also to u32bit without giving
  533. a rangecheck warning/error.
  534. * fixed pascal calling method with reversing also the high tree in
  535. the parast, detected by tcalcst3 test
  536. Revision 1.5 2002/04/21 15:43:32 carl
  537. * changeregsize -> rg.makeregsize
  538. * changeregsize moved from cpubase to here
  539. Revision 1.4 2002/04/15 19:44:22 peter
  540. * fixed stackcheck that would be called recursively when a stack
  541. error was found
  542. * generic changeregsize(reg,size) for i386 register resizing
  543. * removed some more routines from cga unit
  544. * fixed returnvalue handling
  545. * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
  546. Revision 1.3 2002/04/04 19:06:13 peter
  547. * removed unused units
  548. * use tlocation.size in cg.a_*loc*() routines
  549. Revision 1.2 2002/04/02 17:11:39 peter
  550. * tlocation,treference update
  551. * LOC_CONSTANT added for better constant handling
  552. * secondadd splitted in multiple routines
  553. * location_force_reg added for loading a location to a register
  554. of a specified size
  555. * secondassignment parses now first the right and then the left node
  556. (this is compatible with Kylix). This saves a lot of push/pop especially
  557. with string operations
  558. * adapted some routines to use the new cg methods
  559. Revision 1.1 2002/03/31 20:26:40 jonas
  560. + a_loadfpu_* and a_loadmm_* methods in tcg
  561. * register allocation is now handled by a class and is mostly processor
  562. independent (+rgobj.pas and i386/rgcpu.pas)
  563. * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  564. * some small improvements and fixes to the optimizer
  565. * some register allocation fixes
  566. * some fpuvaroffset fixes in the unary minus node
  567. * push/popusedregisters is now called rg.save/restoreusedregisters and
  568. (for i386) uses temps instead of push/pop's when using -Op3 (that code is
  569. also better optimizable)
  570. * fixed and optimized register saving/restoring for new/dispose nodes
  571. * LOC_FPU locations now also require their "register" field to be set to
  572. R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  573. - list field removed of the tnode class because it's not used currently
  574. and can cause hard-to-find bugs
  575. }