tree.pas 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. This units exports some routines to manage the parse tree
  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. {$ifdef tp}
  19. {$E+,N+}
  20. {$endif}
  21. unit tree;
  22. interface
  23. uses
  24. globtype,cobjects,
  25. symconst,symtable,aasm,cpubase;
  26. type
  27. pconstset = ^tconstset;
  28. tconstset = array[0..31] of byte;
  29. ttreetyp = (
  30. addn, {Represents the + operator.}
  31. muln, {Represents the * operator.}
  32. subn, {Represents the - operator.}
  33. divn, {Represents the div operator.}
  34. symdifn, {Represents the >< operator.}
  35. modn, {Represents the mod operator.}
  36. assignn, {Represents an assignment.}
  37. loadn, {Represents the use of a variabele.}
  38. rangen, {Represents a range (i.e. 0..9).}
  39. ltn, {Represents the < operator.}
  40. lten, {Represents the <= operator.}
  41. gtn, {Represents the > operator.}
  42. gten, {Represents the >= operator.}
  43. equaln, {Represents the = operator.}
  44. unequaln, {Represents the <> operator.}
  45. inn, {Represents the in operator.}
  46. orn, {Represents the or operator.}
  47. xorn, {Represents the xor operator.}
  48. shrn, {Represents the shr operator.}
  49. shln, {Represents the shl operator.}
  50. slashn, {Represents the / operator.}
  51. andn, {Represents the and operator.}
  52. subscriptn, {??? Field in a record/object?}
  53. derefn, {Dereferences a pointer.}
  54. addrn, {Represents the @ operator.}
  55. doubleaddrn, {Represents the @@ operator.}
  56. ordconstn, {Represents an ordinal value.}
  57. typeconvn, {Represents type-conversion/typecast.}
  58. calln, {Represents a call node.}
  59. callparan, {Represents a parameter.}
  60. realconstn, {Represents a real value.}
  61. fixconstn, {Represents a fixed value.}
  62. unaryminusn, {Represents a sign change (i.e. -2).}
  63. asmn, {Represents an assembler node }
  64. vecn, {Represents array indexing.}
  65. pointerconstn,
  66. stringconstn, {Represents a string constant.}
  67. funcretn, {Represents the function result var.}
  68. selfn, {Represents the self parameter.}
  69. notn, {Represents the not operator.}
  70. inlinen, {Internal procedures (i.e. writeln).}
  71. niln, {Represents the nil pointer.}
  72. errorn, {This part of the tree could not be
  73. parsed because of a compiler error.}
  74. typen, {A type name. Used for i.e. typeof(obj).}
  75. hnewn, {The new operation, constructor call.}
  76. hdisposen, {The dispose operation with destructor call.}
  77. newn, {The new operation, constructor call.}
  78. simpledisposen, {The dispose operation.}
  79. setelementn, {A set element(s) (i.e. [a,b] and also [a..b]).}
  80. setconstn, {A set constant (i.e. [1,2]).}
  81. blockn, {A block of statements.}
  82. statementn, {One statement in a block of nodes.}
  83. loopn, { used in genloopnode, must be converted }
  84. ifn, {An if statement.}
  85. breakn, {A break statement.}
  86. continuen, {A continue statement.}
  87. repeatn, {A repeat until block.}
  88. whilen, {A while do statement.}
  89. forn, {A for loop.}
  90. exitn, {An exit statement.}
  91. withn, {A with statement.}
  92. casen, {A case statement.}
  93. labeln, {A label.}
  94. goton, {A goto statement.}
  95. simplenewn, {The new operation.}
  96. tryexceptn, {A try except block.}
  97. raisen, {A raise statement.}
  98. switchesn, {??? Currently unused...}
  99. tryfinallyn, {A try finally statement.}
  100. onn, { for an on statement in exception code }
  101. isn, {Represents the is operator.}
  102. asn, {Represents the as typecast.}
  103. caretn, {Represents the ^ operator.}
  104. failn, {Represents the fail statement.}
  105. starstarn, {Represents the ** operator exponentiation }
  106. procinlinen, {Procedures that can be inlined }
  107. arrayconstructn, {Construction node for [...] parsing}
  108. arrayconstructrangen, {Range element to allow sets in array construction tree}
  109. { added for optimizations where we cannot suppress }
  110. nothingn,
  111. loadvmtn
  112. );
  113. tconverttype = (
  114. tc_equal,
  115. tc_not_possible,
  116. tc_string_2_string,
  117. tc_char_2_string,
  118. tc_pchar_2_string,
  119. tc_cchar_2_pchar,
  120. tc_cstring_2_pchar,
  121. tc_ansistring_2_pchar,
  122. tc_string_2_chararray,
  123. tc_chararray_2_string,
  124. tc_array_2_pointer,
  125. tc_pointer_2_array,
  126. tc_int_2_int,
  127. tc_int_2_bool,
  128. tc_bool_2_bool,
  129. tc_bool_2_int,
  130. tc_real_2_real,
  131. tc_int_2_real,
  132. tc_int_2_fix,
  133. tc_real_2_fix,
  134. tc_fix_2_real,
  135. tc_proc_2_procvar,
  136. tc_arrayconstructor_2_set,
  137. tc_load_smallset,
  138. tc_cord_2_pointer
  139. );
  140. { allows to determine which elementes are to be replaced }
  141. tdisposetyp = (dt_nothing,dt_leftright,dt_left,dt_leftrighthigh,
  142. dt_mbleft,dt_typeconv,dt_inlinen,dt_leftrightmethod,
  143. dt_mbleft_and_method,dt_loop,dt_case,dt_with,dt_onn);
  144. { different assignment types }
  145. tassigntyp = (at_normal,at_plus,at_minus,at_star,at_slash);
  146. pcaserecord = ^tcaserecord;
  147. tcaserecord = record
  148. { range }
  149. _low,_high : longint;
  150. { only used by gentreejmp }
  151. _at : pasmlabel;
  152. { label of instruction }
  153. statement : pasmlabel;
  154. { is this the first of an case entry, needed to release statement
  155. label (PFV) }
  156. firstlabel : boolean;
  157. { left and right tree node }
  158. less,greater : pcaserecord;
  159. end;
  160. ptree = ^ttree;
  161. ttree = record
  162. error : boolean;
  163. disposetyp : tdisposetyp;
  164. { is true, if the right and left operand are swaped }
  165. swaped : boolean;
  166. { do we need to parse childs to set var state }
  167. varstateset : boolean;
  168. { the location of the result of this node }
  169. location : tlocation;
  170. { the number of registers needed to evalute the node }
  171. registers32,registersfpu : longint; { must be longint !!!! }
  172. {$ifdef SUPPORT_MMX}
  173. registersmmx : longint;
  174. {$endif SUPPORT_MMX}
  175. left,right : ptree;
  176. resulttype : pdef;
  177. fileinfo : tfileposinfo;
  178. localswitches : tlocalswitches;
  179. isproperty : boolean;
  180. {$ifdef extdebug}
  181. firstpasscount : longint;
  182. {$endif extdebug}
  183. {$ifdef TEMPREGDEBUG}
  184. usableregs : longint;
  185. {$endif TEMPREGDEBUG}
  186. {$ifdef EXTTEMPREGDEBUG}
  187. reallyusedregs : longint;
  188. {$endif EXTTEMPREGDEBUG}
  189. {$ifdef TEMPS_NOT_PUSH}
  190. temp_offset : longint;
  191. {$endif TEMPS_NOT_PUSH}
  192. case treetype : ttreetyp of
  193. addn : (use_strconcat : boolean;string_typ : tstringtype);
  194. callparan : (is_colon_para : boolean;exact_match_found,
  195. convlevel1found,convlevel2found:boolean;hightree:ptree);
  196. assignn : (assigntyp : tassigntyp;concat_string : boolean);
  197. loadn : (symtableentry : psym;symtable : psymtable;
  198. is_absolute,is_first : boolean);
  199. calln : (symtableprocentry : pprocsym;
  200. symtableproc : psymtable;procdefinition : pabstractprocdef;
  201. methodpointer : ptree;
  202. no_check,unit_specific,
  203. return_value_used,static_call : boolean);
  204. addrn : (procvarload:boolean);
  205. ordconstn : (value : longint);
  206. realconstn : (value_real : bestreal;lab_real : pasmlabel);
  207. fixconstn : (value_fix: longint);
  208. funcretn : (funcretprocinfo : pointer;rettype : ttype;
  209. is_first_funcret : boolean);
  210. subscriptn : (vs : pvarsym);
  211. vecn : (memindex,memseg:boolean;callunique : boolean);
  212. stringconstn : (value_str : pchar;length : longint; lab_str : pasmlabel;stringtype : tstringtype);
  213. typeconvn : (convtyp : tconverttype;explizit : boolean);
  214. typen : (typenodetype : pdef;typenodesym:ptypesym);
  215. inlinen : (inlinenumber : byte;inlineconst:boolean);
  216. procinlinen : (inlinetree:ptree;inlineprocsym:pprocsym;retoffset,para_offset,para_size : longint);
  217. setconstn : (value_set : pconstset;lab_set:pasmlabel);
  218. loopn : (t1,t2 : ptree;backward : boolean);
  219. asmn : (p_asm : paasmoutput;object_preserved : boolean);
  220. casen : (nodes : pcaserecord;elseblock : ptree);
  221. labeln,goton : (labelnr : pasmlabel;exceptionblock : ptree;labsym : plabelsym);
  222. withn : (withsymtable : pwithsymtable;tablecount : longint;withreference:preference;islocal:boolean);
  223. onn : (exceptsymtable : psymtable;excepttype : pobjectdef);
  224. arrayconstructn : (cargs,cargswap,forcevaria,novariaallowed: boolean;constructdef:pdef);
  225. end;
  226. function gennode(t : ttreetyp;l,r : ptree) : ptree;
  227. function genlabelnode(t : ttreetyp;nr : pasmlabel) : ptree;
  228. function genloadnode(v : pvarsym;st : psymtable) : ptree;
  229. function genloadcallnode(v: pprocsym;st: psymtable): ptree;
  230. function genloadmethodcallnode(v: pprocsym;st: psymtable; mp:ptree): ptree;
  231. function gensinglenode(t : ttreetyp;l : ptree) : ptree;
  232. function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
  233. function genordinalconstnode(v : longint;def : pdef) : ptree;
  234. function genpointerconstnode(v : longint;def : pdef) : ptree;
  235. function genfixconstnode(v : longint;def : pdef) : ptree;
  236. function gentypeconvnode(node : ptree;t : pdef) : ptree;
  237. function gentypenode(t : pdef;sym:ptypesym) : ptree;
  238. function gencallparanode(expr,next : ptree) : ptree;
  239. function genrealconstnode(v : bestreal;def : pdef) : ptree;
  240. function gencallnode(v : pprocsym;st : psymtable) : ptree;
  241. function genmethodcallnode(v : pprocsym;st : psymtable;mp : ptree) : ptree;
  242. { allow pchar or string for defining a pchar node }
  243. function genstringconstnode(const s : string) : ptree;
  244. { length is required for ansistrings }
  245. function genpcharconstnode(s : pchar;length : longint) : ptree;
  246. { helper routine for conststring node }
  247. function getpcharcopy(p : ptree) : pchar;
  248. function genzeronode(t : ttreetyp) : ptree;
  249. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  250. function genprocinlinenode(callp,code : ptree) : ptree;
  251. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : ptree;
  252. function genenumnode(v : penumsym) : ptree;
  253. function genselfnode(_class : pdef) : ptree;
  254. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  255. function genloopnode(t : ttreetyp;l,r,n1: ptree;back : boolean) : ptree;
  256. function genasmnode(p_asm : paasmoutput) : ptree;
  257. function gencasenode(l,r : ptree;nodes : pcaserecord) : ptree;
  258. function genwithnode(symtable : pwithsymtable;l,r : ptree;count : longint) : ptree;
  259. function getcopy(p : ptree) : ptree;
  260. function equal_trees(t1,t2 : ptree) : boolean;
  261. procedure swaptree(p:Ptree);
  262. procedure disposetree(p : ptree);
  263. procedure putnode(p : ptree);
  264. function getnode : ptree;
  265. procedure clear_location(var loc : tlocation);
  266. procedure set_location(var destloc,sourceloc : tlocation);
  267. procedure swap_location(var destloc,sourceloc : tlocation);
  268. procedure set_file_line(from,_to : ptree);
  269. procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
  270. {$ifdef extdebug}
  271. procedure compare_trees(oldp,p : ptree);
  272. const
  273. maxfirstpasscount : longint = 0;
  274. {$endif extdebug}
  275. { sets the callunique flag, if the node is a vecn, }
  276. { takes care of type casts etc. }
  277. procedure set_unique(p : ptree);
  278. { sets funcret_is_valid to true, if p contains a funcref node }
  279. procedure set_funcret_is_valid(p : ptree);
  280. {
  281. type
  282. tvarstaterequire = (vsr_can_be_undefined,vsr_must_be_valid,
  283. vsr_is_used_after,vsr_must_be_valid_and_is_used_after); }
  284. { sets varsym varstate field correctly }
  285. procedure set_varstate(p : ptree;must_be_valid : boolean);
  286. { gibt den ordinalen Werten der Node zurueck oder falls sie }
  287. { keinen ordinalen Wert hat, wird ein Fehler erzeugt }
  288. function get_ordinal_value(p : ptree) : longint;
  289. function is_constnode(p : ptree) : boolean;
  290. { true, if p is a pointer to a const int value }
  291. function is_constintnode(p : ptree) : boolean;
  292. function is_constboolnode(p : ptree) : boolean;
  293. function is_constrealnode(p : ptree) : boolean;
  294. function is_constcharnode(p : ptree) : boolean;
  295. function str_length(p : ptree) : longint;
  296. function is_emptyset(p : ptree):boolean;
  297. { counts the labels }
  298. function case_count_labels(root : pcaserecord) : longint;
  299. { searches the highest label }
  300. function case_get_max(root : pcaserecord) : longint;
  301. { searches the lowest label }
  302. function case_get_min(root : pcaserecord) : longint;
  303. type
  304. pptree = ^ptree;
  305. {$ifdef TEMPREGDEBUG}
  306. const
  307. curptree : pptree = nil;
  308. {$endif TEMPREGDEBUG}
  309. {$I innr.inc}
  310. implementation
  311. uses
  312. systems,
  313. globals,verbose,files,types,hcodegen;
  314. function getnode : ptree;
  315. var
  316. hp : ptree;
  317. begin
  318. new(hp);
  319. { makes error tracking easier }
  320. fillchar(hp^,sizeof(ttree),0);
  321. { reset }
  322. hp^.location.loc:=LOC_INVALID;
  323. { save local info }
  324. hp^.fileinfo:=aktfilepos;
  325. hp^.localswitches:=aktlocalswitches;
  326. getnode:=hp;
  327. end;
  328. procedure putnode(p : ptree);
  329. begin
  330. { clean up the contents of a node }
  331. case p^.treetype of
  332. asmn : if assigned(p^.p_asm) then
  333. dispose(p^.p_asm,done);
  334. stringconstn : begin
  335. ansistringdispose(p^.value_str,p^.length);
  336. end;
  337. setconstn : begin
  338. if assigned(p^.value_set) then
  339. dispose(p^.value_set);
  340. end;
  341. end;
  342. {$ifdef extdebug}
  343. if p^.firstpasscount>maxfirstpasscount then
  344. maxfirstpasscount:=p^.firstpasscount;
  345. {$endif extdebug}
  346. dispose(p);
  347. end;
  348. function getcopy(p : ptree) : ptree;
  349. var
  350. hp : ptree;
  351. begin
  352. if not assigned(p) then
  353. begin
  354. getcopy:=nil;
  355. exit;
  356. end;
  357. hp:=getnode;
  358. hp^:=p^;
  359. case p^.disposetyp of
  360. dt_leftright :
  361. begin
  362. if assigned(p^.left) then
  363. hp^.left:=getcopy(p^.left);
  364. if assigned(p^.right) then
  365. hp^.right:=getcopy(p^.right);
  366. end;
  367. dt_leftrighthigh :
  368. begin
  369. if assigned(p^.left) then
  370. hp^.left:=getcopy(p^.left);
  371. if assigned(p^.right) then
  372. hp^.right:=getcopy(p^.right);
  373. if assigned(p^.hightree) then
  374. hp^.left:=getcopy(p^.hightree);
  375. end;
  376. dt_leftrightmethod :
  377. begin
  378. if assigned(p^.left) then
  379. hp^.left:=getcopy(p^.left);
  380. if assigned(p^.right) then
  381. hp^.right:=getcopy(p^.right);
  382. if assigned(p^.methodpointer) then
  383. hp^.left:=getcopy(p^.methodpointer);
  384. end;
  385. dt_nothing : ;
  386. dt_left :
  387. if assigned(p^.left) then
  388. hp^.left:=getcopy(p^.left);
  389. dt_mbleft :
  390. if assigned(p^.left) then
  391. hp^.left:=getcopy(p^.left);
  392. dt_mbleft_and_method :
  393. begin
  394. if assigned(p^.left) then
  395. hp^.left:=getcopy(p^.left);
  396. hp^.methodpointer:=getcopy(p^.methodpointer);
  397. end;
  398. dt_loop :
  399. begin
  400. if assigned(p^.left) then
  401. hp^.left:=getcopy(p^.left);
  402. if assigned(p^.right) then
  403. hp^.right:=getcopy(p^.right);
  404. if assigned(p^.t1) then
  405. hp^.t1:=getcopy(p^.t1);
  406. if assigned(p^.t2) then
  407. hp^.t2:=getcopy(p^.t2);
  408. end;
  409. dt_typeconv : hp^.left:=getcopy(p^.left);
  410. dt_inlinen :
  411. if assigned(p^.left) then
  412. hp^.left:=getcopy(p^.left);
  413. else internalerror(11);
  414. end;
  415. { now check treetype }
  416. case p^.treetype of
  417. stringconstn : begin
  418. hp^.value_str:=getpcharcopy(p);
  419. hp^.length:=p^.length;
  420. end;
  421. setconstn : begin
  422. new(hp^.value_set);
  423. hp^.value_set:=p^.value_set;
  424. end;
  425. end;
  426. getcopy:=hp;
  427. end;
  428. procedure deletecaselabels(p : pcaserecord);
  429. begin
  430. if assigned(p^.greater) then
  431. deletecaselabels(p^.greater);
  432. if assigned(p^.less) then
  433. deletecaselabels(p^.less);
  434. dispose(p);
  435. end;
  436. procedure swaptree(p:Ptree);
  437. var swapp:Ptree;
  438. begin
  439. swapp:=p^.right;
  440. p^.right:=p^.left;
  441. p^.left:=swapp;
  442. p^.swaped:=not(p^.swaped);
  443. end;
  444. procedure disposetree(p : ptree);
  445. var
  446. symt : pwithsymtable;
  447. i : longint;
  448. begin
  449. if not(assigned(p)) then
  450. exit;
  451. if not(p^.treetype in [addn..loadvmtn]) then
  452. internalerror(26219);
  453. case p^.disposetyp of
  454. dt_leftright :
  455. begin
  456. if assigned(p^.left) then
  457. disposetree(p^.left);
  458. if assigned(p^.right) then
  459. disposetree(p^.right);
  460. end;
  461. dt_leftrighthigh :
  462. begin
  463. if assigned(p^.left) then
  464. disposetree(p^.left);
  465. if assigned(p^.right) then
  466. disposetree(p^.right);
  467. if assigned(p^.hightree) then
  468. disposetree(p^.hightree);
  469. end;
  470. dt_leftrightmethod :
  471. begin
  472. if assigned(p^.left) then
  473. disposetree(p^.left);
  474. if assigned(p^.right) then
  475. disposetree(p^.right);
  476. if assigned(p^.methodpointer) then
  477. disposetree(p^.methodpointer);
  478. end;
  479. dt_case :
  480. begin
  481. if assigned(p^.left) then
  482. disposetree(p^.left);
  483. if assigned(p^.right) then
  484. disposetree(p^.right);
  485. if assigned(p^.nodes) then
  486. deletecaselabels(p^.nodes);
  487. if assigned(p^.elseblock) then
  488. disposetree(p^.elseblock);
  489. end;
  490. dt_nothing : ;
  491. dt_left :
  492. if assigned(p^.left) then
  493. disposetree(p^.left);
  494. dt_mbleft :
  495. if assigned(p^.left) then
  496. disposetree(p^.left);
  497. dt_mbleft_and_method :
  498. begin
  499. if assigned(p^.left) then disposetree(p^.left);
  500. disposetree(p^.methodpointer);
  501. end;
  502. dt_typeconv : disposetree(p^.left);
  503. dt_inlinen :
  504. if assigned(p^.left) then
  505. disposetree(p^.left);
  506. dt_loop :
  507. begin
  508. if assigned(p^.left) then
  509. disposetree(p^.left);
  510. if assigned(p^.right) then
  511. disposetree(p^.right);
  512. if assigned(p^.t1) then
  513. disposetree(p^.t1);
  514. if assigned(p^.t2) then
  515. disposetree(p^.t2);
  516. end;
  517. dt_onn:
  518. begin
  519. if assigned(p^.left) then
  520. disposetree(p^.left);
  521. if assigned(p^.right) then
  522. disposetree(p^.right);
  523. if assigned(p^.exceptsymtable) then
  524. dispose(p^.exceptsymtable,done);
  525. end;
  526. dt_with :
  527. begin
  528. if assigned(p^.left) then
  529. disposetree(p^.left);
  530. if assigned(p^.right) then
  531. disposetree(p^.right);
  532. symt:=p^.withsymtable;
  533. for i:=1 to p^.tablecount do
  534. begin
  535. if assigned(symt) then
  536. begin
  537. p^.withsymtable:=pwithsymtable(symt^.next);
  538. dispose(symt,done);
  539. end;
  540. symt:=p^.withsymtable;
  541. end;
  542. end;
  543. else internalerror(12);
  544. end;
  545. putnode(p);
  546. end;
  547. procedure set_file_line(from,_to : ptree);
  548. begin
  549. if assigned(from) then
  550. _to^.fileinfo:=from^.fileinfo;
  551. end;
  552. procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
  553. begin
  554. p^.fileinfo:=filepos;
  555. end;
  556. function genwithnode(symtable : pwithsymtable;l,r : ptree;count : longint) : ptree;
  557. var
  558. p : ptree;
  559. begin
  560. p:=getnode;
  561. p^.disposetyp:=dt_with;
  562. p^.treetype:=withn;
  563. p^.left:=l;
  564. p^.right:=r;
  565. p^.registers32:=0;
  566. { p^.registers16:=0;
  567. p^.registers8:=0; }
  568. p^.registersfpu:=0;
  569. {$ifdef SUPPORT_MMX}
  570. p^.registersmmx:=0;
  571. {$endif SUPPORT_MMX}
  572. p^.resulttype:=nil;
  573. p^.withsymtable:=symtable;
  574. p^.tablecount:=count;
  575. p^.withreference:=nil;
  576. p^.islocal:=false;
  577. set_file_line(l,p);
  578. genwithnode:=p;
  579. end;
  580. function genfixconstnode(v : longint;def : pdef) : ptree;
  581. var
  582. p : ptree;
  583. begin
  584. p:=getnode;
  585. p^.disposetyp:=dt_nothing;
  586. p^.treetype:=fixconstn;
  587. p^.registers32:=0;
  588. { p^.registers16:=0;
  589. p^.registers8:=0; }
  590. p^.registersfpu:=0;
  591. {$ifdef SUPPORT_MMX}
  592. p^.registersmmx:=0;
  593. {$endif SUPPORT_MMX}
  594. p^.resulttype:=def;
  595. p^.value:=v;
  596. genfixconstnode:=p;
  597. end;
  598. function gencallparanode(expr,next : ptree) : ptree;
  599. var
  600. p : ptree;
  601. begin
  602. p:=getnode;
  603. p^.disposetyp:=dt_leftrighthigh;
  604. p^.treetype:=callparan;
  605. p^.left:=expr;
  606. p^.right:=next;
  607. p^.registers32:=0;
  608. { p^.registers16:=0;
  609. p^.registers8:=0; }
  610. {$ifdef SUPPORT_MMX}
  611. p^.registersmmx:=0;
  612. {$endif SUPPORT_MMX}
  613. p^.registersfpu:=0;
  614. p^.resulttype:=nil;
  615. p^.exact_match_found:=false;
  616. p^.convlevel1found:=false;
  617. p^.convlevel2found:=false;
  618. p^.is_colon_para:=false;
  619. p^.hightree:=nil;
  620. set_file_line(expr,p);
  621. gencallparanode:=p;
  622. end;
  623. function gennode(t : ttreetyp;l,r : ptree) : ptree;
  624. var
  625. p : ptree;
  626. begin
  627. p:=getnode;
  628. p^.disposetyp:=dt_leftright;
  629. p^.treetype:=t;
  630. p^.left:=l;
  631. p^.right:=r;
  632. p^.registers32:=0;
  633. { p^.registers16:=0;
  634. p^.registers8:=0; }
  635. p^.registersfpu:=0;
  636. {$ifdef SUPPORT_MMX}
  637. p^.registersmmx:=0;
  638. {$endif SUPPORT_MMX}
  639. p^.resulttype:=nil;
  640. gennode:=p;
  641. end;
  642. function gencasenode(l,r : ptree;nodes : pcaserecord) : ptree;
  643. var
  644. p : ptree;
  645. begin
  646. p:=getnode;
  647. p^.disposetyp:=dt_case;
  648. p^.treetype:=casen;
  649. p^.left:=l;
  650. p^.right:=r;
  651. p^.nodes:=nodes;
  652. p^.registers32:=0;
  653. p^.registersfpu:=0;
  654. {$ifdef SUPPORT_MMX}
  655. p^.registersmmx:=0;
  656. {$endif SUPPORT_MMX}
  657. p^.resulttype:=nil;
  658. set_file_line(l,p);
  659. gencasenode:=p;
  660. end;
  661. function genloopnode(t : ttreetyp;l,r,n1 : ptree;back : boolean) : ptree;
  662. var
  663. p : ptree;
  664. begin
  665. p:=getnode;
  666. p^.disposetyp:=dt_loop;
  667. p^.treetype:=t;
  668. p^.left:=l;
  669. p^.right:=r;
  670. p^.t1:=n1;
  671. p^.t2:=nil;
  672. p^.registers32:=0;
  673. p^.backward:=back;
  674. { p^.registers16:=0;
  675. p^.registers8:=0; }
  676. p^.registersfpu:=0;
  677. {$ifdef SUPPORT_MMX}
  678. p^.registersmmx:=0;
  679. {$endif SUPPORT_MMX}
  680. p^.resulttype:=nil;
  681. set_file_line(l,p);
  682. genloopnode:=p;
  683. end;
  684. function genordinalconstnode(v : longint;def : pdef) : ptree;
  685. var
  686. p : ptree;
  687. begin
  688. p:=getnode;
  689. p^.disposetyp:=dt_nothing;
  690. p^.treetype:=ordconstn;
  691. p^.registers32:=0;
  692. { p^.registers16:=0;
  693. p^.registers8:=0; }
  694. p^.registersfpu:=0;
  695. {$ifdef SUPPORT_MMX}
  696. p^.registersmmx:=0;
  697. {$endif SUPPORT_MMX}
  698. p^.resulttype:=def;
  699. p^.value:=v;
  700. if p^.resulttype^.deftype=orddef then
  701. testrange(p^.resulttype,p^.value);
  702. genordinalconstnode:=p;
  703. end;
  704. function genpointerconstnode(v : longint;def : pdef) : ptree;
  705. var
  706. p : ptree;
  707. begin
  708. p:=getnode;
  709. p^.disposetyp:=dt_nothing;
  710. p^.treetype:=pointerconstn;
  711. p^.registers32:=0;
  712. { p^.registers16:=0;
  713. p^.registers8:=0; }
  714. p^.registersfpu:=0;
  715. {$ifdef SUPPORT_MMX}
  716. p^.registersmmx:=0;
  717. {$endif SUPPORT_MMX}
  718. p^.resulttype:=def;
  719. p^.value:=v;
  720. genpointerconstnode:=p;
  721. end;
  722. function genenumnode(v : penumsym) : ptree;
  723. var
  724. p : ptree;
  725. begin
  726. p:=getnode;
  727. p^.disposetyp:=dt_nothing;
  728. p^.treetype:=ordconstn;
  729. p^.registers32:=0;
  730. { p^.registers16:=0;
  731. p^.registers8:=0; }
  732. p^.registersfpu:=0;
  733. {$ifdef SUPPORT_MMX}
  734. p^.registersmmx:=0;
  735. {$endif SUPPORT_MMX}
  736. p^.resulttype:=v^.definition;
  737. p^.value:=v^.value;
  738. testrange(p^.resulttype,p^.value);
  739. genenumnode:=p;
  740. end;
  741. function genrealconstnode(v : bestreal;def : pdef) : ptree;
  742. var
  743. p : ptree;
  744. begin
  745. p:=getnode;
  746. p^.disposetyp:=dt_nothing;
  747. p^.treetype:=realconstn;
  748. p^.registers32:=0;
  749. { p^.registers16:=0;
  750. p^.registers8:=0; }
  751. p^.registersfpu:=0;
  752. {$ifdef SUPPORT_MMX}
  753. p^.registersmmx:=0;
  754. {$endif SUPPORT_MMX}
  755. p^.resulttype:=def;
  756. p^.value_real:=v;
  757. p^.lab_real:=nil;
  758. genrealconstnode:=p;
  759. end;
  760. function genstringconstnode(const s : string) : ptree;
  761. var
  762. p : ptree;
  763. l : longint;
  764. begin
  765. p:=getnode;
  766. p^.disposetyp:=dt_nothing;
  767. p^.treetype:=stringconstn;
  768. p^.registers32:=0;
  769. { p^.registers16:=0;
  770. p^.registers8:=0; }
  771. p^.registersfpu:=0;
  772. {$ifdef SUPPORT_MMX}
  773. p^.registersmmx:=0;
  774. {$endif SUPPORT_MMX}
  775. l:=length(s);
  776. p^.length:=l;
  777. { stringdup write even past a #0 }
  778. getmem(p^.value_str,l+1);
  779. move(s[1],p^.value_str^,l);
  780. p^.value_str[l]:=#0;
  781. p^.lab_str:=nil;
  782. if cs_ansistrings in aktlocalswitches then
  783. begin
  784. p^.stringtype:=st_ansistring;
  785. p^.resulttype:=cansistringdef;
  786. end
  787. else
  788. begin
  789. p^.stringtype:=st_shortstring;
  790. p^.resulttype:=cshortstringdef;
  791. end;
  792. genstringconstnode:=p;
  793. end;
  794. function getpcharcopy(p : ptree) : pchar;
  795. var
  796. pc : pchar;
  797. begin
  798. pc:=nil;
  799. getmem(pc,p^.length+1);
  800. if pc=nil then
  801. Message(general_f_no_memory_left);
  802. move(p^.value_str^,pc^,p^.length+1);
  803. getpcharcopy:=pc;
  804. end;
  805. function genpcharconstnode(s : pchar;length : longint) : ptree;
  806. var
  807. p : ptree;
  808. begin
  809. p:=getnode;
  810. p^.disposetyp:=dt_nothing;
  811. p^.treetype:=stringconstn;
  812. p^.registers32:=0;
  813. { p^.registers16:=0;
  814. p^.registers8:=0; }
  815. p^.registersfpu:=0;
  816. {$ifdef SUPPORT_MMX}
  817. p^.registersmmx:=0;
  818. {$endif SUPPORT_MMX}
  819. p^.length:=length;
  820. if (cs_ansistrings in aktlocalswitches) or
  821. (length>255) then
  822. begin
  823. p^.stringtype:=st_ansistring;
  824. p^.resulttype:=cansistringdef;
  825. end
  826. else
  827. begin
  828. p^.stringtype:=st_shortstring;
  829. p^.resulttype:=cshortstringdef;
  830. end;
  831. p^.value_str:=s;
  832. p^.lab_str:=nil;
  833. genpcharconstnode:=p;
  834. end;
  835. function gensinglenode(t : ttreetyp;l : ptree) : ptree;
  836. var
  837. p : ptree;
  838. begin
  839. p:=getnode;
  840. p^.disposetyp:=dt_left;
  841. p^.treetype:=t;
  842. p^.left:=l;
  843. p^.registers32:=0;
  844. { p^.registers16:=0;
  845. p^.registers8:=0; }
  846. p^.registersfpu:=0;
  847. {$ifdef SUPPORT_MMX}
  848. p^.registersmmx:=0;
  849. {$endif SUPPORT_MMX}
  850. p^.resulttype:=nil;
  851. gensinglenode:=p;
  852. end;
  853. function genasmnode(p_asm : paasmoutput) : ptree;
  854. var
  855. p : ptree;
  856. begin
  857. p:=getnode;
  858. p^.disposetyp:=dt_nothing;
  859. p^.treetype:=asmn;
  860. p^.registers32:=4;
  861. p^.p_asm:=p_asm;
  862. p^.object_preserved:=false;
  863. { p^.registers16:=0;
  864. p^.registers8:=0; }
  865. p^.registersfpu:=8;
  866. {$ifdef SUPPORT_MMX}
  867. p^.registersmmx:=8;
  868. {$endif SUPPORT_MMX}
  869. p^.resulttype:=nil;
  870. genasmnode:=p;
  871. end;
  872. function genloadnode(v : pvarsym;st : psymtable) : ptree;
  873. var
  874. p : ptree;
  875. begin
  876. p:=getnode;
  877. p^.registers32:=0;
  878. { p^.registers16:=0;
  879. p^.registers8:=0; }
  880. p^.registersfpu:=0;
  881. {$ifdef SUPPORT_MMX}
  882. p^.registersmmx:=0;
  883. {$endif SUPPORT_MMX}
  884. p^.treetype:=loadn;
  885. p^.resulttype:=v^.vartype.def;
  886. p^.symtableentry:=v;
  887. p^.symtable:=st;
  888. p^.is_first := False;
  889. { method pointer load nodes can use the left subtree }
  890. p^.disposetyp:=dt_left;
  891. p^.left:=nil;
  892. genloadnode:=p;
  893. end;
  894. function genloadcallnode(v: pprocsym;st: psymtable): ptree;
  895. var
  896. p : ptree;
  897. begin
  898. p:=getnode;
  899. p^.registers32:=0;
  900. { p^.registers16:=0;
  901. p^.registers8:=0; }
  902. p^.registersfpu:=0;
  903. {$ifdef SUPPORT_MMX}
  904. p^.registersmmx:=0;
  905. {$endif SUPPORT_MMX}
  906. p^.treetype:=loadn;
  907. p^.left:=nil;
  908. p^.resulttype:=v^.definition;
  909. p^.symtableentry:=v;
  910. p^.symtable:=st;
  911. p^.is_first := False;
  912. p^.disposetyp:=dt_nothing;
  913. genloadcallnode:=p;
  914. end;
  915. function genloadmethodcallnode(v: pprocsym;st: psymtable; mp:ptree): ptree;
  916. var
  917. p : ptree;
  918. begin
  919. p:=getnode;
  920. p^.registers32:=0;
  921. { p^.registers16:=0;
  922. p^.registers8:=0; }
  923. p^.registersfpu:=0;
  924. {$ifdef SUPPORT_MMX}
  925. p^.registersmmx:=0;
  926. {$endif SUPPORT_MMX}
  927. p^.treetype:=loadn;
  928. p^.left:=nil;
  929. p^.resulttype:=v^.definition;
  930. p^.symtableentry:=v;
  931. p^.symtable:=st;
  932. p^.is_first := False;
  933. p^.disposetyp:=dt_left;
  934. p^.left:=mp;
  935. genloadmethodcallnode:=p;
  936. end;
  937. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : ptree;
  938. var
  939. p : ptree;
  940. begin
  941. p:=getnode;
  942. p^.registers32:=0;
  943. { p^.registers16:=0;
  944. p^.registers8:=0; }
  945. p^.registersfpu:=0;
  946. {$ifdef SUPPORT_MMX}
  947. p^.registersmmx:=0;
  948. {$endif SUPPORT_MMX}
  949. p^.treetype:=loadn;
  950. p^.left:=nil;
  951. p^.resulttype:=sym^.typedconsttype.def;
  952. p^.symtableentry:=sym;
  953. p^.symtable:=st;
  954. p^.disposetyp:=dt_nothing;
  955. gentypedconstloadnode:=p;
  956. end;
  957. function gentypeconvnode(node : ptree;t : pdef) : ptree;
  958. var
  959. p : ptree;
  960. begin
  961. p:=getnode;
  962. p^.disposetyp:=dt_typeconv;
  963. p^.treetype:=typeconvn;
  964. p^.left:=node;
  965. p^.registers32:=0;
  966. { p^.registers16:=0;
  967. p^.registers8:=0; }
  968. p^.convtyp:=tc_equal;
  969. p^.registersfpu:=0;
  970. {$ifdef SUPPORT_MMX}
  971. p^.registersmmx:=0;
  972. {$endif SUPPORT_MMX}
  973. p^.resulttype:=t;
  974. p^.explizit:=false;
  975. set_file_line(node,p);
  976. gentypeconvnode:=p;
  977. end;
  978. function gentypenode(t : pdef;sym:ptypesym) : ptree;
  979. var
  980. p : ptree;
  981. begin
  982. p:=getnode;
  983. p^.disposetyp:=dt_nothing;
  984. p^.treetype:=typen;
  985. p^.registers32:=0;
  986. { p^.registers16:=0;
  987. p^.registers8:=0; }
  988. p^.registersfpu:=0;
  989. {$ifdef SUPPORT_MMX}
  990. p^.registersmmx:=0;
  991. {$endif SUPPORT_MMX}
  992. p^.resulttype:=generrordef;
  993. p^.typenodetype:=t;
  994. p^.typenodesym:=sym;
  995. gentypenode:=p;
  996. end;
  997. function gencallnode(v : pprocsym;st : psymtable) : ptree;
  998. var
  999. p : ptree;
  1000. begin
  1001. p:=getnode;
  1002. p^.registers32:=0;
  1003. { p^.registers16:=0;
  1004. p^.registers8:=0; }
  1005. p^.registersfpu:=0;
  1006. {$ifdef SUPPORT_MMX}
  1007. p^.registersmmx:=0;
  1008. {$endif SUPPORT_MMX}
  1009. p^.treetype:=calln;
  1010. p^.symtableprocentry:=v;
  1011. p^.symtableproc:=st;
  1012. p^.unit_specific:=false;
  1013. p^.no_check:=false;
  1014. p^.return_value_used:=true;
  1015. p^.disposetyp := dt_leftrightmethod;
  1016. p^.methodpointer:=nil;
  1017. p^.left:=nil;
  1018. p^.right:=nil;
  1019. p^.procdefinition:=nil;
  1020. gencallnode:=p;
  1021. end;
  1022. function genmethodcallnode(v : pprocsym;st : psymtable;mp : ptree) : ptree;
  1023. var
  1024. p : ptree;
  1025. begin
  1026. p:=getnode;
  1027. p^.registers32:=0;
  1028. { p^.registers16:=0;
  1029. p^.registers8:=0; }
  1030. p^.registersfpu:=0;
  1031. {$ifdef SUPPORT_MMX}
  1032. p^.registersmmx:=0;
  1033. {$endif SUPPORT_MMX}
  1034. p^.treetype:=calln;
  1035. p^.return_value_used:=true;
  1036. p^.symtableprocentry:=v;
  1037. p^.symtableproc:=st;
  1038. p^.disposetyp:=dt_leftrightmethod;
  1039. p^.left:=nil;
  1040. p^.right:=nil;
  1041. p^.methodpointer:=mp;
  1042. p^.procdefinition:=nil;
  1043. genmethodcallnode:=p;
  1044. end;
  1045. function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
  1046. var
  1047. p : ptree;
  1048. begin
  1049. p:=getnode;
  1050. p^.disposetyp:=dt_left;
  1051. p^.treetype:=subscriptn;
  1052. p^.left:=l;
  1053. p^.registers32:=0;
  1054. p^.vs:=varsym;
  1055. { p^.registers16:=0;
  1056. p^.registers8:=0; }
  1057. p^.registersfpu:=0;
  1058. {$ifdef SUPPORT_MMX}
  1059. p^.registersmmx:=0;
  1060. {$endif SUPPORT_MMX}
  1061. p^.resulttype:=nil;
  1062. gensubscriptnode:=p;
  1063. end;
  1064. function genzeronode(t : ttreetyp) : ptree;
  1065. var
  1066. p : ptree;
  1067. begin
  1068. p:=getnode;
  1069. p^.disposetyp:=dt_nothing;
  1070. p^.treetype:=t;
  1071. p^.registers32:=0;
  1072. { p^.registers16:=0;
  1073. p^.registers8:=0; }
  1074. p^.registersfpu:=0;
  1075. {$ifdef SUPPORT_MMX}
  1076. p^.registersmmx:=0;
  1077. {$endif SUPPORT_MMX}
  1078. p^.resulttype:=nil;
  1079. genzeronode:=p;
  1080. end;
  1081. function genlabelnode(t : ttreetyp;nr : pasmlabel) : ptree;
  1082. var
  1083. p : ptree;
  1084. begin
  1085. p:=getnode;
  1086. p^.disposetyp:=dt_nothing;
  1087. p^.treetype:=t;
  1088. p^.registers32:=0;
  1089. { p^.registers16:=0;
  1090. p^.registers8:=0; }
  1091. p^.registersfpu:=0;
  1092. {$ifdef SUPPORT_MMX}
  1093. p^.registersmmx:=0;
  1094. {$endif SUPPORT_MMX}
  1095. p^.resulttype:=nil;
  1096. { for security }
  1097. { nr^.is_used:=true;}
  1098. p^.labelnr:=nr;
  1099. p^.exceptionblock:=nil;
  1100. genlabelnode:=p;
  1101. end;
  1102. function genselfnode(_class : pdef) : ptree;
  1103. var
  1104. p : ptree;
  1105. begin
  1106. p:=getnode;
  1107. p^.disposetyp:=dt_nothing;
  1108. p^.treetype:=selfn;
  1109. p^.registers32:=0;
  1110. { p^.registers16:=0;
  1111. p^.registers8:=0; }
  1112. p^.registersfpu:=0;
  1113. {$ifdef SUPPORT_MMX}
  1114. p^.registersmmx:=0;
  1115. {$endif SUPPORT_MMX}
  1116. p^.resulttype:=_class;
  1117. genselfnode:=p;
  1118. end;
  1119. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  1120. var
  1121. p : ptree;
  1122. begin
  1123. p:=getnode;
  1124. p^.disposetyp:=dt_inlinen;
  1125. p^.treetype:=inlinen;
  1126. p^.left:=l;
  1127. p^.inlinenumber:=number;
  1128. p^.inlineconst:=is_const;
  1129. p^.registers32:=0;
  1130. { p^.registers16:=0;
  1131. p^.registers8:=0; }
  1132. p^.registersfpu:=0;
  1133. {$ifdef SUPPORT_MMX}
  1134. p^.registersmmx:=0;
  1135. {$endif SUPPORT_MMX}
  1136. p^.resulttype:=nil;
  1137. geninlinenode:=p;
  1138. end;
  1139. { uses the callnode to create the new procinline node }
  1140. function genprocinlinenode(callp,code : ptree) : ptree;
  1141. var
  1142. p : ptree;
  1143. begin
  1144. p:=getnode;
  1145. p^.disposetyp:=dt_nothing;
  1146. p^.treetype:=procinlinen;
  1147. p^.inlineprocsym:=callp^.symtableprocentry;
  1148. p^.retoffset:=-4; { less dangerous as zero (PM) }
  1149. p^.para_offset:=0;
  1150. p^.para_size:=p^.inlineprocsym^.definition^.para_size;
  1151. if ret_in_param(p^.inlineprocsym^.definition^.rettype.def) then
  1152. p^.para_size:=p^.para_size+target_os.size_of_pointer;
  1153. { copy args }
  1154. p^.inlinetree:=code;
  1155. p^.registers32:=code^.registers32;
  1156. p^.registersfpu:=code^.registersfpu;
  1157. {$ifdef SUPPORT_MMX}
  1158. p^.registersmmx:=0;
  1159. {$endif SUPPORT_MMX}
  1160. p^.resulttype:=p^.inlineprocsym^.definition^.rettype.def;
  1161. genprocinlinenode:=p;
  1162. end;
  1163. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  1164. var
  1165. p : ptree;
  1166. begin
  1167. p:=getnode;
  1168. p^.disposetyp:=dt_nothing;
  1169. p^.treetype:=setconstn;
  1170. p^.registers32:=0;
  1171. p^.registersfpu:=0;
  1172. {$ifdef SUPPORT_MMX}
  1173. p^.registersmmx:=0;
  1174. {$endif SUPPORT_MMX}
  1175. p^.resulttype:=settype;
  1176. p^.left:=nil;
  1177. new(p^.value_set);
  1178. p^.value_set^:=s^;
  1179. gensetconstnode:=p;
  1180. end;
  1181. {$ifdef extdebug}
  1182. procedure compare_trees(oldp,p : ptree);
  1183. var
  1184. error_found : boolean;
  1185. begin
  1186. if oldp^.resulttype<>p^.resulttype then
  1187. begin
  1188. error_found:=true;
  1189. if is_equal(oldp^.resulttype,p^.resulttype) then
  1190. comment(v_debug,'resulttype fields are different but equal')
  1191. else
  1192. comment(v_warning,'resulttype fields are really different');
  1193. end;
  1194. if oldp^.treetype<>p^.treetype then
  1195. begin
  1196. comment(v_warning,'treetype field different');
  1197. error_found:=true;
  1198. end
  1199. else
  1200. comment(v_debug,' treetype '+tostr(longint(oldp^.treetype)));
  1201. if oldp^.error<>p^.error then
  1202. begin
  1203. comment(v_warning,'error field different');
  1204. error_found:=true;
  1205. end;
  1206. if oldp^.disposetyp<>p^.disposetyp then
  1207. begin
  1208. comment(v_warning,'disposetyp field different');
  1209. error_found:=true;
  1210. end;
  1211. { is true, if the right and left operand are swaped }
  1212. if oldp^.swaped<>p^.swaped then
  1213. begin
  1214. comment(v_warning,'swaped field different');
  1215. error_found:=true;
  1216. end;
  1217. { the location of the result of this node }
  1218. if oldp^.location.loc<>p^.location.loc then
  1219. begin
  1220. comment(v_warning,'location.loc field different');
  1221. error_found:=true;
  1222. end;
  1223. { the number of registers needed to evalute the node }
  1224. if oldp^.registers32<>p^.registers32 then
  1225. begin
  1226. comment(v_warning,'registers32 field different');
  1227. comment(v_warning,' old '+tostr(oldp^.registers32)+'<> new '+tostr(p^.registers32));
  1228. error_found:=true;
  1229. end;
  1230. if oldp^.registersfpu<>p^.registersfpu then
  1231. begin
  1232. comment(v_warning,'registersfpu field different');
  1233. error_found:=true;
  1234. end;
  1235. {$ifdef SUPPORT_MMX}
  1236. if oldp^.registersmmx<>p^.registersmmx then
  1237. begin
  1238. comment(v_warning,'registersmmx field different');
  1239. error_found:=true;
  1240. end;
  1241. {$endif SUPPORT_MMX}
  1242. if oldp^.left<>p^.left then
  1243. begin
  1244. comment(v_warning,'left field different');
  1245. error_found:=true;
  1246. end;
  1247. if oldp^.right<>p^.right then
  1248. begin
  1249. comment(v_warning,'right field different');
  1250. error_found:=true;
  1251. end;
  1252. if oldp^.fileinfo.line<>p^.fileinfo.line then
  1253. begin
  1254. comment(v_warning,'fileinfo.line field different');
  1255. error_found:=true;
  1256. end;
  1257. if oldp^.fileinfo.column<>p^.fileinfo.column then
  1258. begin
  1259. comment(v_warning,'fileinfo.column field different');
  1260. error_found:=true;
  1261. end;
  1262. if oldp^.fileinfo.fileindex<>p^.fileinfo.fileindex then
  1263. begin
  1264. comment(v_warning,'fileinfo.fileindex field different');
  1265. error_found:=true;
  1266. end;
  1267. if oldp^.localswitches<>p^.localswitches then
  1268. begin
  1269. comment(v_warning,'localswitches field different');
  1270. error_found:=true;
  1271. end;
  1272. {$ifdef extdebug}
  1273. if oldp^.firstpasscount<>p^.firstpasscount then
  1274. begin
  1275. comment(v_warning,'firstpasscount field different');
  1276. error_found:=true;
  1277. end;
  1278. {$endif extdebug}
  1279. if oldp^.treetype=p^.treetype then
  1280. case oldp^.treetype of
  1281. addn :
  1282. begin
  1283. if oldp^.use_strconcat<>p^.use_strconcat then
  1284. begin
  1285. comment(v_warning,'use_strconcat field different');
  1286. error_found:=true;
  1287. end;
  1288. if oldp^.string_typ<>p^.string_typ then
  1289. begin
  1290. comment(v_warning,'stringtyp field different');
  1291. error_found:=true;
  1292. end;
  1293. end;
  1294. callparan :
  1295. {(is_colon_para : boolean;exact_match_found : boolean);}
  1296. begin
  1297. if oldp^.is_colon_para<>p^.is_colon_para then
  1298. begin
  1299. comment(v_warning,'use_strconcat field different');
  1300. error_found:=true;
  1301. end;
  1302. if oldp^.exact_match_found<>p^.exact_match_found then
  1303. begin
  1304. comment(v_warning,'exact_match_found field different');
  1305. error_found:=true;
  1306. end;
  1307. end;
  1308. assignn :
  1309. {(assigntyp : tassigntyp;concat_string : boolean);}
  1310. begin
  1311. if oldp^.assigntyp<>p^.assigntyp then
  1312. begin
  1313. comment(v_warning,'assigntyp field different');
  1314. error_found:=true;
  1315. end;
  1316. if oldp^.concat_string<>p^.concat_string then
  1317. begin
  1318. comment(v_warning,'concat_string field different');
  1319. error_found:=true;
  1320. end;
  1321. end;
  1322. loadn :
  1323. {(symtableentry : psym;symtable : psymtable;
  1324. is_absolute,is_first : boolean);}
  1325. begin
  1326. if oldp^.symtableentry<>p^.symtableentry then
  1327. begin
  1328. comment(v_warning,'symtableentry field different');
  1329. error_found:=true;
  1330. end;
  1331. if oldp^.symtable<>p^.symtable then
  1332. begin
  1333. comment(v_warning,'symtable field different');
  1334. error_found:=true;
  1335. end;
  1336. if oldp^.is_absolute<>p^.is_absolute then
  1337. begin
  1338. comment(v_warning,'is_absolute field different');
  1339. error_found:=true;
  1340. end;
  1341. if oldp^.is_first<>p^.is_first then
  1342. begin
  1343. comment(v_warning,'is_first field different');
  1344. error_found:=true;
  1345. end;
  1346. end;
  1347. calln :
  1348. {(symtableprocentry : pprocsym;
  1349. symtableproc : psymtable;procdefinition : pprocdef;
  1350. methodpointer : ptree;
  1351. no_check,unit_specific : boolean);}
  1352. begin
  1353. if oldp^.symtableprocentry<>p^.symtableprocentry then
  1354. begin
  1355. comment(v_warning,'symtableprocentry field different');
  1356. error_found:=true;
  1357. end;
  1358. if oldp^.symtableproc<>p^.symtableproc then
  1359. begin
  1360. comment(v_warning,'symtableproc field different');
  1361. error_found:=true;
  1362. end;
  1363. if oldp^.procdefinition<>p^.procdefinition then
  1364. begin
  1365. comment(v_warning,'procdefinition field different');
  1366. error_found:=true;
  1367. end;
  1368. if oldp^.methodpointer<>p^.methodpointer then
  1369. begin
  1370. comment(v_warning,'methodpointer field different');
  1371. error_found:=true;
  1372. end;
  1373. if oldp^.no_check<>p^.no_check then
  1374. begin
  1375. comment(v_warning,'no_check field different');
  1376. error_found:=true;
  1377. end;
  1378. if oldp^.unit_specific<>p^.unit_specific then
  1379. begin
  1380. error_found:=true;
  1381. comment(v_warning,'unit_specific field different');
  1382. end;
  1383. end;
  1384. ordconstn :
  1385. begin
  1386. if oldp^.value<>p^.value then
  1387. begin
  1388. comment(v_warning,'value field different');
  1389. error_found:=true;
  1390. end;
  1391. end;
  1392. realconstn :
  1393. begin
  1394. if oldp^.value_real<>p^.value_real then
  1395. begin
  1396. comment(v_warning,'valued field different');
  1397. error_found:=true;
  1398. end;
  1399. if oldp^.lab_real<>p^.lab_real then
  1400. begin
  1401. comment(v_warning,'labnumber field different');
  1402. error_found:=true;
  1403. end;
  1404. { if oldp^.realtyp<>p^.realtyp then
  1405. begin
  1406. comment(v_warning,'realtyp field different');
  1407. error_found:=true;
  1408. end; }
  1409. end;
  1410. end;
  1411. if not error_found then
  1412. comment(v_warning,'did not find difference in trees');
  1413. end;
  1414. {$endif extdebug}
  1415. function equal_trees(t1,t2 : ptree) : boolean;
  1416. begin
  1417. if t1^.treetype=t2^.treetype then
  1418. begin
  1419. case t1^.treetype of
  1420. addn,
  1421. muln,
  1422. equaln,
  1423. orn,
  1424. xorn,
  1425. andn,
  1426. unequaln:
  1427. begin
  1428. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1429. equal_trees(t1^.right,t2^.right)) or
  1430. (equal_trees(t1^.right,t2^.left) and
  1431. equal_trees(t1^.left,t2^.right));
  1432. end;
  1433. subn,
  1434. divn,
  1435. modn,
  1436. assignn,
  1437. ltn,
  1438. lten,
  1439. gtn,
  1440. gten,
  1441. inn,
  1442. shrn,
  1443. shln,
  1444. slashn,
  1445. rangen:
  1446. begin
  1447. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1448. equal_trees(t1^.right,t2^.right));
  1449. end;
  1450. unaryminusn,
  1451. notn,
  1452. derefn,
  1453. addrn:
  1454. begin
  1455. equal_trees:=(equal_trees(t1^.left,t2^.left));
  1456. end;
  1457. loadn:
  1458. begin
  1459. equal_trees:=(t1^.symtableentry=t2^.symtableentry)
  1460. { not necessary
  1461. and (t1^.symtable=t2^.symtable)};
  1462. end;
  1463. {
  1464. subscriptn,
  1465. ordconstn,typeconvn,calln,callparan,
  1466. realconstn,asmn,vecn,
  1467. stringconstn,funcretn,selfn,
  1468. inlinen,niln,errorn,
  1469. typen,hnewn,hdisposen,newn,
  1470. disposen,setelen,setconstrn
  1471. }
  1472. else equal_trees:=false;
  1473. end;
  1474. end
  1475. else
  1476. equal_trees:=false;
  1477. end;
  1478. procedure set_unique(p : ptree);
  1479. begin
  1480. if assigned(p) then
  1481. begin
  1482. case p^.treetype of
  1483. vecn:
  1484. p^.callunique:=true;
  1485. typeconvn,subscriptn,derefn:
  1486. set_unique(p^.left);
  1487. end;
  1488. end;
  1489. end;
  1490. procedure set_funcret_is_valid(p : ptree);
  1491. begin
  1492. if assigned(p) then
  1493. begin
  1494. case p^.treetype of
  1495. funcretn:
  1496. begin
  1497. if p^.is_first_funcret then
  1498. pprocinfo(p^.funcretprocinfo)^.funcret_state:=vs_assigned;
  1499. end;
  1500. vecn,typeconvn,subscriptn,derefn:
  1501. set_funcret_is_valid(p^.left);
  1502. end;
  1503. end;
  1504. end;
  1505. procedure set_varstate(p : ptree;must_be_valid : boolean);
  1506. begin
  1507. if not assigned(p) then
  1508. exit
  1509. else
  1510. begin
  1511. if p^.varstateset then
  1512. exit;
  1513. case p^.treetype of
  1514. typeconvn :
  1515. if p^.convtyp in
  1516. [
  1517. tc_cchar_2_pchar,
  1518. tc_cstring_2_pchar,
  1519. tc_array_2_pointer
  1520. ] then
  1521. set_varstate(p^.left,false)
  1522. else if p^.convtyp in
  1523. [
  1524. tc_pchar_2_string,
  1525. tc_pointer_2_array
  1526. ] then
  1527. set_varstate(p^.left,true)
  1528. else
  1529. set_varstate(p^.left,must_be_valid);
  1530. subscriptn :
  1531. set_varstate(p^.left,must_be_valid);
  1532. vecn:
  1533. begin
  1534. if (p^.left^.resulttype^.deftype in [stringdef,arraydef]) then
  1535. set_varstate(p^.left,must_be_valid)
  1536. else
  1537. set_varstate(p^.left,true);
  1538. set_varstate(p^.right,true);
  1539. end;
  1540. { do not parse calln }
  1541. calln : ;
  1542. callparan:
  1543. begin
  1544. set_varstate(p^.left,must_be_valid);
  1545. set_varstate(p^.right,must_be_valid);
  1546. end;
  1547. loadn :
  1548. if (p^.symtableentry^.typ=varsym) then
  1549. begin
  1550. if must_be_valid and p^.is_first then
  1551. begin
  1552. if (pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found) or
  1553. (pvarsym(p^.symtableentry)^.varstate=vs_set_but_first_not_passed) then
  1554. if (assigned(pvarsym(p^.symtableentry)^.owner) and
  1555. assigned(aktprocsym) and
  1556. (pvarsym(p^.symtableentry)^.owner = aktprocsym^.definition^.localst)) then
  1557. begin
  1558. if p^.symtable^.symtabletype=localsymtable then
  1559. CGMessage1(sym_n_uninitialized_local_variable,pvarsym(p^.symtableentry)^.name)
  1560. else
  1561. CGMessage1(sym_n_uninitialized_variable,pvarsym(p^.symtableentry)^.name);
  1562. end;
  1563. end;
  1564. if (p^.is_first) then
  1565. begin
  1566. if pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found then
  1567. { this can only happen at left of an assignment, no ? PM }
  1568. if (parsing_para_level=0) and not must_be_valid then
  1569. pvarsym(p^.symtableentry)^.varstate:=vs_assigned
  1570. else
  1571. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1572. if pvarsym(p^.symtableentry)^.varstate=vs_set_but_first_not_passed then
  1573. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1574. p^.is_first:=false;
  1575. end
  1576. else
  1577. begin
  1578. if (pvarsym(p^.symtableentry)^.varstate=vs_assigned) and
  1579. (must_be_valid or (parsing_para_level>0) or
  1580. (p^.resulttype^.deftype=procvardef)) then
  1581. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1582. if (pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found) and
  1583. (must_be_valid or (parsing_para_level>0) or
  1584. (p^.resulttype^.deftype=procvardef)) then
  1585. pvarsym(p^.symtableentry)^.varstate:=vs_set_but_first_not_passed;
  1586. end;
  1587. end;
  1588. funcretn:
  1589. begin
  1590. { no claim if setting higher return value_str }
  1591. if must_be_valid and
  1592. (procinfo=pprocinfo(p^.funcretprocinfo)) and
  1593. ((procinfo^.funcret_state=vs_declared) or
  1594. ((p^.is_first_funcret) and
  1595. (procinfo^.funcret_state=vs_declared_and_first_found))) then
  1596. begin
  1597. CGMessage(sym_w_function_result_not_set);
  1598. { avoid multiple warnings }
  1599. procinfo^.funcret_state:=vs_assigned;
  1600. end;
  1601. if p^.is_first_funcret and not must_be_valid then
  1602. pprocinfo(p^.funcretprocinfo)^.funcret_state:=vs_assigned;
  1603. end;
  1604. else
  1605. begin
  1606. {internalerror(565656);}
  1607. end;
  1608. end;{case }
  1609. p^.varstateset:=true;
  1610. end;
  1611. end;
  1612. procedure clear_location(var loc : tlocation);
  1613. begin
  1614. loc.loc:=LOC_INVALID;
  1615. end;
  1616. {This is needed if you want to be able to delete the string with the nodes !!}
  1617. procedure set_location(var destloc,sourceloc : tlocation);
  1618. begin
  1619. destloc:= sourceloc;
  1620. end;
  1621. procedure swap_location(var destloc,sourceloc : tlocation);
  1622. var
  1623. swapl : tlocation;
  1624. begin
  1625. swapl := destloc;
  1626. destloc := sourceloc;
  1627. sourceloc := swapl;
  1628. end;
  1629. function get_ordinal_value(p : ptree) : longint;
  1630. begin
  1631. if p^.treetype=ordconstn then
  1632. get_ordinal_value:=p^.value
  1633. else
  1634. begin
  1635. Message(type_e_ordinal_expr_expected);
  1636. get_ordinal_value:=0;
  1637. end;
  1638. end;
  1639. function is_constnode(p : ptree) : boolean;
  1640. begin
  1641. is_constnode:=(p^.treetype in [ordconstn,realconstn,stringconstn,fixconstn,setconstn]);
  1642. end;
  1643. function is_constintnode(p : ptree) : boolean;
  1644. begin
  1645. is_constintnode:=(p^.treetype=ordconstn) and is_integer(p^.resulttype);
  1646. end;
  1647. function is_constcharnode(p : ptree) : boolean;
  1648. begin
  1649. is_constcharnode:=(p^.treetype=ordconstn) and is_char(p^.resulttype);
  1650. end;
  1651. function is_constrealnode(p : ptree) : boolean;
  1652. begin
  1653. is_constrealnode:=(p^.treetype=realconstn);
  1654. end;
  1655. function is_constboolnode(p : ptree) : boolean;
  1656. begin
  1657. is_constboolnode:=(p^.treetype=ordconstn) and is_boolean(p^.resulttype);
  1658. end;
  1659. function str_length(p : ptree) : longint;
  1660. begin
  1661. str_length:=p^.length;
  1662. end;
  1663. function is_emptyset(p : ptree):boolean;
  1664. {
  1665. return true if set s is empty
  1666. }
  1667. var
  1668. i : longint;
  1669. begin
  1670. i:=0;
  1671. if p^.treetype=setconstn then
  1672. begin
  1673. while (i<32) and (p^.value_set^[i]=0) do
  1674. inc(i);
  1675. end;
  1676. is_emptyset:=(i=32);
  1677. end;
  1678. {*****************************************************************************
  1679. Case Helpers
  1680. *****************************************************************************}
  1681. function case_count_labels(root : pcaserecord) : longint;
  1682. var
  1683. _l : longint;
  1684. procedure count(p : pcaserecord);
  1685. begin
  1686. inc(_l);
  1687. if assigned(p^.less) then
  1688. count(p^.less);
  1689. if assigned(p^.greater) then
  1690. count(p^.greater);
  1691. end;
  1692. begin
  1693. _l:=0;
  1694. count(root);
  1695. case_count_labels:=_l;
  1696. end;
  1697. function case_get_max(root : pcaserecord) : longint;
  1698. var
  1699. hp : pcaserecord;
  1700. begin
  1701. hp:=root;
  1702. while assigned(hp^.greater) do
  1703. hp:=hp^.greater;
  1704. case_get_max:=hp^._high;
  1705. end;
  1706. function case_get_min(root : pcaserecord) : longint;
  1707. var
  1708. hp : pcaserecord;
  1709. begin
  1710. hp:=root;
  1711. while assigned(hp^.less) do
  1712. hp:=hp^.less;
  1713. case_get_min:=hp^._low;
  1714. end;
  1715. end.
  1716. {
  1717. $Log$
  1718. Revision 1.108 2000-01-07 01:14:48 peter
  1719. * updated copyright to 2000
  1720. Revision 1.107 2000/01/06 01:10:33 pierre
  1721. * fixes for set_varstate on conversions
  1722. Revision 1.106 1999/12/22 01:01:52 peter
  1723. - removed freelabel()
  1724. * added undefined label detection in internal assembler, this prevents
  1725. a lot of ld crashes and wrong .o files
  1726. * .o files aren't written anymore if errors have occured
  1727. * inlining of assembler labels is now correct
  1728. Revision 1.105 1999/12/14 09:58:42 florian
  1729. + compiler checks now if a goto leaves an exception block
  1730. Revision 1.104 1999/11/30 10:40:59 peter
  1731. + ttype, tsymlist
  1732. Revision 1.103 1999/11/18 15:34:51 pierre
  1733. * Notes/Hints for local syms changed to
  1734. Set_varstate function
  1735. Revision 1.102 1999/11/17 17:05:07 pierre
  1736. * Notes/hints changes
  1737. Revision 1.101 1999/11/06 14:34:31 peter
  1738. * truncated log to 20 revs
  1739. Revision 1.100 1999/10/22 14:37:31 peter
  1740. * error when properties are passed to var parameters
  1741. Revision 1.99 1999/09/27 23:45:03 peter
  1742. * procinfo is now a pointer
  1743. * support for result setting in sub procedure
  1744. Revision 1.98 1999/09/26 21:30:22 peter
  1745. + constant pointer support which can happend with typecasting like
  1746. const p=pointer(1)
  1747. * better procvar parsing in typed consts
  1748. Revision 1.97 1999/09/17 17:14:13 peter
  1749. * @procvar fixes for tp mode
  1750. * @<id>:= gives now an error
  1751. Revision 1.96 1999/09/16 11:34:59 pierre
  1752. * typo correction
  1753. Revision 1.95 1999/09/10 18:48:11 florian
  1754. * some bug fixes (e.g. must_be_valid and procinfo^.funcret_is_valid)
  1755. * most things for stored properties fixed
  1756. Revision 1.94 1999/09/07 07:52:20 peter
  1757. * > < >= <= support for boolean
  1758. * boolean constants are now calculated like integer constants
  1759. Revision 1.93 1999/08/27 10:38:31 pierre
  1760. + EXTTEMPREGDEBUG code added
  1761. Revision 1.92 1999/08/26 21:10:08 peter
  1762. * better error recovery for case
  1763. Revision 1.91 1999/08/23 23:26:00 pierre
  1764. + TEMPREGDEBUG code, test of register allocation
  1765. if a tree uses more than registers32 regs then
  1766. internalerror(10) is issued
  1767. + EXTTEMPREGDEBUG will also give internalerror(10) if
  1768. a same register is freed twice (happens in several part
  1769. of current compiler like addn for strings and sets)
  1770. Revision 1.90 1999/08/17 13:26:09 peter
  1771. * arrayconstructor -> arrayofconst fixed when arraycosntructor was not
  1772. variant.
  1773. Revision 1.89 1999/08/16 23:23:42 peter
  1774. * arrayconstructor -> openarray type conversions for element types
  1775. Revision 1.88 1999/08/13 21:33:18 peter
  1776. * support for array constructors extended and more error checking
  1777. Revision 1.87 1999/08/09 22:14:46 peter
  1778. * fixed disposing of tree node
  1779. Revision 1.86 1999/08/04 00:23:49 florian
  1780. * renamed i386asm and i386base to cpuasm and cpubase
  1781. Revision 1.85 1999/08/03 22:03:40 peter
  1782. * moved bitmask constants to sets
  1783. * some other type/const renamings
  1784. Revision 1.84 1999/07/27 23:42:24 peter
  1785. * indirect type referencing is now allowed
  1786. Revision 1.83 1999/05/27 19:45:29 peter
  1787. * removed oldasm
  1788. * plabel -> pasmlabel
  1789. * -a switches to source writing automaticly
  1790. * assembler readers OOPed
  1791. * asmsymbol automaticly external
  1792. * jumptables and other label fixes for asm readers
  1793. Revision 1.82 1999/05/18 14:15:59 peter
  1794. * containsself fixes
  1795. * checktypes()
  1796. Revision 1.81 1999/05/18 09:52:22 peter
  1797. * procedure of object and addrn fixes
  1798. }