nld.pas 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376
  1. {
  2. $Id$
  3. Copyright (c) 2000-2002 by Florian Klaempfl
  4. Type checking and register allocation for load/assignment nodes
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit nld;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. node,
  23. {$ifdef state_tracking}
  24. nstate,
  25. {$endif}
  26. symconst,symppu,symbase,symtype,symsym,symdef;
  27. type
  28. tloadnode = class(tunarynode)
  29. symtableentry : tsym;
  30. symtable : tsymtable;
  31. procdef : tprocdef;
  32. constructor create(v : tsym;st : tsymtable);virtual;
  33. constructor create_procvar(v : tsym;d:tprocdef;st : tsymtable);virtual;
  34. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  35. procedure ppuwrite(ppufile:tcompilerppufile);override;
  36. procedure derefimpl;override;
  37. procedure set_mp(p:tnode);
  38. function getcopy : tnode;override;
  39. function pass_1 : tnode;override;
  40. function det_resulttype:tnode;override;
  41. procedure mark_write;override;
  42. function docompare(p: tnode): boolean; override;
  43. procedure printnodedata(var t:text);override;
  44. end;
  45. tloadnodeclass = class of tloadnode;
  46. { different assignment types }
  47. tassigntype = (at_normal,at_plus,at_minus,at_star,at_slash);
  48. tassignmentnode = class(tbinarynode)
  49. assigntype : tassigntype;
  50. constructor create(l,r : tnode);virtual;
  51. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  52. procedure ppuwrite(ppufile:tcompilerppufile);override;
  53. function getcopy : tnode;override;
  54. function pass_1 : tnode;override;
  55. function det_resulttype:tnode;override;
  56. {$ifdef state_tracking}
  57. function track_state_pass(exec_known:boolean):boolean;override;
  58. {$endif state_tracking}
  59. function docompare(p: tnode): boolean; override;
  60. end;
  61. tassignmentnodeclass = class of tassignmentnode;
  62. tarrayconstructorrangenode = class(tbinarynode)
  63. constructor create(l,r : tnode);virtual;
  64. function pass_1 : tnode;override;
  65. function det_resulttype:tnode;override;
  66. end;
  67. tarrayconstructorrangenodeclass = class of tarrayconstructorrangenode;
  68. tarrayconstructornode = class(tbinarynode)
  69. constructor create(l,r : tnode);virtual;
  70. function getcopy : tnode;override;
  71. function pass_1 : tnode;override;
  72. function det_resulttype:tnode;override;
  73. function docompare(p: tnode): boolean; override;
  74. procedure force_type(tt:ttype);
  75. end;
  76. tarrayconstructornodeclass = class of tarrayconstructornode;
  77. ttypenode = class(tnode)
  78. allowed : boolean;
  79. restype : ttype;
  80. constructor create(t : ttype);virtual;
  81. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  82. procedure ppuwrite(ppufile:tcompilerppufile);override;
  83. procedure derefimpl;override;
  84. function pass_1 : tnode;override;
  85. function det_resulttype:tnode;override;
  86. function docompare(p: tnode): boolean; override;
  87. end;
  88. ttypenodeclass = class of ttypenode;
  89. trttinode = class(tnode)
  90. l1,l2 : longint;
  91. rttitype : trttitype;
  92. rttidef : tstoreddef;
  93. constructor create(def:tstoreddef;rt:trttitype);virtual;
  94. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  95. procedure ppuwrite(ppufile:tcompilerppufile);override;
  96. procedure derefimpl;override;
  97. function getcopy : tnode;override;
  98. function pass_1 : tnode;override;
  99. procedure pass_2;override;
  100. function det_resulttype:tnode;override;
  101. function docompare(p: tnode): boolean; override;
  102. end;
  103. trttinodeclass = class of trttinode;
  104. var
  105. cloadnode : tloadnodeclass;
  106. cassignmentnode : tassignmentnodeclass;
  107. carrayconstructorrangenode : tarrayconstructorrangenodeclass;
  108. carrayconstructornode : tarrayconstructornodeclass;
  109. ctypenode : ttypenodeclass;
  110. crttinode : trttinodeclass;
  111. procedure load_procvar_from_calln(var p1:tnode);
  112. function load_high_value(vs:tvarsym):tnode;
  113. implementation
  114. uses
  115. cutils,verbose,globtype,globals,systems,
  116. symtable,paramgr,defutil,defcmp,
  117. htypechk,pass_1,
  118. ncon,ninl,ncnv,nmem,ncal,cpubase,rgobj,cginfo,cgbase
  119. ,symnot
  120. ;
  121. {*****************************************************************************
  122. Helpers
  123. *****************************************************************************}
  124. procedure load_procvar_from_calln(var p1:tnode);
  125. var
  126. p2 : tnode;
  127. begin
  128. if p1.nodetype<>calln then
  129. internalerror(200212251);
  130. { was it a procvar, then we simply remove the calln and
  131. reuse the right }
  132. if assigned(tcallnode(p1).right) then
  133. begin
  134. p2:=tcallnode(p1).right;
  135. tcallnode(p1).right:=nil;
  136. end
  137. else
  138. begin
  139. p2:=cloadnode.create_procvar(tcallnode(p1).symtableprocentry,
  140. tprocdef(tcallnode(p1).procdefinition),tcallnode(p1).symtableproc);
  141. { when the methodpointer is typen we've something like:
  142. tobject.create. Then only the address is needed of the
  143. method without a self pointer }
  144. if assigned(tcallnode(p1).methodpointer) and
  145. (tcallnode(p1).methodpointer.nodetype<>typen) then
  146. begin
  147. tloadnode(p2).set_mp(tcallnode(p1).methodpointer);
  148. tcallnode(p1).methodpointer:=nil;
  149. end;
  150. end;
  151. resulttypepass(p2);
  152. p1.free;
  153. p1:=p2;
  154. end;
  155. function load_high_value(vs:tvarsym):tnode;
  156. var
  157. srsym : tsym;
  158. srsymtable : tsymtable;
  159. begin
  160. result:=nil;
  161. srsymtable:=vs.owner;
  162. if vo_is_local_copy in vs.varoptions then
  163. begin
  164. { next symtable is always the para symtable }
  165. srsymtable:=srsymtable.next;
  166. if not(srsymtable.symtabletype in [parasymtable,inlineparasymtable]) then
  167. internalerror(200212171);
  168. end;
  169. srsym:=searchsymonlyin(srsymtable,'high'+vs.name);
  170. if assigned(srsym) then
  171. result:=cloadnode.create(srsym,srsymtable)
  172. else
  173. CGMessage(cg_e_illegal_expression);
  174. end;
  175. {*****************************************************************************
  176. TLOADNODE
  177. *****************************************************************************}
  178. constructor tloadnode.create(v : tsym;st : tsymtable);
  179. begin
  180. inherited create(loadn,nil);
  181. if not assigned(v) then
  182. internalerror(200108121);
  183. symtableentry:=v;
  184. symtable:=st;
  185. procdef:=nil;
  186. end;
  187. constructor tloadnode.create_procvar(v : tsym;d:tprocdef;st : tsymtable);
  188. begin
  189. inherited create(loadn,nil);
  190. if not assigned(v) then
  191. internalerror(200108121);
  192. symtableentry:=v;
  193. symtable:=st;
  194. procdef:=d;
  195. end;
  196. constructor tloadnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  197. begin
  198. inherited ppuload(t,ppufile);
  199. symtableentry:=tsym(ppufile.getderef);
  200. {$ifdef fpc}
  201. {$warning FIXME: No withsymtable support}
  202. {$endif}
  203. symtable:=nil;
  204. procdef:=tprocdef(ppufile.getderef);
  205. end;
  206. procedure tloadnode.ppuwrite(ppufile:tcompilerppufile);
  207. begin
  208. inherited ppuwrite(ppufile);
  209. ppufile.putderef(symtableentry);
  210. ppufile.putderef(procdef);
  211. end;
  212. procedure tloadnode.derefimpl;
  213. begin
  214. inherited derefimpl;
  215. resolvesym(pointer(symtableentry));
  216. symtable:=symtableentry.owner;
  217. resolvedef(pointer(procdef));
  218. end;
  219. procedure tloadnode.set_mp(p:tnode);
  220. begin
  221. { typen nodes should not be set }
  222. if p.nodetype=typen then
  223. internalerror(200301042);
  224. left:=p;
  225. end;
  226. function tloadnode.getcopy : tnode;
  227. var
  228. n : tloadnode;
  229. begin
  230. n:=tloadnode(inherited getcopy);
  231. n.symtable:=symtable;
  232. n.symtableentry:=symtableentry;
  233. result:=n;
  234. end;
  235. function tloadnode.det_resulttype:tnode;
  236. var
  237. p1 : tnode;
  238. begin
  239. result:=nil;
  240. { optimize simple with loadings }
  241. if (symtable.symtabletype=withsymtable) and
  242. (twithsymtable(symtable).direct_with) and
  243. (symtableentry.typ=varsym) then
  244. begin
  245. p1:=tnode(twithsymtable(symtable).withrefnode).getcopy;
  246. p1:=csubscriptnode.create(tvarsym(symtableentry),p1);
  247. left:=nil;
  248. result:=p1;
  249. exit;
  250. end;
  251. { handle first absolute as it will replace the symtableentry }
  252. if symtableentry.typ=absolutesym then
  253. begin
  254. { force the resulttype to the type of the absolute }
  255. resulttype:=tabsolutesym(symtableentry).vartype;
  256. { replace the symtableentry when it points to a var, else
  257. we are finished }
  258. if (tabsolutesym(symtableentry).abstyp=tovar) then
  259. begin
  260. symtableentry:=tabsolutesym(symtableentry).ref;
  261. symtable:=symtableentry.owner;
  262. include(flags,nf_absolute);
  263. end
  264. else
  265. exit;
  266. end;
  267. case symtableentry.typ of
  268. constsym:
  269. begin
  270. if tconstsym(symtableentry).consttyp=constresourcestring then
  271. resulttype:=cansistringtype
  272. else
  273. internalerror(22799);
  274. end;
  275. varsym :
  276. begin
  277. { if it's refered by absolute then it's used }
  278. if nf_absolute in flags then
  279. tvarsym(symtableentry).varstate:=vs_used
  280. else
  281. resulttype:=tvarsym(symtableentry).vartype;
  282. end;
  283. typedconstsym :
  284. if not(nf_absolute in flags) then
  285. resulttype:=ttypedconstsym(symtableentry).typedconsttype;
  286. procsym :
  287. begin
  288. if not assigned(procdef) then
  289. begin
  290. if Tprocsym(symtableentry).procdef_count>1 then
  291. CGMessage(parser_e_no_overloaded_procvars);
  292. procdef:=tprocsym(symtableentry).first_procdef;
  293. end;
  294. { Delphi returns Pointer as type }
  295. if not(m_tp_procvar in aktmodeswitches) then
  296. resulttype.setdef(procdef)
  297. else
  298. resulttype:=voidpointertype;
  299. { process methodpointer }
  300. if assigned(left) then
  301. resulttypepass(left);
  302. end;
  303. else
  304. internalerror(200104141);
  305. end;
  306. end;
  307. procedure Tloadnode.mark_write;
  308. begin
  309. include(flags,nf_write);
  310. end;
  311. function tloadnode.pass_1 : tnode;
  312. begin
  313. result:=nil;
  314. expectloc:=LOC_REFERENCE;
  315. registers32:=0;
  316. registersfpu:=0;
  317. {$ifdef SUPPORT_MMX}
  318. registersmmx:=0;
  319. {$endif SUPPORT_MMX}
  320. case symtableentry.typ of
  321. absolutesym :
  322. ;
  323. constsym:
  324. begin
  325. if tconstsym(symtableentry).consttyp=constresourcestring then
  326. begin
  327. { we use ansistrings so no fast exit here }
  328. if assigned(procinfo) then
  329. procinfo.no_fast_exit:=true;
  330. expectloc:=LOC_CREFERENCE;
  331. end;
  332. end;
  333. varsym :
  334. begin
  335. if (symtable.symtabletype in [parasymtable,localsymtable]) and
  336. (lexlevel>symtable.symtablelevel) then
  337. begin
  338. { if the variable is in an other stackframe then we need
  339. a register to dereference }
  340. if (symtable.symtablelevel)>0 then
  341. begin
  342. registers32:=1;
  343. { further, the variable can't be put into a register }
  344. tvarsym(symtableentry).varoptions:=
  345. tvarsym(symtableentry).varoptions-[vo_fpuregable,vo_regable];
  346. end;
  347. end;
  348. if (tvarsym(symtableentry).varspez=vs_const) then
  349. expectloc:=LOC_CREFERENCE;
  350. { we need a register for call by reference parameters }
  351. if (tvarsym(symtableentry).varspez in [vs_var,vs_out]) or
  352. ((tvarsym(symtableentry).varspez=vs_const) and
  353. paramanager.push_addr_param(tvarsym(symtableentry).vartype.def,pocall_none)) or
  354. { call by value open arrays are also indirect addressed }
  355. is_open_array(tvarsym(symtableentry).vartype.def) then
  356. registers32:=1;
  357. if symtable.symtabletype in [withsymtable,objectsymtable] then
  358. inc(registers32);
  359. if ([vo_is_thread_var,vo_is_dll_var]*tvarsym(symtableentry).varoptions)<>[] then
  360. registers32:=1;
  361. if nf_write in flags then
  362. Tvarsym(symtableentry).trigger_notifications(vn_onwrite)
  363. else
  364. Tvarsym(symtableentry).trigger_notifications(vn_onread);
  365. { count variable references }
  366. { this will create problem with local var set by
  367. under_procedures
  368. if (assigned(tvarsym(symtableentry).owner) and assigned(aktprocsym)
  369. and ((tvarsym(symtableentry).owner = aktprocdef.localst)
  370. or (tvarsym(symtableentry).owner = aktprocdef.localst))) then }
  371. if rg.t_times<1 then
  372. inc(tvarsym(symtableentry).refs)
  373. else
  374. inc(tvarsym(symtableentry).refs,rg.t_times);
  375. end;
  376. typedconstsym :
  377. ;
  378. procsym :
  379. begin
  380. { method pointer ? }
  381. if assigned(left) then
  382. begin
  383. expectloc:=LOC_CREFERENCE;
  384. firstpass(left);
  385. registers32:=max(registers32,left.registers32);
  386. registersfpu:=max(registersfpu,left.registersfpu);
  387. {$ifdef SUPPORT_MMX}
  388. registersmmx:=max(registersmmx,left.registersmmx);
  389. {$endif SUPPORT_MMX}
  390. end;
  391. end;
  392. else
  393. internalerror(200104143);
  394. end;
  395. end;
  396. function tloadnode.docompare(p: tnode): boolean;
  397. begin
  398. docompare :=
  399. inherited docompare(p) and
  400. (symtableentry = tloadnode(p).symtableentry) and
  401. (symtable = tloadnode(p).symtable);
  402. end;
  403. procedure Tloadnode.printnodedata(var t:text);
  404. begin
  405. inherited printnodedata(t);
  406. writeln(t,printnodeindention,'symbol = ',symtableentry.name);
  407. end;
  408. {*****************************************************************************
  409. TASSIGNMENTNODE
  410. *****************************************************************************}
  411. constructor tassignmentnode.create(l,r : tnode);
  412. begin
  413. inherited create(assignn,l,r);
  414. l.mark_write;
  415. assigntype:=at_normal;
  416. end;
  417. constructor tassignmentnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  418. begin
  419. inherited ppuload(t,ppufile);
  420. assigntype:=tassigntype(ppufile.getbyte);
  421. end;
  422. procedure tassignmentnode.ppuwrite(ppufile:tcompilerppufile);
  423. begin
  424. inherited ppuwrite(ppufile);
  425. ppufile.putbyte(byte(assigntype));
  426. end;
  427. function tassignmentnode.getcopy : tnode;
  428. var
  429. n : tassignmentnode;
  430. begin
  431. n:=tassignmentnode(inherited getcopy);
  432. n.assigntype:=assigntype;
  433. getcopy:=n;
  434. end;
  435. function tassignmentnode.det_resulttype:tnode;
  436. var
  437. hp : tnode;
  438. useshelper : boolean;
  439. original_size : longint;
  440. begin
  441. result:=nil;
  442. resulttype:=voidtype;
  443. original_size := 0;
  444. { must be made unique }
  445. set_unique(left);
  446. resulttypepass(left);
  447. if is_ansistring(left.resulttype.def) then
  448. begin
  449. { fold <ansistring>:=<ansistring>+<char|shortstring|ansistring> }
  450. if (right.nodetype=addn) and
  451. left.isequal(tbinarynode(right).left) and
  452. { don't fold multiple concatenations else we could get trouble
  453. with multiple uses of s
  454. }
  455. (tbinarynode(right).left.nodetype<>addn) and
  456. (tbinarynode(right).right.nodetype<>addn) then
  457. begin
  458. { don't do a resulttypepass(right), since then the addnode }
  459. { may insert typeconversions that make this optimization }
  460. { opportunity quite difficult to detect (JM) }
  461. resulttypepass(tbinarynode(right).left);
  462. resulttypepass(tbinarynode(right).right);
  463. if (is_char(tbinarynode(right).right.resulttype.def) or
  464. is_shortstring(tbinarynode(right).right.resulttype.def) or
  465. is_ansistring(tbinarynode(right).right.resulttype.def)) then
  466. begin
  467. { remove property flag so it'll not trigger an error }
  468. exclude(left.flags,nf_isproperty);
  469. { generate call to helper }
  470. hp:=ccallparanode.create(tbinarynode(right).right,
  471. ccallparanode.create(left,nil));
  472. if is_char(tbinarynode(right).right.resulttype.def) then
  473. result:=ccallnode.createintern('fpc_ansistr_append_char',hp)
  474. else if is_shortstring(tbinarynode(right).right.resulttype.def) then
  475. result:=ccallnode.createintern('fpc_ansistr_append_shortstring',hp)
  476. else
  477. result:=ccallnode.createintern('fpc_ansistr_append_ansistring',hp);
  478. tbinarynode(right).right:=nil;
  479. left:=nil;
  480. exit;
  481. end;
  482. end;
  483. end;
  484. resulttypepass(right);
  485. set_varstate(left,false);
  486. set_varstate(right,true);
  487. { set_funcret_is_valid(left); }
  488. if codegenerror then
  489. exit;
  490. { assignments to open arrays aren't allowed }
  491. if is_open_array(left.resulttype.def) then
  492. CGMessage(type_e_mismatch);
  493. { test if node can be assigned, properties are allowed }
  494. valid_for_assignment(left);
  495. { assigning nil to a dynamic array clears the array }
  496. if is_dynamic_array(left.resulttype.def) and
  497. (right.nodetype=niln) then
  498. begin
  499. hp:=ccallparanode.create(caddrnode.create
  500. (crttinode.create(tstoreddef(left.resulttype.def),initrtti)),
  501. ccallparanode.create(ctypeconvnode.create_explicit(left,voidpointertype),nil));
  502. result := ccallnode.createintern('fpc_dynarray_clear',hp);
  503. left:=nil;
  504. exit;
  505. end;
  506. { shortstring helpers can do the conversion directly,
  507. so treat them separatly }
  508. if (is_shortstring(left.resulttype.def)) then
  509. begin
  510. { test for s:=s+anything ... }
  511. { the problem is for
  512. s:=s+s+s;
  513. this is broken here !! }
  514. {$ifdef newoptimizations2}
  515. { the above is fixed now, but still problem with s := s + f(); if }
  516. { f modifies s (bad programming, so only enable if uncertain }
  517. { optimizations are on) (JM) }
  518. if (cs_UncertainOpts in aktglobalswitches) then
  519. begin
  520. hp := right;
  521. while hp.treetype=addn do
  522. hp:=hp.left;
  523. if left.docompare(hp) then
  524. begin
  525. concat_string:=true;
  526. hp:=right;
  527. while hp.treetype=addn do
  528. begin
  529. hp.use_strconcat:=true;
  530. hp:=hp.left;
  531. end;
  532. end;
  533. end;
  534. {$endif newoptimizations2}
  535. { insert typeconv, except for chars that are handled in
  536. secondpass and except for ansi/wide string that can
  537. be converted immediatly }
  538. if not(is_char(right.resulttype.def) or
  539. (right.resulttype.def.deftype=stringdef)) then
  540. inserttypeconv(right,left.resulttype);
  541. if right.resulttype.def.deftype=stringdef then
  542. begin
  543. useshelper:=true;
  544. { convert constant strings to shortstrings. But
  545. skip empty constant strings, that will be handled
  546. in secondpass }
  547. if (right.nodetype=stringconstn) then
  548. begin
  549. { verify if range fits within shortstring }
  550. { just emit a warning, delphi gives an }
  551. { error, only if the type definition of }
  552. { of the string is less < 255 characters }
  553. if not is_open_string(left.resulttype.def) and
  554. (tstringconstnode(right).len > tstringdef(left.resulttype.def).len) then
  555. cgmessage(type_w_string_too_long);
  556. inserttypeconv(right,left.resulttype);
  557. if (tstringconstnode(right).len=0) then
  558. useshelper:=false;
  559. end;
  560. if useshelper then
  561. begin
  562. hp:=ccallparanode.create
  563. (right,
  564. ccallparanode.create(cinlinenode.create
  565. (in_high_x,false,left.getcopy),nil));
  566. result:=ccallnode.createinternreturn('fpc_'+tstringdef(right.resulttype.def).stringtypname+'_to_shortstr',hp,left);
  567. left:=nil;
  568. right:=nil;
  569. exit;
  570. end;
  571. end;
  572. end
  573. else
  574. begin
  575. { get the size before the type conversion - check for all nodes }
  576. if assigned(right.resulttype.def) and (right.nodetype in [loadn,vecn,calln]) then
  577. original_size := right.resulttype.def.size;
  578. inserttypeconv(right,left.resulttype);
  579. end;
  580. { check if the assignment may cause a range check error }
  581. { if its not explicit, and only if the values are }
  582. { ordinals, enumdef and floatdef }
  583. if (right.nodetype = typeconvn) and
  584. not (nf_explicit in ttypeconvnode(right).flags) then
  585. begin
  586. if assigned(left.resulttype.def) and
  587. (left.resulttype.def.deftype in [enumdef,orddef,floatdef]) then
  588. begin
  589. if (original_size <> 0) and (left.resulttype.def.size < original_size) then
  590. begin
  591. if (cs_check_range in aktlocalswitches) then
  592. Message(type_w_smaller_possible_range_check)
  593. else
  594. Message(type_h_smaller_possible_range_check);
  595. end;
  596. end;
  597. end;
  598. { call helpers for interface }
  599. if is_interfacecom(left.resulttype.def) then
  600. begin
  601. hp:=ccallparanode.create(ctypeconvnode.create_explicit
  602. (right,voidpointertype),
  603. ccallparanode.create(ctypeconvnode.create_explicit
  604. (left,voidpointertype),nil));
  605. result:=ccallnode.createintern('fpc_intf_assign',hp);
  606. left:=nil;
  607. right:=nil;
  608. exit;
  609. end;
  610. { check if local proc/func is assigned to procvar }
  611. if right.resulttype.def.deftype=procvardef then
  612. test_local_to_procvar(tprocvardef(right.resulttype.def),left.resulttype.def);
  613. end;
  614. function tassignmentnode.pass_1 : tnode;
  615. begin
  616. result:=nil;
  617. expectloc:=LOC_VOID;
  618. firstpass(left);
  619. firstpass(right);
  620. if codegenerror then
  621. exit;
  622. registers32:=left.registers32+right.registers32;
  623. registersfpu:=max(left.registersfpu,right.registersfpu);
  624. {$ifdef SUPPORT_MMX}
  625. registersmmx:=max(left.registersmmx,right.registersmmx);
  626. {$endif SUPPORT_MMX}
  627. end;
  628. function tassignmentnode.docompare(p: tnode): boolean;
  629. begin
  630. docompare :=
  631. inherited docompare(p) and
  632. (assigntype = tassignmentnode(p).assigntype);
  633. end;
  634. {$ifdef state_tracking}
  635. function Tassignmentnode.track_state_pass(exec_known:boolean):boolean;
  636. var se:Tstate_entry;
  637. begin
  638. track_state_pass:=false;
  639. if exec_known then
  640. begin
  641. track_state_pass:=right.track_state_pass(exec_known);
  642. {Force a new resulttype pass.}
  643. right.resulttype.def:=nil;
  644. do_resulttypepass(right);
  645. resulttypepass(right);
  646. aktstate.store_fact(left.getcopy,right.getcopy);
  647. end
  648. else
  649. aktstate.delete_fact(left);
  650. end;
  651. {$endif}
  652. {*****************************************************************************
  653. TARRAYCONSTRUCTORRANGENODE
  654. *****************************************************************************}
  655. constructor tarrayconstructorrangenode.create(l,r : tnode);
  656. begin
  657. inherited create(arrayconstructorrangen,l,r);
  658. end;
  659. function tarrayconstructorrangenode.det_resulttype:tnode;
  660. begin
  661. result:=nil;
  662. resulttypepass(left);
  663. resulttypepass(right);
  664. set_varstate(left,true);
  665. set_varstate(right,true);
  666. if codegenerror then
  667. exit;
  668. resulttype:=left.resulttype;
  669. end;
  670. function tarrayconstructorrangenode.pass_1 : tnode;
  671. begin
  672. firstpass(left);
  673. firstpass(right);
  674. expectloc:=LOC_CREFERENCE;
  675. calcregisters(self,0,0,0);
  676. result:=nil;
  677. end;
  678. {****************************************************************************
  679. TARRAYCONSTRUCTORNODE
  680. *****************************************************************************}
  681. constructor tarrayconstructornode.create(l,r : tnode);
  682. begin
  683. inherited create(arrayconstructorn,l,r);
  684. end;
  685. function tarrayconstructornode.getcopy : tnode;
  686. var
  687. n : tarrayconstructornode;
  688. begin
  689. n:=tarrayconstructornode(inherited getcopy);
  690. result:=n;
  691. end;
  692. function tarrayconstructornode.det_resulttype:tnode;
  693. var
  694. htype : ttype;
  695. hp : tarrayconstructornode;
  696. len : longint;
  697. varia : boolean;
  698. begin
  699. result:=nil;
  700. { are we allowing array constructor? Then convert it to a set }
  701. if not allow_array_constructor then
  702. begin
  703. hp:=tarrayconstructornode(getcopy);
  704. arrayconstructor_to_set(tnode(hp));
  705. result:=hp;
  706. exit;
  707. end;
  708. { only pass left tree, right tree contains next construct if any }
  709. htype.reset;
  710. len:=0;
  711. varia:=false;
  712. if assigned(left) then
  713. begin
  714. hp:=self;
  715. while assigned(hp) do
  716. begin
  717. resulttypepass(hp.left);
  718. set_varstate(hp.left,true);
  719. if (htype.def=nil) then
  720. htype:=hp.left.resulttype
  721. else
  722. begin
  723. if ((nf_novariaallowed in flags) or (not varia)) and
  724. (not equal_defs(htype.def,hp.left.resulttype.def)) then
  725. begin
  726. varia:=true;
  727. end;
  728. end;
  729. inc(len);
  730. hp:=tarrayconstructornode(hp.right);
  731. end;
  732. end;
  733. if not assigned(htype.def) then
  734. htype:=voidtype;
  735. resulttype.setdef(tarraydef.create(0,len-1,s32bittype));
  736. tarraydef(resulttype.def).setelementtype(htype);
  737. tarraydef(resulttype.def).IsConstructor:=true;
  738. tarraydef(resulttype.def).IsVariant:=varia;
  739. end;
  740. procedure tarrayconstructornode.force_type(tt:ttype);
  741. var
  742. hp : tarrayconstructornode;
  743. begin
  744. tarraydef(resulttype.def).setelementtype(tt);
  745. tarraydef(resulttype.def).IsConstructor:=true;
  746. tarraydef(resulttype.def).IsVariant:=false;
  747. if assigned(left) then
  748. begin
  749. hp:=self;
  750. while assigned(hp) do
  751. begin
  752. inserttypeconv(hp.left,tt);
  753. hp:=tarrayconstructornode(hp.right);
  754. end;
  755. end;
  756. end;
  757. function tarrayconstructornode.pass_1 : tnode;
  758. var
  759. thp,
  760. chp,
  761. hp : tarrayconstructornode;
  762. dovariant : boolean;
  763. htype : ttype;
  764. orgflags : tnodeflagset;
  765. begin
  766. dovariant:=(nf_forcevaria in flags) or tarraydef(resulttype.def).isvariant;
  767. result:=nil;
  768. { only pass left tree, right tree contains next construct if any }
  769. if assigned(left) then
  770. begin
  771. hp:=self;
  772. while assigned(hp) do
  773. begin
  774. firstpass(hp.left);
  775. { Insert typeconvs for array of const }
  776. if dovariant then
  777. begin
  778. case hp.left.resulttype.def.deftype of
  779. enumdef :
  780. begin
  781. hp.left:=ctypeconvnode.create_explicit(hp.left,s32bittype);
  782. firstpass(hp.left);
  783. end;
  784. arraydef :
  785. begin
  786. hp.left:=ctypeconvnode.create(hp.left,charpointertype);
  787. firstpass(hp.left);
  788. end;
  789. orddef :
  790. begin
  791. if is_integer(hp.left.resulttype.def) and
  792. not(is_64bitint(hp.left.resulttype.def)) then
  793. begin
  794. hp.left:=ctypeconvnode.create(hp.left,s32bittype);
  795. firstpass(hp.left);
  796. end;
  797. end;
  798. floatdef :
  799. begin
  800. { C uses 64bit floats }
  801. if nf_cargs in flags then
  802. hp.left:=ctypeconvnode.create(hp.left,s64floattype)
  803. else
  804. hp.left:=ctypeconvnode.create(hp.left,pbestrealtype^);
  805. firstpass(hp.left);
  806. end;
  807. stringdef :
  808. begin
  809. if nf_cargs in flags then
  810. begin
  811. hp.left:=ctypeconvnode.create(hp.left,charpointertype);
  812. firstpass(hp.left);
  813. end;
  814. end;
  815. procvardef :
  816. begin
  817. hp.left:=ctypeconvnode.create(hp.left,voidpointertype);
  818. firstpass(hp.left);
  819. end;
  820. variantdef,
  821. pointerdef,
  822. classrefdef,
  823. objectdef : ;
  824. else
  825. CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename);
  826. end;
  827. end;
  828. hp:=tarrayconstructornode(hp.right);
  829. end;
  830. { swap the tree for cargs }
  831. if (nf_cargs in flags) and (not(nf_cargswap in flags)) then
  832. begin
  833. chp:=nil;
  834. { save resulttype }
  835. htype:=resulttype;
  836. { we need a copy here, because self is destroyed }
  837. { by firstpass later }
  838. hp:=tarrayconstructornode(getcopy);
  839. { we also need a copy of the nf_ forcevaria flag to restore }
  840. { later) (JM) }
  841. orgflags := flags * [nf_forcevaria];
  842. while assigned(hp) do
  843. begin
  844. thp:=tarrayconstructornode(hp.right);
  845. hp.right:=chp;
  846. chp:=hp;
  847. hp:=thp;
  848. end;
  849. chp.flags := chp.flags+orgflags;
  850. include(chp.flags,nf_cargs);
  851. include(chp.flags,nf_cargswap);
  852. chp.expectloc:=LOC_CREFERENCE;
  853. calcregisters(chp,0,0,0);
  854. chp.resulttype:=htype;
  855. result:=chp;
  856. exit;
  857. end;
  858. end;
  859. { C style has pushed everything on the stack, so
  860. there is no return value }
  861. if (nf_cargs in flags) then
  862. expectloc:=LOC_VOID
  863. else
  864. expectloc:=LOC_CREFERENCE;
  865. { Calculate registers }
  866. calcregisters(self,0,0,0);
  867. end;
  868. function tarrayconstructornode.docompare(p: tnode): boolean;
  869. begin
  870. docompare :=
  871. inherited docompare(p);
  872. end;
  873. {*****************************************************************************
  874. TTYPENODE
  875. *****************************************************************************}
  876. constructor ttypenode.create(t : ttype);
  877. begin
  878. inherited create(typen);
  879. restype:=t;
  880. allowed:=false;
  881. end;
  882. constructor ttypenode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  883. begin
  884. inherited ppuload(t,ppufile);
  885. ppufile.gettype(restype);
  886. allowed:=boolean(ppufile.getbyte);
  887. end;
  888. procedure ttypenode.ppuwrite(ppufile:tcompilerppufile);
  889. begin
  890. inherited ppuwrite(ppufile);
  891. ppufile.puttype(restype);
  892. ppufile.putbyte(byte(allowed));
  893. end;
  894. procedure ttypenode.derefimpl;
  895. begin
  896. inherited derefimpl;
  897. restype.resolve;
  898. end;
  899. function ttypenode.det_resulttype:tnode;
  900. begin
  901. result:=nil;
  902. resulttype:=restype;
  903. { check if it's valid }
  904. if restype.def.deftype = errordef then
  905. CGMessage(cg_e_illegal_expression);
  906. end;
  907. function ttypenode.pass_1 : tnode;
  908. begin
  909. result:=nil;
  910. expectloc:=LOC_VOID;
  911. { a typenode can't generate code, so we give here
  912. an error. Else it'll be an abstract error in pass_2.
  913. Only when the allowed flag is set we don't generate
  914. an error }
  915. if not allowed then
  916. Message(parser_e_no_type_not_allowed_here);
  917. end;
  918. function ttypenode.docompare(p: tnode): boolean;
  919. begin
  920. docompare :=
  921. inherited docompare(p);
  922. end;
  923. {*****************************************************************************
  924. TRTTINODE
  925. *****************************************************************************}
  926. constructor trttinode.create(def:tstoreddef;rt:trttitype);
  927. begin
  928. inherited create(rttin);
  929. rttidef:=def;
  930. rttitype:=rt;
  931. end;
  932. constructor trttinode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  933. begin
  934. inherited ppuload(t,ppufile);
  935. rttidef:=tstoreddef(ppufile.getderef);
  936. rttitype:=trttitype(ppufile.getbyte);
  937. end;
  938. procedure trttinode.ppuwrite(ppufile:tcompilerppufile);
  939. begin
  940. inherited ppuwrite(ppufile);
  941. ppufile.putderef(rttidef);
  942. ppufile.putbyte(byte(rttitype));
  943. end;
  944. procedure trttinode.derefimpl;
  945. begin
  946. inherited derefimpl;
  947. resolvedef(pointer(rttidef));
  948. end;
  949. function trttinode.getcopy : tnode;
  950. var
  951. n : trttinode;
  952. begin
  953. n:=trttinode(inherited getcopy);
  954. n.rttidef:=rttidef;
  955. n.rttitype:=rttitype;
  956. result:=n;
  957. end;
  958. function trttinode.det_resulttype:tnode;
  959. begin
  960. { rtti information will be returned as a void pointer }
  961. result:=nil;
  962. resulttype:=voidpointertype;
  963. end;
  964. function trttinode.pass_1 : tnode;
  965. begin
  966. result:=nil;
  967. expectloc:=LOC_CREFERENCE;
  968. end;
  969. function trttinode.docompare(p: tnode): boolean;
  970. begin
  971. docompare :=
  972. inherited docompare(p) and
  973. (rttidef = trttinode(p).rttidef) and
  974. (rttitype = trttinode(p).rttitype);
  975. end;
  976. procedure trttinode.pass_2;
  977. begin
  978. location_reset(location,LOC_CREFERENCE,OS_NO);
  979. location.reference.symbol:=rttidef.get_rtti_label(rttitype);
  980. end;
  981. begin
  982. cloadnode:=tloadnode;
  983. cassignmentnode:=tassignmentnode;
  984. carrayconstructorrangenode:=tarrayconstructorrangenode;
  985. carrayconstructornode:=tarrayconstructornode;
  986. ctypenode:=ttypenode;
  987. crttinode:=trttinode;
  988. end.
  989. {
  990. $Log$
  991. Revision 1.88 2003-04-26 00:28:42 peter
  992. * removed load_funcret
  993. Revision 1.87 2003/04/25 20:59:33 peter
  994. * removed funcretn,funcretsym, function result is now in varsym
  995. and aliases for result and function name are added using absolutesym
  996. * vs_hidden parameter for funcret passed in parameter
  997. * vs_hidden fixes
  998. * writenode changed to printnode and released from extdebug
  999. * -vp option added to generate a tree.log with the nodetree
  1000. * nicer printnode for statements, callnode
  1001. Revision 1.86 2003/04/23 20:16:04 peter
  1002. + added currency support based on int64
  1003. + is_64bit for use in cg units instead of is_64bitint
  1004. * removed cgmessage from n386add, replace with internalerrors
  1005. Revision 1.85 2003/04/23 10:10:54 peter
  1006. * procvar is not compared in addrn
  1007. Revision 1.84 2003/04/22 23:50:23 peter
  1008. * firstpass uses expectloc
  1009. * checks if there are differences between the expectloc and
  1010. location.loc from secondpass in EXTDEBUG
  1011. Revision 1.83 2003/04/11 15:01:23 peter
  1012. * fix bug 2438
  1013. Revision 1.82 2003/03/28 19:16:56 peter
  1014. * generic constructor working for i386
  1015. * remove fixed self register
  1016. * esi added as address register for i386
  1017. Revision 1.81 2003/03/11 21:46:24 jonas
  1018. * lots of new regallocator fixes, both in generic and ppc-specific code
  1019. (ppc compiler still can't compile the linux system unit though)
  1020. Revision 1.80 2003/01/07 16:52:58 jonas
  1021. * fixed ansistring+char and ansistring+shortstring optimizations (those
  1022. cases were always handled as ansistring+ansistring due to
  1023. typeconversions inserted by the add-node)
  1024. Revision 1.79 2003/01/05 22:44:14 peter
  1025. * remove a lot of code to support typen in loadn-procsym
  1026. Revision 1.78 2003/01/03 12:15:56 daniel
  1027. * Removed ifdefs around notifications
  1028. ifdefs around for loop optimizations remain
  1029. Revision 1.77 2002/12/31 09:55:58 daniel
  1030. + Notification implementation complete
  1031. + Add for loop code optimization using notifications
  1032. results in 1.5-1.9% speed improvement in nestloop benchmark
  1033. Optimization incomplete, compiler does not cycle yet with
  1034. notifications enabled.
  1035. Revision 1.76 2002/12/30 22:44:53 daniel
  1036. * Some work on notifications
  1037. Revision 1.75 2002/12/27 15:27:25 peter
  1038. * remove property indicator when calling internal helpers
  1039. Revision 1.74 2002/12/24 16:53:19 peter
  1040. * fix for tb0438
  1041. Revision 1.73 2002/12/20 18:14:53 peter
  1042. * fix result of high_tree when high was not available
  1043. Revision 1.72 2002/12/17 22:19:33 peter
  1044. * fixed pushing of records>8 bytes with stdcall
  1045. * simplified hightree loading
  1046. Revision 1.71 2002/12/07 14:27:07 carl
  1047. * 3% memory optimization
  1048. * changed some types
  1049. + added type checking with different size for call node and for
  1050. parameters
  1051. Revision 1.70 2002/12/02 19:38:06 carl
  1052. * fix some errors
  1053. Revision 1.69 2002/11/29 20:02:44 carl
  1054. * warning / hint for possible loss of data in assignment
  1055. Revision 1.68 2002/11/27 20:04:39 peter
  1056. * cdecl array of const fixes
  1057. Revision 1.67 2002/11/27 15:33:47 peter
  1058. * the never ending story of tp procvar hacks
  1059. Revision 1.66 2002/11/25 17:43:20 peter
  1060. * splitted defbase in defutil,symutil,defcmp
  1061. * merged isconvertable and is_equal into compare_defs(_ext)
  1062. * made operator search faster by walking the list only once
  1063. Revision 1.65 2002/11/18 17:31:57 peter
  1064. * pass proccalloption to ret_in_xxx and push_xxx functions
  1065. Revision 1.64 2002/11/15 01:58:52 peter
  1066. * merged changes from 1.0.7 up to 04-11
  1067. - -V option for generating bug report tracing
  1068. - more tracing for option parsing
  1069. - errors for cdecl and high()
  1070. - win32 import stabs
  1071. - win32 records<=8 are returned in eax:edx (turned off by default)
  1072. - heaptrc update
  1073. - more info for temp management in .s file with EXTDEBUG
  1074. Revision 1.63 2002/10/17 12:44:09 florian
  1075. + s:=s+<string type> where s is an ansistring is done via calls to append_ansistring_*
  1076. Revision 1.62 2002/10/05 12:43:25 carl
  1077. * fixes for Delphi 6 compilation
  1078. (warning : Some features do not work under Delphi)
  1079. Revision 1.61 2002/10/03 21:26:08 carl
  1080. + compile-time range checking for strings
  1081. Revision 1.60 2002/09/27 21:13:28 carl
  1082. * low-highval always checked if limit ober 2GB is reached (to avoid overflow)
  1083. Revision 1.59 2002/09/26 15:02:05 florian
  1084. + support of passing variants to "array of const"
  1085. Revision 1.58 2002/09/07 15:25:03 peter
  1086. * old logs removed and tabs fixed
  1087. Revision 1.57 2002/09/03 16:26:26 daniel
  1088. * Make Tprocdef.defs protected
  1089. Revision 1.56 2002/09/01 13:28:37 daniel
  1090. - write_access fields removed in favor of a flag
  1091. Revision 1.55 2002/09/01 08:01:16 daniel
  1092. * Removed sets from Tcallnode.det_resulttype
  1093. + Added read/write notifications of variables. These will be usefull
  1094. for providing information for several optimizations. For example
  1095. the value of the loop variable of a for loop does matter is the
  1096. variable is read after the for loop, but if it's no longer used
  1097. or written, it doesn't matter and this can be used to optimize
  1098. the loop code generation.
  1099. Revision 1.54 2002/08/25 19:25:19 peter
  1100. * sym.insert_in_data removed
  1101. * symtable.insertvardata/insertconstdata added
  1102. * removed insert_in_data call from symtable.insert, it needs to be
  1103. called separatly. This allows to deref the address calculation
  1104. * procedures now calculate the parast addresses after the procedure
  1105. directives are parsed. This fixes the cdecl parast problem
  1106. * push_addr_param has an extra argument that specifies if cdecl is used
  1107. or not
  1108. Revision 1.53 2002/08/19 19:36:43 peter
  1109. * More fixes for cross unit inlining, all tnodes are now implemented
  1110. * Moved pocall_internconst to po_internconst because it is not a
  1111. calling type at all and it conflicted when inlining of these small
  1112. functions was requested
  1113. Revision 1.52 2002/08/18 20:06:23 peter
  1114. * inlining is now also allowed in interface
  1115. * renamed write/load to ppuwrite/ppuload
  1116. * tnode storing in ppu
  1117. * nld,ncon,nbas are already updated for storing in ppu
  1118. Revision 1.51 2002/08/17 22:09:46 florian
  1119. * result type handling in tcgcal.pass_2 overhauled
  1120. * better tnode.dowrite
  1121. * some ppc stuff fixed
  1122. Revision 1.50 2002/08/17 09:23:37 florian
  1123. * first part of procinfo rewrite
  1124. Revision 1.49 2002/07/20 11:57:54 florian
  1125. * types.pas renamed to defbase.pas because D6 contains a types
  1126. unit so this would conflicts if D6 programms are compiled
  1127. + Willamette/SSE2 instructions to assembler added
  1128. Revision 1.48 2002/07/20 07:44:37 daniel
  1129. * Forgot to add a $ifdef extdebug
  1130. Revision 1.47 2002/07/19 12:55:27 daniel
  1131. * Further developed state tracking in whilerepeatn
  1132. Revision 1.46 2002/07/19 11:41:36 daniel
  1133. * State tracker work
  1134. * The whilen and repeatn are now completely unified into whilerepeatn. This
  1135. allows the state tracker to change while nodes automatically into
  1136. repeat nodes.
  1137. * Resulttypepass improvements to the notn. 'not not a' is optimized away and
  1138. 'not(a>b)' is optimized into 'a<=b'.
  1139. * Resulttypepass improvements to the whilerepeatn. 'while not a' is optimized
  1140. by removing the notn and later switchting the true and falselabels. The
  1141. same is done with 'repeat until not a'.
  1142. Revision 1.45 2002/07/15 18:03:15 florian
  1143. * readded removed changes
  1144. Revision 1.43 2002/07/11 14:41:28 florian
  1145. * start of the new generic parameter handling
  1146. Revision 1.44 2002/07/14 18:00:44 daniel
  1147. + Added the beginning of a state tracker. This will track the values of
  1148. variables through procedures and optimize things away.
  1149. Revision 1.42 2002/05/18 13:34:10 peter
  1150. * readded missing revisions
  1151. Revision 1.41 2002/05/16 19:46:38 carl
  1152. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1153. + try to fix temp allocation (still in ifdef)
  1154. + generic constructor calls
  1155. + start of tassembler / tmodulebase class cleanup
  1156. Revision 1.39 2002/05/12 16:53:07 peter
  1157. * moved entry and exitcode to ncgutil and cgobj
  1158. * foreach gets extra argument for passing local data to the
  1159. iterator function
  1160. * -CR checks also class typecasts at runtime by changing them
  1161. into as
  1162. * fixed compiler to cycle with the -CR option
  1163. * fixed stabs with elf writer, finally the global variables can
  1164. be watched
  1165. * removed a lot of routines from cga unit and replaced them by
  1166. calls to cgobj
  1167. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  1168. u32bit then the other is typecasted also to u32bit without giving
  1169. a rangecheck warning/error.
  1170. * fixed pascal calling method with reversing also the high tree in
  1171. the parast, detected by tcalcst3 test
  1172. Revision 1.38 2002/04/25 20:16:39 peter
  1173. * moved more routines from cga/n386util
  1174. Revision 1.37 2002/04/23 19:16:34 peter
  1175. * add pinline unit that inserts compiler supported functions using
  1176. one or more statements
  1177. * moved finalize and setlength from ninl to pinline
  1178. }