nld.pas 49 KB

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