nset.pas 26 KB

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