nflw.pas 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593
  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. {$ifdef loopvar_dont_mind}
  659. hp : Tnode;
  660. {$endif loopvar_dont_mind}
  661. begin
  662. result:=nil;
  663. { Calc register weight }
  664. old_t_times:=rg.t_times;
  665. if not(cs_littlesize in aktglobalswitches) then
  666. rg.t_times:=rg.t_times*8;
  667. rg.cleartempgen;
  668. firstpass(left);
  669. rg.cleartempgen;
  670. if assigned(t1) then
  671. begin
  672. firstpass(t1);
  673. if codegenerror then
  674. exit;
  675. end;
  676. registers32:=t1.registers32;
  677. registersfpu:=t1.registersfpu;
  678. {$ifdef SUPPORT_MMX}
  679. registersmmx:=left.registersmmx;
  680. {$endif SUPPORT_MMX}
  681. if left.registers32>registers32 then
  682. registers32:=left.registers32;
  683. if left.registersfpu>registersfpu then
  684. registersfpu:=left.registersfpu;
  685. {$ifdef SUPPORT_MMX}
  686. if left.registersmmx>registersmmx then
  687. registersmmx:=left.registersmmx;
  688. {$endif SUPPORT_MMX}
  689. { process count var }
  690. rg.cleartempgen;
  691. firstpass(t2);
  692. if codegenerror then
  693. exit;
  694. if t2.registers32>registers32 then
  695. registers32:=t2.registers32;
  696. if t2.registersfpu>registersfpu then
  697. registersfpu:=t2.registersfpu;
  698. {$ifdef SUPPORT_MMX}
  699. if t2.registersmmx>registersmmx then
  700. registersmmx:=t2.registersmmx;
  701. {$endif SUPPORT_MMX}
  702. rg.cleartempgen;
  703. firstpass(right);
  704. {$ifdef loopvar_dont_mind}
  705. { Check count var, record fields are also allowed in tp7 }
  706. include(loopflags,lnf_dont_mind_loopvar_on_exit);
  707. hp:=t2;
  708. while (hp.nodetype=subscriptn) or
  709. ((hp.nodetype=vecn) and
  710. is_constintnode(tvecnode(hp).right)) do
  711. hp:=tunarynode(hp).left;
  712. if (hp.nodetype=loadn) and (Tloadnode(hp).symtableentry.typ=varsym) then
  713. loopvar_notid:=Tvarsym(Tloadnode(hp).symtableentry).
  714. register_notification([vn_onread,vn_onwrite],@loop_var_access);
  715. {$endif}
  716. if right.registers32>registers32 then
  717. registers32:=right.registers32;
  718. if right.registersfpu>registersfpu then
  719. registersfpu:=right.registersfpu;
  720. {$ifdef SUPPORT_MMX}
  721. if right.registersmmx>registersmmx then
  722. registersmmx:=right.registersmmx;
  723. {$endif SUPPORT_MMX}
  724. { we need at least one register for comparisons PM }
  725. if registers32=0 then
  726. inc(registers32);
  727. rg.t_times:=old_t_times;
  728. end;
  729. {*****************************************************************************
  730. TEXITNODE
  731. *****************************************************************************}
  732. constructor texitnode.create(l:tnode);
  733. begin
  734. inherited create(exitn,l);
  735. onlyassign:=false;
  736. end;
  737. constructor texitnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  738. begin
  739. inherited ppuload(t,ppufile);
  740. onlyassign:=boolean(ppufile.getbyte);
  741. end;
  742. procedure texitnode.ppuwrite(ppufile:tcompilerppufile);
  743. begin
  744. inherited ppuwrite(ppufile);
  745. ppufile.putbyte(byte(onlyassign));
  746. end;
  747. function texitnode.det_resulttype:tnode;
  748. var
  749. pt : tnode;
  750. begin
  751. result:=nil;
  752. { Check the 2 types }
  753. if not inlining_procedure then
  754. begin
  755. if assigned(left) then
  756. begin
  757. inserttypeconv(left,aktprocdef.rettype);
  758. if paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption) or
  759. (procinfo.no_fast_exit) or
  760. ((procinfo.flags and pi_uses_exceptions)<>0) then
  761. begin
  762. pt:=cfuncretnode.create(aktprocdef.funcretsym);
  763. left:=cassignmentnode.create(pt,left);
  764. onlyassign:=true;
  765. end;
  766. tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_assigned;
  767. end;
  768. end;
  769. if assigned(left) then
  770. begin
  771. resulttypepass(left);
  772. set_varstate(left,true);
  773. end;
  774. resulttype:=voidtype;
  775. end;
  776. function texitnode.pass_1 : tnode;
  777. begin
  778. result:=nil;
  779. if assigned(left) then
  780. begin
  781. firstpass(left);
  782. if codegenerror then
  783. exit;
  784. registers32:=left.registers32;
  785. registersfpu:=left.registersfpu;
  786. {$ifdef SUPPORT_MMX}
  787. registersmmx:=left.registersmmx;
  788. {$endif SUPPORT_MMX}
  789. end;
  790. end;
  791. {*****************************************************************************
  792. TBREAKNODE
  793. *****************************************************************************}
  794. constructor tbreaknode.create;
  795. begin
  796. inherited create(breakn);
  797. end;
  798. function tbreaknode.det_resulttype:tnode;
  799. begin
  800. result:=nil;
  801. resulttype:=voidtype;
  802. end;
  803. function tbreaknode.pass_1 : tnode;
  804. begin
  805. result:=nil;
  806. end;
  807. {*****************************************************************************
  808. TCONTINUENODE
  809. *****************************************************************************}
  810. constructor tcontinuenode.create;
  811. begin
  812. inherited create(continuen);
  813. end;
  814. function tcontinuenode.det_resulttype:tnode;
  815. begin
  816. result:=nil;
  817. resulttype:=voidtype;
  818. end;
  819. function tcontinuenode.pass_1 : tnode;
  820. begin
  821. result:=nil;
  822. end;
  823. {*****************************************************************************
  824. TGOTONODE
  825. *****************************************************************************}
  826. constructor tgotonode.create(p : tlabelsym);
  827. begin
  828. inherited create(goton);
  829. exceptionblock:=aktexceptblock;
  830. labsym:=p;
  831. end;
  832. constructor tgotonode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  833. begin
  834. inherited ppuload(t,ppufile);
  835. labsym:=tlabelsym(ppufile.getderef);
  836. exceptionblock:=ppufile.getbyte;
  837. end;
  838. procedure tgotonode.ppuwrite(ppufile:tcompilerppufile);
  839. begin
  840. inherited ppuwrite(ppufile);
  841. ppufile.putderef(labsym);
  842. ppufile.putbyte(exceptionblock);
  843. end;
  844. procedure tgotonode.derefimpl;
  845. begin
  846. inherited derefimpl;
  847. resolvesym(pointer(labsym));
  848. end;
  849. function tgotonode.det_resulttype:tnode;
  850. begin
  851. result:=nil;
  852. resulttype:=voidtype;
  853. end;
  854. function tgotonode.pass_1 : tnode;
  855. begin
  856. result:=nil;
  857. { check if }
  858. if assigned(labsym) and
  859. assigned(labsym.code) and
  860. (exceptionblock<>tlabelnode(labsym.code).exceptionblock) then
  861. begin
  862. writeln('goto exceptblock: ',exceptionblock);
  863. writeln('label exceptblock: ',tlabelnode(labsym.code).exceptionblock);
  864. CGMessage(cg_e_goto_inout_of_exception_block);
  865. end;
  866. end;
  867. function tgotonode.getcopy : tnode;
  868. var
  869. p : tgotonode;
  870. begin
  871. p:=tgotonode(inherited getcopy);
  872. p.labsym:=labsym;
  873. p.exceptionblock:=exceptionblock;
  874. result:=p;
  875. end;
  876. function tgotonode.docompare(p: tnode): boolean;
  877. begin
  878. docompare := false;
  879. end;
  880. {*****************************************************************************
  881. TLABELNODE
  882. *****************************************************************************}
  883. constructor tlabelnode.createcase(p : tasmlabel;l:tnode);
  884. begin
  885. inherited create(labeln,l);
  886. { it shouldn't be possible to jump to case labels using goto }
  887. exceptionblock:=-1;
  888. labsym:=nil;
  889. labelnr:=p;
  890. end;
  891. constructor tlabelnode.create(p : tlabelsym;l:tnode);
  892. begin
  893. inherited create(labeln,l);
  894. exceptionblock:=aktexceptblock;
  895. labsym:=p;
  896. labelnr:=p.lab;
  897. { save the current labelnode in the labelsym }
  898. p.code:=self;
  899. end;
  900. constructor tlabelnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  901. begin
  902. inherited ppuload(t,ppufile);
  903. labsym:=tlabelsym(ppufile.getderef);
  904. labelnr:=tasmlabel(ppufile.getasmsymbol);
  905. exceptionblock:=ppufile.getbyte;
  906. end;
  907. procedure tlabelnode.ppuwrite(ppufile:tcompilerppufile);
  908. begin
  909. inherited ppuwrite(ppufile);
  910. ppufile.putderef(labsym);
  911. ppufile.putasmsymbol(labelnr);
  912. ppufile.putbyte(exceptionblock);
  913. end;
  914. procedure tlabelnode.derefimpl;
  915. begin
  916. inherited derefimpl;
  917. resolvesym(pointer(labsym));
  918. objectlibrary.derefasmsymbol(tasmsymbol(labelnr));
  919. end;
  920. function tlabelnode.det_resulttype:tnode;
  921. begin
  922. result:=nil;
  923. { left could still be unassigned }
  924. if assigned(left) then
  925. resulttypepass(left);
  926. resulttype:=voidtype;
  927. end;
  928. function tlabelnode.pass_1 : tnode;
  929. begin
  930. result:=nil;
  931. if assigned(left) then
  932. begin
  933. rg.cleartempgen;
  934. firstpass(left);
  935. registers32:=left.registers32;
  936. registersfpu:=left.registersfpu;
  937. {$ifdef SUPPORT_MMX}
  938. registersmmx:=left.registersmmx;
  939. {$endif SUPPORT_MMX}
  940. end;
  941. end;
  942. function tlabelnode.getcopy : tnode;
  943. var
  944. p : tlabelnode;
  945. begin
  946. p:=tlabelnode(inherited getcopy);
  947. p.labelnr:=labelnr;
  948. p.exceptionblock:=exceptionblock;
  949. p.labsym:=labsym;
  950. result:=p;
  951. end;
  952. function tlabelnode.docompare(p: tnode): boolean;
  953. begin
  954. docompare := false;
  955. end;
  956. {*****************************************************************************
  957. TRAISENODE
  958. *****************************************************************************}
  959. constructor traisenode.create(l,taddr,tframe:tnode);
  960. begin
  961. inherited create(raisen,l,taddr);
  962. frametree:=tframe;
  963. end;
  964. constructor traisenode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  965. begin
  966. inherited ppuload(t,ppufile);
  967. frametree:=ppuloadnode(ppufile);
  968. end;
  969. procedure traisenode.ppuwrite(ppufile:tcompilerppufile);
  970. begin
  971. inherited ppuwrite(ppufile);
  972. ppuwritenode(ppufile,frametree);
  973. end;
  974. procedure traisenode.derefimpl;
  975. begin
  976. inherited derefimpl;
  977. if assigned(frametree) then
  978. frametree.derefimpl;
  979. end;
  980. function traisenode.getcopy : tnode;
  981. var
  982. n : traisenode;
  983. begin
  984. n:=traisenode(inherited getcopy);
  985. if assigned(frametree) then
  986. n.frametree:=frametree.getcopy
  987. else
  988. n.frametree:=nil;
  989. getcopy:=n;
  990. end;
  991. procedure traisenode.insertintolist(l : tnodelist);
  992. begin
  993. end;
  994. function traisenode.det_resulttype:tnode;
  995. begin
  996. result:=nil;
  997. resulttype:=voidtype;
  998. if assigned(left) then
  999. begin
  1000. { first para must be a _class_ }
  1001. resulttypepass(left);
  1002. set_varstate(left,true);
  1003. if codegenerror then
  1004. exit;
  1005. if not(is_class(left.resulttype.def)) then
  1006. CGMessage(type_e_mismatch);
  1007. { insert needed typeconvs for addr,frame }
  1008. if assigned(right) then
  1009. begin
  1010. { addr }
  1011. resulttypepass(right);
  1012. inserttypeconv(right,voidpointertype);
  1013. { frame }
  1014. if assigned(frametree) then
  1015. begin
  1016. resulttypepass(frametree);
  1017. inserttypeconv(frametree,voidpointertype);
  1018. end;
  1019. end;
  1020. end;
  1021. end;
  1022. function traisenode.pass_1 : tnode;
  1023. begin
  1024. result:=nil;
  1025. if assigned(left) then
  1026. begin
  1027. { first para must be a _class_ }
  1028. firstpass(left);
  1029. { insert needed typeconvs for addr,frame }
  1030. if assigned(right) then
  1031. begin
  1032. { addr }
  1033. firstpass(right);
  1034. { frame }
  1035. if assigned(frametree) then
  1036. firstpass(frametree);
  1037. end;
  1038. left_right_max;
  1039. end;
  1040. end;
  1041. function traisenode.docompare(p: tnode): boolean;
  1042. begin
  1043. docompare := false;
  1044. end;
  1045. {*****************************************************************************
  1046. TTRYEXCEPTNODE
  1047. *****************************************************************************}
  1048. constructor ttryexceptnode.create(l,r,_t1 : tnode);
  1049. begin
  1050. inherited create(tryexceptn,l,r,_t1,nil);
  1051. end;
  1052. function ttryexceptnode.det_resulttype:tnode;
  1053. begin
  1054. result:=nil;
  1055. resulttypepass(left);
  1056. { on statements }
  1057. if assigned(right) then
  1058. resulttypepass(right);
  1059. { else block }
  1060. if assigned(t1) then
  1061. resulttypepass(t1);
  1062. resulttype:=voidtype;
  1063. end;
  1064. function ttryexceptnode.pass_1 : tnode;
  1065. begin
  1066. result:=nil;
  1067. rg.cleartempgen;
  1068. firstpass(left);
  1069. { on statements }
  1070. if assigned(right) then
  1071. begin
  1072. rg.cleartempgen;
  1073. firstpass(right);
  1074. registers32:=max(registers32,right.registers32);
  1075. registersfpu:=max(registersfpu,right.registersfpu);
  1076. {$ifdef SUPPORT_MMX}
  1077. registersmmx:=max(registersmmx,right.registersmmx);
  1078. {$endif SUPPORT_MMX}
  1079. end;
  1080. { else block }
  1081. if assigned(t1) then
  1082. begin
  1083. firstpass(t1);
  1084. registers32:=max(registers32,t1.registers32);
  1085. registersfpu:=max(registersfpu,t1.registersfpu);
  1086. {$ifdef SUPPORT_MMX}
  1087. registersmmx:=max(registersmmx,t1.registersmmx);
  1088. {$endif SUPPORT_MMX}
  1089. end;
  1090. end;
  1091. {*****************************************************************************
  1092. TTRYFINALLYNODE
  1093. *****************************************************************************}
  1094. constructor ttryfinallynode.create(l,r:tnode);
  1095. begin
  1096. inherited create(tryfinallyn,l,r);
  1097. end;
  1098. function ttryfinallynode.det_resulttype:tnode;
  1099. begin
  1100. result:=nil;
  1101. resulttype:=voidtype;
  1102. resulttypepass(left);
  1103. set_varstate(left,true);
  1104. resulttypepass(right);
  1105. set_varstate(right,true);
  1106. end;
  1107. function ttryfinallynode.pass_1 : tnode;
  1108. begin
  1109. result:=nil;
  1110. rg.cleartempgen;
  1111. firstpass(left);
  1112. rg.cleartempgen;
  1113. firstpass(right);
  1114. left_right_max;
  1115. end;
  1116. {*****************************************************************************
  1117. TONNODE
  1118. *****************************************************************************}
  1119. constructor tonnode.create(l,r:tnode);
  1120. begin
  1121. inherited create(onn,l,r);
  1122. exceptsymtable:=nil;
  1123. excepttype:=nil;
  1124. end;
  1125. destructor tonnode.destroy;
  1126. begin
  1127. if assigned(exceptsymtable) then
  1128. exceptsymtable.free;
  1129. inherited destroy;
  1130. end;
  1131. constructor tonnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  1132. begin
  1133. inherited ppuload(t,ppufile);
  1134. exceptsymtable:=nil;
  1135. excepttype:=nil;
  1136. end;
  1137. function tonnode.getcopy : tnode;
  1138. var
  1139. n : tonnode;
  1140. begin
  1141. n:=tonnode(inherited getcopy);
  1142. n.exceptsymtable:=exceptsymtable;
  1143. n.excepttype:=excepttype;
  1144. result:=n;
  1145. end;
  1146. function tonnode.det_resulttype:tnode;
  1147. begin
  1148. result:=nil;
  1149. resulttype:=voidtype;
  1150. if not(is_class(excepttype)) then
  1151. CGMessage(type_e_mismatch);
  1152. if assigned(left) then
  1153. resulttypepass(left);
  1154. if assigned(right) then
  1155. resulttypepass(right);
  1156. end;
  1157. function tonnode.pass_1 : tnode;
  1158. begin
  1159. result:=nil;
  1160. rg.cleartempgen;
  1161. registers32:=0;
  1162. registersfpu:=0;
  1163. {$ifdef SUPPORT_MMX}
  1164. registersmmx:=0;
  1165. {$endif SUPPORT_MMX}
  1166. if assigned(left) then
  1167. begin
  1168. firstpass(left);
  1169. registers32:=left.registers32;
  1170. registersfpu:=left.registersfpu;
  1171. {$ifdef SUPPORT_MMX}
  1172. registersmmx:=left.registersmmx;
  1173. {$endif SUPPORT_MMX}
  1174. end;
  1175. rg.cleartempgen;
  1176. if assigned(right) then
  1177. begin
  1178. firstpass(right);
  1179. registers32:=max(registers32,right.registers32);
  1180. registersfpu:=max(registersfpu,right.registersfpu);
  1181. {$ifdef SUPPORT_MMX}
  1182. registersmmx:=max(registersmmx,right.registersmmx);
  1183. {$endif SUPPORT_MMX}
  1184. end;
  1185. end;
  1186. function tonnode.docompare(p: tnode): boolean;
  1187. begin
  1188. docompare := false;
  1189. end;
  1190. {*****************************************************************************
  1191. TFAILNODE
  1192. *****************************************************************************}
  1193. constructor tfailnode.create;
  1194. begin
  1195. inherited create(failn);
  1196. end;
  1197. function tfailnode.det_resulttype:tnode;
  1198. begin
  1199. result:=nil;
  1200. resulttype:=voidtype;
  1201. end;
  1202. function tfailnode.pass_1 : tnode;
  1203. begin
  1204. result:=nil;
  1205. end;
  1206. function tfailnode.docompare(p: tnode): boolean;
  1207. begin
  1208. docompare := false;
  1209. end;
  1210. begin
  1211. cwhilerepeatnode:=twhilerepeatnode;
  1212. cifnode:=tifnode;
  1213. cfornode:=tfornode;
  1214. cexitnode:=texitnode;
  1215. cgotonode:=tgotonode;
  1216. clabelnode:=tlabelnode;
  1217. craisenode:=traisenode;
  1218. ctryexceptnode:=ttryexceptnode;
  1219. ctryfinallynode:=ttryfinallynode;
  1220. connode:=tonnode;
  1221. cfailnode:=tfailnode;
  1222. end.
  1223. {
  1224. $Log$
  1225. Revision 1.64 2003-01-09 21:52:37 peter
  1226. * merged some verbosity options.
  1227. * V_LineInfo is a verbosity flag to include line info
  1228. Revision 1.63 2003/01/04 08:08:47 daniel
  1229. * Readded missing variable
  1230. Revision 1.62 2003/01/03 17:16:57 peter
  1231. * fixed warning about unset funcret
  1232. Revision 1.61 2003/01/03 12:15:56 daniel
  1233. * Removed ifdefs around notifications
  1234. ifdefs around for loop optimizations remain
  1235. Revision 1.60 2002/12/31 09:55:58 daniel
  1236. + Notification implementation complete
  1237. + Add for loop code optimization using notifications
  1238. results in 1.5-1.9% speed improvement in nestloop benchmark
  1239. Optimization incomplete, compiler does not cycle yet with
  1240. notifications enabled.
  1241. Revision 1.59 2002/12/30 22:44:53 daniel
  1242. * Some work on notifications
  1243. Revision 1.58 2002/12/27 15:25:40 peter
  1244. * do not allow threadvar as loop counter
  1245. Revision 1.57 2002/11/28 11:17:02 florian
  1246. * loop node flags from node flags splitted
  1247. Revision 1.56 2002/11/25 17:43:18 peter
  1248. * splitted defbase in defutil,symutil,defcmp
  1249. * merged isconvertable and is_equal into compare_defs(_ext)
  1250. * made operator search faster by walking the list only once
  1251. Revision 1.55 2002/11/18 17:31:56 peter
  1252. * pass proccalloption to ret_in_xxx and push_xxx functions
  1253. Revision 1.54 2002/10/20 15:31:49 peter
  1254. * set funcret state for exit(0)
  1255. Revision 1.53 2002/10/05 12:43:25 carl
  1256. * fixes for Delphi 6 compilation
  1257. (warning : Some features do not work under Delphi)
  1258. Revision 1.52 2002/09/07 15:25:03 peter
  1259. * old logs removed and tabs fixed
  1260. Revision 1.51 2002/09/07 12:16:04 carl
  1261. * second part bug report 1996 fix, testrange in cordconstnode
  1262. only called if option is set (also make parsing a tiny faster)
  1263. Revision 1.50 2002/09/01 18:47:00 peter
  1264. * assignn check in exitnode changed to use a separate boolean as the
  1265. assignn can be changed to a calln
  1266. Revision 1.49 2002/09/01 08:01:16 daniel
  1267. * Removed sets from Tcallnode.det_resulttype
  1268. + Added read/write notifications of variables. These will be usefull
  1269. for providing information for several optimizations. For example
  1270. the value of the loop variable of a for loop does matter is the
  1271. variable is read after the for loop, but if it's no longer used
  1272. or written, it doesn't matter and this can be used to optimize
  1273. the loop code generation.
  1274. Revision 1.48 2002/08/22 15:15:20 daniel
  1275. * Fixed the detection wether the first check of a for loop can be skipped
  1276. Revision 1.47 2002/08/19 19:36:43 peter
  1277. * More fixes for cross unit inlining, all tnodes are now implemented
  1278. * Moved pocall_internconst to po_internconst because it is not a
  1279. calling type at all and it conflicted when inlining of these small
  1280. functions was requested
  1281. Revision 1.46 2002/08/17 22:09:46 florian
  1282. * result type handling in tcgcal.pass_2 overhauled
  1283. * better tnode.dowrite
  1284. * some ppc stuff fixed
  1285. Revision 1.45 2002/08/17 09:23:37 florian
  1286. * first part of procinfo rewrite
  1287. Revision 1.44 2002/07/21 06:58:49 daniel
  1288. * Changed booleans into flags
  1289. Revision 1.43 2002/07/20 11:57:54 florian
  1290. * types.pas renamed to defbase.pas because D6 contains a types
  1291. unit so this would conflicts if D6 programms are compiled
  1292. + Willamette/SSE2 instructions to assembler added
  1293. Revision 1.42 2002/07/20 11:18:18 daniel
  1294. * Small mistake fixed; the skip test was done before we know the for node
  1295. is correct.
  1296. Revision 1.40 2002/07/20 08:19:31 daniel
  1297. * State tracker automatically changes while loops into repeat loops
  1298. Revision 1.39 2002/07/19 12:55:27 daniel
  1299. * Further developed state tracking in whilerepeatn
  1300. Revision 1.38 2002/07/19 11:41:35 daniel
  1301. * State tracker work
  1302. * The whilen and repeatn are now completely unified into whilerepeatn. This
  1303. allows the state tracker to change while nodes automatically into
  1304. repeat nodes.
  1305. * Resulttypepass improvements to the notn. 'not not a' is optimized away and
  1306. 'not(a>b)' is optimized into 'a<=b'.
  1307. * Resulttypepass improvements to the whilerepeatn. 'while not a' is optimized
  1308. by removing the notn and later switchting the true and falselabels. The
  1309. same is done with 'repeat until not a'.
  1310. Revision 1.37 2002/07/16 13:57:02 florian
  1311. * raise takes now a void pointer as at and frame address
  1312. instead of a longint
  1313. Revision 1.36 2002/07/15 18:03:15 florian
  1314. * readded removed changes
  1315. Revision 1.35 2002/07/14 18:00:44 daniel
  1316. + Added the beginning of a state tracker. This will track the values of
  1317. variables through procedures and optimize things away.
  1318. Revision 1.34 2002/07/11 14:41:28 florian
  1319. * start of the new generic parameter handling
  1320. Revision 1.33 2002/07/01 18:46:23 peter
  1321. * internal linker
  1322. * reorganized aasm layer
  1323. Revision 1.32 2002/05/18 13:34:10 peter
  1324. * readded missing revisions
  1325. Revision 1.31 2002/05/16 19:46:38 carl
  1326. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1327. + try to fix temp allocation (still in ifdef)
  1328. + generic constructor calls
  1329. + start of tassembler / tmodulebase class cleanup
  1330. }