regvars.pas 28 KB

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