nflw.pas 46 KB

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