nflw.pas 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Type checking and register allocation for nodes that influence
  5. the flow
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit nflw;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. node,cpubase,
  24. aasmbase,aasmtai,aasmcpu,symnot,
  25. symppu,symtype,symbase,symdef,symsym;
  26. type
  27. { flags used by loop nodes }
  28. tloopflags = (
  29. { set if it is a for ... downto ... do loop }
  30. lnf_backward,
  31. { Do we need to parse childs to set var state? }
  32. lnf_varstate,
  33. { Do a test at the begin of the loop?}
  34. lnf_testatbegin,
  35. { Negate the loop test? }
  36. lnf_checknegate,
  37. { Should the value of the loop variable on exit be correct. }
  38. lnf_dont_mind_loopvar_on_exit);
  39. const
  40. { loop flags which must match to consider loop nodes equal regarding the flags }
  41. loopflagsequal = [lnf_backward];
  42. type
  43. tloopnode = class(tbinarynode)
  44. t1,t2 : tnode;
  45. loopflags : set of tloopflags;
  46. constructor create(tt : tnodetype;l,r,_t1,_t2 : tnode);virtual;
  47. destructor destroy;override;
  48. function getcopy : tnode;override;
  49. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  50. procedure ppuwrite(ppufile:tcompilerppufile);override;
  51. procedure derefimpl;override;
  52. procedure insertintolist(l : tnodelist);override;
  53. {$ifdef extdebug}
  54. procedure _dowrite;override;
  55. {$endif extdebug}
  56. function docompare(p: tnode): boolean; override;
  57. end;
  58. twhilerepeatnode = class(tloopnode)
  59. constructor create(l,r,_t1:Tnode;tab,cn:boolean);virtual;
  60. function det_resulttype:tnode;override;
  61. function pass_1 : tnode;override;
  62. {$ifdef state_tracking}
  63. function track_state_pass(exec_known:boolean):boolean;override;
  64. {$endif}
  65. end;
  66. twhilerepeatnodeclass = class of twhilerepeatnode;
  67. tifnode = class(tloopnode)
  68. constructor create(l,r,_t1 : tnode);virtual;
  69. function det_resulttype:tnode;override;
  70. function pass_1 : tnode;override;
  71. end;
  72. tifnodeclass = class of tifnode;
  73. tfornode = class(tloopnode)
  74. loopvar_notid:cardinal;
  75. constructor create(l,r,_t1,_t2 : tnode;back : boolean);virtual;
  76. procedure loop_var_access(not_type:Tnotification_flag;symbol:Tsym);
  77. function det_resulttype:tnode;override;
  78. function pass_1 : tnode;override;
  79. end;
  80. tfornodeclass = class of tfornode;
  81. texitnode = class(tunarynode)
  82. onlyassign : boolean;
  83. constructor create(l:tnode);virtual;
  84. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  85. procedure ppuwrite(ppufile:tcompilerppufile);override;
  86. function det_resulttype:tnode;override;
  87. function pass_1 : tnode;override;
  88. end;
  89. texitnodeclass = class of texitnode;
  90. tbreaknode = class(tnode)
  91. constructor create;virtual;
  92. function det_resulttype:tnode;override;
  93. function pass_1 : tnode;override;
  94. end;
  95. tbreaknodeclass = class of tbreaknode;
  96. tcontinuenode = class(tnode)
  97. constructor create;virtual;
  98. function det_resulttype:tnode;override;
  99. function pass_1 : tnode;override;
  100. end;
  101. tcontinuenodeclass = class of tcontinuenode;
  102. tgotonode = class(tnode)
  103. labsym : tlabelsym;
  104. exceptionblock : integer;
  105. constructor create(p : tlabelsym);virtual;
  106. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  107. procedure ppuwrite(ppufile:tcompilerppufile);override;
  108. procedure derefimpl;override;
  109. function getcopy : tnode;override;
  110. function det_resulttype:tnode;override;
  111. function pass_1 : tnode;override;
  112. function docompare(p: tnode): boolean; override;
  113. end;
  114. tgotonodeclass = class of tgotonode;
  115. tlabelnode = class(tunarynode)
  116. labelnr : tasmlabel;
  117. labsym : tlabelsym;
  118. exceptionblock : integer;
  119. constructor createcase(p : tasmlabel;l:tnode);virtual;
  120. constructor create(p : tlabelsym;l:tnode);virtual;
  121. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  122. procedure ppuwrite(ppufile:tcompilerppufile);override;
  123. procedure derefimpl;override;
  124. function getcopy : tnode;override;
  125. function det_resulttype:tnode;override;
  126. function pass_1 : tnode;override;
  127. function docompare(p: tnode): boolean; override;
  128. end;
  129. tlabelnodeclass = class of tlabelnode;
  130. traisenode = class(tbinarynode)
  131. frametree : tnode;
  132. constructor create(l,taddr,tframe:tnode);virtual;
  133. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  134. procedure ppuwrite(ppufile:tcompilerppufile);override;
  135. procedure derefimpl;override;
  136. function getcopy : tnode;override;
  137. procedure insertintolist(l : tnodelist);override;
  138. function det_resulttype:tnode;override;
  139. function pass_1 : tnode;override;
  140. function docompare(p: tnode): boolean; override;
  141. end;
  142. traisenodeclass = class of traisenode;
  143. ttryexceptnode = class(tloopnode)
  144. constructor create(l,r,_t1 : tnode);virtual;
  145. function det_resulttype:tnode;override;
  146. function pass_1 : tnode;override;
  147. end;
  148. ttryexceptnodeclass = class of ttryexceptnode;
  149. ttryfinallynode = class(tbinarynode)
  150. constructor create(l,r:tnode);virtual;
  151. function det_resulttype:tnode;override;
  152. function pass_1 : tnode;override;
  153. end;
  154. ttryfinallynodeclass = class of ttryfinallynode;
  155. tonnode = class(tbinarynode)
  156. exceptsymtable : tsymtable;
  157. excepttype : tobjectdef;
  158. constructor create(l,r:tnode);virtual;
  159. destructor destroy;override;
  160. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  161. function det_resulttype:tnode;override;
  162. function pass_1 : tnode;override;
  163. function getcopy : tnode;override;
  164. function docompare(p: tnode): boolean; override;
  165. end;
  166. tonnodeclass = class of tonnode;
  167. tfailnode = class(tnode)
  168. constructor create;virtual;
  169. function det_resulttype:tnode;override;
  170. function pass_1: tnode;override;
  171. function docompare(p: tnode): boolean; override;
  172. end;
  173. tfailnodeclass = class of tfailnode;
  174. { for compatibilty }
  175. function genloopnode(t : tnodetype;l,r,n1 : tnode;back : boolean) : tnode;
  176. var
  177. cwhilerepeatnode : twhilerepeatnodeclass;
  178. cifnode : tifnodeclass;
  179. cfornode : tfornodeclass;
  180. cexitnode : texitnodeclass;
  181. cbreaknode : tbreaknodeclass;
  182. ccontinuenode : tcontinuenodeclass;
  183. cgotonode : tgotonodeclass;
  184. clabelnode : tlabelnodeclass;
  185. craisenode : traisenodeclass;
  186. ctryexceptnode : ttryexceptnodeclass;
  187. ctryfinallynode : ttryfinallynodeclass;
  188. connode : tonnodeclass;
  189. cfailnode : tfailnodeclass;
  190. implementation
  191. uses
  192. globtype,systems,
  193. cutils,verbose,globals,
  194. symconst,symtable,paramgr,defutil,htypechk,pass_1,
  195. ncon,nmem,nld,ncnv,nbas,rgobj,
  196. {$ifdef state_tracking}
  197. nstate,
  198. {$endif}
  199. cgbase
  200. ;
  201. function genloopnode(t : tnodetype;l,r,n1 : tnode;back : boolean) : tnode;
  202. var
  203. p : tnode;
  204. begin
  205. case t of
  206. ifn:
  207. p:=cifnode.create(l,r,n1);
  208. whilerepeatn:
  209. if back then
  210. {Repeat until.}
  211. p:=cwhilerepeatnode.create(l,r,n1,false,true)
  212. else
  213. {While do.}
  214. p:=cwhilerepeatnode.create(l,r,n1,true,false);
  215. forn:
  216. p:=cfornode.create(l,r,n1,nil,back);
  217. end;
  218. genloopnode:=p;
  219. end;
  220. {****************************************************************************
  221. TLOOPNODE
  222. *****************************************************************************}
  223. constructor tloopnode.create(tt : tnodetype;l,r,_t1,_t2 : tnode);
  224. begin
  225. inherited create(tt,l,r);
  226. t1:=_t1;
  227. t2:=_t2;
  228. set_file_line(l);
  229. end;
  230. destructor tloopnode.destroy;
  231. begin
  232. t1.free;
  233. t2.free;
  234. inherited destroy;
  235. end;
  236. constructor tloopnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  237. begin
  238. inherited ppuload(t,ppufile);
  239. t1:=ppuloadnode(ppufile);
  240. t2:=ppuloadnode(ppufile);
  241. end;
  242. procedure tloopnode.ppuwrite(ppufile:tcompilerppufile);
  243. begin
  244. inherited ppuwrite(ppufile);
  245. ppuwritenode(ppufile,t1);
  246. ppuwritenode(ppufile,t2);
  247. end;
  248. procedure tloopnode.derefimpl;
  249. begin
  250. inherited derefimpl;
  251. if assigned(t1) then
  252. t1.derefimpl;
  253. if assigned(t2) then
  254. t2.derefimpl;
  255. end;
  256. function tloopnode.getcopy : tnode;
  257. var
  258. p : tloopnode;
  259. begin
  260. p:=tloopnode(inherited getcopy);
  261. if assigned(t1) then
  262. p.t1:=t1.getcopy
  263. else
  264. p.t1:=nil;
  265. if assigned(t2) then
  266. p.t2:=t2.getcopy
  267. else
  268. p.t2:=nil;
  269. getcopy:=p;
  270. end;
  271. procedure tloopnode.insertintolist(l : tnodelist);
  272. begin
  273. end;
  274. {$ifdef extdebug}
  275. procedure tloopnode._dowrite;
  276. begin
  277. inherited _dowrite;
  278. writenodeindention:=writenodeindention+' ';
  279. writenode(t1);
  280. writenode(t2);
  281. delete(writenodeindention,1,4);
  282. end;
  283. {$endif extdebug}
  284. function tloopnode.docompare(p: tnode): boolean;
  285. begin
  286. docompare :=
  287. inherited docompare(p) and
  288. (loopflags*loopflagsequal=tloopnode(p).loopflags*loopflagsequal) and
  289. t1.isequal(tloopnode(p).t1) and
  290. t2.isequal(tloopnode(p).t2);
  291. end;
  292. {****************************************************************************
  293. TWHILEREPEATNODE
  294. *****************************************************************************}
  295. constructor Twhilerepeatnode.create(l,r,_t1:Tnode;tab,cn:boolean);
  296. begin
  297. inherited create(whilerepeatn,l,r,_t1,nil);
  298. if tab then
  299. include(loopflags, lnf_testatbegin);
  300. if cn then
  301. include(loopflags,lnf_checknegate);
  302. end;
  303. function twhilerepeatnode.det_resulttype:tnode;
  304. var
  305. t:Tunarynode;
  306. begin
  307. result:=nil;
  308. resulttype:=voidtype;
  309. resulttypepass(left);
  310. {A not node can be removed.}
  311. if left.nodetype=notn then
  312. begin
  313. t:=Tunarynode(left);
  314. left:=Tunarynode(left).left;
  315. t.left:=nil;
  316. t.destroy;
  317. {$ifdef Delphi}
  318. { How can this be handled in Delphi ? }
  319. RunError(255);
  320. {$else}
  321. {Symdif operator, in case you are wondering:}
  322. loopflags:=loopflags >< [lnf_checknegate];
  323. {$endif}
  324. end;
  325. { loop instruction }
  326. if assigned(right) then
  327. resulttypepass(right);
  328. set_varstate(left,true);
  329. if codegenerror then
  330. exit;
  331. if not is_boolean(left.resulttype.def) then
  332. begin
  333. CGMessage(type_e_mismatch);
  334. exit;
  335. end;
  336. end;
  337. function twhilerepeatnode.pass_1 : tnode;
  338. var
  339. old_t_times : longint;
  340. begin
  341. result:=nil;
  342. old_t_times:=rg.t_times;
  343. { calc register weight }
  344. if not(cs_littlesize in aktglobalswitches ) then
  345. rg.t_times:=rg.t_times*8;
  346. rg.cleartempgen;
  347. firstpass(left);
  348. if codegenerror then
  349. exit;
  350. registers32:=left.registers32;
  351. registersfpu:=left.registersfpu;
  352. {$ifdef SUPPORT_MMX}
  353. registersmmx:=left.registersmmx;
  354. {$endif SUPPORT_MMX}
  355. { loop instruction }
  356. if assigned(right) then
  357. begin
  358. rg.cleartempgen;
  359. firstpass(right);
  360. if codegenerror then
  361. exit;
  362. if registers32<right.registers32 then
  363. registers32:=right.registers32;
  364. if registersfpu<right.registersfpu then
  365. registersfpu:=right.registersfpu;
  366. {$ifdef SUPPORT_MMX}
  367. if registersmmx<right.registersmmx then
  368. registersmmx:=right.registersmmx;
  369. {$endif SUPPORT_MMX}
  370. end;
  371. rg.t_times:=old_t_times;
  372. end;
  373. {$ifdef state_tracking}
  374. function Twhilerepeatnode.track_state_pass(exec_known:boolean):boolean;
  375. var condition:Tnode;
  376. code:Tnode;
  377. done:boolean;
  378. value:boolean;
  379. change:boolean;
  380. firsttest:boolean;
  381. factval:Tnode;
  382. begin
  383. track_state_pass:=false;
  384. done:=false;
  385. firsttest:=true;
  386. {For repeat until statements, first do a pass through the code.}
  387. if not(lnf_testatbegin in flags) then
  388. begin
  389. code:=right.getcopy;
  390. if code.track_state_pass(exec_known) then
  391. track_state_pass:=true;
  392. code.destroy;
  393. end;
  394. repeat
  395. condition:=left.getcopy;
  396. code:=right.getcopy;
  397. change:=condition.track_state_pass(exec_known);
  398. factval:=aktstate.find_fact(left);
  399. if factval<>nil then
  400. begin
  401. condition.destroy;
  402. condition:=factval.getcopy;
  403. change:=true;
  404. end;
  405. if change then
  406. begin
  407. track_state_pass:=true;
  408. {Force new resulttype pass.}
  409. condition.resulttype.def:=nil;
  410. do_resulttypepass(condition);
  411. end;
  412. if is_constboolnode(condition) then
  413. begin
  414. {Try to turn a while loop into a repeat loop.}
  415. if firsttest then
  416. exclude(flags,testatbegin);
  417. value:=(Tordconstnode(condition).value<>0) xor checknegate;
  418. if value then
  419. begin
  420. if code.track_state_pass(exec_known) then
  421. track_state_pass:=true;
  422. end
  423. else
  424. done:=true;
  425. end
  426. else
  427. begin
  428. {Remove any modified variables from the state.}
  429. code.track_state_pass(false);
  430. done:=true;
  431. end;
  432. code.destroy;
  433. condition.destroy;
  434. firsttest:=false;
  435. until done;
  436. {The loop condition is also known, for example:
  437. while i<10 do
  438. begin
  439. ...
  440. end;
  441. When the loop is done, we do know that i<10 = false.
  442. }
  443. condition:=left.getcopy;
  444. if condition.track_state_pass(exec_known) then
  445. begin
  446. track_state_pass:=true;
  447. {Force new resulttype pass.}
  448. condition.resulttype.def:=nil;
  449. do_resulttypepass(condition);
  450. end;
  451. if not is_constboolnode(condition) then
  452. aktstate.store_fact(condition,
  453. cordconstnode.create(byte(checknegate),booltype,true))
  454. else
  455. condition.destroy;
  456. end;
  457. {$endif}
  458. {*****************************************************************************
  459. TIFNODE
  460. *****************************************************************************}
  461. constructor tifnode.create(l,r,_t1 : tnode);
  462. begin
  463. inherited create(ifn,l,r,_t1,nil);
  464. end;
  465. function tifnode.det_resulttype:tnode;
  466. begin
  467. result:=nil;
  468. resulttype:=voidtype;
  469. resulttypepass(left);
  470. { if path }
  471. if assigned(right) then
  472. resulttypepass(right);
  473. { else path }
  474. if assigned(t1) then
  475. resulttypepass(t1);
  476. set_varstate(left,true);
  477. if codegenerror then
  478. exit;
  479. if not is_boolean(left.resulttype.def) then
  480. Message1(type_e_boolean_expr_expected,left.resulttype.def.typename);
  481. end;
  482. function tifnode.pass_1 : tnode;
  483. var
  484. old_t_times : longint;
  485. hp : tnode;
  486. begin
  487. result:=nil;
  488. old_t_times:=rg.t_times;
  489. rg.cleartempgen;
  490. firstpass(left);
  491. registers32:=left.registers32;
  492. registersfpu:=left.registersfpu;
  493. {$ifdef SUPPORT_MMX}
  494. registersmmx:=left.registersmmx;
  495. {$endif SUPPORT_MMX}
  496. { determines registers weigths }
  497. if not(cs_littlesize in aktglobalswitches) then
  498. rg.t_times:=rg.t_times div 2;
  499. if rg.t_times=0 then
  500. rg.t_times:=1;
  501. { if path }
  502. if assigned(right) then
  503. begin
  504. rg.cleartempgen;
  505. firstpass(right);
  506. if registers32<right.registers32 then
  507. registers32:=right.registers32;
  508. if registersfpu<right.registersfpu then
  509. registersfpu:=right.registersfpu;
  510. {$ifdef SUPPORT_MMX}
  511. if registersmmx<right.registersmmx then
  512. registersmmx:=right.registersmmx;
  513. {$endif SUPPORT_MMX}
  514. end;
  515. { else path }
  516. if assigned(t1) then
  517. begin
  518. rg.cleartempgen;
  519. firstpass(t1);
  520. if registers32<t1.registers32 then
  521. registers32:=t1.registers32;
  522. if registersfpu<t1.registersfpu then
  523. registersfpu:=t1.registersfpu;
  524. {$ifdef SUPPORT_MMX}
  525. if registersmmx<t1.registersmmx then
  526. registersmmx:=t1.registersmmx;
  527. {$endif SUPPORT_MMX}
  528. end;
  529. { leave if we've got an error in one of the paths }
  530. if codegenerror then
  531. exit;
  532. if left.nodetype=ordconstn then
  533. begin
  534. { optimize }
  535. if tordconstnode(left).value=1 then
  536. begin
  537. hp:=right;
  538. right:=nil;
  539. { we cannot set p to nil !!! }
  540. if assigned(hp) then
  541. result:=hp
  542. else
  543. result:=cnothingnode.create;
  544. end
  545. else
  546. begin
  547. hp:=t1;
  548. t1:=nil;
  549. { we cannot set p to nil !!! }
  550. if assigned(hp) then
  551. result:=hp
  552. else
  553. result:=cnothingnode.create;
  554. end;
  555. end;
  556. rg.t_times:=old_t_times;
  557. end;
  558. {*****************************************************************************
  559. TFORNODE
  560. *****************************************************************************}
  561. constructor tfornode.create(l,r,_t1,_t2 : tnode;back : boolean);
  562. begin
  563. inherited create(forn,l,r,_t1,_t2);
  564. if back then
  565. include(loopflags,lnf_backward);
  566. include(loopflags,lnf_testatbegin);
  567. end;
  568. procedure Tfornode.loop_var_access(not_type:Tnotification_flag;
  569. symbol:Tsym);
  570. begin
  571. {If there is a read access, the value of the loop counter is important;
  572. at the end of the loop the loop variable should contain the value it
  573. had in the last iteration.}
  574. if not_type=vn_onwrite then
  575. begin
  576. writeln('Loopvar does not matter on exit');
  577. end
  578. else
  579. begin
  580. exclude(loopflags,lnf_dont_mind_loopvar_on_exit);
  581. writeln('Loopvar does matter on exit');
  582. end;
  583. Tvarsym(symbol).unregister_notification(loopvar_notid);
  584. end;
  585. function tfornode.det_resulttype:tnode;
  586. var
  587. hp : tnode;
  588. begin
  589. result:=nil;
  590. resulttype:=voidtype;
  591. if left.nodetype<>assignn then
  592. begin
  593. CGMessage(cg_e_illegal_expression);
  594. exit;
  595. end;
  596. {Can we spare the first comparision?}
  597. if (right.nodetype=ordconstn) and (Tassignmentnode(left).right.nodetype=ordconstn) then
  598. if (
  599. (lnf_backward in loopflags) and
  600. (Tordconstnode(Tassignmentnode(left).right).value>=Tordconstnode(right).value)
  601. )
  602. or not(
  603. (lnf_backward in loopflags) and
  604. (Tordconstnode(Tassignmentnode(left).right).value<=Tordconstnode(right).value)
  605. ) then
  606. exclude(loopflags,lnf_testatbegin);
  607. { save counter var }
  608. t2:=tassignmentnode(left).left.getcopy;
  609. resulttypepass(left);
  610. set_varstate(left,false);
  611. if assigned(t1) then
  612. begin
  613. resulttypepass(t1);
  614. if codegenerror then
  615. exit;
  616. end;
  617. { process count var }
  618. resulttypepass(t2);
  619. set_varstate(t2,true);
  620. if codegenerror then
  621. exit;
  622. { Check count var, record fields are also allowed in tp7 }
  623. hp:=t2;
  624. while (hp.nodetype=subscriptn) or
  625. ((hp.nodetype=vecn) and
  626. is_constintnode(tvecnode(hp).right)) do
  627. hp:=tunarynode(hp).left;
  628. { we need a simple loadn, but the load must be in a global symtable or
  629. in the same lexlevel }
  630. if (hp.nodetype=funcretn) or
  631. (
  632. (hp.nodetype=loadn) and
  633. (
  634. (tloadnode(hp).symtable.symtablelevel<=1) or
  635. (tloadnode(hp).symtable.symtablelevel=lexlevel)
  636. ) and
  637. not(
  638. (tloadnode(hp).symtableentry.typ=varsym) and
  639. (vo_is_thread_var in tvarsym(tloadnode(hp).symtableentry).varoptions)
  640. )
  641. ) then
  642. begin
  643. if (hp.nodetype=loadn) and
  644. (tloadnode(hp).symtableentry.typ=varsym) then
  645. tvarsym(tloadnode(hp).symtableentry).varstate:=vs_used;
  646. if (not(is_ordinal(t2.resulttype.def)) or is_64bitint(t2.resulttype.def)) then
  647. CGMessagePos(hp.fileinfo,type_e_ordinal_expr_expected);
  648. end
  649. else
  650. CGMessagePos(hp.fileinfo,cg_e_illegal_count_var);
  651. resulttypepass(right);
  652. set_varstate(right,true);
  653. inserttypeconv(right,t2.resulttype);
  654. end;
  655. function tfornode.pass_1 : tnode;
  656. var
  657. old_t_times : longint;
  658. hp : Tnode;
  659. begin
  660. result:=nil;
  661. { Calc register weight }
  662. old_t_times:=rg.t_times;
  663. if not(cs_littlesize in aktglobalswitches) then
  664. rg.t_times:=rg.t_times*8;
  665. rg.cleartempgen;
  666. firstpass(left);
  667. rg.cleartempgen;
  668. if assigned(t1) then
  669. begin
  670. firstpass(t1);
  671. if codegenerror then
  672. exit;
  673. end;
  674. registers32:=t1.registers32;
  675. registersfpu:=t1.registersfpu;
  676. {$ifdef SUPPORT_MMX}
  677. registersmmx:=left.registersmmx;
  678. {$endif SUPPORT_MMX}
  679. if left.registers32>registers32 then
  680. registers32:=left.registers32;
  681. if left.registersfpu>registersfpu then
  682. registersfpu:=left.registersfpu;
  683. {$ifdef SUPPORT_MMX}
  684. if left.registersmmx>registersmmx then
  685. registersmmx:=left.registersmmx;
  686. {$endif SUPPORT_MMX}
  687. { process count var }
  688. rg.cleartempgen;
  689. firstpass(t2);
  690. if codegenerror then
  691. exit;
  692. if t2.registers32>registers32 then
  693. registers32:=t2.registers32;
  694. if t2.registersfpu>registersfpu then
  695. registersfpu:=t2.registersfpu;
  696. {$ifdef SUPPORT_MMX}
  697. if t2.registersmmx>registersmmx then
  698. registersmmx:=t2.registersmmx;
  699. {$endif SUPPORT_MMX}
  700. rg.cleartempgen;
  701. firstpass(right);
  702. {$ifdef loopvar_dont_mind}
  703. { Check count var, record fields are also allowed in tp7 }
  704. include(loopflags,lnf_dont_mind_loopvar_on_exit);
  705. hp:=t2;
  706. while (hp.nodetype=subscriptn) or
  707. ((hp.nodetype=vecn) and
  708. is_constintnode(tvecnode(hp).right)) do
  709. hp:=tunarynode(hp).left;
  710. if (hp.nodetype=loadn) and (Tloadnode(hp).symtableentry.typ=varsym) then
  711. loopvar_notid:=Tvarsym(Tloadnode(hp).symtableentry).
  712. register_notification([vn_onread,vn_onwrite],@loop_var_access);
  713. {$endif}
  714. if right.registers32>registers32 then
  715. registers32:=right.registers32;
  716. if right.registersfpu>registersfpu then
  717. registersfpu:=right.registersfpu;
  718. {$ifdef SUPPORT_MMX}
  719. if right.registersmmx>registersmmx then
  720. registersmmx:=right.registersmmx;
  721. {$endif SUPPORT_MMX}
  722. { we need at least one register for comparisons PM }
  723. if registers32=0 then
  724. inc(registers32);
  725. rg.t_times:=old_t_times;
  726. end;
  727. {*****************************************************************************
  728. TEXITNODE
  729. *****************************************************************************}
  730. constructor texitnode.create(l:tnode);
  731. begin
  732. inherited create(exitn,l);
  733. onlyassign:=false;
  734. end;
  735. constructor texitnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  736. begin
  737. inherited ppuload(t,ppufile);
  738. onlyassign:=boolean(ppufile.getbyte);
  739. end;
  740. procedure texitnode.ppuwrite(ppufile:tcompilerppufile);
  741. begin
  742. inherited ppuwrite(ppufile);
  743. ppufile.putbyte(byte(onlyassign));
  744. end;
  745. function texitnode.det_resulttype:tnode;
  746. var
  747. pt : tnode;
  748. begin
  749. result:=nil;
  750. { Check the 2 types }
  751. if not inlining_procedure then
  752. begin
  753. if assigned(left) then
  754. begin
  755. inserttypeconv(left,aktprocdef.rettype);
  756. if paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption) or
  757. (procinfo.no_fast_exit) or
  758. ((procinfo.flags and pi_uses_exceptions)<>0) then
  759. begin
  760. pt:=cfuncretnode.create(aktprocdef.funcretsym);
  761. left:=cassignmentnode.create(pt,left);
  762. onlyassign:=true;
  763. end;
  764. tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_assigned;
  765. end;
  766. end;
  767. if assigned(left) then
  768. begin
  769. resulttypepass(left);
  770. set_varstate(left,true);
  771. end;
  772. resulttype:=voidtype;
  773. end;
  774. function texitnode.pass_1 : tnode;
  775. begin
  776. result:=nil;
  777. if assigned(left) then
  778. begin
  779. firstpass(left);
  780. if codegenerror then
  781. exit;
  782. registers32:=left.registers32;
  783. registersfpu:=left.registersfpu;
  784. {$ifdef SUPPORT_MMX}
  785. registersmmx:=left.registersmmx;
  786. {$endif SUPPORT_MMX}
  787. end;
  788. end;
  789. {*****************************************************************************
  790. TBREAKNODE
  791. *****************************************************************************}
  792. constructor tbreaknode.create;
  793. begin
  794. inherited create(breakn);
  795. end;
  796. function tbreaknode.det_resulttype:tnode;
  797. begin
  798. result:=nil;
  799. resulttype:=voidtype;
  800. end;
  801. function tbreaknode.pass_1 : tnode;
  802. begin
  803. result:=nil;
  804. end;
  805. {*****************************************************************************
  806. TCONTINUENODE
  807. *****************************************************************************}
  808. constructor tcontinuenode.create;
  809. begin
  810. inherited create(continuen);
  811. end;
  812. function tcontinuenode.det_resulttype:tnode;
  813. begin
  814. result:=nil;
  815. resulttype:=voidtype;
  816. end;
  817. function tcontinuenode.pass_1 : tnode;
  818. begin
  819. result:=nil;
  820. end;
  821. {*****************************************************************************
  822. TGOTONODE
  823. *****************************************************************************}
  824. constructor tgotonode.create(p : tlabelsym);
  825. begin
  826. inherited create(goton);
  827. exceptionblock:=aktexceptblock;
  828. labsym:=p;
  829. end;
  830. constructor tgotonode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  831. begin
  832. inherited ppuload(t,ppufile);
  833. labsym:=tlabelsym(ppufile.getderef);
  834. exceptionblock:=ppufile.getbyte;
  835. end;
  836. procedure tgotonode.ppuwrite(ppufile:tcompilerppufile);
  837. begin
  838. inherited ppuwrite(ppufile);
  839. ppufile.putderef(labsym);
  840. ppufile.putbyte(exceptionblock);
  841. end;
  842. procedure tgotonode.derefimpl;
  843. begin
  844. inherited derefimpl;
  845. resolvesym(pointer(labsym));
  846. end;
  847. function tgotonode.det_resulttype:tnode;
  848. begin
  849. result:=nil;
  850. resulttype:=voidtype;
  851. end;
  852. function tgotonode.pass_1 : tnode;
  853. begin
  854. result:=nil;
  855. { check if }
  856. if assigned(labsym) and
  857. assigned(labsym.code) and
  858. (exceptionblock<>tlabelnode(labsym.code).exceptionblock) then
  859. begin
  860. writeln('goto exceptblock: ',exceptionblock);
  861. writeln('label exceptblock: ',tlabelnode(labsym.code).exceptionblock);
  862. CGMessage(cg_e_goto_inout_of_exception_block);
  863. end;
  864. end;
  865. function tgotonode.getcopy : tnode;
  866. var
  867. p : tgotonode;
  868. begin
  869. p:=tgotonode(inherited getcopy);
  870. p.labsym:=labsym;
  871. p.exceptionblock:=exceptionblock;
  872. result:=p;
  873. end;
  874. function tgotonode.docompare(p: tnode): boolean;
  875. begin
  876. docompare := false;
  877. end;
  878. {*****************************************************************************
  879. TLABELNODE
  880. *****************************************************************************}
  881. constructor tlabelnode.createcase(p : tasmlabel;l:tnode);
  882. begin
  883. inherited create(labeln,l);
  884. { it shouldn't be possible to jump to case labels using goto }
  885. exceptionblock:=-1;
  886. labsym:=nil;
  887. labelnr:=p;
  888. end;
  889. constructor tlabelnode.create(p : tlabelsym;l:tnode);
  890. begin
  891. inherited create(labeln,l);
  892. exceptionblock:=aktexceptblock;
  893. labsym:=p;
  894. labelnr:=p.lab;
  895. { save the current labelnode in the labelsym }
  896. p.code:=self;
  897. end;
  898. constructor tlabelnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  899. begin
  900. inherited ppuload(t,ppufile);
  901. labsym:=tlabelsym(ppufile.getderef);
  902. labelnr:=tasmlabel(ppufile.getasmsymbol);
  903. exceptionblock:=ppufile.getbyte;
  904. end;
  905. procedure tlabelnode.ppuwrite(ppufile:tcompilerppufile);
  906. begin
  907. inherited ppuwrite(ppufile);
  908. ppufile.putderef(labsym);
  909. ppufile.putasmsymbol(labelnr);
  910. ppufile.putbyte(exceptionblock);
  911. end;
  912. procedure tlabelnode.derefimpl;
  913. begin
  914. inherited derefimpl;
  915. resolvesym(pointer(labsym));
  916. objectlibrary.derefasmsymbol(tasmsymbol(labelnr));
  917. end;
  918. function tlabelnode.det_resulttype:tnode;
  919. begin
  920. result:=nil;
  921. { left could still be unassigned }
  922. if assigned(left) then
  923. resulttypepass(left);
  924. resulttype:=voidtype;
  925. end;
  926. function tlabelnode.pass_1 : tnode;
  927. begin
  928. result:=nil;
  929. if assigned(left) then
  930. begin
  931. rg.cleartempgen;
  932. firstpass(left);
  933. registers32:=left.registers32;
  934. registersfpu:=left.registersfpu;
  935. {$ifdef SUPPORT_MMX}
  936. registersmmx:=left.registersmmx;
  937. {$endif SUPPORT_MMX}
  938. end;
  939. end;
  940. function tlabelnode.getcopy : tnode;
  941. var
  942. p : tlabelnode;
  943. begin
  944. p:=tlabelnode(inherited getcopy);
  945. p.labelnr:=labelnr;
  946. p.exceptionblock:=exceptionblock;
  947. p.labsym:=labsym;
  948. result:=p;
  949. end;
  950. function tlabelnode.docompare(p: tnode): boolean;
  951. begin
  952. docompare := false;
  953. end;
  954. {*****************************************************************************
  955. TRAISENODE
  956. *****************************************************************************}
  957. constructor traisenode.create(l,taddr,tframe:tnode);
  958. begin
  959. inherited create(raisen,l,taddr);
  960. frametree:=tframe;
  961. end;
  962. constructor traisenode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  963. begin
  964. inherited ppuload(t,ppufile);
  965. frametree:=ppuloadnode(ppufile);
  966. end;
  967. procedure traisenode.ppuwrite(ppufile:tcompilerppufile);
  968. begin
  969. inherited ppuwrite(ppufile);
  970. ppuwritenode(ppufile,frametree);
  971. end;
  972. procedure traisenode.derefimpl;
  973. begin
  974. inherited derefimpl;
  975. if assigned(frametree) then
  976. frametree.derefimpl;
  977. end;
  978. function traisenode.getcopy : tnode;
  979. var
  980. n : traisenode;
  981. begin
  982. n:=traisenode(inherited getcopy);
  983. if assigned(frametree) then
  984. n.frametree:=frametree.getcopy
  985. else
  986. n.frametree:=nil;
  987. getcopy:=n;
  988. end;
  989. procedure traisenode.insertintolist(l : tnodelist);
  990. begin
  991. end;
  992. function traisenode.det_resulttype:tnode;
  993. begin
  994. result:=nil;
  995. resulttype:=voidtype;
  996. if assigned(left) then
  997. begin
  998. { first para must be a _class_ }
  999. resulttypepass(left);
  1000. set_varstate(left,true);
  1001. if codegenerror then
  1002. exit;
  1003. if not(is_class(left.resulttype.def)) then
  1004. CGMessage(type_e_mismatch);
  1005. { insert needed typeconvs for addr,frame }
  1006. if assigned(right) then
  1007. begin
  1008. { addr }
  1009. resulttypepass(right);
  1010. inserttypeconv(right,voidpointertype);
  1011. { frame }
  1012. if assigned(frametree) then
  1013. begin
  1014. resulttypepass(frametree);
  1015. inserttypeconv(frametree,voidpointertype);
  1016. end;
  1017. end;
  1018. end;
  1019. end;
  1020. function traisenode.pass_1 : tnode;
  1021. begin
  1022. result:=nil;
  1023. if assigned(left) then
  1024. begin
  1025. { first para must be a _class_ }
  1026. firstpass(left);
  1027. { insert needed typeconvs for addr,frame }
  1028. if assigned(right) then
  1029. begin
  1030. { addr }
  1031. firstpass(right);
  1032. { frame }
  1033. if assigned(frametree) then
  1034. firstpass(frametree);
  1035. end;
  1036. left_right_max;
  1037. end;
  1038. end;
  1039. function traisenode.docompare(p: tnode): boolean;
  1040. begin
  1041. docompare := false;
  1042. end;
  1043. {*****************************************************************************
  1044. TTRYEXCEPTNODE
  1045. *****************************************************************************}
  1046. constructor ttryexceptnode.create(l,r,_t1 : tnode);
  1047. begin
  1048. inherited create(tryexceptn,l,r,_t1,nil);
  1049. end;
  1050. function ttryexceptnode.det_resulttype:tnode;
  1051. begin
  1052. result:=nil;
  1053. resulttypepass(left);
  1054. { on statements }
  1055. if assigned(right) then
  1056. resulttypepass(right);
  1057. { else block }
  1058. if assigned(t1) then
  1059. resulttypepass(t1);
  1060. resulttype:=voidtype;
  1061. end;
  1062. function ttryexceptnode.pass_1 : tnode;
  1063. begin
  1064. result:=nil;
  1065. rg.cleartempgen;
  1066. firstpass(left);
  1067. { on statements }
  1068. if assigned(right) then
  1069. begin
  1070. rg.cleartempgen;
  1071. firstpass(right);
  1072. registers32:=max(registers32,right.registers32);
  1073. registersfpu:=max(registersfpu,right.registersfpu);
  1074. {$ifdef SUPPORT_MMX}
  1075. registersmmx:=max(registersmmx,right.registersmmx);
  1076. {$endif SUPPORT_MMX}
  1077. end;
  1078. { else block }
  1079. if assigned(t1) then
  1080. begin
  1081. firstpass(t1);
  1082. registers32:=max(registers32,t1.registers32);
  1083. registersfpu:=max(registersfpu,t1.registersfpu);
  1084. {$ifdef SUPPORT_MMX}
  1085. registersmmx:=max(registersmmx,t1.registersmmx);
  1086. {$endif SUPPORT_MMX}
  1087. end;
  1088. end;
  1089. {*****************************************************************************
  1090. TTRYFINALLYNODE
  1091. *****************************************************************************}
  1092. constructor ttryfinallynode.create(l,r:tnode);
  1093. begin
  1094. inherited create(tryfinallyn,l,r);
  1095. end;
  1096. function ttryfinallynode.det_resulttype:tnode;
  1097. begin
  1098. result:=nil;
  1099. resulttype:=voidtype;
  1100. resulttypepass(left);
  1101. set_varstate(left,true);
  1102. resulttypepass(right);
  1103. set_varstate(right,true);
  1104. end;
  1105. function ttryfinallynode.pass_1 : tnode;
  1106. begin
  1107. result:=nil;
  1108. rg.cleartempgen;
  1109. firstpass(left);
  1110. rg.cleartempgen;
  1111. firstpass(right);
  1112. left_right_max;
  1113. end;
  1114. {*****************************************************************************
  1115. TONNODE
  1116. *****************************************************************************}
  1117. constructor tonnode.create(l,r:tnode);
  1118. begin
  1119. inherited create(onn,l,r);
  1120. exceptsymtable:=nil;
  1121. excepttype:=nil;
  1122. end;
  1123. destructor tonnode.destroy;
  1124. begin
  1125. if assigned(exceptsymtable) then
  1126. exceptsymtable.free;
  1127. inherited destroy;
  1128. end;
  1129. constructor tonnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  1130. begin
  1131. inherited ppuload(t,ppufile);
  1132. exceptsymtable:=nil;
  1133. excepttype:=nil;
  1134. end;
  1135. function tonnode.getcopy : tnode;
  1136. var
  1137. n : tonnode;
  1138. begin
  1139. n:=tonnode(inherited getcopy);
  1140. n.exceptsymtable:=exceptsymtable;
  1141. n.excepttype:=excepttype;
  1142. result:=n;
  1143. end;
  1144. function tonnode.det_resulttype:tnode;
  1145. begin
  1146. result:=nil;
  1147. resulttype:=voidtype;
  1148. if not(is_class(excepttype)) then
  1149. CGMessage(type_e_mismatch);
  1150. if assigned(left) then
  1151. resulttypepass(left);
  1152. if assigned(right) then
  1153. resulttypepass(right);
  1154. end;
  1155. function tonnode.pass_1 : tnode;
  1156. begin
  1157. result:=nil;
  1158. rg.cleartempgen;
  1159. registers32:=0;
  1160. registersfpu:=0;
  1161. {$ifdef SUPPORT_MMX}
  1162. registersmmx:=0;
  1163. {$endif SUPPORT_MMX}
  1164. if assigned(left) then
  1165. begin
  1166. firstpass(left);
  1167. registers32:=left.registers32;
  1168. registersfpu:=left.registersfpu;
  1169. {$ifdef SUPPORT_MMX}
  1170. registersmmx:=left.registersmmx;
  1171. {$endif SUPPORT_MMX}
  1172. end;
  1173. rg.cleartempgen;
  1174. if assigned(right) then
  1175. begin
  1176. firstpass(right);
  1177. registers32:=max(registers32,right.registers32);
  1178. registersfpu:=max(registersfpu,right.registersfpu);
  1179. {$ifdef SUPPORT_MMX}
  1180. registersmmx:=max(registersmmx,right.registersmmx);
  1181. {$endif SUPPORT_MMX}
  1182. end;
  1183. end;
  1184. function tonnode.docompare(p: tnode): boolean;
  1185. begin
  1186. docompare := false;
  1187. end;
  1188. {*****************************************************************************
  1189. TFAILNODE
  1190. *****************************************************************************}
  1191. constructor tfailnode.create;
  1192. begin
  1193. inherited create(failn);
  1194. end;
  1195. function tfailnode.det_resulttype:tnode;
  1196. begin
  1197. result:=nil;
  1198. resulttype:=voidtype;
  1199. end;
  1200. function tfailnode.pass_1 : tnode;
  1201. begin
  1202. result:=nil;
  1203. end;
  1204. function tfailnode.docompare(p: tnode): boolean;
  1205. begin
  1206. docompare := false;
  1207. end;
  1208. begin
  1209. cwhilerepeatnode:=twhilerepeatnode;
  1210. cifnode:=tifnode;
  1211. cfornode:=tfornode;
  1212. cexitnode:=texitnode;
  1213. cgotonode:=tgotonode;
  1214. clabelnode:=tlabelnode;
  1215. craisenode:=traisenode;
  1216. ctryexceptnode:=ttryexceptnode;
  1217. ctryfinallynode:=ttryfinallynode;
  1218. connode:=tonnode;
  1219. cfailnode:=tfailnode;
  1220. end.
  1221. {
  1222. $Log$
  1223. Revision 1.63 2003-01-04 08:08:47 daniel
  1224. * Readded missing variable
  1225. Revision 1.62 2003/01/03 17:16:57 peter
  1226. * fixed warning about unset funcret
  1227. Revision 1.61 2003/01/03 12:15:56 daniel
  1228. * Removed ifdefs around notifications
  1229. ifdefs around for loop optimizations remain
  1230. Revision 1.60 2002/12/31 09:55:58 daniel
  1231. + Notification implementation complete
  1232. + Add for loop code optimization using notifications
  1233. results in 1.5-1.9% speed improvement in nestloop benchmark
  1234. Optimization incomplete, compiler does not cycle yet with
  1235. notifications enabled.
  1236. Revision 1.59 2002/12/30 22:44:53 daniel
  1237. * Some work on notifications
  1238. Revision 1.58 2002/12/27 15:25:40 peter
  1239. * do not allow threadvar as loop counter
  1240. Revision 1.57 2002/11/28 11:17:02 florian
  1241. * loop node flags from node flags splitted
  1242. Revision 1.56 2002/11/25 17:43:18 peter
  1243. * splitted defbase in defutil,symutil,defcmp
  1244. * merged isconvertable and is_equal into compare_defs(_ext)
  1245. * made operator search faster by walking the list only once
  1246. Revision 1.55 2002/11/18 17:31:56 peter
  1247. * pass proccalloption to ret_in_xxx and push_xxx functions
  1248. Revision 1.54 2002/10/20 15:31:49 peter
  1249. * set funcret state for exit(0)
  1250. Revision 1.53 2002/10/05 12:43:25 carl
  1251. * fixes for Delphi 6 compilation
  1252. (warning : Some features do not work under Delphi)
  1253. Revision 1.52 2002/09/07 15:25:03 peter
  1254. * old logs removed and tabs fixed
  1255. Revision 1.51 2002/09/07 12:16:04 carl
  1256. * second part bug report 1996 fix, testrange in cordconstnode
  1257. only called if option is set (also make parsing a tiny faster)
  1258. Revision 1.50 2002/09/01 18:47:00 peter
  1259. * assignn check in exitnode changed to use a separate boolean as the
  1260. assignn can be changed to a calln
  1261. Revision 1.49 2002/09/01 08:01:16 daniel
  1262. * Removed sets from Tcallnode.det_resulttype
  1263. + Added read/write notifications of variables. These will be usefull
  1264. for providing information for several optimizations. For example
  1265. the value of the loop variable of a for loop does matter is the
  1266. variable is read after the for loop, but if it's no longer used
  1267. or written, it doesn't matter and this can be used to optimize
  1268. the loop code generation.
  1269. Revision 1.48 2002/08/22 15:15:20 daniel
  1270. * Fixed the detection wether the first check of a for loop can be skipped
  1271. Revision 1.47 2002/08/19 19:36:43 peter
  1272. * More fixes for cross unit inlining, all tnodes are now implemented
  1273. * Moved pocall_internconst to po_internconst because it is not a
  1274. calling type at all and it conflicted when inlining of these small
  1275. functions was requested
  1276. Revision 1.46 2002/08/17 22:09:46 florian
  1277. * result type handling in tcgcal.pass_2 overhauled
  1278. * better tnode.dowrite
  1279. * some ppc stuff fixed
  1280. Revision 1.45 2002/08/17 09:23:37 florian
  1281. * first part of procinfo rewrite
  1282. Revision 1.44 2002/07/21 06:58:49 daniel
  1283. * Changed booleans into flags
  1284. Revision 1.43 2002/07/20 11:57:54 florian
  1285. * types.pas renamed to defbase.pas because D6 contains a types
  1286. unit so this would conflicts if D6 programms are compiled
  1287. + Willamette/SSE2 instructions to assembler added
  1288. Revision 1.42 2002/07/20 11:18:18 daniel
  1289. * Small mistake fixed; the skip test was done before we know the for node
  1290. is correct.
  1291. Revision 1.40 2002/07/20 08:19:31 daniel
  1292. * State tracker automatically changes while loops into repeat loops
  1293. Revision 1.39 2002/07/19 12:55:27 daniel
  1294. * Further developed state tracking in whilerepeatn
  1295. Revision 1.38 2002/07/19 11:41:35 daniel
  1296. * State tracker work
  1297. * The whilen and repeatn are now completely unified into whilerepeatn. This
  1298. allows the state tracker to change while nodes automatically into
  1299. repeat nodes.
  1300. * Resulttypepass improvements to the notn. 'not not a' is optimized away and
  1301. 'not(a>b)' is optimized into 'a<=b'.
  1302. * Resulttypepass improvements to the whilerepeatn. 'while not a' is optimized
  1303. by removing the notn and later switchting the true and falselabels. The
  1304. same is done with 'repeat until not a'.
  1305. Revision 1.37 2002/07/16 13:57:02 florian
  1306. * raise takes now a void pointer as at and frame address
  1307. instead of a longint
  1308. Revision 1.36 2002/07/15 18:03:15 florian
  1309. * readded removed changes
  1310. Revision 1.35 2002/07/14 18:00:44 daniel
  1311. + Added the beginning of a state tracker. This will track the values of
  1312. variables through procedures and optimize things away.
  1313. Revision 1.34 2002/07/11 14:41:28 florian
  1314. * start of the new generic parameter handling
  1315. Revision 1.33 2002/07/01 18:46:23 peter
  1316. * internal linker
  1317. * reorganized aasm layer
  1318. Revision 1.32 2002/05/18 13:34:10 peter
  1319. * readded missing revisions
  1320. Revision 1.31 2002/05/16 19:46:38 carl
  1321. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1322. + try to fix temp allocation (still in ifdef)
  1323. + generic constructor calls
  1324. + start of tassembler / tmodulebase class cleanup
  1325. }