nld.pas 47 KB

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