node.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. {
  2. $Id$
  3. Copyright (c) 2000 by Florian Klaempfl
  4. Basic node handling
  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 node;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. cclasses,
  23. globtype,globals,
  24. cpubase,
  25. aasm,
  26. symtype;
  27. type
  28. pconstset = ^tconstset;
  29. tconstset = array[0..31] of byte;
  30. pconst32bitset = ^tconst32bitset;
  31. tconst32bitset = array[0..7] of longint;
  32. tnodetype = (
  33. addn, {Represents the + operator.}
  34. muln, {Represents the * operator.}
  35. subn, {Represents the - operator.}
  36. divn, {Represents the div operator.}
  37. symdifn, {Represents the >< operator.}
  38. modn, {Represents the mod operator.}
  39. assignn, {Represents an assignment.}
  40. loadn, {Represents the use of a variabele.}
  41. rangen, {Represents a range (i.e. 0..9).}
  42. ltn, {Represents the < operator.}
  43. lten, {Represents the <= operator.}
  44. gtn, {Represents the > operator.}
  45. gten, {Represents the >= operator.}
  46. equaln, {Represents the = operator.}
  47. unequaln, {Represents the <> operator.}
  48. inn, {Represents the in operator.}
  49. orn, {Represents the or operator.}
  50. xorn, {Represents the xor operator.}
  51. shrn, {Represents the shr operator.}
  52. shln, {Represents the shl operator.}
  53. slashn, {Represents the / operator.}
  54. andn, {Represents the and operator.}
  55. subscriptn, {??? Field in a record/object?}
  56. derefn, {Dereferences a pointer.}
  57. addrn, {Represents the @ operator.}
  58. doubleaddrn, {Represents the @@ operator.}
  59. ordconstn, {Represents an ordinal value.}
  60. typeconvn, {Represents type-conversion/typecast.}
  61. calln, {Represents a call node.}
  62. callparan, {Represents a parameter.}
  63. realconstn, {Represents a real value.}
  64. unaryminusn, {Represents a sign change (i.e. -2).}
  65. asmn, {Represents an assembler node }
  66. vecn, {Represents array indexing.}
  67. pointerconstn,
  68. stringconstn, {Represents a string constant.}
  69. funcretn, {Represents the function result var.}
  70. selfn, {Represents the self parameter.}
  71. notn, {Represents the not operator.}
  72. inlinen, {Internal procedures (i.e. writeln).}
  73. niln, {Represents the nil pointer.}
  74. errorn, {This part of the tree could not be
  75. parsed because of a compiler error.}
  76. typen, {A type name. Used for i.e. typeof(obj).}
  77. hnewn, {The new operation, constructor call.}
  78. hdisposen, {The dispose operation with destructor call.}
  79. newn, {The new operation, constructor call.}
  80. simpledisposen, {The dispose operation.}
  81. setelementn, {A set element(s) (i.e. [a,b] and also [a..b]).}
  82. setconstn, {A set constant (i.e. [1,2]).}
  83. blockn, {A block of statements.}
  84. statementn, {One statement in a block of nodes.}
  85. loopn, { used in genloopnode, must be converted }
  86. ifn, {An if statement.}
  87. breakn, {A break statement.}
  88. continuen, {A continue statement.}
  89. repeatn, {A repeat until block.}
  90. whilen, {A while do statement.}
  91. forn, {A for loop.}
  92. exitn, {An exit statement.}
  93. withn, {A with statement.}
  94. casen, {A case statement.}
  95. labeln, {A label.}
  96. goton, {A goto statement.}
  97. simplenewn, {The new operation.}
  98. tryexceptn, {A try except block.}
  99. raisen, {A raise statement.}
  100. switchesn, {??? Currently unused...}
  101. tryfinallyn, {A try finally statement.}
  102. onn, { for an on statement in exception code }
  103. isn, {Represents the is operator.}
  104. asn, {Represents the as typecast.}
  105. caretn, {Represents the ^ operator.}
  106. failn, {Represents the fail statement.}
  107. starstarn, {Represents the ** operator exponentiation }
  108. procinlinen, {Procedures that can be inlined }
  109. arrayconstructorn, {Construction node for [...] parsing}
  110. arrayconstructorrangen, {Range element to allow sets in array construction tree}
  111. { added for optimizations where we cannot suppress }
  112. addoptn,
  113. nothingn,
  114. loadvmtn
  115. );
  116. const
  117. nodetype2str : array[tnodetype] of string[20] = (
  118. 'addn',
  119. 'muln',
  120. 'subn',
  121. 'divn',
  122. 'symdifn',
  123. 'modn',
  124. 'assignn',
  125. 'loadn',
  126. 'rangen',
  127. 'ltn',
  128. 'lten',
  129. 'gtn',
  130. 'gten',
  131. 'equaln',
  132. 'unequaln',
  133. 'inn',
  134. 'orn',
  135. 'xorn',
  136. 'shrn',
  137. 'shln',
  138. 'slashn',
  139. 'andn',
  140. 'subscriptn',
  141. 'derefn',
  142. 'addrn',
  143. 'doubleaddrn',
  144. 'ordconstn',
  145. 'typeconvn',
  146. 'calln',
  147. 'callparan',
  148. 'realconstn',
  149. 'umminusn',
  150. 'asmn',
  151. 'vecn',
  152. 'pointerconstn',
  153. 'stringconstn',
  154. 'funcretn',
  155. 'selfn',
  156. 'notn',
  157. 'inlinen',
  158. 'niln',
  159. 'errorn',
  160. 'typen',
  161. 'hnewn',
  162. 'hdisposen',
  163. 'newn',
  164. 'simpledisposen',
  165. 'setelementn',
  166. 'setconstn',
  167. 'blockn',
  168. 'statementn',
  169. 'loopn',
  170. 'ifn',
  171. 'breakn',
  172. 'continuen',
  173. 'repeatn',
  174. 'whilen',
  175. 'forn',
  176. 'exitn',
  177. 'withn',
  178. 'casen',
  179. 'labeln',
  180. 'goton',
  181. 'simplenewn',
  182. 'tryexceptn',
  183. 'raisen',
  184. 'switchesn',
  185. 'tryfinallyn',
  186. 'onn',
  187. 'isn',
  188. 'asn',
  189. 'caretn',
  190. 'failn',
  191. 'starstarn',
  192. 'procinlinen',
  193. 'arrayconstructn',
  194. 'arrayconstructrangen',
  195. 'addoptn',
  196. 'nothingn',
  197. 'loadvmtn');
  198. type
  199. { all boolean field of ttree are now collected in flags }
  200. tnodeflags = (
  201. nf_needs_truefalselabel,
  202. nf_swapable, { tbinop operands can be swaped }
  203. nf_swaped, { tbinop operands are swaped }
  204. nf_error,
  205. { flags used by tcallnode }
  206. nf_return_value_used,
  207. nf_static_call,
  208. { flags used by tcallparanode }
  209. nf_varargs_para, { belongs this para to varargs }
  210. { flags used by loop nodes }
  211. nf_backward, { set if it is a for ... downto ... do loop }
  212. nf_varstate, { do we need to parse childs to set var state }
  213. { taddrnode }
  214. nf_procvarload,
  215. { tvecnode }
  216. nf_memindex,
  217. nf_memseg,
  218. nf_callunique,
  219. { twithnode }
  220. nf_islocal,
  221. { tloadnode }
  222. nf_absolute,
  223. nf_first,
  224. { tassignmentnode }
  225. nf_concat_string,
  226. { tfuncretnode }
  227. nf_is_first_funcret, { 20th }
  228. { tarrayconstructnode }
  229. nf_cargs,
  230. nf_cargswap,
  231. nf_forcevaria,
  232. nf_novariaallowed,
  233. { ttypeconvnode }
  234. nf_explizit,
  235. { tinlinenode }
  236. nf_inlineconst,
  237. { general }
  238. nf_isproperty,
  239. nf_varstateset,
  240. { tasmnode }
  241. nf_object_preserved,
  242. { taddnode }
  243. nf_use_strconcat
  244. );
  245. tnodeflagset = set of tnodeflags;
  246. const
  247. { contains the flags which must be equal for the equality }
  248. { of nodes }
  249. flagsequal : tnodeflagset = [nf_error,nf_static_call,nf_backward];
  250. type
  251. tnodelist = class
  252. end;
  253. { later (for the newcg) tnode will inherit from tlinkedlist_item }
  254. tnode = class
  255. public
  256. { type of this node }
  257. nodetype : tnodetype;
  258. { type of the current code block, general/const/type }
  259. blocktype : tblock_type;
  260. { the location of the result of this node }
  261. location : tlocation;
  262. { the parent node of this is node }
  263. { this field is set by concattolist }
  264. parent : tnode;
  265. { there are some properties about the node stored }
  266. flags : tnodeflagset;
  267. { the number of registers needed to evalute the node }
  268. registers32,registersfpu : longint; { must be longint !!!! }
  269. {$ifdef SUPPORT_MMX}
  270. registersmmx,registerskni : longint;
  271. {$endif SUPPORT_MMX}
  272. resulttype : ttype;
  273. fileinfo : tfileposinfo;
  274. localswitches : tlocalswitches;
  275. {$ifdef extdebug}
  276. maxfirstpasscount,
  277. firstpasscount : longint;
  278. {$endif extdebug}
  279. list : taasmoutput;
  280. constructor create(tt : tnodetype);
  281. { this constructor is only for creating copies of class }
  282. { the fields are copied by getcopy }
  283. constructor createforcopy;
  284. destructor destroy;override;
  285. { toggles the flag }
  286. procedure toggleflag(f : tnodeflags);
  287. { the 1.1 code generator may override pass_1 }
  288. { and it need not to implement det_* then }
  289. { 1.1: pass_1 returns a value<>0 if the node has been transformed }
  290. { 2.0: runs det_resulttype and det_temp }
  291. function pass_1 : tnode;virtual;abstract;
  292. { dermines the resulttype of the node }
  293. function det_resulttype : tnode;virtual;abstract;
  294. { dermines the number of necessary temp. locations to evaluate
  295. the node }
  296. procedure det_temp;virtual;abstract;
  297. procedure pass_2;virtual;abstract;
  298. { comparing of nodes }
  299. function isequal(p : tnode) : boolean;
  300. { to implement comparisation, override this method }
  301. function docompare(p : tnode) : boolean;virtual;
  302. { gets a copy of the node }
  303. function getcopy : tnode;virtual;
  304. procedure insertintolist(l : tnodelist);virtual;
  305. {$ifdef EXTDEBUG}
  306. { writes a node for debugging purpose, shouldn't be called }
  307. { direct, because there is no test for nil, use writenode }
  308. { to write a complete tree }
  309. procedure dowrite;virtual;
  310. procedure dowritenodetype;virtual;
  311. {$endif EXTDEBUG}
  312. procedure concattolist(l : tlinkedlist);virtual;
  313. function ischild(p : tnode) : boolean;virtual;
  314. procedure set_file_line(from : tnode);
  315. procedure set_tree_filepos(const filepos : tfileposinfo);
  316. end;
  317. { this node is the anchestor for all nodes with at least }
  318. { one child, you have to use it if you want to use }
  319. { true- and falselabel }
  320. tparentnode = class(tnode)
  321. {$ifdef newcg}
  322. falselabel,truelabel : tasmlabel;
  323. {$endif newcg}
  324. end;
  325. tnodeclass = class of tnode;
  326. punarynode = ^tunarynode;
  327. tunarynode = class(tparentnode)
  328. left : tnode;
  329. constructor create(tt : tnodetype;l : tnode);
  330. destructor destroy;override;
  331. procedure concattolist(l : tlinkedlist);override;
  332. function ischild(p : tnode) : boolean;override;
  333. function docompare(p : tnode) : boolean;override;
  334. function getcopy : tnode;override;
  335. procedure insertintolist(l : tnodelist);override;
  336. procedure left_max;
  337. {$ifdef extdebug}
  338. procedure dowrite;override;
  339. {$endif extdebug}
  340. end;
  341. pbinarynode = ^tbinarynode;
  342. tbinarynode = class(tunarynode)
  343. right : tnode;
  344. constructor create(tt : tnodetype;l,r : tnode);
  345. destructor destroy;override;
  346. procedure concattolist(l : tlinkedlist);override;
  347. function ischild(p : tnode) : boolean;override;
  348. function docompare(p : tnode) : boolean;override;
  349. procedure swapleftright;
  350. function getcopy : tnode;override;
  351. procedure insertintolist(l : tnodelist);override;
  352. procedure left_right_max;
  353. {$ifdef extdebug}
  354. procedure dowrite;override;
  355. {$endif extdebug}
  356. end;
  357. pbinopnode = ^tbinopnode;
  358. tbinopnode = class(tbinarynode)
  359. constructor create(tt : tnodetype;l,r : tnode);virtual;
  360. function docompare(p : tnode) : boolean;override;
  361. end;
  362. {$ifdef EXTDEBUG}
  363. var
  364. writenodeindention : string;
  365. procedure writenode(t:tnode);
  366. {$endif EXTDEBUG}
  367. implementation
  368. uses
  369. cutils;
  370. {****************************************************************************
  371. TNODE
  372. ****************************************************************************}
  373. constructor tnode.create(tt : tnodetype);
  374. begin
  375. inherited create;
  376. nodetype:=tt;
  377. blocktype:=block_type;
  378. { this allows easier error tracing }
  379. location.loc:=LOC_INVALID;
  380. { save local info }
  381. fileinfo:=aktfilepos;
  382. localswitches:=aktlocalswitches;
  383. resulttype.reset;
  384. registers32:=0;
  385. registersfpu:=0;
  386. {$ifdef SUPPORT_MMX}
  387. registersmmx:=0;
  388. {$endif SUPPORT_MMX}
  389. {$ifdef EXTDEBUG}
  390. maxfirstpasscount:=0;
  391. firstpasscount:=0;
  392. {$endif EXTDEBUG}
  393. flags:=[];
  394. end;
  395. constructor tnode.createforcopy;
  396. begin
  397. end;
  398. procedure tnode.toggleflag(f : tnodeflags);
  399. begin
  400. if f in flags then
  401. exclude(flags,f)
  402. else
  403. include(flags,f);
  404. end;
  405. destructor tnode.destroy;
  406. begin
  407. {$ifdef EXTDEBUG}
  408. if firstpasscount>maxfirstpasscount then
  409. maxfirstpasscount:=firstpasscount;
  410. {$endif EXTDEBUG}
  411. end;
  412. procedure tnode.concattolist(l : tlinkedlist);
  413. begin
  414. {$ifdef newcg}
  415. //!!!!!!! l^.concat(self);
  416. {$warning fixme}
  417. {$endif newcg}
  418. end;
  419. function tnode.ischild(p : tnode) : boolean;
  420. begin
  421. ischild:=false;
  422. end;
  423. {$ifdef EXTDEBUG}
  424. procedure tnode.dowrite;
  425. begin
  426. dowritenodetype;
  427. end;
  428. procedure tnode.dowritenodetype;
  429. begin
  430. write(writenodeindention,'(',nodetype2str[nodetype]);
  431. end;
  432. {$endif EXTDEBUG}
  433. function tnode.isequal(p : tnode) : boolean;
  434. begin
  435. isequal:=
  436. (not assigned(self) and not assigned(p)) or
  437. (assigned(self) and assigned(p) and
  438. { optimized subclasses have the same nodetype as their }
  439. { superclass (for compatibility), so also check the classtype (JM) }
  440. (p.classtype=classtype) and
  441. (p.nodetype=nodetype) and
  442. (flags*flagsequal=p.flags*flagsequal) and
  443. docompare(p));
  444. end;
  445. function tnode.docompare(p : tnode) : boolean;
  446. begin
  447. docompare:=true;
  448. end;
  449. function tnode.getcopy : tnode;
  450. var
  451. p : tnode;
  452. begin
  453. { this is quite tricky because we need a node of the current }
  454. { node type and not one of tnode! }
  455. p:=tnodeclass(classtype).createforcopy;
  456. p.nodetype:=nodetype;
  457. p.location:=location;
  458. p.parent:=parent;
  459. p.flags:=flags;
  460. p.registers32:=registers32;
  461. p.registersfpu:=registersfpu;
  462. {$ifdef SUPPORT_MMX}
  463. p.registersmmx:=registersmmx;
  464. p.registerskni:=registerskni;
  465. {$endif SUPPORT_MMX}
  466. p.resulttype:=resulttype;
  467. p.fileinfo:=fileinfo;
  468. p.localswitches:=localswitches;
  469. {$ifdef extdebug}
  470. p.firstpasscount:=firstpasscount;
  471. {$endif extdebug}
  472. p.list:=list;
  473. getcopy:=p;
  474. end;
  475. procedure tnode.insertintolist(l : tnodelist);
  476. begin
  477. end;
  478. procedure tnode.set_file_line(from : tnode);
  479. begin
  480. if assigned(from) then
  481. fileinfo:=from.fileinfo;
  482. end;
  483. procedure tnode.set_tree_filepos(const filepos : tfileposinfo);
  484. begin
  485. fileinfo:=filepos;
  486. end;
  487. {****************************************************************************
  488. TUNARYNODE
  489. ****************************************************************************}
  490. constructor tunarynode.create(tt : tnodetype;l : tnode);
  491. begin
  492. inherited create(tt);
  493. left:=l;
  494. end;
  495. destructor tunarynode.destroy;
  496. begin
  497. left.free;
  498. inherited destroy;
  499. end;
  500. function tunarynode.docompare(p : tnode) : boolean;
  501. begin
  502. docompare:=(inherited docompare(p) and
  503. ((left=nil) or left.isequal(tunarynode(p).left))
  504. );
  505. end;
  506. function tunarynode.getcopy : tnode;
  507. var
  508. p : tunarynode;
  509. begin
  510. p:=tunarynode(inherited getcopy);
  511. if assigned(left) then
  512. p.left:=left.getcopy
  513. else
  514. p.left:=nil;
  515. getcopy:=p;
  516. end;
  517. procedure tunarynode.insertintolist(l : tnodelist);
  518. begin
  519. end;
  520. {$ifdef extdebug}
  521. procedure tunarynode.dowrite;
  522. begin
  523. inherited dowrite;
  524. writeln(',');
  525. writenodeindention:=writenodeindention+' ';
  526. writenode(left);
  527. write(')');
  528. delete(writenodeindention,1,4);
  529. end;
  530. {$endif}
  531. procedure tunarynode.left_max;
  532. begin
  533. registers32:=left.registers32;
  534. registersfpu:=left.registersfpu;
  535. {$ifdef SUPPORT_MMX}
  536. registersmmx:=left.registersmmx;
  537. {$endif SUPPORT_MMX}
  538. end;
  539. procedure tunarynode.concattolist(l : tlinkedlist);
  540. begin
  541. left.parent:=self;
  542. left.concattolist(l);
  543. inherited concattolist(l);
  544. end;
  545. function tunarynode.ischild(p : tnode) : boolean;
  546. begin
  547. ischild:=p=left;
  548. end;
  549. {****************************************************************************
  550. TBINARYNODE
  551. ****************************************************************************}
  552. constructor tbinarynode.create(tt : tnodetype;l,r : tnode);
  553. begin
  554. inherited create(tt,l);
  555. right:=r
  556. end;
  557. destructor tbinarynode.destroy;
  558. begin
  559. right.free;
  560. inherited destroy;
  561. end;
  562. procedure tbinarynode.concattolist(l : tlinkedlist);
  563. begin
  564. { we could change that depending on the number of }
  565. { required registers }
  566. left.parent:=self;
  567. left.concattolist(l);
  568. left.parent:=self;
  569. left.concattolist(l);
  570. inherited concattolist(l);
  571. end;
  572. function tbinarynode.ischild(p : tnode) : boolean;
  573. begin
  574. ischild:=(p=right);
  575. end;
  576. function tbinarynode.docompare(p : tnode) : boolean;
  577. begin
  578. docompare:=(inherited docompare(p) and
  579. ((right=nil) or right.isequal(tbinarynode(p).right))
  580. );
  581. end;
  582. function tbinarynode.getcopy : tnode;
  583. var
  584. p : tbinarynode;
  585. begin
  586. p:=tbinarynode(inherited getcopy);
  587. if assigned(right) then
  588. p.right:=right.getcopy
  589. else
  590. p.right:=nil;
  591. getcopy:=p;
  592. end;
  593. procedure tbinarynode.insertintolist(l : tnodelist);
  594. begin
  595. end;
  596. procedure tbinarynode.swapleftright;
  597. var
  598. swapp : tnode;
  599. begin
  600. swapp:=right;
  601. right:=left;
  602. left:=swapp;
  603. if nf_swaped in flags then
  604. exclude(flags,nf_swaped)
  605. else
  606. include(flags,nf_swaped);
  607. end;
  608. procedure tbinarynode.left_right_max;
  609. begin
  610. if assigned(left) then
  611. begin
  612. if assigned(right) then
  613. begin
  614. registers32:=max(left.registers32,right.registers32);
  615. registersfpu:=max(left.registersfpu,right.registersfpu);
  616. {$ifdef SUPPORT_MMX}
  617. registersmmx:=max(left.registersmmx,right.registersmmx);
  618. {$endif SUPPORT_MMX}
  619. end
  620. else
  621. begin
  622. registers32:=left.registers32;
  623. registersfpu:=left.registersfpu;
  624. {$ifdef SUPPORT_MMX}
  625. registersmmx:=left.registersmmx;
  626. {$endif SUPPORT_MMX}
  627. end;
  628. end;
  629. end;
  630. {$ifdef extdebug}
  631. procedure tbinarynode.dowrite;
  632. begin
  633. inherited dowrite;
  634. writeln(',');
  635. writenodeindention:=writenodeindention+' ';
  636. writenode(right);
  637. write(')');
  638. delete(writenodeindention,1,4);
  639. end;
  640. {$endif}
  641. {****************************************************************************
  642. TBINOPYNODE
  643. ****************************************************************************}
  644. constructor tbinopnode.create(tt : tnodetype;l,r : tnode);
  645. begin
  646. inherited create(tt,l,r);
  647. end;
  648. function tbinopnode.docompare(p : tnode) : boolean;
  649. begin
  650. docompare:=(inherited docompare(p)) or
  651. { if that's in the flags, is p then always a tbinopnode (?) (JM) }
  652. ((nf_swapable in flags) and
  653. left.isequal(tbinopnode(p).right) and
  654. right.isequal(tbinopnode(p).left));
  655. end;
  656. {****************************************************************************
  657. WRITENODE
  658. ****************************************************************************}
  659. {$ifdef EXTDEBUG}
  660. procedure writenode(t:tnode);
  661. begin
  662. if assigned(t) then
  663. t.dowrite
  664. else
  665. write(writenodeindention,'nil');
  666. if writenodeindention='' then
  667. writeln;
  668. end;
  669. {$endif EXTDEBUG}
  670. end.
  671. {
  672. $Log$
  673. Revision 1.18 2001-07-30 20:59:27 peter
  674. * m68k updates from v10 merged
  675. Revision 1.17 2001/06/04 18:14:16 peter
  676. * store blocktype info in tnode
  677. Revision 1.16 2001/06/04 11:53:13 peter
  678. + varargs directive
  679. Revision 1.15 2001/04/13 01:22:10 peter
  680. * symtable change to classes
  681. * range check generation and errors fixed, make cycle DEBUG=1 works
  682. * memory leaks fixed
  683. Revision 1.14 2001/04/02 21:20:31 peter
  684. * resulttype rewrite
  685. Revision 1.13 2001/01/13 00:08:09 peter
  686. * added missing addoptn
  687. Revision 1.12 2001/01/01 11:38:45 peter
  688. * forgot to remove node.inc and nodeh.inc that were merged into node.pas
  689. already.
  690. Revision 1.11 2000/12/25 00:07:26 peter
  691. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  692. tlinkedlist objects)
  693. Revision 1.10 2000/11/29 00:30:34 florian
  694. * unused units removed from uses clause
  695. * some changes for widestrings
  696. Revision 1.9 2000/10/31 22:02:49 peter
  697. * symtable splitted, no real code changes
  698. Revision 1.8 2000/10/01 19:48:24 peter
  699. * lot of compile updates for cg11
  700. Revision 1.7 2000/09/30 16:08:45 peter
  701. * more cg11 updates
  702. Revision 1.6 2000/09/28 19:49:52 florian
  703. *** empty log message ***
  704. Revision 1.5 2000/09/27 18:14:31 florian
  705. * fixed a lot of syntax errors in the n*.pas stuff
  706. Revision 1.4 2000/09/24 15:06:19 peter
  707. * use defines.inc
  708. Revision 1.3 2000/09/22 21:45:35 florian
  709. * some updates e.g. getcopy added
  710. Revision 1.2 2000/09/20 21:52:38 florian
  711. * removed a lot of errors
  712. Revision 1.1 2000/08/26 12:27:35 florian
  713. * initial release
  714. }