nld.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  1. {
  2. $Id$
  3. Copyright (c) 2000 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 defines.inc}
  20. interface
  21. uses
  22. node,
  23. symbase,symtype,symsym;
  24. type
  25. tloadnode = class(tunarynode)
  26. symtableentry : psym;
  27. symtable : psymtable;
  28. constructor create(v : psym;st : psymtable);virtual;
  29. function getcopy : tnode;override;
  30. function pass_1 : tnode;override;
  31. end;
  32. { different assignment types }
  33. tassigntype = (at_normal,at_plus,at_minus,at_star,at_slash);
  34. tassignmentnode = class(tbinarynode)
  35. assigntype : tassigntype;
  36. constructor create(l,r : tnode);virtual;
  37. function getcopy : tnode;override;
  38. function pass_1 : tnode;override;
  39. end;
  40. tfuncretnode = class(tnode)
  41. funcretprocinfo : pointer;
  42. rettype : ttype;
  43. constructor create;virtual;
  44. function getcopy : tnode;override;
  45. function pass_1 : tnode;override;
  46. end;
  47. tarrayconstructorrangenode = class(tbinarynode)
  48. constructor create(l,r : tnode);virtual;
  49. function pass_1 : tnode;override;
  50. end;
  51. tarrayconstructornode = class(tbinarynode)
  52. constructordef : pdef;
  53. constructor create(l,r : tnode);virtual;
  54. function getcopy : tnode;override;
  55. function pass_1 : tnode;override;
  56. end;
  57. ttypenode = class(tnode)
  58. typenodetype : pdef;
  59. typenodesym:ptypesym;
  60. constructor create(t : pdef;sym:ptypesym);virtual;
  61. function getcopy : tnode;override;
  62. function pass_1 : tnode;override;
  63. end;
  64. var
  65. cloadnode : class of tloadnode;
  66. cassignmentnode : class of tassignmentnode;
  67. cfuncretnode : class of tfuncretnode;
  68. carrayconstructorrangenode : class of tarrayconstructorrangenode;
  69. carrayconstructornode : class of tarrayconstructornode;
  70. ctypenode : class of ttypenode;
  71. function genloadnode(v : pvarsym;st : psymtable) : tloadnode;
  72. function gentypenode(t : pdef;sym:ptypesym) : ttypenode;
  73. function genloadcallnode(v: pprocsym;st: psymtable): tloadnode;
  74. function genloadmethodcallnode(v: pprocsym;st: psymtable; mp: tnode): tloadnode;
  75. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : tloadnode;
  76. implementation
  77. uses
  78. cutils,verbose,globtype,globals,systems,
  79. symconst,symdef,symtable,types,
  80. htypechk,pass_1,
  81. ncnv,nmem,cpubase,tgcpu,hcodegen
  82. {$ifdef newcg}
  83. ,cgbase
  84. ,tgobj
  85. {$endif newcg}
  86. ;
  87. function genloadnode(v : pvarsym;st : psymtable) : tloadnode;
  88. var
  89. n : tloadnode;
  90. begin
  91. n:=cloadnode.create(v,st);
  92. n.resulttype:=v^.vartype.def;
  93. genloadnode:=n;
  94. end;
  95. function genloadcallnode(v: pprocsym;st: psymtable): tloadnode;
  96. var
  97. n : tloadnode;
  98. begin
  99. n:=cloadnode.create(v,st);
  100. n.resulttype:=v^.definition;
  101. genloadcallnode:=n;
  102. end;
  103. function genloadmethodcallnode(v: pprocsym;st: psymtable; mp: tnode): tloadnode;
  104. var
  105. n : tloadnode;
  106. begin
  107. n:=cloadnode.create(v,st);
  108. n.resulttype:=v^.definition;
  109. n.left:=mp;
  110. genloadmethodcallnode:=n;
  111. end;
  112. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : tloadnode;
  113. var
  114. n : tloadnode;
  115. begin
  116. n:=cloadnode.create(sym,st);
  117. n.resulttype:=sym^.typedconsttype.def;
  118. gentypedconstloadnode:=n;
  119. end;
  120. function gentypenode(t : pdef;sym:ptypesym) : ttypenode;
  121. begin
  122. gentypenode:=ctypenode.create(t,sym);
  123. end;
  124. {*****************************************************************************
  125. TLOADNODE
  126. *****************************************************************************}
  127. constructor tloadnode.create(v : psym;st : psymtable);
  128. begin
  129. inherited create(loadn,nil);
  130. symtableentry:=v;
  131. symtable:=st;
  132. end;
  133. function tloadnode.getcopy : tnode;
  134. var
  135. n : tloadnode;
  136. begin
  137. n:=tloadnode(inherited getcopy);
  138. n.symtable:=symtable;
  139. n.symtableentry:=symtableentry;
  140. result:=n;
  141. end;
  142. function tloadnode.pass_1 : tnode;
  143. var
  144. p1 : tnode;
  145. begin
  146. result:=nil;
  147. if (symtable^.symtabletype=withsymtable) and
  148. (pwithsymtable(symtable)^.direct_with) and
  149. (symtableentry^.typ=varsym) then
  150. begin
  151. p1:=tnode(pwithsymtable(symtable)^.withrefnode).getcopy;
  152. p1:=gensubscriptnode(pvarsym(symtableentry),p1);
  153. left:=nil;
  154. firstpass(p1);
  155. result:=p1;
  156. exit;
  157. end;
  158. location.loc:=LOC_REFERENCE;
  159. registers32:=0;
  160. registersfpu:=0;
  161. {$ifdef SUPPORT_MMX}
  162. registersmmx:=0;
  163. {$endif SUPPORT_MMX}
  164. { handle first absolute as it will replace the symtableentry }
  165. if symtableentry^.typ=absolutesym then
  166. begin
  167. resulttype:=pabsolutesym(symtableentry)^.vartype.def;
  168. { replace the symtableentry when it points to a var, else
  169. we are finished }
  170. if pabsolutesym(symtableentry)^.abstyp=tovar then
  171. begin
  172. symtableentry:=pabsolutesym(symtableentry)^.ref;
  173. symtable:=symtableentry^.owner;
  174. include(flags,nf_absolute);
  175. end
  176. else
  177. exit;
  178. end;
  179. case symtableentry^.typ of
  180. funcretsym :
  181. begin
  182. p1:=cfuncretnode.create;
  183. tfuncretnode(p1).funcretprocinfo:=pprocinfo(pfuncretsym(symtableentry)^.funcretprocinfo);
  184. tfuncretnode(p1).rettype:=pfuncretsym(symtableentry)^.rettype;
  185. firstpass(p1);
  186. { if it's refered as absolute then we need to have the
  187. type of the absolute instead of the function return,
  188. the function return is then also assigned }
  189. if nf_absolute in flags then
  190. begin
  191. pprocinfo(tfuncretnode(p1).funcretprocinfo)^.funcret_state:=vs_assigned;
  192. p1.resulttype:=resulttype;
  193. end;
  194. left:=nil;
  195. result:=p1;
  196. end;
  197. constsym:
  198. begin
  199. if pconstsym(symtableentry)^.consttyp=constresourcestring then
  200. begin
  201. resulttype:=cansistringdef;
  202. { we use ansistrings so no fast exit here }
  203. if assigned(procinfo) then
  204. procinfo^.no_fast_exit:=true;
  205. location.loc:=LOC_MEM;
  206. end
  207. else
  208. internalerror(22799);
  209. end;
  210. varsym :
  211. begin
  212. { if it's refered by absolute then it's used }
  213. if nf_absolute in flags then
  214. pvarsym(symtableentry)^.varstate:=vs_used
  215. else
  216. if (resulttype=nil) then
  217. resulttype:=pvarsym(symtableentry)^.vartype.def;
  218. if (symtable^.symtabletype in [parasymtable,localsymtable]) and
  219. (lexlevel>symtable^.symtablelevel) then
  220. begin
  221. { if the variable is in an other stackframe then we need
  222. a register to dereference }
  223. if (symtable^.symtablelevel)>0 then
  224. begin
  225. registers32:=1;
  226. { further, the variable can't be put into a register }
  227. pvarsym(symtableentry)^.varoptions:=
  228. pvarsym(symtableentry)^.varoptions-[vo_fpuregable,vo_regable];
  229. end;
  230. end;
  231. if (pvarsym(symtableentry)^.varspez=vs_const) then
  232. location.loc:=LOC_MEM;
  233. { we need a register for call by reference parameters }
  234. if (pvarsym(symtableentry)^.varspez in [vs_var,vs_out]) or
  235. ((pvarsym(symtableentry)^.varspez=vs_const) and
  236. push_addr_param(pvarsym(symtableentry)^.vartype.def)) or
  237. { call by value open arrays are also indirect addressed }
  238. is_open_array(pvarsym(symtableentry)^.vartype.def) then
  239. registers32:=1;
  240. if symtable^.symtabletype=withsymtable then
  241. inc(registers32);
  242. if ([vo_is_thread_var,vo_is_dll_var]*pvarsym(symtableentry)^.varoptions)<>[] then
  243. registers32:=1;
  244. { count variable references }
  245. { this will create problem with local var set by
  246. under_procedures
  247. if (assigned(pvarsym(symtableentry)^.owner) and assigned(aktprocsym)
  248. and ((pvarsym(symtableentry)^.owner = aktprocsym^.definition^.localst)
  249. or (pvarsym(symtableentry)^.owner = aktprocsym^.definition^.localst))) then }
  250. if t_times<1 then
  251. inc(pvarsym(symtableentry)^.refs)
  252. else
  253. inc(pvarsym(symtableentry)^.refs,t_times);
  254. end;
  255. typedconstsym :
  256. if not(nf_absolute in flags) then
  257. resulttype:=ptypedconstsym(symtableentry)^.typedconsttype.def;
  258. procsym :
  259. begin
  260. if assigned(pprocsym(symtableentry)^.definition^.nextoverloaded) then
  261. CGMessage(parser_e_no_overloaded_procvars);
  262. resulttype:=pprocsym(symtableentry)^.definition;
  263. { if the owner of the procsym is a object, }
  264. { left must be set, if left isn't set }
  265. { it can be only self }
  266. { this code is only used in TP procvar mode }
  267. if (m_tp_procvar in aktmodeswitches) and
  268. not(assigned(left)) and
  269. (pprocsym(symtableentry)^.owner^.symtabletype=objectsymtable) then
  270. left:=genselfnode(pobjectdef(symtableentry^.owner^.defowner));
  271. { method pointer ? }
  272. if assigned(left) then
  273. begin
  274. firstpass(left);
  275. registers32:=max(registers32,left.registers32);
  276. registersfpu:=max(registersfpu,left.registersfpu);
  277. {$ifdef SUPPORT_MMX}
  278. registersmmx:=max(registersmmx,left.registersmmx);
  279. {$endif SUPPORT_MMX}
  280. end;
  281. end;
  282. else
  283. internalerror(3);
  284. end;
  285. end;
  286. {*****************************************************************************
  287. TASSIGNMENTNODE
  288. *****************************************************************************}
  289. constructor tassignmentnode.create(l,r : tnode);
  290. begin
  291. inherited create(assignn,l,r);
  292. assigntype:=at_normal;
  293. end;
  294. function tassignmentnode.getcopy : tnode;
  295. var
  296. n : tassignmentnode;
  297. begin
  298. n:=tassignmentnode(inherited getcopy);
  299. n.assigntype:=assigntype;
  300. getcopy:=n;
  301. end;
  302. function tassignmentnode.pass_1 : tnode;
  303. {$ifdef newoptimizations2}
  304. var
  305. hp : tnode;
  306. {$endif newoptimizations2}
  307. begin
  308. result:=nil;
  309. { must be made unique }
  310. if assigned(left) then
  311. begin
  312. set_unique(left);
  313. { set we the function result? }
  314. set_funcret_is_valid(left);
  315. end;
  316. firstpass(left);
  317. set_varstate(left,false);
  318. if codegenerror then
  319. exit;
  320. { assignements to open arrays aren't allowed }
  321. if is_open_array(left.resulttype) then
  322. CGMessage(type_e_mismatch);
  323. { test if we can avoid copying string to temp
  324. as in s:=s+...; (PM) }
  325. {$ifdef dummyi386}
  326. if ((right.treetype=addn) or (right.treetype=subn)) and
  327. equal_trees(left,right.left) and
  328. (ret_in_acc(left.resulttype)) and
  329. (not cs_rangechecking in aktmoduleswitches^) then
  330. begin
  331. disposetree(right.left);
  332. hp:=right;
  333. right:=right.right;
  334. if hp.treetype=addn then
  335. assigntyp:=at_plus
  336. else
  337. assigntyp:=at_minus;
  338. putnode(hp);
  339. end;
  340. if assigntyp<>at_normal then
  341. begin
  342. { for fpu type there is no faster way }
  343. if is_fpu(left.resulttype) then
  344. case assigntyp of
  345. at_plus : right:=gennode(addn,getcopy(left),right);
  346. at_minus : right:=gennode(subn,getcopy(left),right);
  347. at_star : right:=gennode(muln,getcopy(left),right);
  348. at_slash : right:=gennode(slashn,getcopy(left),right);
  349. end;
  350. end;
  351. {$endif i386}
  352. firstpass(right);
  353. set_varstate(right,true);
  354. if codegenerror then
  355. exit;
  356. { some string functions don't need conversion, so treat them separatly }
  357. if is_shortstring(left.resulttype) and (assigned(right.resulttype)) then
  358. begin
  359. if not (is_shortstring(right.resulttype) or
  360. is_ansistring(right.resulttype) or
  361. is_char(right.resulttype)) then
  362. begin
  363. right:=gentypeconvnode(right,left.resulttype);
  364. firstpass(right);
  365. if codegenerror then
  366. exit;
  367. end;
  368. { we call STRCOPY }
  369. procinfo^.flags:=procinfo^.flags or pi_do_call;
  370. { test for s:=s+anything ... }
  371. { the problem is for
  372. s:=s+s+s;
  373. this is broken here !! }
  374. {$ifdef newoptimizations2}
  375. { the above is fixed now, but still problem with s := s + f(); if }
  376. { f modifies s (bad programming, so only enable if uncertain }
  377. { optimizations are on) (JM) }
  378. if (cs_UncertainOpts in aktglobalswitches) then
  379. begin
  380. hp := right;
  381. while hp.treetype=addn do hp:=hp.left;
  382. if equal_trees(left,hp) and
  383. not multiple_uses(left,right) then
  384. begin
  385. concat_string:=true;
  386. hp:=right;
  387. while hp.treetype=addn do
  388. begin
  389. hp.use_strconcat:=true;
  390. hp:=hp.left;
  391. end;
  392. end;
  393. end;
  394. {$endif newoptimizations2}
  395. end
  396. else
  397. begin
  398. right:=gentypeconvnode(right,left.resulttype);
  399. firstpass(right);
  400. if codegenerror then
  401. exit;
  402. end;
  403. { test if node can be assigned, properties are allowed }
  404. valid_for_assign(left,true);
  405. { check if local proc/func is assigned to procvar }
  406. if right.resulttype^.deftype=procvardef then
  407. test_local_to_procvar(pprocvardef(right.resulttype),left.resulttype);
  408. resulttype:=voiddef;
  409. {
  410. registers32:=max(left.registers32,right.registers32);
  411. registersfpu:=max(left.registersfpu,right.registersfpu);
  412. }
  413. registers32:=left.registers32+right.registers32;
  414. registersfpu:=max(left.registersfpu,right.registersfpu);
  415. {$ifdef SUPPORT_MMX}
  416. registersmmx:=max(left.registersmmx,right.registersmmx);
  417. {$endif SUPPORT_MMX}
  418. end;
  419. {*****************************************************************************
  420. TFUNCRETNODE
  421. *****************************************************************************}
  422. constructor tfuncretnode.create;
  423. begin
  424. inherited create(funcretn);
  425. funcretprocinfo:=nil;
  426. end;
  427. function tfuncretnode.getcopy : tnode;
  428. var
  429. n : tfuncretnode;
  430. begin
  431. n:=tfuncretnode(inherited getcopy);
  432. n.funcretprocinfo:=funcretprocinfo;
  433. n.rettype:=rettype;
  434. getcopy:=n;
  435. end;
  436. function tfuncretnode.pass_1 : tnode;
  437. begin
  438. result:=nil;
  439. resulttype:=rettype.def;
  440. location.loc:=LOC_REFERENCE;
  441. if ret_in_param(rettype.def) or
  442. (procinfo<>pprocinfo(funcretprocinfo)) then
  443. registers32:=1;
  444. end;
  445. {*****************************************************************************
  446. TARRAYCONSTRUCTORRANGENODE
  447. *****************************************************************************}
  448. constructor tarrayconstructorrangenode.create(l,r : tnode);
  449. begin
  450. inherited create(arrayconstructorrangen,l,r);
  451. end;
  452. function tarrayconstructorrangenode.pass_1 : tnode;
  453. begin
  454. result:=nil;
  455. firstpass(left);
  456. set_varstate(left,true);
  457. firstpass(right);
  458. set_varstate(right,true);
  459. calcregisters(self,0,0,0);
  460. resulttype:=left.resulttype;
  461. end;
  462. {****************************************************************************
  463. TARRAYCONSTRUCTORNODE
  464. *****************************************************************************}
  465. constructor tarrayconstructornode.create(l,r : tnode);
  466. begin
  467. inherited create(arrayconstructorn,l,r);
  468. constructordef:=nil;
  469. end;
  470. function tarrayconstructornode.getcopy : tnode;
  471. var
  472. n : tarrayconstructornode;
  473. begin
  474. n:=tarrayconstructornode(inherited getcopy);
  475. n.constructordef:=constructordef;
  476. result:=n;
  477. end;
  478. function tarrayconstructornode.pass_1 : tnode;
  479. var
  480. pd : pdef;
  481. thp,
  482. chp,
  483. hp : tarrayconstructornode;
  484. len : longint;
  485. varia : boolean;
  486. procedure postprocess(t : tnode);
  487. begin
  488. calcregisters(tbinarynode(t),0,0,0);
  489. { looks a little bit dangerous to me }
  490. { len-1 gives problems with is_open_array if len=0, }
  491. { is_open_array checks now for isconstructor (FK) }
  492. { if no type is set then we set the type to voiddef to overcome a
  493. 0 addressing }
  494. if not assigned(pd) then
  495. pd:=voiddef;
  496. { skip if already done ! (PM) }
  497. if not assigned(t.resulttype) or
  498. (t.resulttype^.deftype<>arraydef) or
  499. not parraydef(t.resulttype)^.IsConstructor or
  500. (parraydef(t.resulttype)^.lowrange<>0) or
  501. (parraydef(t.resulttype)^.highrange<>len-1) then
  502. t.resulttype:=new(parraydef,init(0,len-1,s32bitdef));
  503. parraydef(t.resulttype)^.elementtype.def:=pd;
  504. parraydef(t.resulttype)^.IsConstructor:=true;
  505. parraydef(t.resulttype)^.IsVariant:=varia;
  506. t.location.loc:=LOC_MEM;
  507. end;
  508. begin
  509. result:=nil;
  510. { are we allowing array constructor? Then convert it to a set }
  511. if not allow_array_constructor then
  512. begin
  513. hp:=tarrayconstructornode(getcopy);
  514. arrayconstructor_to_set(hp);
  515. firstpass(hp);
  516. pass_1:=hp;
  517. exit;
  518. end;
  519. { only pass left tree, right tree contains next construct if any }
  520. pd:=constructordef;
  521. len:=0;
  522. varia:=false;
  523. if assigned(left) then
  524. begin
  525. hp:=self;
  526. while assigned(hp) do
  527. begin
  528. firstpass(hp.left);
  529. set_varstate(hp.left,true);
  530. if (not get_para_resulttype) and
  531. (not(nf_novariaallowed in flags)) then
  532. begin
  533. case hp.left.resulttype^.deftype of
  534. enumdef :
  535. begin
  536. hp.left:=gentypeconvnode(hp.left,s32bitdef);
  537. firstpass(hp.left);
  538. end;
  539. orddef :
  540. begin
  541. if is_integer(hp.left.resulttype) and
  542. not(is_64bitint(hp.left.resulttype)) then
  543. begin
  544. hp.left:=gentypeconvnode(hp.left,s32bitdef);
  545. firstpass(hp.left);
  546. end;
  547. end;
  548. floatdef :
  549. begin
  550. hp.left:=gentypeconvnode(hp.left,bestrealdef^);
  551. firstpass(hp.left);
  552. end;
  553. stringdef :
  554. begin
  555. if nf_cargs in flags then
  556. begin
  557. hp.left:=gentypeconvnode(hp.left,charpointerdef);
  558. firstpass(hp.left);
  559. end;
  560. end;
  561. procvardef :
  562. begin
  563. hp.left:=gentypeconvnode(hp.left,voidpointerdef);
  564. firstpass(hp.left);
  565. end;
  566. pointerdef,
  567. classrefdef,
  568. objectdef : ;
  569. else
  570. CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype^.typename);
  571. end;
  572. end;
  573. if (pd=nil) then
  574. pd:=hp.left.resulttype
  575. else
  576. begin
  577. if ((nf_novariaallowed in flags) or (not varia)) and
  578. (not is_equal(pd,hp.left.resulttype)) then
  579. begin
  580. { if both should be equal try inserting a conversion }
  581. if nf_novariaallowed in flags then
  582. begin
  583. hp.left:=gentypeconvnode(hp.left,pd);
  584. firstpass(hp.left);
  585. end;
  586. varia:=true;
  587. end;
  588. end;
  589. inc(len);
  590. hp:=tarrayconstructornode(hp.right);
  591. end;
  592. { swap the tree for cargs }
  593. if (nf_cargs in flags) and (not(nf_cargswap in flags)) then
  594. begin
  595. chp:=nil;
  596. { we need a copy here, because self is destroyed }
  597. { by firstpass later }
  598. hp:=tarrayconstructornode(getcopy);
  599. while assigned(hp) do
  600. begin
  601. thp:=tarrayconstructornode(hp.right);
  602. hp.right:=chp;
  603. chp:=hp;
  604. hp:=thp;
  605. end;
  606. include(chp.flags,nf_cargs);
  607. include(chp.flags,nf_cargswap);
  608. postprocess(chp);
  609. pass_1:=chp;
  610. exit;
  611. end;
  612. end;
  613. postprocess(self);
  614. end;
  615. {*****************************************************************************
  616. TTYPENODE
  617. *****************************************************************************}
  618. constructor ttypenode.create(t : pdef;sym:ptypesym);
  619. begin
  620. inherited create(typen);
  621. resulttype:=generrordef;
  622. typenodetype:=t;
  623. typenodesym:=sym;
  624. end;
  625. function ttypenode.getcopy : tnode;
  626. var
  627. n : ttypenode;
  628. begin
  629. n:=ttypenode(inherited getcopy);
  630. n.typenodetype:=typenodetype;
  631. n.typenodesym:=typenodesym;
  632. result:=n;
  633. end;
  634. function ttypenode.pass_1 : tnode;
  635. begin
  636. pass_1:=nil;
  637. { do nothing, resulttype is already set }
  638. end;
  639. begin
  640. cloadnode:=tloadnode;
  641. cassignmentnode:=tassignmentnode;
  642. cfuncretnode:=tfuncretnode;
  643. carrayconstructorrangenode:=tarrayconstructorrangenode;
  644. carrayconstructornode:=tarrayconstructornode;
  645. ctypenode:=ttypenode;
  646. end.
  647. {
  648. $Log$
  649. Revision 1.9 2000-11-29 00:30:33 florian
  650. * unused units removed from uses clause
  651. * some changes for widestrings
  652. Revision 1.8 2000/11/04 14:25:20 florian
  653. + merged Attila's changes for interfaces, not tested yet
  654. Revision 1.7 2000/10/31 22:02:49 peter
  655. * symtable splitted, no real code changes
  656. Revision 1.6 2000/10/14 10:14:50 peter
  657. * moehrendorf oct 2000 rewrite
  658. Revision 1.5 2000/10/01 19:48:24 peter
  659. * lot of compile updates for cg11
  660. Revision 1.4 2000/09/28 19:49:52 florian
  661. *** empty log message ***
  662. Revision 1.3 2000/09/27 18:14:31 florian
  663. * fixed a lot of syntax errors in the n*.pas stuff
  664. Revision 1.2 2000/09/25 15:37:14 florian
  665. * more fixes
  666. Revision 1.1 2000/09/25 14:55:05 florian
  667. * initial revision
  668. }