nbas.pas 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  1. {
  2. $Id$
  3. Copyright (c) 2000 by Florian Klaempfl
  4. This unit implements some basic 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 nbas;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. aasm,symtype,node,cpubase;
  23. type
  24. tnothingnode = class(tnode)
  25. constructor create;virtual;
  26. function pass_1 : tnode;override;
  27. function det_resulttype:tnode;override;
  28. end;
  29. tnothingnodeclass = class of tnothingnode;
  30. terrornode = class(tnode)
  31. constructor create;virtual;
  32. function pass_1 : tnode;override;
  33. function det_resulttype:tnode;override;
  34. end;
  35. terrornodeclass = class of terrornode;
  36. tasmnode = class(tnode)
  37. p_asm : taasmoutput;
  38. constructor create(p : taasmoutput);virtual;
  39. destructor destroy;override;
  40. function getcopy : tnode;override;
  41. function pass_1 : tnode;override;
  42. function det_resulttype:tnode;override;
  43. function docompare(p: tnode): boolean; override;
  44. end;
  45. tasmnodeclass = class of tasmnode;
  46. tstatementnode = class(tbinarynode)
  47. constructor create(l,r : tnode);virtual;
  48. function pass_1 : tnode;override;
  49. function det_resulttype:tnode;override;
  50. {$ifdef extdebug}
  51. procedure dowrite;override;
  52. {$endif extdebug}
  53. end;
  54. tstatementnodeclass = class of tstatementnode;
  55. tblocknode = class(tunarynode)
  56. constructor create(l : tnode);virtual;
  57. function pass_1 : tnode;override;
  58. function det_resulttype:tnode;override;
  59. end;
  60. tblocknodeclass = class of tblocknode;
  61. { to allow access to the location by temp references even after the temp has }
  62. { already been disposed and to make sure the coherency between temps and }
  63. { temp references is kept after a getcopy }
  64. ptempinfo = ^ttempinfo;
  65. ttempinfo = record
  66. { set to the copy of a tempcreate pnode (if it gets copied) so that the }
  67. { refs and deletenode can hook to this copy once they get copied too }
  68. hookoncopy : ptempinfo;
  69. ref : treference;
  70. restype : ttype;
  71. valid : boolean;
  72. end;
  73. { a node which will create a (non)persistent temp of a given type with a given }
  74. { size (the size is separate to allow creating "void" temps with a custom size) }
  75. ttempcreatenode = class(tnode)
  76. size: longint;
  77. tempinfo: ptempinfo;
  78. persistent: boolean;
  79. { * persistent temps are used in manually written code where the temp }
  80. { be usable among different statements and where you can manually say }
  81. { when the temp has to be freed (using a ttempdeletenode) }
  82. { * non-persistent temps are mostly used in typeconversion helpers, }
  83. { where the node that receives the temp becomes responsible for }
  84. { freeing it. In this last case, you should use only one reference }
  85. { to it and *not* generate a ttempdeletenode }
  86. constructor create(const _restype: ttype; _size: longint; _persistent: boolean); virtual;
  87. function getcopy: tnode; override;
  88. function pass_1 : tnode; override;
  89. function det_resulttype: tnode; override;
  90. function docompare(p: tnode): boolean; override;
  91. end;
  92. ttempcreatenodeclass = class of ttempcreatenode;
  93. { a node which is a reference to a certain temp }
  94. ttemprefnode = class(tnode)
  95. constructor create(const temp: ttempcreatenode); virtual;
  96. constructor create_offset(const temp: ttempcreatenode;aoffset:longint);
  97. function getcopy: tnode; override;
  98. function pass_1 : tnode; override;
  99. function det_resulttype : tnode; override;
  100. function docompare(p: tnode): boolean; override;
  101. protected
  102. tempinfo: ptempinfo;
  103. offset : longint;
  104. end;
  105. ttemprefnodeclass = class of ttemprefnode;
  106. { a node which removes a temp }
  107. ttempdeletenode = class(tnode)
  108. constructor create(const temp: ttempcreatenode);
  109. { this will convert the persistant temp to a normal temp
  110. for returning to the other nodes }
  111. constructor create_normal_temp(const temp: ttempcreatenode);
  112. function getcopy: tnode; override;
  113. function pass_1: tnode; override;
  114. function det_resulttype: tnode; override;
  115. function docompare(p: tnode): boolean; override;
  116. destructor destroy; override;
  117. protected
  118. tempinfo: ptempinfo;
  119. release_to_normal : boolean;
  120. end;
  121. ttempdeletenodeclass = class of ttempdeletenode;
  122. var
  123. cnothingnode : tnothingnodeclass;
  124. cerrornode : terrornodeclass;
  125. casmnode : tasmnodeclass;
  126. cstatementnode : tstatementnodeclass;
  127. cblocknode : tblocknodeclass;
  128. ctempcreatenode : ttempcreatenodeclass;
  129. ctemprefnode : ttemprefnodeclass;
  130. ctempdeletenode : ttempdeletenodeclass;
  131. { Create a blocknode and statement node for multiple statements
  132. generated internally by the parser }
  133. function internalstatements(var laststatement:tstatementnode):tblocknode;
  134. procedure addstatement(var laststatement:tstatementnode;n:tnode);
  135. implementation
  136. uses
  137. cutils,
  138. verbose,globals,globtype,systems,
  139. symconst,symdef,symsym,types,
  140. pass_1,
  141. ncal,nflw,rgobj,cgbase
  142. ;
  143. {*****************************************************************************
  144. Helpers
  145. *****************************************************************************}
  146. function internalstatements(var laststatement:tstatementnode):tblocknode;
  147. begin
  148. { create dummy initial statement }
  149. laststatement := cstatementnode.create(nil,cnothingnode.create);
  150. internalstatements := cblocknode.create(laststatement);
  151. end;
  152. procedure addstatement(var laststatement:tstatementnode;n:tnode);
  153. begin
  154. if assigned(laststatement.left) then
  155. internalerror(200204201);
  156. laststatement.left:=cstatementnode.create(nil,n);
  157. laststatement:=tstatementnode(laststatement.left);
  158. end;
  159. {*****************************************************************************
  160. TFIRSTNOTHING
  161. *****************************************************************************}
  162. constructor tnothingnode.create;
  163. begin
  164. inherited create(nothingn);
  165. end;
  166. function tnothingnode.det_resulttype:tnode;
  167. begin
  168. result:=nil;
  169. resulttype:=voidtype;
  170. end;
  171. function tnothingnode.pass_1 : tnode;
  172. begin
  173. result:=nil;
  174. end;
  175. {*****************************************************************************
  176. TFIRSTERROR
  177. *****************************************************************************}
  178. constructor terrornode.create;
  179. begin
  180. inherited create(errorn);
  181. end;
  182. function terrornode.det_resulttype:tnode;
  183. begin
  184. result:=nil;
  185. include(flags,nf_error);
  186. codegenerror:=true;
  187. resulttype:=generrortype;
  188. end;
  189. function terrornode.pass_1 : tnode;
  190. begin
  191. result:=nil;
  192. codegenerror:=true;
  193. end;
  194. {*****************************************************************************
  195. TSTATEMENTNODE
  196. *****************************************************************************}
  197. constructor tstatementnode.create(l,r : tnode);
  198. begin
  199. inherited create(statementn,l,r);
  200. end;
  201. function tstatementnode.det_resulttype:tnode;
  202. begin
  203. result:=nil;
  204. resulttype:=voidtype;
  205. { right is the statement itself calln assignn or a complex one }
  206. resulttypepass(right);
  207. if (not (cs_extsyntax in aktmoduleswitches)) and
  208. assigned(right.resulttype.def) and
  209. not((right.nodetype=calln) and
  210. (tcallnode(right).procdefinition.proctypeoption=potype_constructor)) and
  211. not(is_void(right.resulttype.def)) then
  212. CGMessage(cg_e_illegal_expression);
  213. if codegenerror then
  214. exit;
  215. { left is the next in the list }
  216. resulttypepass(left);
  217. if codegenerror then
  218. exit;
  219. end;
  220. function tstatementnode.pass_1 : tnode;
  221. begin
  222. result:=nil;
  223. { no temps over several statements }
  224. rg.cleartempgen;
  225. { right is the statement itself calln assignn or a complex one }
  226. firstpass(right);
  227. if codegenerror then
  228. exit;
  229. location.loc:=right.location.loc;
  230. registers32:=right.registers32;
  231. registersfpu:=right.registersfpu;
  232. {$ifdef SUPPORT_MMX}
  233. registersmmx:=right.registersmmx;
  234. {$endif SUPPORT_MMX}
  235. { left is the next in the list }
  236. firstpass(left);
  237. if codegenerror then
  238. exit;
  239. if right.registers32>registers32 then
  240. registers32:=right.registers32;
  241. if right.registersfpu>registersfpu then
  242. registersfpu:=right.registersfpu;
  243. {$ifdef SUPPORT_MMX}
  244. if right.registersmmx>registersmmx then
  245. registersmmx:=right.registersmmx;
  246. {$endif}
  247. end;
  248. {$ifdef extdebug}
  249. procedure tstatementnode.dowrite;
  250. begin
  251. { can't use inherited dowrite, because that will use the
  252. binary which we don't want for statements }
  253. dowritenodetype;
  254. writeln(',');
  255. { write the statement }
  256. writenodeindention:=writenodeindention+' ';
  257. writenode(right);
  258. writeln(')');
  259. delete(writenodeindention,1,4);
  260. { go on with the next statement }
  261. writenode(left);
  262. end;
  263. {$endif}
  264. {*****************************************************************************
  265. TBLOCKNODE
  266. *****************************************************************************}
  267. constructor tblocknode.create(l : tnode);
  268. begin
  269. inherited create(blockn,l);
  270. end;
  271. function tblocknode.det_resulttype:tnode;
  272. var
  273. hp : tstatementnode;
  274. begin
  275. result:=nil;
  276. resulttype:=voidtype;
  277. hp:=tstatementnode(left);
  278. while assigned(hp) do
  279. begin
  280. if assigned(hp.right) then
  281. begin
  282. codegenerror:=false;
  283. resulttypepass(hp.right);
  284. if (not (cs_extsyntax in aktmoduleswitches)) and
  285. assigned(hp.right.resulttype.def) and
  286. not((hp.right.nodetype=calln) and
  287. (tcallnode(hp.right).procdefinition.proctypeoption=potype_constructor)) and
  288. not(is_void(hp.right.resulttype.def)) then
  289. CGMessage(cg_e_illegal_expression);
  290. { the resulttype of the block is the last type that is
  291. returned. Normally this is a voidtype. But when the
  292. compiler inserts a block of multiple statements then the
  293. last entry can return a value }
  294. resulttype:=hp.right.resulttype;
  295. end;
  296. hp:=tstatementnode(hp.left);
  297. end;
  298. end;
  299. function tblocknode.pass_1 : tnode;
  300. var
  301. hp : tstatementnode;
  302. count : longint;
  303. begin
  304. result:=nil;
  305. count:=0;
  306. hp:=tstatementnode(left);
  307. while assigned(hp) do
  308. begin
  309. if cs_regalloc in aktglobalswitches then
  310. begin
  311. { node transformations }
  312. { concat function result to exit }
  313. { this is wrong for string or other complex
  314. result types !!! }
  315. if {ret_in_acc(aktprocdef.rettype.def) and }
  316. (is_ordinal(aktprocdef.rettype.def) or
  317. is_smallset(aktprocdef.rettype.def)) and
  318. assigned(hp.left) and
  319. assigned(tstatementnode(hp.left).right) and
  320. (tstatementnode(hp.left).right.nodetype=exitn) and
  321. (hp.right.nodetype=assignn) and
  322. { !!!! this tbinarynode should be tassignmentnode }
  323. (tbinarynode(hp.right).left.nodetype=funcretn) then
  324. begin
  325. if assigned(texitnode(tstatementnode(hp.left).right).left) then
  326. CGMessage(cg_n_inefficient_code)
  327. else
  328. begin
  329. texitnode(tstatementnode(hp.left).right).left:=tstatementnode(hp.right).right;
  330. tstatementnode(hp.right).right:=nil;
  331. hp.right.free;
  332. hp.right:=nil;
  333. end;
  334. end
  335. { warning if unreachable code occurs and elimate this }
  336. else if (hp.right.nodetype in
  337. [exitn,breakn,continuen,goton]) and
  338. { statement node (JM) }
  339. assigned(hp.left) and
  340. { kind of statement! (JM) }
  341. assigned(tstatementnode(hp.left).right) and
  342. (tstatementnode(hp.left).right.nodetype<>labeln) then
  343. begin
  344. { use correct line number }
  345. aktfilepos:=hp.left.fileinfo;
  346. hp.left.free;
  347. hp.left:=nil;
  348. CGMessage(cg_w_unreachable_code);
  349. { old lines }
  350. aktfilepos:=hp.right.fileinfo;
  351. end;
  352. end;
  353. if assigned(hp.right) then
  354. begin
  355. rg.cleartempgen;
  356. codegenerror:=false;
  357. firstpass(hp.right);
  358. hp.registers32:=hp.right.registers32;
  359. hp.registersfpu:=hp.right.registersfpu;
  360. {$ifdef SUPPORT_MMX}
  361. hp.registersmmx:=hp.right.registersmmx;
  362. {$endif SUPPORT_MMX}
  363. end
  364. else
  365. hp.registers32:=0;
  366. if hp.registers32>registers32 then
  367. registers32:=hp.registers32;
  368. if hp.registersfpu>registersfpu then
  369. registersfpu:=hp.registersfpu;
  370. {$ifdef SUPPORT_MMX}
  371. if hp.registersmmx>registersmmx then
  372. registersmmx:=hp.registersmmx;
  373. {$endif}
  374. location.loc:=hp.location.loc;
  375. inc(count);
  376. hp:=tstatementnode(hp.left);
  377. end;
  378. end;
  379. {*****************************************************************************
  380. TASMNODE
  381. *****************************************************************************}
  382. constructor tasmnode.create(p : taasmoutput);
  383. begin
  384. inherited create(asmn);
  385. p_asm:=p;
  386. end;
  387. destructor tasmnode.destroy;
  388. begin
  389. if assigned(p_asm) then
  390. p_asm.free;
  391. inherited destroy;
  392. end;
  393. function tasmnode.getcopy: tnode;
  394. var
  395. n: tasmnode;
  396. begin
  397. n := tasmnode(inherited getcopy);
  398. if assigned(p_asm) then
  399. begin
  400. n.p_asm:=taasmoutput.create;
  401. n.p_asm.concatlistcopy(p_asm);
  402. end
  403. else n.p_asm := nil;
  404. getcopy := n;
  405. end;
  406. function tasmnode.det_resulttype:tnode;
  407. begin
  408. result:=nil;
  409. resulttype:=voidtype;
  410. end;
  411. function tasmnode.pass_1 : tnode;
  412. begin
  413. result:=nil;
  414. procinfo^.flags:=procinfo^.flags or pi_uses_asm;
  415. end;
  416. function tasmnode.docompare(p: tnode): boolean;
  417. begin
  418. { comparing of asmlists is not implemented (JM) }
  419. docompare := false;
  420. end;
  421. {*****************************************************************************
  422. TEMPCREATENODE
  423. *****************************************************************************}
  424. constructor ttempcreatenode.create(const _restype: ttype; _size: longint; _persistent: boolean);
  425. begin
  426. inherited create(tempn);
  427. size := _size;
  428. new(tempinfo);
  429. fillchar(tempinfo^,sizeof(tempinfo^),0);
  430. tempinfo^.restype := _restype;
  431. persistent := _persistent;
  432. end;
  433. function ttempcreatenode.getcopy: tnode;
  434. var
  435. n: ttempcreatenode;
  436. begin
  437. n := ttempcreatenode(inherited getcopy);
  438. n.size := size;
  439. new(n.tempinfo);
  440. fillchar(n.tempinfo^,sizeof(n.tempinfo^),0);
  441. n.tempinfo^.restype := tempinfo^.restype;
  442. { signal the temprefs that the temp they point to has been copied, }
  443. { so that if the refs get copied as well, they can hook themselves }
  444. { to the copy of the temp }
  445. tempinfo^.hookoncopy := n.tempinfo;
  446. result := n;
  447. end;
  448. function ttempcreatenode.pass_1 : tnode;
  449. begin
  450. result := nil;
  451. end;
  452. function ttempcreatenode.det_resulttype: tnode;
  453. begin
  454. result := nil;
  455. { a tempcreatenode doesn't have a resulttype, only temprefnodes do }
  456. resulttype := voidtype;
  457. end;
  458. function ttempcreatenode.docompare(p: tnode): boolean;
  459. begin
  460. result :=
  461. inherited docompare(p) and
  462. (ttempcreatenode(p).size = size) and
  463. is_equal(ttempcreatenode(p).tempinfo^.restype.def,tempinfo^.restype.def);
  464. end;
  465. {*****************************************************************************
  466. TEMPREFNODE
  467. *****************************************************************************}
  468. constructor ttemprefnode.create(const temp: ttempcreatenode);
  469. begin
  470. inherited create(temprefn);
  471. tempinfo := temp.tempinfo;
  472. offset:=0;
  473. end;
  474. constructor ttemprefnode.create_offset(const temp: ttempcreatenode;aoffset:longint);
  475. begin
  476. self.create(temp);
  477. offset := aoffset;
  478. end;
  479. function ttemprefnode.getcopy: tnode;
  480. var
  481. n: ttemprefnode;
  482. begin
  483. n := ttemprefnode(inherited getcopy);
  484. if assigned(tempinfo^.hookoncopy) then
  485. { if the temp has been copied, assume it becomes a new }
  486. { temp which has to be hooked by the copied reference }
  487. begin
  488. { hook the ref to the copied temp }
  489. n.tempinfo := tempinfo^.hookoncopy;
  490. end
  491. else
  492. { if the temp we refer to hasn't been copied, assume }
  493. { we're just a new reference to that temp }
  494. begin
  495. n.tempinfo := tempinfo;
  496. end;
  497. result := n;
  498. end;
  499. function ttemprefnode.pass_1 : tnode;
  500. begin
  501. location.loc:=LOC_REFERENCE;
  502. result := nil;
  503. end;
  504. function ttemprefnode.det_resulttype: tnode;
  505. begin
  506. { check if the temp is already resulttype passed }
  507. if not assigned(tempinfo^.restype.def) then
  508. internalerror(200108233);
  509. result := nil;
  510. resulttype := tempinfo^.restype;
  511. end;
  512. function ttemprefnode.docompare(p: tnode): boolean;
  513. begin
  514. result :=
  515. inherited docompare(p) and
  516. (ttemprefnode(p).tempinfo = tempinfo);
  517. end;
  518. {*****************************************************************************
  519. TEMPDELETENODE
  520. *****************************************************************************}
  521. constructor ttempdeletenode.create(const temp: ttempcreatenode);
  522. begin
  523. inherited create(temprefn);
  524. tempinfo := temp.tempinfo;
  525. release_to_normal := false;
  526. if not temp.persistent then
  527. internalerror(200204211);
  528. end;
  529. constructor ttempdeletenode.create_normal_temp(const temp: ttempcreatenode);
  530. begin
  531. inherited create(temprefn);
  532. tempinfo := temp.tempinfo;
  533. release_to_normal := true;
  534. end;
  535. function ttempdeletenode.getcopy: tnode;
  536. var
  537. n: ttempdeletenode;
  538. begin
  539. n := ttempdeletenode(inherited getcopy);
  540. if assigned(tempinfo^.hookoncopy) then
  541. { if the temp has been copied, assume it becomes a new }
  542. { temp which has to be hooked by the copied deletenode }
  543. begin
  544. { hook the tempdeletenode to the copied temp }
  545. n.tempinfo := tempinfo^.hookoncopy;
  546. end
  547. else
  548. { if the temp we refer to hasn't been copied, we have a }
  549. { problem since that means we now have two delete nodes }
  550. { for one temp }
  551. internalerror(200108234);
  552. result := n;
  553. end;
  554. function ttempdeletenode.pass_1 : tnode;
  555. begin
  556. result := nil;
  557. end;
  558. function ttempdeletenode.det_resulttype: tnode;
  559. begin
  560. result := nil;
  561. resulttype := voidtype;
  562. end;
  563. function ttempdeletenode.docompare(p: tnode): boolean;
  564. begin
  565. result :=
  566. inherited docompare(p) and
  567. (ttemprefnode(p).tempinfo = tempinfo);
  568. end;
  569. destructor ttempdeletenode.destroy;
  570. begin
  571. dispose(tempinfo);
  572. end;
  573. begin
  574. cnothingnode:=tnothingnode;
  575. cerrornode:=terrornode;
  576. casmnode:=tasmnode;
  577. cstatementnode:=tstatementnode;
  578. cblocknode:=tblocknode;
  579. ctempcreatenode:=ttempcreatenode;
  580. ctemprefnode:=ttemprefnode;
  581. ctempdeletenode:=ttempdeletenode;
  582. end.
  583. {
  584. $Log$
  585. Revision 1.24 2002-05-16 19:46:37 carl
  586. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  587. + try to fix temp allocation (still in ifdef)
  588. + generic constructor calls
  589. + start of tassembler / tmodulebase class cleanup
  590. Revision 1.22 2002/04/23 19:16:34 peter
  591. * add pinline unit that inserts compiler supported functions using
  592. one or more statements
  593. * moved finalize and setlength from ninl to pinline
  594. Revision 1.21 2002/04/21 19:02:03 peter
  595. * removed newn and disposen nodes, the code is now directly
  596. inlined from pexpr
  597. * -an option that will write the secondpass nodes to the .s file, this
  598. requires EXTDEBUG define to actually write the info
  599. * fixed various internal errors and crashes due recent code changes
  600. Revision 1.20 2002/04/04 19:05:57 peter
  601. * removed unused units
  602. * use tlocation.size in cg.a_*loc*() routines
  603. Revision 1.19 2002/03/31 20:26:33 jonas
  604. + a_loadfpu_* and a_loadmm_* methods in tcg
  605. * register allocation is now handled by a class and is mostly processor
  606. independent (+rgobj.pas and i386/rgcpu.pas)
  607. * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  608. * some small improvements and fixes to the optimizer
  609. * some register allocation fixes
  610. * some fpuvaroffset fixes in the unary minus node
  611. * push/popusedregisters is now called rg.save/restoreusedregisters and
  612. (for i386) uses temps instead of push/pop's when using -Op3 (that code is
  613. also better optimizable)
  614. * fixed and optimized register saving/restoring for new/dispose nodes
  615. * LOC_FPU locations now also require their "register" field to be set to
  616. R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  617. - list field removed of the tnode class because it's not used currently
  618. and can cause hard-to-find bugs
  619. Revision 1.18 2001/11/02 22:58:01 peter
  620. * procsym definition rewrite
  621. Revision 1.17 2001/09/02 21:12:06 peter
  622. * move class of definitions into type section for delphi
  623. Revision 1.16 2001/08/26 13:36:38 florian
  624. * some cg reorganisation
  625. * some PPC updates
  626. Revision 1.15 2001/08/24 13:47:26 jonas
  627. * moved "reverseparameters" from ninl.pas to ncal.pas
  628. + support for non-persistent temps in ttempcreatenode.create, for use
  629. with typeconversion nodes
  630. Revision 1.14 2001/08/23 14:28:35 jonas
  631. + tempcreate/ref/delete nodes (allows the use of temps in the
  632. resulttype and first pass)
  633. * made handling of read(ln)/write(ln) processor independent
  634. * moved processor independent handling for str and reset/rewrite-typed
  635. from firstpass to resulttype pass
  636. * changed names of helpers in text.inc to be generic for use as
  637. compilerprocs + added "iocheck" directive for most of them
  638. * reading of ordinals is done by procedures instead of functions
  639. because otherwise FPC_IOCHECK overwrote the result before it could
  640. be stored elsewhere (range checking still works)
  641. * compilerprocs can now be used in the system unit before they are
  642. implemented
  643. * added note to errore.msg that booleans can't be read using read/readln
  644. Revision 1.13 2001/08/06 21:40:46 peter
  645. * funcret moved from tprocinfo to tprocdef
  646. Revision 1.12 2001/06/11 17:41:12 jonas
  647. * fixed web bug 1501 in conjunction with -Or
  648. Revision 1.11 2001/05/18 22:31:06 peter
  649. * tasmnode.pass_2 is independent of cpu, moved to ncgbas
  650. * include ncgbas for independent nodes
  651. Revision 1.10 2001/04/13 01:22:08 peter
  652. * symtable change to classes
  653. * range check generation and errors fixed, make cycle DEBUG=1 works
  654. * memory leaks fixed
  655. Revision 1.9 2001/04/02 21:20:30 peter
  656. * resulttype rewrite
  657. Revision 1.8 2001/02/05 20:45:49 peter
  658. * fixed buf 1364
  659. Revision 1.7 2000/12/31 11:14:10 jonas
  660. + implemented/fixed docompare() mathods for all nodes (not tested)
  661. + nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
  662. and constant strings/chars together
  663. * n386add.pas: don't copy temp strings (of size 256) to another temp string
  664. when adding
  665. Revision 1.6 2000/12/25 00:07:26 peter
  666. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  667. tlinkedlist objects)
  668. Revision 1.5 2000/11/29 00:30:31 florian
  669. * unused units removed from uses clause
  670. * some changes for widestrings
  671. Revision 1.4 2000/10/31 22:02:47 peter
  672. * symtable splitted, no real code changes
  673. Revision 1.3 2000/10/27 14:57:16 jonas
  674. + implementation for tasmnode.getcopy
  675. Revision 1.2 2000/10/14 21:52:54 peter
  676. * fixed memory leaks
  677. Revision 1.1 2000/10/14 10:14:50 peter
  678. * moehrendorf oct 2000 rewrite
  679. }