nld.pas 48 KB

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