regvars.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl and Jonas Maebe
  4. This unit handles register variable allocation
  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 regvars;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. aasmbase,aasmtai,aasmcpu,
  23. node,
  24. symsym,
  25. cpubase, cginfo, tgobj, rgobj;
  26. procedure assign_regvars(p: tnode);
  27. procedure load_regvars(asml: TAAsmoutput; p: tnode);
  28. procedure cleanup_regvars(asml: TAAsmoutput);
  29. procedure store_regvar_int(asml:Taasmoutput;reg:Tsuperregister);
  30. procedure store_regvar(asml: TAAsmoutput; reg: tregister);
  31. procedure load_regvar(asml: TAAsmoutput; vsym: tvarsym);
  32. procedure load_regvar_reg(asml: TAAsmoutput; reg: tregister);
  33. procedure load_all_regvars(asml: TAAsmoutput);
  34. procedure sync_regvars(list1, list2: taasmoutput; const regvarsloaded1,
  35. regvarsloaded2: regvar_booleanarray);
  36. implementation
  37. uses
  38. globtype,systems,comphook,
  39. cutils,cclasses,verbose,globals,
  40. symconst,symbase,symtype,symdef,paramgr,defutil,
  41. cgbase,cgobj,cgcpu,rgcpu;
  42. procedure searchregvars(p : tnamedindexitem;arg:pointer);
  43. var
  44. i,j,k : longint;
  45. parasym : boolean;
  46. begin
  47. parasym:=pboolean(arg)^;
  48. if (tsym(p).typ=varsym) and (vo_regable in tvarsym(p).varoptions) then
  49. begin
  50. j:=tvarsym(p).refs;
  51. { parameter get a less value }
  52. if parasym then
  53. begin
  54. if cs_littlesize in aktglobalswitches then
  55. dec(j,1)
  56. else
  57. dec(j,100);
  58. end;
  59. { walk through all momentary register variables }
  60. for i:=1 to maxvarregs do
  61. begin
  62. with pregvarinfo(current_procdef.regvarinfo)^ do
  63. if ((regvars[i]=nil) or (j>regvars_refs[i])) and (j>0) then
  64. begin
  65. for k:=maxvarregs-1 downto i do
  66. begin
  67. regvars[k+1]:=regvars[k];
  68. regvars_para[k+1]:=regvars_para[k];
  69. regvars_refs[k+1]:=regvars_refs[k];
  70. end;
  71. { calc the new refs
  72. tvarsym(p).refs:=j; }
  73. regvars[i]:=tvarsym(p);
  74. regvars_para[i]:=parasym;
  75. regvars_refs[i]:=j;
  76. break;
  77. end;
  78. end;
  79. end;
  80. end;
  81. procedure searchfpuregvars(p : tnamedindexitem;arg:pointer);
  82. var
  83. i,j,k : longint;
  84. parasym : boolean;
  85. begin
  86. parasym:=pboolean(arg)^;
  87. if (tsym(p).typ=varsym) and (vo_fpuregable in tvarsym(p).varoptions) then
  88. begin
  89. j:=tvarsym(p).refs;
  90. { parameter get a less value }
  91. if parasym then
  92. begin
  93. if cs_littlesize in aktglobalswitches then
  94. dec(j,1)
  95. else
  96. dec(j,100);
  97. end;
  98. { walk through all momentary register variables }
  99. for i:=1 to maxfpuvarregs do
  100. begin
  101. with pregvarinfo(current_procdef.regvarinfo)^ do
  102. if ((fpuregvars[i]=nil) or (j>fpuregvars_refs[i])) and (j>0) then
  103. begin
  104. for k:=maxfpuvarregs-1 downto i do
  105. begin
  106. fpuregvars[k+1]:=fpuregvars[k];
  107. fpuregvars_para[k+1]:=fpuregvars_para[k];
  108. fpuregvars_refs[k+1]:=fpuregvars_refs[k];
  109. end;
  110. { calc the new refs
  111. tvarsym(p).refs:=j; }
  112. fpuregvars[i]:=tvarsym(p);
  113. fpuregvars_para[i]:=parasym;
  114. fpuregvars_refs[i]:=j;
  115. break;
  116. end;
  117. end;
  118. end;
  119. end;
  120. procedure assign_regvars(p: tnode);
  121. { register variables }
  122. var
  123. regvarinfo: pregvarinfo;
  124. i: longint;
  125. parasym : boolean;
  126. r : Tregister;
  127. begin
  128. { max. optimizations }
  129. { only if no asm is used }
  130. { and no try statement }
  131. if (cs_regalloc in aktglobalswitches) and
  132. not(pi_uses_asm in current_procinfo.flags) and
  133. not(pi_uses_exceptions in current_procinfo.flags) then
  134. begin
  135. new(regvarinfo);
  136. fillchar(regvarinfo^,sizeof(regvarinfo^),0);
  137. current_procdef.regvarinfo := regvarinfo;
  138. if (p.registers32<4) then
  139. begin
  140. parasym:=false;
  141. symtablestack.foreach_static({$ifdef FPCPROCVAR}@{$endif}searchregvars,@parasym);
  142. { copy parameter into a register ? }
  143. parasym:=true;
  144. symtablestack.next.foreach_static({$ifdef FPCPROCVAR}@{$endif}searchregvars,@parasym);
  145. { hold needed registers free }
  146. for i:=maxvarregs downto maxvarregs-p.registers32+1 do
  147. begin
  148. regvarinfo^.regvars[i]:=nil;
  149. regvarinfo^.regvars_para[i] := false;
  150. end;
  151. { now assign register }
  152. for i:=1 to maxvarregs-p.registers32 do
  153. begin
  154. if assigned(regvarinfo^.regvars[i]) and
  155. (rg.reg_pushes[varregs[i]] < regvarinfo^.regvars[i].refs) then
  156. begin
  157. { register is no longer available for }
  158. { expressions }
  159. { search the register which is the most }
  160. { unused }
  161. r.enum:=varregs[i];
  162. if r.enum=R_INTREGISTER then
  163. rg.makeregvarint(r.number)
  164. else
  165. rg.makeregvarother(r);
  166. { possibly no 32 bit register are needed }
  167. { call by reference/const ? }
  168. if (regvarinfo^.regvars[i].varspez in [vs_var,vs_out]) or
  169. ((regvarinfo^.regvars[i].varspez=vs_const) and
  170. paramanager.push_addr_param(regvarinfo^.regvars[i].vartype.def,current_procdef.proccalloption)) then
  171. begin
  172. r.enum:=varregs[i];
  173. regvarinfo^.regvars[i].reg:=r;
  174. end
  175. else
  176. if (regvarinfo^.regvars[i].vartype.def.deftype in [orddef,enumdef]) and
  177. (regvarinfo^.regvars[i].vartype.def.size=1) then
  178. begin
  179. r.enum:=varregs[i];
  180. regvarinfo^.regvars[i].reg:=rg.makeregsize(r,OS_8);
  181. end
  182. else
  183. if (regvarinfo^.regvars[i].vartype.def.deftype in [orddef,enumdef]) and
  184. (regvarinfo^.regvars[i].vartype.def.size=2) then
  185. begin
  186. r.enum:=varregs[i];
  187. regvarinfo^.regvars[i].reg:=rg.makeregsize(r,OS_16);
  188. end
  189. else
  190. begin
  191. r.enum:=varregs[i];
  192. regvarinfo^.regvars[i].reg:=r;
  193. end;
  194. { procedure uses this register }
  195. include(rg.usedinproc,varregs[i]);
  196. end
  197. else
  198. begin
  199. regvarinfo^.regvars[i] := nil;
  200. regvarinfo^.regvars_para[i] := false;
  201. end;
  202. end;
  203. end;
  204. if ((p.registersfpu+1)<maxfpuvarregs) then
  205. begin
  206. parasym:=false;
  207. symtablestack.foreach_static({$ifdef FPCPROCVAR}@{$endif}searchfpuregvars,@parasym);
  208. {$ifdef dummy}
  209. { this code should be never enabled because }
  210. { 1. the caller loads parameters into registers }
  211. { 2. (later) the CSE loads a parameter into a }
  212. { register, if necessary }
  213. { (FK) }
  214. { copy parameter into a register ? }
  215. parasym:=true;
  216. symtablestack.next.foreach_static({$ifdef FPCPROCVAR}@{$endif}searchregvars);
  217. {$endif dummy}
  218. { hold needed registers free }
  219. { in non leaf procedures we must be very careful }
  220. { with assigning registers }
  221. if aktmaxfpuregisters=-1 then
  222. begin
  223. if (pi_do_call in current_procinfo.flags) then
  224. begin
  225. for i:=maxfpuvarregs downto 2 do
  226. regvarinfo^.fpuregvars[i]:=nil;
  227. end
  228. else
  229. begin
  230. for i:=maxfpuvarregs downto maxfpuvarregs-p.registersfpu do
  231. regvarinfo^.fpuregvars[i]:=nil;
  232. end;
  233. end
  234. else
  235. begin
  236. for i:=aktmaxfpuregisters+1 to maxfpuvarregs do
  237. regvarinfo^.fpuregvars[i]:=nil;
  238. end;
  239. { now assign register }
  240. for i:=1 to maxfpuvarregs do
  241. begin
  242. if assigned(regvarinfo^.fpuregvars[i]) then
  243. begin
  244. {$ifdef i386}
  245. { reserve place on the FPU stack }
  246. r.enum:=R_ST0;
  247. regvarinfo^.fpuregvars[i].reg:=trgcpu(rg).correct_fpuregister(r,i);
  248. {$else i386}
  249. rg.makeregvarother(regvarinfo^.fpuregvars[i].reg);
  250. {$endif i386}
  251. end;
  252. end;
  253. end;
  254. end;
  255. end;
  256. procedure store_regvar_int(asml:Taasmoutput;reg:Tsuperregister);
  257. begin
  258. internalerror(200301104);
  259. end;
  260. procedure store_regvar(asml: TAAsmoutput; reg: tregister);
  261. var
  262. i: longint;
  263. hr: treference;
  264. regvarinfo: pregvarinfo;
  265. vsym: tvarsym;
  266. begin
  267. if reg.enum>lastreg then
  268. internalerror(200301081);
  269. regvarinfo := pregvarinfo(current_procdef.regvarinfo);
  270. if not assigned(regvarinfo) then
  271. exit;
  272. for i := 1 to maxvarregs do
  273. if assigned(regvarinfo^.regvars[i]) and
  274. (rg.makeregsize(regvarinfo^.regvars[i].reg,OS_INT).enum = reg.enum) then
  275. begin
  276. if rg.regvar_loaded[rg.makeregsize(reg,OS_INT).enum] then
  277. begin
  278. vsym := tvarsym(regvarinfo^.regvars[i]);
  279. { we only have to store the regvar back to memory if it's }
  280. { possible that it's been modified (JM) }
  281. if not(vsym.varspez in [vs_const,vs_var,vs_out]) then
  282. begin
  283. reference_reset_base(hr,current_procinfo.framepointer,vsym.adjusted_address);
  284. cg.a_load_reg_ref(asml,def_cgsize(vsym.vartype.def),vsym.reg,hr);
  285. end;
  286. asml.concat(tai_regalloc.dealloc(rg.makeregsize(reg,OS_INT)));
  287. rg.regvar_loaded[rg.makeregsize(reg,OS_INT).enum] := false;
  288. end;
  289. break;
  290. end;
  291. end;
  292. procedure load_regvar(asml: TAAsmoutput; vsym: tvarsym);
  293. var
  294. hr: treference;
  295. opsize: tcgsize;
  296. reg : tregister;
  297. begin
  298. reg:=rg.makeregsize(vsym.reg,OS_INT);
  299. if reg.enum>lastreg then
  300. internalerror(200301081);
  301. if not rg.regvar_loaded[reg.enum] then
  302. begin
  303. asml.concat(tai_regalloc.alloc(reg));
  304. reference_reset_base(hr,current_procinfo.framepointer,vsym.adjusted_address);
  305. if (vsym.varspez in [vs_var,vs_out]) or
  306. ((vsym.varspez=vs_const) and
  307. paramanager.push_addr_param(vsym.vartype.def,current_procdef.proccalloption)) then
  308. opsize := OS_ADDR
  309. else
  310. opsize := def_cgsize(vsym.vartype.def);
  311. cg.a_load_ref_reg(asml,opsize,hr,reg);
  312. rg.regvar_loaded[reg.enum] := true;
  313. end;
  314. end;
  315. procedure load_regvar_reg(asml: TAAsmoutput; reg: tregister);
  316. var
  317. i: longint;
  318. regvarinfo: pregvarinfo;
  319. reg_spare : tregister;
  320. begin
  321. regvarinfo := pregvarinfo(current_procdef.regvarinfo);
  322. if not assigned(regvarinfo) then
  323. exit;
  324. reg_spare := rg.makeregsize(reg,OS_INT);
  325. if reg_spare.enum>lastreg then
  326. internalerror(2003010801);
  327. for i := 1 to maxvarregs do
  328. if assigned(regvarinfo^.regvars[i]) and
  329. (rg.makeregsize(regvarinfo^.regvars[i].reg,OS_INT).enum = reg_spare.enum) then
  330. load_regvar(asml,tvarsym(regvarinfo^.regvars[i]))
  331. end;
  332. procedure load_all_regvars(asml: TAAsmoutput);
  333. var
  334. i: longint;
  335. regvarinfo: pregvarinfo;
  336. begin
  337. regvarinfo := pregvarinfo(current_procdef.regvarinfo);
  338. if not assigned(regvarinfo) then
  339. exit;
  340. for i := 1 to maxvarregs do
  341. if assigned(regvarinfo^.regvars[i]) {and
  342. (makereg32(regvarinfo^.regvars[i].reg) in [R_EAX,R_EBX,R_ECX,R_EDX])} then
  343. load_regvar(asml,tvarsym(regvarinfo^.regvars[i]))
  344. end;
  345. procedure load_regvars(asml: TAAsmoutput; p: tnode);
  346. var
  347. i: longint;
  348. regvarinfo: pregvarinfo;
  349. r:Tregister;
  350. begin
  351. if (cs_regalloc in aktglobalswitches) and
  352. not(pi_uses_asm in current_procinfo.flags) and
  353. not(pi_uses_exceptions in current_procinfo.flags) then
  354. begin
  355. regvarinfo := pregvarinfo(current_procdef.regvarinfo);
  356. { can happen when inlining assembler procedures (JM) }
  357. if not assigned(regvarinfo) then
  358. exit;
  359. for i:=1 to maxvarregs do
  360. begin
  361. if assigned(regvarinfo^.regvars[i]) then
  362. begin
  363. if cs_asm_source in aktglobalswitches then
  364. asml.insert(tai_comment.Create(strpnew(regvarinfo^.regvars[i].name+
  365. ' with weight '+tostr(regvarinfo^.regvars[i].refs)+' assigned to register '+
  366. std_reg2str[regvarinfo^.regvars[i].reg.enum])));
  367. if (status.verbosity and v_debug)=v_debug then
  368. Message3(cg_d_register_weight,std_reg2str[regvarinfo^.regvars[i].reg.enum],
  369. tostr(regvarinfo^.regvars[i].refs),regvarinfo^.regvars[i].name);
  370. end;
  371. end;
  372. for i:=1 to maxfpuvarregs do
  373. begin
  374. if assigned(regvarinfo^.fpuregvars[i]) then
  375. begin
  376. {$ifdef i386}
  377. r.enum:=R_ST0;
  378. { reserve place on the FPU stack }
  379. regvarinfo^.fpuregvars[i].reg:=trgcpu(rg).correct_fpuregister(r,i-1);
  380. asml.concat(Taicpu.op_none(A_FLDZ,S_NO));
  381. {$endif i386}
  382. end;
  383. end;
  384. {$ifdef i386}
  385. if assigned(p) then
  386. if cs_asm_source in aktglobalswitches then
  387. asml.insert(tai_comment.Create(strpnew(tostr(p.registersfpu)+
  388. ' registers on FPU stack used by temp. expressions')));
  389. {$endif i386}
  390. for i:=1 to maxfpuvarregs do
  391. begin
  392. if assigned(regvarinfo^.fpuregvars[i]) then
  393. begin
  394. if cs_asm_source in aktglobalswitches then
  395. asml.insert(tai_comment.Create(strpnew(regvarinfo^.fpuregvars[i].name+
  396. ' with weight '+tostr(regvarinfo^.fpuregvars[i].refs)+' assigned to register '+
  397. std_reg2str[regvarinfo^.fpuregvars[i].reg.enum])));
  398. if (status.verbosity and v_debug)=v_debug then
  399. Message3(cg_d_register_weight,std_reg2str[regvarinfo^.fpuregvars[i].reg.enum],
  400. tostr(regvarinfo^.fpuregvars[i].refs),regvarinfo^.fpuregvars[i].name);
  401. end;
  402. end;
  403. if cs_asm_source in aktglobalswitches then
  404. asml.insert(tai_comment.Create(strpnew('Register variable assignment:')));
  405. end;
  406. end;
  407. procedure sync_regvars(list1, list2: taasmoutput; const regvarsloaded1,
  408. regvarsloaded2: regvar_booleanarray);
  409. var
  410. counter: tregister;
  411. begin
  412. for counter.enum := low(rg.regvar_loaded) to high(rg.regvar_loaded) do
  413. begin
  414. rg.regvar_loaded[counter.enum] := regvarsloaded1[counter.enum] and
  415. regvarsloaded2[counter.enum];
  416. if regvarsloaded1[counter.enum] xor regvarsloaded2[counter.enum] then
  417. if regvarsloaded1[counter.enum] then
  418. load_regvar_reg(list2,counter)
  419. else
  420. load_regvar_reg(list1,counter);
  421. end;
  422. end;
  423. procedure cleanup_regvars(asml: TAAsmoutput);
  424. var
  425. i: longint;
  426. r,reg : tregister;
  427. begin
  428. { can happen when inlining assembler procedures (JM) }
  429. if not assigned(current_procdef.regvarinfo) then
  430. exit;
  431. if (cs_regalloc in aktglobalswitches) and
  432. not(pi_uses_asm in current_procinfo.flags) and
  433. not(pi_uses_exceptions in current_procinfo.flags) then
  434. with pregvarinfo(current_procdef.regvarinfo)^ do
  435. begin
  436. {$ifdef i386}
  437. r.enum:=R_ST0;
  438. for i:=1 to maxfpuvarregs do
  439. if assigned(fpuregvars[i]) then
  440. { ... and clean it up }
  441. asml.concat(Taicpu.op_reg(A_FSTP,S_NO,r));
  442. {$endif i386}
  443. for i := 1 to maxvarregs do
  444. begin
  445. if assigned(regvars[i]) then
  446. begin
  447. reg:=rg.makeregsize(regvars[i].reg,OS_INT);
  448. if reg.enum>lastreg then
  449. internalerror(200201081);
  450. if (rg.regvar_loaded[reg.enum]) then
  451. asml.concat(tai_regalloc.dealloc(reg));
  452. end;
  453. end;
  454. end;
  455. end;
  456. end.
  457. {
  458. $Log$
  459. Revision 1.49 2003-05-15 18:58:53 peter
  460. * removed selfpointer_offset, vmtpointer_offset
  461. * tvarsym.adjusted_address
  462. * address in localsymtable is now in the real direction
  463. * removed some obsolete globals
  464. Revision 1.48 2003/05/12 17:22:00 jonas
  465. * fixed (last?) remaining -tvarsym(X).address to
  466. tg.direction*tvarsym(X).address...
  467. Revision 1.47 2003/04/27 11:21:34 peter
  468. * aktprocdef renamed to current_procdef
  469. * procinfo renamed to current_procinfo
  470. * procinfo will now be stored in current_module so it can be
  471. cleaned up properly
  472. * gen_main_procsym changed to create_main_proc and release_main_proc
  473. to also generate a tprocinfo structure
  474. * fixed unit implicit initfinal
  475. Revision 1.46 2003/03/28 19:16:57 peter
  476. * generic constructor working for i386
  477. * remove fixed self register
  478. * esi added as address register for i386
  479. Revision 1.45 2003/02/19 22:00:14 daniel
  480. * Code generator converted to new register notation
  481. - Horribily outdated todo.txt removed
  482. Revision 1.44 2003/01/08 18:43:57 daniel
  483. * Tregister changed into a record
  484. Revision 1.43 2002/11/25 17:43:24 peter
  485. * splitted defbase in defutil,symutil,defcmp
  486. * merged isconvertable and is_equal into compare_defs(_ext)
  487. * made operator search faster by walking the list only once
  488. Revision 1.42 2002/11/18 17:31:59 peter
  489. * pass proccalloption to ret_in_xxx and push_xxx functions
  490. Revision 1.41 2002/08/25 19:25:20 peter
  491. * sym.insert_in_data removed
  492. * symtable.insertvardata/insertconstdata added
  493. * removed insert_in_data call from symtable.insert, it needs to be
  494. called separatly. This allows to deref the address calculation
  495. * procedures now calculate the parast addresses after the procedure
  496. directives are parsed. This fixes the cdecl parast problem
  497. * push_addr_param has an extra argument that specifies if cdecl is used
  498. or not
  499. Revision 1.40 2002/08/18 20:06:25 peter
  500. * inlining is now also allowed in interface
  501. * renamed write/load to ppuwrite/ppuload
  502. * tnode storing in ppu
  503. * nld,ncon,nbas are already updated for storing in ppu
  504. Revision 1.39 2002/08/17 09:23:41 florian
  505. * first part of procinfo rewrite
  506. Revision 1.38 2002/08/06 20:55:22 florian
  507. * first part of ppc calling conventions fix
  508. Revision 1.37 2002/07/20 11:57:57 florian
  509. * types.pas renamed to defbase.pas because D6 contains a types
  510. unit so this would conflicts if D6 programms are compiled
  511. + Willamette/SSE2 instructions to assembler added
  512. Revision 1.36 2002/07/11 14:41:30 florian
  513. * start of the new generic parameter handling
  514. Revision 1.35 2002/07/01 18:46:25 peter
  515. * internal linker
  516. * reorganized aasm layer
  517. Revision 1.34 2002/06/24 12:43:00 jonas
  518. * fixed errors found with new -CR code from Peter when cycling with -O2p3r
  519. Revision 1.33 2002/05/18 13:34:17 peter
  520. * readded missing revisions
  521. Revision 1.32 2002/05/16 19:46:44 carl
  522. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  523. + try to fix temp allocation (still in ifdef)
  524. + generic constructor calls
  525. + start of tassembler / tmodulebase class cleanup
  526. Revision 1.30 2002/05/12 16:53:10 peter
  527. * moved entry and exitcode to ncgutil and cgobj
  528. * foreach gets extra argument for passing local data to the
  529. iterator function
  530. * -CR checks also class typecasts at runtime by changing them
  531. into as
  532. * fixed compiler to cycle with the -CR option
  533. * fixed stabs with elf writer, finally the global variables can
  534. be watched
  535. * removed a lot of routines from cga unit and replaced them by
  536. calls to cgobj
  537. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  538. u32bit then the other is typecasted also to u32bit without giving
  539. a rangecheck warning/error.
  540. * fixed pascal calling method with reversing also the high tree in
  541. the parast, detected by tcalcst3 test
  542. Revision 1.29 2002/04/21 15:23:34 carl
  543. + changeregsize -> makeregsize
  544. Revision 1.28 2002/04/19 15:46:03 peter
  545. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  546. in most cases and not written to the ppu
  547. * add mangeledname_prefix() routine to generate the prefix of
  548. manglednames depending on the current procedure, object and module
  549. * removed static procprefix since the mangledname is now build only
  550. on demand from tprocdef.mangledname
  551. Revision 1.27 2002/04/15 19:44:19 peter
  552. * fixed stackcheck that would be called recursively when a stack
  553. error was found
  554. * generic changeregsize(reg,size) for i386 register resizing
  555. * removed some more routines from cga unit
  556. * fixed returnvalue handling
  557. * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
  558. Revision 1.26 2002/04/15 19:04:04 carl
  559. + reg2str -> std_reg2str()
  560. Revision 1.25 2002/04/06 18:13:01 jonas
  561. * several powerpc-related additions and fixes
  562. Revision 1.24 2002/04/02 17:11:29 peter
  563. * tlocation,treference update
  564. * LOC_CONSTANT added for better constant handling
  565. * secondadd splitted in multiple routines
  566. * location_force_reg added for loading a location to a register
  567. of a specified size
  568. * secondassignment parses now first the right and then the left node
  569. (this is compatible with Kylix). This saves a lot of push/pop especially
  570. with string operations
  571. * adapted some routines to use the new cg methods
  572. Revision 1.23 2002/03/31 20:26:36 jonas
  573. + a_loadfpu_* and a_loadmm_* methods in tcg
  574. * register allocation is now handled by a class and is mostly processor
  575. independent (+rgobj.pas and i386/rgcpu.pas)
  576. * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  577. * some small improvements and fixes to the optimizer
  578. * some register allocation fixes
  579. * some fpuvaroffset fixes in the unary minus node
  580. * push/popusedregisters is now called rg.save/restoreusedregisters and
  581. (for i386) uses temps instead of push/pop's when using -Op3 (that code is
  582. also better optimizable)
  583. * fixed and optimized register saving/restoring for new/dispose nodes
  584. * LOC_FPU locations now also require their "register" field to be set to
  585. R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  586. - list field removed of the tnode class because it's not used currently
  587. and can cause hard-to-find bugs
  588. }