nld.pas 48 KB

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