nutils.pas 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. Type checking and register allocation for inline nodes
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit nutils;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. globals,
  22. symtype,symsym,node;
  23. const
  24. NODE_COMPLEXITY_INF = 255;
  25. type
  26. { resultdef of functions that process on all nodes in a (sub)tree }
  27. foreachnoderesult = (
  28. { false, continue recursion }
  29. fen_false,
  30. { false, stop recursion }
  31. fen_norecurse_false,
  32. { true, continue recursion }
  33. fen_true,
  34. { true, stop recursion }
  35. fen_norecurse_true
  36. );
  37. tforeachprocmethod = (pm_preprocess,pm_postprocess);
  38. foreachnodefunction = function(var n: tnode; arg: pointer): foreachnoderesult of object;
  39. staticforeachnodefunction = function(var n: tnode; arg: pointer): foreachnoderesult;
  40. function foreachnode(var n: tnode; f: foreachnodefunction; arg: pointer): boolean;
  41. function foreachnodestatic(var n: tnode; f: staticforeachnodefunction; arg: pointer): boolean;
  42. function foreachnodestatic(procmethod : tforeachprocmethod;var n: tnode; f: staticforeachnodefunction; arg: pointer): boolean;
  43. { checks if the given node tree contains only nodes of the given type,
  44. if this isn't the case, an ie is thrown
  45. }
  46. procedure checktreenodetypes(n : tnode;typeset : tnodetypeset);
  47. procedure load_procvar_from_calln(var p1:tnode);
  48. function maybe_call_procvar(var p1:tnode;tponly:boolean):boolean;
  49. function get_high_value_sym(vs: tparavarsym):tsym; { marking it as inline causes IE 200311075 during loading from ppu file }
  50. function load_high_value_node(vs:tparavarsym):tnode;
  51. function load_self_node:tnode;
  52. function load_result_node:tnode;
  53. function load_self_pointer_node:tnode;
  54. function load_vmt_pointer_node:tnode;
  55. function is_self_node(p:tnode):boolean;
  56. function call_fail_node:tnode;
  57. function initialize_data_node(p:tnode):tnode;
  58. function finalize_data_node(p:tnode):tnode;
  59. function node_complexity(p: tnode): cardinal;
  60. procedure node_tree_set_filepos(var n:tnode;const filepos:tfileposinfo);
  61. { tries to simplify the given node }
  62. procedure dosimplify(var n : tnode);
  63. implementation
  64. uses
  65. globtype,verbose,
  66. symconst,symbase,symdef,symtable,
  67. defutil,defcmp,
  68. nbas,ncon,ncnv,nld,nflw,nset,ncal,nadd,nmem,
  69. cgbase,procinfo,
  70. pass_1;
  71. function foreachnode(var n: tnode; f: foreachnodefunction; arg: pointer): boolean;
  72. var
  73. i: longint;
  74. begin
  75. result := false;
  76. if not assigned(n) then
  77. exit;
  78. case f(n,arg) of
  79. fen_norecurse_false:
  80. exit;
  81. fen_norecurse_true:
  82. begin
  83. result := true;
  84. exit;
  85. end;
  86. fen_true:
  87. result := true;
  88. { result is already false
  89. fen_false:
  90. result := false; }
  91. end;
  92. case n.nodetype of
  93. asn:
  94. if assigned(tasnode(n).call) then
  95. begin
  96. result := foreachnode(tasnode(n).call,f,arg);
  97. exit
  98. end;
  99. calln:
  100. begin
  101. { not in one statement, won't work because of b- }
  102. result := foreachnode(tcallnode(n).methodpointerinit,f,arg) or result;
  103. result := foreachnode(tcallnode(n).methodpointer,f,arg) or result;
  104. result := foreachnode(tcallnode(n).methodpointerdone,f,arg) or result;
  105. end;
  106. ifn, whilerepeatn, forn:
  107. begin
  108. { not in one statement, won't work because of b- }
  109. result := foreachnode(tloopnode(n).t1,f,arg) or result;
  110. result := foreachnode(tloopnode(n).t2,f,arg) or result;
  111. end;
  112. raisen:
  113. result := foreachnode(traisenode(n).frametree,f,arg) or result;
  114. casen:
  115. begin
  116. for i := 0 to tcasenode(n).blocks.count-1 do
  117. if assigned(tcasenode(n).blocks[i]) then
  118. result := foreachnode(pcaseblock(tcasenode(n).blocks[i])^.statement,f,arg) or result;
  119. result := foreachnode(tcasenode(n).elseblock,f,arg) or result;
  120. end;
  121. end;
  122. if n.inheritsfrom(tbinarynode) then
  123. begin
  124. { first process the "payload" of statementnodes }
  125. result := foreachnode(tbinarynode(n).left,f,arg) or result;
  126. result := foreachnode(tbinarynode(n).right,f,arg) or result;
  127. end
  128. else if n.inheritsfrom(tunarynode) then
  129. result := foreachnode(tunarynode(n).left,f,arg) or result;
  130. end;
  131. function foreachnodestatic(procmethod : tforeachprocmethod;var n: tnode; f: staticforeachnodefunction; arg: pointer): boolean;
  132. function process_children(res : boolean) : boolean;
  133. var
  134. i: longint;
  135. begin
  136. result:=res;
  137. case n.nodetype of
  138. asn:
  139. if assigned(tasnode(n).call) then
  140. begin
  141. result := foreachnodestatic(procmethod,tasnode(n).call,f,arg);
  142. exit
  143. end;
  144. calln:
  145. begin
  146. result := foreachnodestatic(procmethod,tcallnode(n).methodpointerinit,f,arg) or result;
  147. result := foreachnodestatic(procmethod,tcallnode(n).methodpointer,f,arg) or result;
  148. result := foreachnodestatic(procmethod,tcallnode(n).methodpointerdone,f,arg) or result;
  149. end;
  150. ifn, whilerepeatn, forn:
  151. begin
  152. { not in one statement, won't work because of b- }
  153. result := foreachnodestatic(procmethod,tloopnode(n).t1,f,arg) or result;
  154. result := foreachnodestatic(procmethod,tloopnode(n).t2,f,arg) or result;
  155. end;
  156. raisen:
  157. result := foreachnodestatic(traisenode(n).frametree,f,arg) or result;
  158. casen:
  159. begin
  160. for i := 0 to tcasenode(n).blocks.count-1 do
  161. if assigned(tcasenode(n).blocks[i]) then
  162. result := foreachnodestatic(procmethod,pcaseblock(tcasenode(n).blocks[i])^.statement,f,arg) or result;
  163. result := foreachnodestatic(procmethod,tcasenode(n).elseblock,f,arg) or result;
  164. end;
  165. end;
  166. if n.inheritsfrom(tbinarynode) then
  167. begin
  168. { first process the "payload" of statementnodes }
  169. result := foreachnodestatic(procmethod,tbinarynode(n).left,f,arg) or result;
  170. result := foreachnodestatic(procmethod,tbinarynode(n).right,f,arg) or result;
  171. end
  172. else if n.inheritsfrom(tunarynode) then
  173. result := foreachnodestatic(procmethod,tunarynode(n).left,f,arg) or result;
  174. end;
  175. begin
  176. result := false;
  177. if not assigned(n) then
  178. exit;
  179. if procmethod=pm_preprocess then
  180. result:=process_children(result);
  181. case f(n,arg) of
  182. fen_norecurse_false:
  183. exit;
  184. fen_norecurse_true:
  185. begin
  186. result := true;
  187. exit;
  188. end;
  189. fen_true:
  190. result := true;
  191. { result is already false
  192. fen_false:
  193. result := false; }
  194. end;
  195. if procmethod=pm_postprocess then
  196. result:=process_children(result);
  197. end;
  198. function foreachnodestatic(var n: tnode; f: staticforeachnodefunction; arg: pointer): boolean;
  199. begin
  200. result:=foreachnodestatic(pm_postprocess,n,f,arg);
  201. end;
  202. function do_check(var n: tnode; arg: pointer): foreachnoderesult;
  203. begin
  204. if not(n.nodetype in pnodetypeset(arg)^) then
  205. internalerror(200610141);
  206. result:=fen_true;
  207. end;
  208. procedure checktreenodetypes(n : tnode;typeset : tnodetypeset);
  209. begin
  210. foreachnodestatic(n,@do_check,@typeset);
  211. end;
  212. procedure load_procvar_from_calln(var p1:tnode);
  213. var
  214. p2 : tnode;
  215. begin
  216. if p1.nodetype<>calln then
  217. internalerror(200212251);
  218. { was it a procvar, then we simply remove the calln and
  219. reuse the right }
  220. if assigned(tcallnode(p1).right) then
  221. begin
  222. p2:=tcallnode(p1).right;
  223. tcallnode(p1).right:=nil;
  224. end
  225. else
  226. begin
  227. p2:=cloadnode.create_procvar(tcallnode(p1).symtableprocentry,
  228. tprocdef(tcallnode(p1).procdefinition),tcallnode(p1).symtableproc);
  229. { when the methodpointer is typen we've something like:
  230. tobject.create. Then only the address is needed of the
  231. method without a self pointer }
  232. if assigned(tcallnode(p1).methodpointer) and
  233. (tcallnode(p1).methodpointer.nodetype<>typen) then
  234. tloadnode(p2).set_mp(tcallnode(p1).get_load_methodpointer);
  235. end;
  236. typecheckpass(p2);
  237. p1.free;
  238. p1:=p2;
  239. end;
  240. function maybe_call_procvar(var p1:tnode;tponly:boolean):boolean;
  241. var
  242. hp : tnode;
  243. begin
  244. result:=false;
  245. if (p1.resultdef.typ<>procvardef) or
  246. (tponly and
  247. not(m_tp_procvar in current_settings.modeswitches)) then
  248. exit;
  249. { ignore vecn,subscriptn }
  250. hp:=p1;
  251. repeat
  252. case hp.nodetype of
  253. vecn,
  254. derefn,
  255. typeconvn,
  256. subscriptn :
  257. hp:=tunarynode(hp).left;
  258. else
  259. break;
  260. end;
  261. until false;
  262. { a tempref is used when it is loaded from a withsymtable }
  263. if (hp.nodetype in [calln,loadn,temprefn]) then
  264. begin
  265. hp:=ccallnode.create_procvar(nil,p1);
  266. typecheckpass(hp);
  267. p1:=hp;
  268. result:=true;
  269. end;
  270. end;
  271. function get_high_value_sym(vs: tparavarsym):tsym;
  272. begin
  273. result := tsym(vs.owner.Find('high'+vs.name));
  274. end;
  275. function load_high_value_node(vs:tparavarsym):tnode;
  276. var
  277. srsym : tsym;
  278. begin
  279. result:=nil;
  280. srsym:=get_high_value_sym(vs);
  281. if assigned(srsym) then
  282. begin
  283. result:=cloadnode.create(srsym,vs.owner);
  284. typecheckpass(result);
  285. end
  286. else
  287. CGMessage(parser_e_illegal_expression);
  288. end;
  289. function load_self_node:tnode;
  290. var
  291. srsym : tsym;
  292. srsymtable : TSymtable;
  293. begin
  294. result:=nil;
  295. searchsym('self',srsym,srsymtable);
  296. if assigned(srsym) then
  297. begin
  298. result:=cloadnode.create(srsym,srsymtable);
  299. include(result.flags,nf_is_self);
  300. end
  301. else
  302. begin
  303. result:=cerrornode.create;
  304. CGMessage(parser_e_illegal_expression);
  305. end;
  306. typecheckpass(result);
  307. end;
  308. function load_result_node:tnode;
  309. var
  310. srsym : tsym;
  311. srsymtable : TSymtable;
  312. begin
  313. result:=nil;
  314. searchsym('result',srsym,srsymtable);
  315. if assigned(srsym) then
  316. result:=cloadnode.create(srsym,srsymtable)
  317. else
  318. begin
  319. result:=cerrornode.create;
  320. CGMessage(parser_e_illegal_expression);
  321. end;
  322. typecheckpass(result);
  323. end;
  324. function load_self_pointer_node:tnode;
  325. var
  326. srsym : tsym;
  327. srsymtable : TSymtable;
  328. begin
  329. result:=nil;
  330. searchsym('self',srsym,srsymtable);
  331. if assigned(srsym) then
  332. begin
  333. result:=cloadnode.create(srsym,srsymtable);
  334. include(result.flags,nf_load_self_pointer);
  335. end
  336. else
  337. begin
  338. result:=cerrornode.create;
  339. CGMessage(parser_e_illegal_expression);
  340. end;
  341. typecheckpass(result);
  342. end;
  343. function load_vmt_pointer_node:tnode;
  344. var
  345. srsym : tsym;
  346. srsymtable : TSymtable;
  347. begin
  348. result:=nil;
  349. searchsym('vmt',srsym,srsymtable);
  350. if assigned(srsym) then
  351. result:=cloadnode.create(srsym,srsymtable)
  352. else
  353. begin
  354. result:=cerrornode.create;
  355. CGMessage(parser_e_illegal_expression);
  356. end;
  357. typecheckpass(result);
  358. end;
  359. function is_self_node(p:tnode):boolean;
  360. begin
  361. is_self_node:=(p.nodetype=loadn) and
  362. (tloadnode(p).symtableentry.typ=paravarsym) and
  363. (vo_is_self in tparavarsym(tloadnode(p).symtableentry).varoptions);
  364. end;
  365. function call_fail_node:tnode;
  366. var
  367. para : tcallparanode;
  368. newstatement : tstatementnode;
  369. srsym : tsym;
  370. begin
  371. result:=internalstatements(newstatement);
  372. { call fail helper and exit normal }
  373. if is_class(current_procinfo.procdef._class) then
  374. begin
  375. srsym:=search_class_member(current_procinfo.procdef._class,'FREEINSTANCE');
  376. if assigned(srsym) and
  377. (srsym.typ=procsym) then
  378. begin
  379. { if self<>0 and vmt=1 then freeinstance }
  380. addstatement(newstatement,cifnode.create(
  381. caddnode.create(andn,
  382. caddnode.create(unequaln,
  383. load_self_pointer_node,
  384. cnilnode.create),
  385. caddnode.create(equaln,
  386. ctypeconvnode.create(
  387. load_vmt_pointer_node,
  388. voidpointertype),
  389. cpointerconstnode.create(1,voidpointertype))),
  390. ccallnode.create(nil,tprocsym(srsym),srsym.owner,load_self_node,[]),
  391. nil));
  392. end
  393. else
  394. internalerror(200305108);
  395. end
  396. else
  397. if is_object(current_procinfo.procdef._class) then
  398. begin
  399. { parameter 3 : vmt_offset }
  400. { parameter 2 : pointer to vmt }
  401. { parameter 1 : self pointer }
  402. para:=ccallparanode.create(
  403. cordconstnode.create(current_procinfo.procdef._class.vmt_offset,s32inttype,false),
  404. ccallparanode.create(
  405. ctypeconvnode.create_internal(
  406. load_vmt_pointer_node,
  407. voidpointertype),
  408. ccallparanode.create(
  409. ctypeconvnode.create_internal(
  410. load_self_pointer_node,
  411. voidpointertype),
  412. nil)));
  413. addstatement(newstatement,
  414. ccallnode.createintern('fpc_help_fail',para));
  415. end
  416. else
  417. internalerror(200305132);
  418. { self:=nil }
  419. addstatement(newstatement,cassignmentnode.create(
  420. load_self_pointer_node,
  421. cnilnode.create));
  422. { exit }
  423. addstatement(newstatement,cexitnode.create(nil));
  424. end;
  425. function initialize_data_node(p:tnode):tnode;
  426. begin
  427. if not assigned(p.resultdef) then
  428. typecheckpass(p);
  429. if is_ansistring(p.resultdef) or
  430. is_widestring(p.resultdef) or
  431. is_interfacecom(p.resultdef) or
  432. is_dynamic_array(p.resultdef) then
  433. begin
  434. result:=cassignmentnode.create(
  435. ctypeconvnode.create_internal(p,voidpointertype),
  436. cnilnode.create
  437. );
  438. end
  439. else
  440. begin
  441. result:=ccallnode.createintern('fpc_initialize',
  442. ccallparanode.create(
  443. caddrnode.create_internal(
  444. crttinode.create(
  445. tstoreddef(p.resultdef),initrtti,rdt_normal)),
  446. ccallparanode.create(
  447. caddrnode.create_internal(p),
  448. nil)));
  449. end;
  450. end;
  451. function finalize_data_node(p:tnode):tnode;
  452. var
  453. newstatement : tstatementnode;
  454. begin
  455. if not assigned(p.resultdef) then
  456. typecheckpass(p);
  457. if is_ansistring(p.resultdef) then
  458. begin
  459. result:=internalstatements(newstatement);
  460. addstatement(newstatement,ccallnode.createintern('fpc_ansistr_decr_ref',
  461. ccallparanode.create(
  462. ctypeconvnode.create_internal(p,voidpointertype),
  463. nil)));
  464. addstatement(newstatement,cassignmentnode.create(
  465. ctypeconvnode.create_internal(p.getcopy,voidpointertype),
  466. cnilnode.create
  467. ));
  468. end
  469. else if is_widestring(p.resultdef) then
  470. begin
  471. result:=internalstatements(newstatement);
  472. addstatement(newstatement,ccallnode.createintern('fpc_widestr_decr_ref',
  473. ccallparanode.create(
  474. ctypeconvnode.create_internal(p,voidpointertype),
  475. nil)));
  476. addstatement(newstatement,cassignmentnode.create(
  477. ctypeconvnode.create_internal(p.getcopy,voidpointertype),
  478. cnilnode.create
  479. ));
  480. end
  481. else
  482. result:=ccallnode.createintern('fpc_finalize',
  483. ccallparanode.create(
  484. caddrnode.create_internal(
  485. crttinode.create(
  486. tstoreddef(p.resultdef),initrtti,rdt_normal)),
  487. ccallparanode.create(
  488. caddrnode.create_internal(p),
  489. nil)));
  490. end;
  491. { this function must return a very high value ("infinity") for }
  492. { trees containing a call, the rest can be balanced more or less }
  493. { at will, probably best mainly in terms of required memory }
  494. { accesses }
  495. function node_complexity(p: tnode): cardinal;
  496. begin
  497. result := 0;
  498. while true do
  499. begin
  500. case p.nodetype of
  501. temprefn,
  502. loadvmtaddrn,
  503. { main reason for the next one: we can't take the address of }
  504. { loadparentfpnode, so replacing it by a temp which is the }
  505. { address of this node's location and then dereferencing }
  506. { doesn't work. If changed, check whether webtbs/tw0935 }
  507. { still works with nodeinlining (JM) }
  508. loadparentfpn:
  509. begin
  510. result := 1;
  511. exit;
  512. end;
  513. loadn:
  514. begin
  515. { threadvars need a helper call }
  516. if (tloadnode(p).symtableentry.typ=staticvarsym) and
  517. (vo_is_thread_var in tstaticvarsym(tloadnode(p).symtableentry).varoptions) then
  518. inc(result,5)
  519. else
  520. inc(result);
  521. if (result >= NODE_COMPLEXITY_INF) then
  522. result := NODE_COMPLEXITY_INF;
  523. exit;
  524. end;
  525. subscriptn:
  526. begin
  527. if is_class_or_interface(tunarynode(p).left.resultdef) then
  528. inc(result);
  529. if (result = NODE_COMPLEXITY_INF) then
  530. exit;
  531. p := tunarynode(p).left;
  532. end;
  533. blockn:
  534. p := tunarynode(p).left;
  535. notn,
  536. derefn :
  537. begin
  538. inc(result);
  539. if (result = NODE_COMPLEXITY_INF) then
  540. exit;
  541. p := tunarynode(p).left;
  542. end;
  543. typeconvn:
  544. begin
  545. { may be more complex in some cases }
  546. if not(ttypeconvnode(p).convtype in [tc_equal,tc_int_2_int,tc_bool_2_bool,tc_real_2_real,tc_cord_2_pointer]) then
  547. inc(result);
  548. if (result = NODE_COMPLEXITY_INF) then
  549. exit;
  550. p := tunarynode(p).left;
  551. end;
  552. vecn,
  553. statementn:
  554. begin
  555. inc(result,node_complexity(tbinarynode(p).left));
  556. if (result >= NODE_COMPLEXITY_INF) then
  557. begin
  558. result := NODE_COMPLEXITY_INF;
  559. exit;
  560. end;
  561. p := tbinarynode(p).right;
  562. end;
  563. addn,subn,orn,andn,xorn,muln,divn,modn,symdifn,
  564. shln,shrn,
  565. equaln,unequaln,gtn,gten,ltn,lten,
  566. assignn:
  567. begin
  568. inc(result,node_complexity(tbinarynode(p).left)+1);
  569. if (p.nodetype in [muln,divn,modn]) then
  570. inc(result,5);
  571. if (result >= NODE_COMPLEXITY_INF) then
  572. begin
  573. result := NODE_COMPLEXITY_INF;
  574. exit;
  575. end;
  576. p := tbinarynode(p).right;
  577. end;
  578. tempcreaten,
  579. tempdeleten,
  580. ordconstn,
  581. pointerconstn,
  582. niln:
  583. exit;
  584. else
  585. begin
  586. result := NODE_COMPLEXITY_INF;
  587. exit;
  588. end;
  589. end;
  590. end;
  591. end;
  592. function setnodefilepos(var n: tnode; arg: pointer): foreachnoderesult;
  593. begin
  594. result:=fen_true;
  595. n.fileinfo:=pfileposinfo(arg)^;
  596. end;
  597. procedure node_tree_set_filepos(var n:tnode;const filepos:tfileposinfo);
  598. begin
  599. foreachnodestatic(n,@setnodefilepos,@filepos);
  600. end;
  601. {$ifdef FPCMT}
  602. threadvar
  603. {$else FPCMT}
  604. var
  605. {$endif FPCMT}
  606. treechanged : boolean;
  607. function callsimplify(var n: tnode; arg: pointer): foreachnoderesult;
  608. var
  609. hn : tnode;
  610. begin
  611. result:=fen_false;
  612. // do_typecheckpass(n);
  613. hn:=n.simplify;
  614. if assigned(hn) then
  615. begin
  616. treechanged:=true;
  617. n:=hn;
  618. typecheckpass(n);
  619. end;
  620. end;
  621. { tries to simplify the given node calling the simplify method recursively }
  622. procedure dosimplify(var n : tnode);
  623. begin
  624. repeat
  625. treechanged:=false;
  626. foreachnodestatic(pm_preprocess,n,@callsimplify,nil);
  627. until not(treechanged);
  628. end;
  629. end.