nld.pas 48 KB

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