nset.pas 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. {
  2. $Id$
  3. Copyright (c) 2000-2002 by Florian Klaempfl
  4. Type checking and register allocation for set/case nodes
  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 nset;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. node,globals,
  23. aasmbase,aasmtai,
  24. symppu;
  25. type
  26. pcaserecord = ^tcaserecord;
  27. tcaserecord = record
  28. { range }
  29. _low,_high : TConstExprInt;
  30. { only used by gentreejmp }
  31. _at : tasmlabel;
  32. { label of instruction }
  33. statement : tasmlabel;
  34. { is this the first of an case entry, needed to release statement
  35. label (PFV) }
  36. firstlabel : boolean;
  37. { left and right tree node }
  38. less,greater : pcaserecord;
  39. end;
  40. tsetelementnode = class(tbinarynode)
  41. constructor create(l,r : tnode);virtual;
  42. function det_resulttype:tnode;override;
  43. function pass_1 : tnode;override;
  44. end;
  45. tsetelementnodeclass = class of tsetelementnode;
  46. tinnode = class(tbinopnode)
  47. constructor create(l,r : tnode);virtual;
  48. function det_resulttype:tnode;override;
  49. function pass_1 : tnode;override;
  50. end;
  51. tinnodeclass = class of tinnode;
  52. trangenode = class(tbinarynode)
  53. constructor create(l,r : tnode);virtual;
  54. function det_resulttype:tnode;override;
  55. function pass_1 : tnode;override;
  56. end;
  57. trangenodeclass = class of trangenode;
  58. tcasenode = class(tbinarynode)
  59. nodes : pcaserecord;
  60. elseblock : tnode;
  61. constructor create(l,r : tnode;n : pcaserecord);virtual;
  62. destructor destroy;override;
  63. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  64. procedure ppuwrite(ppufile:tcompilerppufile);override;
  65. procedure buildderefimpl;override;
  66. procedure derefimpl;override;
  67. function getcopy : tnode;override;
  68. procedure insertintolist(l : tnodelist);override;
  69. function det_resulttype:tnode;override;
  70. function pass_1 : tnode;override;
  71. function docompare(p: tnode): boolean; override;
  72. end;
  73. tcasenodeclass = class of tcasenode;
  74. var
  75. csetelementnode : tsetelementnodeclass;
  76. cinnode : tinnodeclass;
  77. crangenode : trangenodeclass;
  78. ccasenode : tcasenodeclass;
  79. { counts the labels }
  80. function case_count_labels(root : pcaserecord) : longint;
  81. { searches the highest label }
  82. {$ifdef int64funcresok}
  83. function case_get_max(root : pcaserecord) : tconstexprint;
  84. {$else int64funcresok}
  85. function case_get_max(root : pcaserecord) : longint;
  86. {$endif int64funcresok}
  87. { searches the lowest label }
  88. {$ifdef int64funcresok}
  89. function case_get_min(root : pcaserecord) : tconstexprint;
  90. {$else int64funcresok}
  91. function case_get_min(root : pcaserecord) : longint;
  92. {$endif int64funcresok}
  93. function gencasenode(l,r : tnode;nodes : pcaserecord) : tnode;
  94. implementation
  95. uses
  96. globtype,systems,
  97. verbose,
  98. symconst,symdef,symsym,defutil,defcmp,
  99. htypechk,pass_1,
  100. nbas,ncnv,ncon,nld,cgobj,cgbase;
  101. function gencasenode(l,r : tnode;nodes : pcaserecord) : tnode;
  102. var
  103. t : tnode;
  104. begin
  105. t:=ccasenode.create(l,r,nodes);
  106. gencasenode:=t;
  107. end;
  108. {*****************************************************************************
  109. TSETELEMENTNODE
  110. *****************************************************************************}
  111. constructor tsetelementnode.create(l,r : tnode);
  112. begin
  113. inherited create(setelementn,l,r);
  114. end;
  115. function tsetelementnode.det_resulttype:tnode;
  116. begin
  117. result:=nil;
  118. resulttypepass(left);
  119. if assigned(right) then
  120. resulttypepass(right);
  121. set_varstate(left,vs_used,true);
  122. if codegenerror then
  123. exit;
  124. resulttype:=left.resulttype;
  125. end;
  126. function tsetelementnode.pass_1 : tnode;
  127. begin
  128. result:=nil;
  129. firstpass(left);
  130. if assigned(right) then
  131. firstpass(right);
  132. if codegenerror then
  133. exit;
  134. expectloc:=left.expectloc;
  135. calcregisters(self,0,0,0);
  136. end;
  137. {*****************************************************************************
  138. TINNODE
  139. *****************************************************************************}
  140. constructor tinnode.create(l,r : tnode);
  141. begin
  142. inherited create(inn,l,r);
  143. end;
  144. function tinnode.det_resulttype:tnode;
  145. var
  146. t : tnode;
  147. pst : pconstset;
  148. function createsetconst(psd : tsetdef) : pconstset;
  149. var
  150. pcs : pconstset;
  151. pes : tenumsym;
  152. i : longint;
  153. begin
  154. new(pcs);
  155. case psd.elementtype.def.deftype of
  156. enumdef :
  157. begin
  158. pes:=tenumsym(tenumdef(psd.elementtype.def).firstenum);
  159. while assigned(pes) do
  160. begin
  161. include(pcs^,pes.value);
  162. pes:=pes.nextenum;
  163. end;
  164. end;
  165. orddef :
  166. begin
  167. for i:=torddef(psd.elementtype.def).low to torddef(psd.elementtype.def).high do
  168. include(pcs^,i);
  169. end;
  170. end;
  171. createsetconst:=pcs;
  172. end;
  173. begin
  174. result:=nil;
  175. resulttype:=booltype;
  176. resulttypepass(right);
  177. set_varstate(right,vs_used,true);
  178. if codegenerror then
  179. exit;
  180. { Convert array constructor first to set }
  181. if is_array_constructor(right.resulttype.def) then
  182. begin
  183. arrayconstructor_to_set(right);
  184. firstpass(right);
  185. if codegenerror then
  186. exit;
  187. end;
  188. if right.resulttype.def.deftype<>setdef then
  189. CGMessage(sym_e_set_expected);
  190. if (right.nodetype=typen) then
  191. begin
  192. { we need to create a setconstn }
  193. pst:=createsetconst(tsetdef(ttypenode(right).resulttype.def));
  194. t:=csetconstnode.create(pst,ttypenode(right).resulttype);
  195. dispose(pst);
  196. right.free;
  197. right:=t;
  198. end;
  199. resulttypepass(left);
  200. set_varstate(left,vs_used,true);
  201. if codegenerror then
  202. exit;
  203. if not assigned(left.resulttype.def) then
  204. internalerror(20021126);
  205. { insert a hint that a range check error might occur on non-byte
  206. elements.with the in operator.
  207. }
  208. if (
  209. (left.resulttype.def.deftype = orddef) and not
  210. (torddef(left.resulttype.def).typ in [s8bit,u8bit,uchar,bool8bit])
  211. )
  212. or
  213. (
  214. (left.resulttype.def.deftype = enumdef)
  215. and (tenumdef(left.resulttype.def).size <> 1)
  216. )
  217. then
  218. Message(type_h_in_range_check);
  219. { type conversion/check }
  220. if assigned(tsetdef(right.resulttype.def).elementtype.def) then
  221. begin
  222. inserttypeconv(left,tsetdef(right.resulttype.def).elementtype);
  223. end;
  224. { empty set then return false }
  225. if not assigned(tsetdef(right.resulttype.def).elementtype.def) or
  226. ((right.nodetype = setconstn) and
  227. (tnormalset(tsetconstnode(right).value_set^) = [])) then
  228. begin
  229. t:=cordconstnode.create(0,booltype,false);
  230. resulttypepass(t);
  231. result:=t;
  232. exit;
  233. end;
  234. { constant evaluation }
  235. if (left.nodetype=ordconstn) and (right.nodetype=setconstn) then
  236. begin
  237. t:=cordconstnode.create(byte(tordconstnode(left).value in Tsetconstnode(right).value_set^),
  238. booltype,true);
  239. resulttypepass(t);
  240. result:=t;
  241. exit;
  242. end;
  243. end;
  244. { Warning : This is the first pass for the generic version }
  245. { the only difference is mainly the result location which }
  246. { is changed, compared to the i386 version. }
  247. { ALSO REGISTER ALLOC IS WRONG? }
  248. function tinnode.pass_1 : tnode;
  249. begin
  250. result:=nil;
  251. expectloc:=LOC_REGISTER;
  252. firstpass(right);
  253. firstpass(left);
  254. if codegenerror then
  255. exit;
  256. left_right_max;
  257. if tsetdef(right.resulttype.def).settype<>smallset then
  258. begin
  259. if registers32 < 3 then
  260. registers32 := 3;
  261. end
  262. else
  263. begin
  264. { a smallset needs maybe an misc. register }
  265. if (left.nodetype<>ordconstn) and
  266. not(right.expectloc in [LOC_CREGISTER,LOC_REGISTER]) and
  267. (right.registers32<1) then
  268. inc(registers32);
  269. end;
  270. end;
  271. {*****************************************************************************
  272. TRANGENODE
  273. *****************************************************************************}
  274. constructor trangenode.create(l,r : tnode);
  275. begin
  276. inherited create(rangen,l,r);
  277. end;
  278. function trangenode.det_resulttype : tnode;
  279. begin
  280. result:=nil;
  281. resulttypepass(left);
  282. resulttypepass(right);
  283. set_varstate(left,vs_used,true);
  284. set_varstate(right,vs_used,true);
  285. if codegenerror then
  286. exit;
  287. { both types must be compatible }
  288. if compare_defs(left.resulttype.def,right.resulttype.def,left.nodetype)=te_incompatible then
  289. CGMessage(type_e_mismatch);
  290. { Check if only when its a constant set }
  291. if (left.nodetype=ordconstn) and (right.nodetype=ordconstn) then
  292. begin
  293. { upper limit must be greater or equal than lower limit }
  294. if (tordconstnode(left).value>tordconstnode(right).value) and
  295. ((tordconstnode(left).value<0) or (tordconstnode(right).value>=0)) then
  296. CGMessage(cg_e_upper_lower_than_lower);
  297. end;
  298. resulttype:=left.resulttype;
  299. end;
  300. function trangenode.pass_1 : tnode;
  301. begin
  302. result:=nil;
  303. firstpass(left);
  304. firstpass(right);
  305. if codegenerror then
  306. exit;
  307. left_right_max;
  308. expectloc:=left.expectloc;
  309. end;
  310. {*****************************************************************************
  311. Case Helpers
  312. *****************************************************************************}
  313. function case_count_labels(root : pcaserecord) : longint;
  314. var
  315. _l : longint;
  316. procedure count(p : pcaserecord);
  317. begin
  318. inc(_l);
  319. if assigned(p^.less) then
  320. count(p^.less);
  321. if assigned(p^.greater) then
  322. count(p^.greater);
  323. end;
  324. begin
  325. _l:=0;
  326. count(root);
  327. case_count_labels:=_l;
  328. end;
  329. {$ifdef int64funcresok}
  330. function case_get_max(root : pcaserecord) : tconstexprint;
  331. {$else int64funcresok}
  332. function case_get_max(root : pcaserecord) : longint;
  333. {$endif int64funcresok}
  334. var
  335. hp : pcaserecord;
  336. begin
  337. hp:=root;
  338. while assigned(hp^.greater) do
  339. hp:=hp^.greater;
  340. case_get_max:=hp^._high;
  341. end;
  342. {$ifdef int64funcresok}
  343. function case_get_min(root : pcaserecord) : tconstexprint;
  344. {$else int64funcresok}
  345. function case_get_min(root : pcaserecord) : longint;
  346. {$endif int64funcresok}
  347. var
  348. hp : pcaserecord;
  349. begin
  350. hp:=root;
  351. while assigned(hp^.less) do
  352. hp:=hp^.less;
  353. case_get_min:=hp^._low;
  354. end;
  355. procedure deletecaselabels(p : pcaserecord);
  356. begin
  357. if assigned(p^.greater) then
  358. deletecaselabels(p^.greater);
  359. if assigned(p^.less) then
  360. deletecaselabels(p^.less);
  361. dispose(p);
  362. end;
  363. function copycaserecord(p : pcaserecord) : pcaserecord;
  364. var
  365. n : pcaserecord;
  366. begin
  367. new(n);
  368. n^:=p^;
  369. if assigned(p^.greater) then
  370. n^.greater:=copycaserecord(p^.greater);
  371. if assigned(p^.less) then
  372. n^.less:=copycaserecord(p^.less);
  373. copycaserecord:=n;
  374. end;
  375. procedure ppuwritecaserecord(ppufile:tcompilerppufile;p : pcaserecord);
  376. var
  377. b : byte;
  378. begin
  379. ppufile.putexprint(p^._low);
  380. ppufile.putexprint(p^._high);
  381. ppufile.putasmsymbol(p^._at);
  382. ppufile.putasmsymbol(p^.statement);
  383. ppufile.putbyte(byte(p^.firstlabel));
  384. b:=0;
  385. if assigned(p^.greater) then
  386. b:=b or 1;
  387. if assigned(p^.less) then
  388. b:=b or 2;
  389. ppufile.putbyte(b);
  390. if assigned(p^.greater) then
  391. ppuwritecaserecord(ppufile,p^.greater);
  392. if assigned(p^.less) then
  393. ppuwritecaserecord(ppufile,p^.less);
  394. end;
  395. function ppuloadcaserecord(ppufile:tcompilerppufile):pcaserecord;
  396. var
  397. b : byte;
  398. p : pcaserecord;
  399. begin
  400. new(p);
  401. p^._low:=ppufile.getexprint;
  402. p^._high:=ppufile.getexprint;
  403. p^._at:=tasmlabel(ppufile.getasmsymbol);
  404. p^.statement:=tasmlabel(ppufile.getasmsymbol);
  405. p^.firstlabel:=boolean(ppufile.getbyte);
  406. b:=ppufile.getbyte;
  407. if (b and 1)=1 then
  408. p^.greater:=ppuloadcaserecord(ppufile)
  409. else
  410. p^.greater:=nil;
  411. if (b and 2)=2 then
  412. p^.less:=ppuloadcaserecord(ppufile)
  413. else
  414. p^.less:=nil;
  415. ppuloadcaserecord:=p;
  416. end;
  417. procedure ppuderefcaserecord(p : pcaserecord);
  418. begin
  419. objectlibrary.derefasmsymbol(tasmsymbol(p^._at));
  420. objectlibrary.derefasmsymbol(tasmsymbol(p^.statement));
  421. if assigned(p^.greater) then
  422. ppuderefcaserecord(p^.greater);
  423. if assigned(p^.less) then
  424. ppuderefcaserecord(p^.less);
  425. end;
  426. {*****************************************************************************
  427. TCASENODE
  428. *****************************************************************************}
  429. constructor tcasenode.create(l,r : tnode;n : pcaserecord);
  430. begin
  431. inherited create(casen,l,r);
  432. nodes:=n;
  433. elseblock:=nil;
  434. set_file_line(l);
  435. end;
  436. destructor tcasenode.destroy;
  437. begin
  438. elseblock.free;
  439. deletecaselabels(nodes);
  440. inherited destroy;
  441. end;
  442. constructor tcasenode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  443. begin
  444. inherited ppuload(t,ppufile);
  445. elseblock:=ppuloadnode(ppufile);
  446. nodes:=ppuloadcaserecord(ppufile);
  447. end;
  448. procedure tcasenode.ppuwrite(ppufile:tcompilerppufile);
  449. begin
  450. inherited ppuwrite(ppufile);
  451. ppuwritenode(ppufile,elseblock);
  452. ppuwritecaserecord(ppufile,nodes);
  453. end;
  454. procedure tcasenode.buildderefimpl;
  455. begin
  456. inherited buildderefimpl;
  457. if assigned(elseblock) then
  458. elseblock.buildderefimpl;
  459. {ppubuildderefimplcaserecord(nodes);}
  460. end;
  461. procedure tcasenode.derefimpl;
  462. begin
  463. inherited derefimpl;
  464. if assigned(elseblock) then
  465. elseblock.derefimpl;
  466. ppuderefcaserecord(nodes);
  467. end;
  468. function tcasenode.det_resulttype : tnode;
  469. begin
  470. result:=nil;
  471. resulttype:=voidtype;
  472. end;
  473. function tcasenode.pass_1 : tnode;
  474. var
  475. old_t_times : longint;
  476. hp : tstatementnode;
  477. begin
  478. result:=nil;
  479. expectloc:=LOC_VOID;
  480. { evalutes the case expression }
  481. firstpass(left);
  482. set_varstate(left,vs_used,true);
  483. if codegenerror then
  484. exit;
  485. registers32:=left.registers32;
  486. registersfpu:=left.registersfpu;
  487. {$ifdef SUPPORT_MMX}
  488. registersmmx:=left.registersmmx;
  489. {$endif SUPPORT_MMX}
  490. { walk through all instructions }
  491. { estimates the repeat of each instruction }
  492. old_t_times:=cg.t_times;
  493. if not(cs_littlesize in aktglobalswitches) then
  494. begin
  495. cg.t_times:=cg.t_times div case_count_labels(nodes);
  496. if cg.t_times<1 then
  497. cg.t_times:=1;
  498. end;
  499. { first case }
  500. hp:=tstatementnode(right);
  501. while assigned(hp) do
  502. begin
  503. firstpass(hp.left);
  504. { searchs max registers }
  505. if hp.left.registers32>registers32 then
  506. registers32:=hp.left.registers32;
  507. if hp.left.registersfpu>registersfpu then
  508. registersfpu:=hp.left.registersfpu;
  509. {$ifdef SUPPORT_MMX}
  510. if hp.left.registersmmx>registersmmx then
  511. registersmmx:=hp.left.registersmmx;
  512. {$endif SUPPORT_MMX}
  513. hp:=tstatementnode(hp.right);
  514. end;
  515. { may be handle else tree }
  516. if assigned(elseblock) then
  517. begin
  518. firstpass(elseblock);
  519. if codegenerror then
  520. exit;
  521. if registers32<elseblock.registers32 then
  522. registers32:=elseblock.registers32;
  523. if registersfpu<elseblock.registersfpu then
  524. registersfpu:=elseblock.registersfpu;
  525. {$ifdef SUPPORT_MMX}
  526. if registersmmx<elseblock.registersmmx then
  527. registersmmx:=elseblock.registersmmx;
  528. {$endif SUPPORT_MMX}
  529. end;
  530. cg.t_times:=old_t_times;
  531. { there is one register required for the case expression }
  532. { for 64 bit ints we cheat: the high dword is stored in EDI }
  533. { so we don't need an extra register }
  534. if registers32<1 then registers32:=1;
  535. end;
  536. function tcasenode.getcopy : tnode;
  537. var
  538. p : tcasenode;
  539. begin
  540. p:=tcasenode(inherited getcopy);
  541. if assigned(elseblock) then
  542. p.elseblock:=elseblock.getcopy
  543. else
  544. p.elseblock:=nil;
  545. if assigned(nodes) then
  546. p.nodes:=copycaserecord(nodes)
  547. else
  548. p.nodes:=nil;
  549. getcopy:=p;
  550. end;
  551. procedure tcasenode.insertintolist(l : tnodelist);
  552. begin
  553. end;
  554. function casenodesequal(n1,n2: pcaserecord): boolean;
  555. begin
  556. casenodesequal :=
  557. (not assigned(n1) and not assigned(n2)) or
  558. (assigned(n1) and assigned(n2) and
  559. (n1^._low = n2^._low) and
  560. (n1^._high = n2^._high) and
  561. { the rest of the fields don't matter for equality (JM) }
  562. casenodesequal(n1^.less,n2^.less) and
  563. casenodesequal(n1^.greater,n2^.greater))
  564. end;
  565. function tcasenode.docompare(p: tnode): boolean;
  566. begin
  567. docompare :=
  568. inherited docompare(p) and
  569. casenodesequal(nodes,tcasenode(p).nodes) and
  570. elseblock.isequal(tcasenode(p).elseblock);
  571. end;
  572. begin
  573. csetelementnode:=tsetelementnode;
  574. cinnode:=tinnode;
  575. crangenode:=trangenode;
  576. ccasenode:=tcasenode;
  577. end.
  578. {
  579. $Log$
  580. Revision 1.49 2003-10-23 14:44:07 peter
  581. * splitted buildderef and buildderefimpl to fix interface crc
  582. calculation
  583. Revision 1.48 2003/10/22 20:40:00 peter
  584. * write derefdata in a separate ppu entry
  585. Revision 1.47 2003/10/09 21:31:37 daniel
  586. * Register allocator splitted, ans abstract now
  587. Revision 1.46 2003/10/08 19:19:45 peter
  588. * set_varstate cleanup
  589. Revision 1.45 2003/10/01 20:34:49 peter
  590. * procinfo unit contains tprocinfo
  591. * cginfo renamed to cgbase
  592. * moved cgmessage to verbose
  593. * fixed ppc and sparc compiles
  594. Revision 1.44 2003/09/03 15:55:01 peter
  595. * NEWRA branch merged
  596. Revision 1.43 2003/06/12 22:09:54 jonas
  597. * tcginnode.pass_2 doesn't call a helper anymore in any case
  598. * fixed ungetregisterfpu compilation problems
  599. Revision 1.42 2003/05/13 19:14:41 peter
  600. * failn removed
  601. * inherited result code check moven to pexpr
  602. Revision 1.41 2003/04/27 11:21:33 peter
  603. * aktprocdef renamed to current_procdef
  604. * procinfo renamed to current_procinfo
  605. * procinfo will now be stored in current_module so it can be
  606. cleaned up properly
  607. * gen_main_procsym changed to create_main_proc and release_main_proc
  608. to also generate a tprocinfo structure
  609. * fixed unit implicit initfinal
  610. Revision 1.40 2003/04/25 08:25:26 daniel
  611. * Ifdefs around a lot of calls to cleartempgen
  612. * Fixed registers that are allocated but not freed in several nodes
  613. * Tweak to register allocator to cause less spills
  614. * 8-bit registers now interfere with esi,edi and ebp
  615. Compiler can now compile rtl successfully when using new register
  616. allocator
  617. Revision 1.39 2003/04/22 23:50:23 peter
  618. * firstpass uses expectloc
  619. * checks if there are differences between the expectloc and
  620. location.loc from secondpass in EXTDEBUG
  621. Revision 1.38 2002/12/07 14:12:56 carl
  622. - removed unused variable
  623. Revision 1.37 2002/11/27 02:37:14 peter
  624. * case statement inlining added
  625. * fixed inlining of write()
  626. * switched statementnode left and right parts so the statements are
  627. processed in the correct order when getcopy is used. This is
  628. required for tempnodes
  629. Revision 1.36 2002/11/26 21:52:38 carl
  630. + hint for in operator with non byte sized operand
  631. Revision 1.35 2002/11/25 17:43:21 peter
  632. * splitted defbase in defutil,symutil,defcmp
  633. * merged isconvertable and is_equal into compare_defs(_ext)
  634. * made operator search faster by walking the list only once
  635. Revision 1.34 2002/10/05 12:43:25 carl
  636. * fixes for Delphi 6 compilation
  637. (warning : Some features do not work under Delphi)
  638. Revision 1.33 2002/09/07 12:16:03 carl
  639. * second part bug report 1996 fix, testrange in cordconstnode
  640. only called if option is set (also make parsing a tiny faster)
  641. Revision 1.32 2002/08/19 19:36:44 peter
  642. * More fixes for cross unit inlining, all tnodes are now implemented
  643. * Moved pocall_internconst to po_internconst because it is not a
  644. calling type at all and it conflicted when inlining of these small
  645. functions was requested
  646. Revision 1.31 2002/08/17 09:23:38 florian
  647. * first part of current_procinfo rewrite
  648. Revision 1.30 2002/07/23 13:19:40 jonas
  649. * fixed evaluation of expressions with empty sets that are calculated
  650. at compile time
  651. Revision 1.29 2002/07/23 12:34:30 daniel
  652. * Readded old set code. To use it define 'oldset'. Activated by default
  653. for ppc.
  654. Revision 1.28 2002/07/22 11:48:04 daniel
  655. * Sets are now internally sets.
  656. Revision 1.27 2002/07/20 11:57:55 florian
  657. * types.pas renamed to defbase.pas because D6 contains a types
  658. unit so this would conflicts if D6 programms are compiled
  659. + Willamette/SSE2 instructions to assembler added
  660. Revision 1.26 2002/07/06 20:19:25 carl
  661. + generic set handling
  662. Revision 1.25 2002/07/01 18:46:24 peter
  663. * internal linker
  664. * reorganized aasm layer
  665. Revision 1.24 2002/05/18 13:34:10 peter
  666. * readded missing revisions
  667. Revision 1.23 2002/05/16 19:46:39 carl
  668. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  669. + try to fix temp allocation (still in ifdef)
  670. + generic constructor calls
  671. + start of tassembler / tmodulebase class cleanup
  672. Revision 1.21 2002/05/12 16:53:08 peter
  673. * moved entry and exitcode to ncgutil and cgobj
  674. * foreach gets extra argument for passing local data to the
  675. iterator function
  676. * -CR checks also class typecasts at runtime by changing them
  677. into as
  678. * fixed compiler to cycle with the -CR option
  679. * fixed stabs with elf writer, finally the global variables can
  680. be watched
  681. * removed a lot of routines from cga unit and replaced them by
  682. calls to cgobj
  683. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  684. u32bit then the other is typecasted also to u32bit without giving
  685. a rangecheck warning/error.
  686. * fixed pascal calling method with reversing also the high tree in
  687. the parast, detected by tcalcst3 test
  688. Revision 1.20 2002/04/07 13:27:50 carl
  689. + change unit use
  690. Revision 1.19 2002/04/02 17:11:29 peter
  691. * tlocation,treference update
  692. * LOC_CONSTANT added for better constant handling
  693. * secondadd splitted in multiple routines
  694. * location_force_reg added for loading a location to a register
  695. of a specified size
  696. * secondassignment parses now first the right and then the left node
  697. (this is compatible with Kylix). This saves a lot of push/pop especially
  698. with string operations
  699. * adapted some routines to use the new cg methods
  700. Revision 1.18 2002/03/31 20:26:35 jonas
  701. + a_loadfpu_* and a_loadmm_* methods in tcg
  702. * register allocation is now handled by a class and is mostly processor
  703. independent (+rgobj.pas and i386/rgcpu.pas)
  704. * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  705. * some small improvements and fixes to the optimizer
  706. * some register allocation fixes
  707. * some fpuvaroffset fixes in the unary minus node
  708. * push/popusedregisters is now called rg.save/restoreusedregisters and
  709. (for i386) uses temps instead of push/pop's when using -Op3 (that code is
  710. also better optimizable)
  711. * fixed and optimized register saving/restoring for new/dispose nodes
  712. * LOC_FPU locations now also require their "register" field to be set to
  713. R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  714. - list field removed of the tnode class because it's not used currently
  715. and can cause hard-to-find bugs
  716. }