tree.pas 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 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,symtable,aasm
  25. {$ifdef ag386bin}
  26. ,i386base
  27. {$else}
  28. ,i386
  29. {$endif}
  30. {$ifdef m68k}
  31. ,m68k
  32. {$endif}
  33. {$ifdef alpha}
  34. ,alpha
  35. {$endif}
  36. ;
  37. type
  38. pconstset = ^tconstset;
  39. tconstset = array[0..31] of byte;
  40. ttreetyp = (
  41. addn, {Represents the + operator.}
  42. muln, {Represents the * operator.}
  43. subn, {Represents the - operator.}
  44. divn, {Represents the div operator.}
  45. symdifn, {Represents the >< operator.}
  46. modn, {Represents the mod operator.}
  47. assignn, {Represents an assignment.}
  48. loadn, {Represents the use of a variabele.}
  49. rangen, {Represents a range (i.e. 0..9).}
  50. ltn, {Represents the < operator.}
  51. lten, {Represents the <= operator.}
  52. gtn, {Represents the > operator.}
  53. gten, {Represents the >= operator.}
  54. equaln, {Represents the = operator.}
  55. unequaln, {Represents the <> operator.}
  56. inn, {Represents the in operator.}
  57. orn, {Represents the or operator.}
  58. xorn, {Represents the xor operator.}
  59. shrn, {Represents the shr operator.}
  60. shln, {Represents the shl operator.}
  61. slashn, {Represents the / operator.}
  62. andn, {Represents the and operator.}
  63. subscriptn, {??? Field in a record/object?}
  64. derefn, {Dereferences a pointer.}
  65. addrn, {Represents the @ operator.}
  66. doubleaddrn, {Represents the @@ operator.}
  67. ordconstn, {Represents an ordinal value.}
  68. typeconvn, {Represents type-conversion/typecast.}
  69. calln, {Represents a call node.}
  70. callparan, {Represents a parameter.}
  71. realconstn, {Represents a real value.}
  72. fixconstn, {Represents a fixed value.}
  73. umminusn, {Represents a sign change (i.e. -2).}
  74. asmn, {Represents an assembler node }
  75. vecn, {Represents array indexing.}
  76. stringconstn, {Represents a string constant.}
  77. funcretn, {Represents the function result var.}
  78. selfn, {Represents the self parameter.}
  79. notn, {Represents the not operator.}
  80. inlinen, {Internal procedures (i.e. writeln).}
  81. niln, {Represents the nil pointer.}
  82. errorn, {This part of the tree could not be
  83. parsed because of a compiler error.}
  84. typen, {A type name. Used for i.e. typeof(obj).}
  85. hnewn, {The new operation, constructor call.}
  86. hdisposen, {The dispose operation with destructor call.}
  87. newn, {The new operation, constructor call.}
  88. simpledisposen, {The dispose operation.}
  89. setelementn, {A set element(s) (i.e. [a,b] and also [a..b]).}
  90. setconstn, {A set constant (i.e. [1,2]).}
  91. blockn, {A block of statements.}
  92. statementn, {One statement in a block of nodes.}
  93. loopn, { used in genloopnode, must be converted }
  94. ifn, {An if statement.}
  95. breakn, {A break statement.}
  96. continuen, {A continue statement.}
  97. repeatn, {A repeat until block.}
  98. whilen, {A while do statement.}
  99. forn, {A for loop.}
  100. exitn, {An exit statement.}
  101. withn, {A with statement.}
  102. casen, {A case statement.}
  103. labeln, {A label.}
  104. goton, {A goto statement.}
  105. simplenewn, {The new operation.}
  106. tryexceptn, {A try except block.}
  107. raisen, {A raise statement.}
  108. switchesn, {??? Currently unused...}
  109. tryfinallyn, {A try finally statement.}
  110. onn, { for an on statement in exception code }
  111. isn, {Represents the is operator.}
  112. asn, {Represents the as typecast.}
  113. caretn, {Represents the ^ operator.}
  114. failn, {Represents the fail statement.}
  115. starstarn, {Represents the ** operator exponentiation }
  116. procinlinen, {Procedures that can be inlined }
  117. arrayconstructn, {Construction node for [...] parsing}
  118. arrayconstructrangen, {Range element to allow sets in array construction tree}
  119. { added for optimizations where we cannot suppress }
  120. nothingn,
  121. loadvmtn
  122. );
  123. {$ifndef OLDCNV}
  124. tconverttype = (
  125. tc_equal,
  126. tc_not_possible,
  127. tc_string_2_string,
  128. tc_char_2_string,
  129. tc_pchar_2_string,
  130. tc_cchar_2_pchar,
  131. tc_cstring_2_pchar,
  132. tc_ansistring_2_pchar,
  133. tc_string_2_chararray,
  134. tc_chararray_2_string,
  135. tc_array_2_pointer,
  136. tc_pointer_2_array,
  137. tc_int_2_int,
  138. tc_bool_2_int,
  139. tc_int_2_bool,
  140. tc_real_2_real,
  141. tc_int_2_real,
  142. tc_int_2_fix,
  143. tc_real_2_fix,
  144. tc_fix_2_real,
  145. tc_proc_2_procvar,
  146. tc_arrayconstructor_2_set,
  147. tc_load_smallset
  148. );
  149. {$else}
  150. tconverttype = (tc_equal,tc_not_possible,tc_u8bit_2_s32bit,
  151. tc_only_rangechecks32bit,tc_s8bit_2_s32bit,
  152. tc_u16bit_2_s32bit,tc_s16bit_2_s32bit,
  153. tc_s32bit_2_s16bit,tc_s32bit_2_u8bit,
  154. tc_s32bit_2_u16bit,tc_string_2_string,
  155. tc_cstring_2_pchar,tc_string_2_chararray,
  156. tc_array_2_pointer,tc_pointer_2_array,
  157. tc_char_2_string,tc_u8bit_2_s16bit,
  158. tc_u8bit_2_u16bit,tc_s8bit_2_s16bit,
  159. tc_s16bit_2_s8bit,tc_s16bit_2_u8bit,
  160. tc_u16bit_2_s8bit,tc_u16bit_2_u8bit,
  161. tc_s8bit_2_u16bit,tc_s32bit_2_s8bit,
  162. tc_s32bit_2_u32bit,tc_s16bit_2_u32bit,
  163. tc_s8bit_2_u32bit,tc_u16bit_2_u32bit,
  164. tc_u8bit_2_u32bit,tc_u32bit_2_s32bit,
  165. tc_u32bit_2_s8bit,tc_u32bit_2_u8bit,
  166. tc_u32bit_2_s16bit,tc_u32bit_2_u16bit,
  167. tc_bool_2_int,tc_int_2_bool,
  168. tc_int_2_real,tc_real_2_fix,
  169. tc_fix_2_real,tc_int_2_fix,tc_real_2_real,
  170. tc_chararray_2_string,
  171. tc_proc_2_procvar,tc_cchar_2_pchar,tc_load_smallset,
  172. tc_ansistring_2_pchar,tc_pchar_2_string,
  173. tc_arrayconstructor_2_set);
  174. {$endif}
  175. { allows to determine which elementes are to be replaced }
  176. tdisposetyp = (dt_nothing,dt_leftright,dt_left,dt_leftrighthigh,
  177. dt_mbleft,dt_typeconv,dt_inlinen,
  178. dt_mbleft_and_method,dt_loop,dt_case,dt_with,dt_onn);
  179. { different assignment types }
  180. tassigntyp = (at_normal,at_plus,at_minus,at_star,at_slash);
  181. pcaserecord = ^tcaserecord;
  182. tcaserecord = record
  183. { range }
  184. _low,_high : longint;
  185. { only used by gentreejmp }
  186. _at : plabel;
  187. { label of instruction }
  188. statement : plabel;
  189. { is this the first of an case entry, needed to release statement
  190. label (PFV) }
  191. firstlabel : boolean;
  192. { left and right tree node }
  193. less,greater : pcaserecord;
  194. end;
  195. ptree = ^ttree;
  196. ttree = record
  197. error : boolean;
  198. disposetyp : tdisposetyp;
  199. { is true, if the right and left operand are swaped }
  200. swaped : boolean;
  201. { the location of the result of this node }
  202. location : tlocation;
  203. { the number of registers needed to evalute the node }
  204. registers32,registersfpu : longint; { must be longint !!!! }
  205. {$ifdef SUPPORT_MMX}
  206. registersmmx : longint;
  207. {$endif SUPPORT_MMX}
  208. left,right : ptree;
  209. resulttype : pdef;
  210. fileinfo : tfileposinfo;
  211. localswitches : tlocalswitches;
  212. {$ifdef extdebug}
  213. firstpasscount : longint;
  214. {$endif extdebug}
  215. case treetype : ttreetyp of
  216. addn : (use_strconcat : boolean;string_typ : tstringtype);
  217. callparan : (is_colon_para : boolean;exact_match_found : boolean;hightree:ptree);
  218. assignn : (assigntyp : tassigntyp;concat_string : boolean);
  219. loadn : (symtableentry : psym;symtable : psymtable;
  220. is_absolute,is_first : boolean);
  221. calln : (symtableprocentry : psym;
  222. symtableproc : psymtable;procdefinition : pprocdef;
  223. methodpointer : ptree;
  224. no_check,unit_specific,
  225. return_value_used,static_call : boolean);
  226. ordconstn : (value : longint);
  227. realconstn : (value_real : bestreal;lab_real : plabel;realtyp : tait);
  228. fixconstn : (value_fix: longint);
  229. funcretn : (funcretprocinfo : pointer;retdef : pdef);
  230. subscriptn : (vs : pvarsym);
  231. vecn : (memindex,memseg:boolean;callunique : boolean);
  232. stringconstn : (value_str : pchar;length : longint; lab_str : plabel;stringtype : tstringtype);
  233. typeconvn : (convtyp : tconverttype;explizit : boolean);
  234. typen : (typenodetype : pdef);
  235. inlinen : (inlinenumber : byte;inlineconst:boolean);
  236. procinlinen : (inlineprocdef : pprocdef;
  237. retoffset,para_offset,para_size : longint);
  238. setconstn : (value_set : pconstset;lab_set:plabel);
  239. loopn : (t1,t2 : ptree;backward : boolean);
  240. asmn : (p_asm : paasmoutput;object_preserved : boolean);
  241. casen : (nodes : pcaserecord;elseblock : ptree);
  242. labeln,goton : (labelnr : plabel);
  243. withn : (withsymtable : pwithsymtable;tablecount : longint;
  244. pref : preference);
  245. onn : (exceptsymtable : psymtable;excepttype : pobjectdef);
  246. arrayconstructn : (cargs,cargswap: boolean);
  247. end;
  248. function gennode(t : ttreetyp;l,r : ptree) : ptree;
  249. function genlabelnode(t : ttreetyp;nr : plabel) : ptree;
  250. function genloadnode(v : pvarsym;st : psymtable) : ptree;
  251. function genloadcallnode(v: pprocsym;st: psymtable): ptree;
  252. function gensinglenode(t : ttreetyp;l : ptree) : ptree;
  253. function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
  254. function genordinalconstnode(v : longint;def : pdef) : ptree;
  255. function genfixconstnode(v : longint;def : pdef) : ptree;
  256. function gentypeconvnode(node : ptree;t : pdef) : ptree;
  257. function gentypenode(t : pdef) : ptree;
  258. function gencallparanode(expr,next : ptree) : ptree;
  259. function genrealconstnode(v : bestreal) : ptree;
  260. function gencallnode(v : pprocsym;st : psymtable) : ptree;
  261. function genmethodcallnode(v : pprocsym;st : psymtable;mp : ptree) : ptree;
  262. { allow pchar or string for defining a pchar node }
  263. function genstringconstnode(const s : string) : ptree;
  264. { length is required for ansistrings }
  265. function genpcharconstnode(s : pchar;length : longint) : ptree;
  266. { helper routine for conststring node }
  267. function getpcharcopy(p : ptree) : pchar;
  268. function genzeronode(t : ttreetyp) : ptree;
  269. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  270. function genprocinlinenode(callp,code : ptree) : ptree;
  271. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : ptree;
  272. function genenumnode(v : penumsym) : ptree;
  273. function genselfnode(_class : pdef) : ptree;
  274. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  275. function genloopnode(t : ttreetyp;l,r,n1: ptree;back : boolean) : ptree;
  276. function genasmnode(p_asm : paasmoutput) : ptree;
  277. function gencasenode(l,r : ptree;nodes : pcaserecord) : ptree;
  278. function genwithnode(symtable : pwithsymtable;l,r : ptree;count : longint) : ptree;
  279. function getcopy(p : ptree) : ptree;
  280. function equal_trees(t1,t2 : ptree) : boolean;
  281. procedure swaptree(p:Ptree);
  282. procedure disposetree(p : ptree);
  283. procedure putnode(p : ptree);
  284. function getnode : ptree;
  285. procedure clear_location(var loc : tlocation);
  286. procedure set_location(var destloc,sourceloc : tlocation);
  287. procedure swap_location(var destloc,sourceloc : tlocation);
  288. procedure set_file_line(from,_to : ptree);
  289. procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
  290. {$ifdef extdebug}
  291. procedure compare_trees(oldp,p : ptree);
  292. const
  293. maxfirstpasscount : longint = 0;
  294. {$endif extdebug}
  295. { sets the callunique flag, if the node is a vecn, }
  296. { takes care of type casts etc. }
  297. procedure set_unique(p : ptree);
  298. { gibt den ordinalen Werten der Node zurueck oder falls sie }
  299. { keinen ordinalen Wert hat, wird ein Fehler erzeugt }
  300. function get_ordinal_value(p : ptree) : longint;
  301. function is_constnode(p : ptree) : boolean;
  302. { true, if p is a pointer to a const int value }
  303. function is_constintnode(p : ptree) : boolean;
  304. function is_constboolnode(p : ptree) : boolean;
  305. function is_constrealnode(p : ptree) : boolean;
  306. function is_constcharnode(p : ptree) : boolean;
  307. function str_length(p : ptree) : longint;
  308. function is_emptyset(p : ptree):boolean;
  309. {$I innr.inc}
  310. implementation
  311. uses
  312. systems,
  313. globals,verbose,files,types;
  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. { reference info }
  343. if (p^.location.loc in [LOC_MEM,LOC_REFERENCE]) and
  344. assigned(p^.location.reference.symbol) then
  345. stringdispose(p^.location.reference.symbol);
  346. {$ifdef extdebug}
  347. if p^.firstpasscount>maxfirstpasscount then
  348. maxfirstpasscount:=p^.firstpasscount;
  349. {$endif extdebug}
  350. dispose(p);
  351. end;
  352. function getcopy(p : ptree) : ptree;
  353. var
  354. hp : ptree;
  355. begin
  356. hp:=getnode;
  357. hp^:=p^;
  358. if assigned(p^.location.reference.symbol) then
  359. hp^.location.reference.symbol:=stringdup(p^.location.reference.symbol^);
  360. case p^.disposetyp of
  361. dt_leftright :
  362. begin
  363. if assigned(p^.left) then
  364. hp^.left:=getcopy(p^.left);
  365. if assigned(p^.right) then
  366. hp^.right:=getcopy(p^.right);
  367. end;
  368. dt_leftrighthigh :
  369. begin
  370. if assigned(p^.left) then
  371. hp^.left:=getcopy(p^.left);
  372. if assigned(p^.right) then
  373. hp^.right:=getcopy(p^.right);
  374. if assigned(p^.hightree) then
  375. hp^.left:=getcopy(p^.hightree);
  376. end;
  377. dt_nothing : ;
  378. dt_left :
  379. if assigned(p^.left) then
  380. hp^.left:=getcopy(p^.left);
  381. dt_mbleft :
  382. if assigned(p^.left) then
  383. hp^.left:=getcopy(p^.left);
  384. dt_mbleft_and_method :
  385. begin
  386. if assigned(p^.left) then
  387. hp^.left:=getcopy(p^.left);
  388. hp^.methodpointer:=getcopy(p^.methodpointer);
  389. end;
  390. dt_loop :
  391. begin
  392. if assigned(p^.left) then
  393. hp^.left:=getcopy(p^.left);
  394. if assigned(p^.right) then
  395. hp^.right:=getcopy(p^.right);
  396. if assigned(p^.t1) then
  397. hp^.t1:=getcopy(p^.t1);
  398. if assigned(p^.t2) then
  399. hp^.t2:=getcopy(p^.t2);
  400. end;
  401. dt_typeconv : hp^.left:=getcopy(p^.left);
  402. dt_inlinen :
  403. if assigned(p^.left) then
  404. hp^.left:=getcopy(p^.left);
  405. else internalerror(11);
  406. end;
  407. { now check treetype }
  408. case p^.treetype of
  409. stringconstn : begin
  410. hp^.value_str:=getpcharcopy(p);
  411. hp^.length:=p^.length;
  412. end;
  413. setconstn : begin
  414. new(hp^.value_set);
  415. hp^.value_set:=p^.value_set;
  416. end;
  417. end;
  418. getcopy:=hp;
  419. end;
  420. procedure deletecaselabels(p : pcaserecord);
  421. begin
  422. if assigned(p^.greater) then
  423. deletecaselabels(p^.greater);
  424. if assigned(p^.less) then
  425. deletecaselabels(p^.less);
  426. freelabel(p^._at);
  427. if p^.firstlabel then
  428. freelabel(p^.statement);
  429. dispose(p);
  430. end;
  431. procedure swaptree(p:Ptree);
  432. var swapp:Ptree;
  433. begin
  434. swapp:=p^.right;
  435. p^.right:=p^.left;
  436. p^.left:=swapp;
  437. p^.swaped:=not(p^.swaped);
  438. end;
  439. procedure disposetree(p : ptree);
  440. var
  441. symt : pwithsymtable;
  442. i : longint;
  443. begin
  444. if not(assigned(p)) then
  445. exit;
  446. if not(p^.treetype in [addn..loadvmtn]) then
  447. internalerror(26219);
  448. case p^.disposetyp of
  449. dt_leftright :
  450. begin
  451. if assigned(p^.left) then
  452. disposetree(p^.left);
  453. if assigned(p^.right) then
  454. disposetree(p^.right);
  455. end;
  456. dt_leftrighthigh :
  457. begin
  458. if assigned(p^.left) then
  459. disposetree(p^.left);
  460. if assigned(p^.right) then
  461. disposetree(p^.right);
  462. if assigned(p^.hightree) then
  463. disposetree(p^.hightree);
  464. end;
  465. dt_case :
  466. begin
  467. if assigned(p^.left) then
  468. disposetree(p^.left);
  469. if assigned(p^.right) then
  470. disposetree(p^.right);
  471. if assigned(p^.nodes) then
  472. deletecaselabels(p^.nodes);
  473. if assigned(p^.elseblock) then
  474. disposetree(p^.elseblock);
  475. end;
  476. dt_nothing : ;
  477. dt_left :
  478. if assigned(p^.left) then
  479. disposetree(p^.left);
  480. dt_mbleft :
  481. if assigned(p^.left) then
  482. disposetree(p^.left);
  483. dt_mbleft_and_method :
  484. begin
  485. if assigned(p^.left) then disposetree(p^.left);
  486. disposetree(p^.methodpointer);
  487. end;
  488. dt_typeconv : disposetree(p^.left);
  489. dt_inlinen :
  490. if assigned(p^.left) then
  491. disposetree(p^.left);
  492. dt_loop :
  493. begin
  494. if assigned(p^.left) then
  495. disposetree(p^.left);
  496. if assigned(p^.right) then
  497. disposetree(p^.right);
  498. if assigned(p^.t1) then
  499. disposetree(p^.t1);
  500. if assigned(p^.t2) then
  501. disposetree(p^.t2);
  502. end;
  503. dt_onn:
  504. begin
  505. if assigned(p^.left) then
  506. disposetree(p^.left);
  507. if assigned(p^.right) then
  508. disposetree(p^.right);
  509. if assigned(p^.exceptsymtable) then
  510. dispose(p^.exceptsymtable,done);
  511. end;
  512. dt_with :
  513. begin
  514. if assigned(p^.left) then
  515. disposetree(p^.left);
  516. if assigned(p^.right) then
  517. disposetree(p^.right);
  518. symt:=p^.withsymtable;
  519. for i:=1 to p^.tablecount do
  520. begin
  521. if assigned(symt) then
  522. begin
  523. p^.withsymtable:=pwithsymtable(symt^.next);
  524. dispose(symt,done);
  525. end;
  526. symt:=p^.withsymtable;
  527. end;
  528. end;
  529. else internalerror(12);
  530. end;
  531. putnode(p);
  532. end;
  533. procedure set_file_line(from,_to : ptree);
  534. begin
  535. if assigned(from) then
  536. _to^.fileinfo:=from^.fileinfo;
  537. end;
  538. procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
  539. begin
  540. p^.fileinfo:=filepos;
  541. end;
  542. function genwithnode(symtable : pwithsymtable;l,r : ptree;count : longint) : ptree;
  543. var
  544. p : ptree;
  545. begin
  546. p:=getnode;
  547. p^.disposetyp:=dt_with;
  548. p^.treetype:=withn;
  549. p^.left:=l;
  550. p^.right:=r;
  551. p^.registers32:=0;
  552. { p^.registers16:=0;
  553. p^.registers8:=0; }
  554. p^.registersfpu:=0;
  555. {$ifdef SUPPORT_MMX}
  556. p^.registersmmx:=0;
  557. {$endif SUPPORT_MMX}
  558. p^.resulttype:=nil;
  559. p^.withsymtable:=symtable;
  560. p^.tablecount:=count;
  561. p^.pref:=nil;
  562. set_file_line(l,p);
  563. genwithnode:=p;
  564. end;
  565. function genfixconstnode(v : longint;def : pdef) : ptree;
  566. var
  567. p : ptree;
  568. begin
  569. p:=getnode;
  570. p^.disposetyp:=dt_nothing;
  571. p^.treetype:=fixconstn;
  572. p^.registers32:=0;
  573. { p^.registers16:=0;
  574. p^.registers8:=0; }
  575. p^.registersfpu:=0;
  576. {$ifdef SUPPORT_MMX}
  577. p^.registersmmx:=0;
  578. {$endif SUPPORT_MMX}
  579. p^.resulttype:=def;
  580. p^.value:=v;
  581. genfixconstnode:=p;
  582. end;
  583. function gencallparanode(expr,next : ptree) : ptree;
  584. var
  585. p : ptree;
  586. begin
  587. p:=getnode;
  588. p^.disposetyp:=dt_leftrighthigh;
  589. p^.treetype:=callparan;
  590. p^.left:=expr;
  591. p^.right:=next;
  592. p^.registers32:=0;
  593. { p^.registers16:=0;
  594. p^.registers8:=0; }
  595. {$ifdef SUPPORT_MMX}
  596. p^.registersmmx:=0;
  597. {$endif SUPPORT_MMX}
  598. p^.registersfpu:=0;
  599. p^.resulttype:=nil;
  600. p^.exact_match_found:=false;
  601. p^.is_colon_para:=false;
  602. p^.hightree:=nil;
  603. set_file_line(expr,p);
  604. gencallparanode:=p;
  605. end;
  606. function gennode(t : ttreetyp;l,r : ptree) : ptree;
  607. var
  608. p : ptree;
  609. begin
  610. p:=getnode;
  611. p^.disposetyp:=dt_leftright;
  612. p^.treetype:=t;
  613. p^.left:=l;
  614. p^.right:=r;
  615. p^.registers32:=0;
  616. { p^.registers16:=0;
  617. p^.registers8:=0; }
  618. p^.registersfpu:=0;
  619. {$ifdef SUPPORT_MMX}
  620. p^.registersmmx:=0;
  621. {$endif SUPPORT_MMX}
  622. p^.resulttype:=nil;
  623. gennode:=p;
  624. end;
  625. function gencasenode(l,r : ptree;nodes : pcaserecord) : ptree;
  626. var
  627. p : ptree;
  628. begin
  629. p:=getnode;
  630. p^.disposetyp:=dt_case;
  631. p^.treetype:=casen;
  632. p^.left:=l;
  633. p^.right:=r;
  634. p^.nodes:=nodes;
  635. p^.registers32:=0;
  636. p^.registersfpu:=0;
  637. {$ifdef SUPPORT_MMX}
  638. p^.registersmmx:=0;
  639. {$endif SUPPORT_MMX}
  640. p^.resulttype:=nil;
  641. set_file_line(l,p);
  642. gencasenode:=p;
  643. end;
  644. function genloopnode(t : ttreetyp;l,r,n1 : ptree;back : boolean) : ptree;
  645. var
  646. p : ptree;
  647. begin
  648. p:=getnode;
  649. p^.disposetyp:=dt_loop;
  650. p^.treetype:=t;
  651. p^.left:=l;
  652. p^.right:=r;
  653. p^.t1:=n1;
  654. p^.t2:=nil;
  655. p^.registers32:=0;
  656. p^.backward:=back;
  657. { p^.registers16:=0;
  658. p^.registers8:=0; }
  659. p^.registersfpu:=0;
  660. {$ifdef SUPPORT_MMX}
  661. p^.registersmmx:=0;
  662. {$endif SUPPORT_MMX}
  663. p^.resulttype:=nil;
  664. set_file_line(l,p);
  665. genloopnode:=p;
  666. end;
  667. function genordinalconstnode(v : longint;def : pdef) : ptree;
  668. var
  669. p : ptree;
  670. begin
  671. p:=getnode;
  672. p^.disposetyp:=dt_nothing;
  673. p^.treetype:=ordconstn;
  674. p^.registers32:=0;
  675. { p^.registers16:=0;
  676. p^.registers8:=0; }
  677. p^.registersfpu:=0;
  678. {$ifdef SUPPORT_MMX}
  679. p^.registersmmx:=0;
  680. {$endif SUPPORT_MMX}
  681. p^.resulttype:=def;
  682. p^.value:=v;
  683. if p^.resulttype^.deftype=orddef then
  684. testrange(p^.resulttype,p^.value);
  685. genordinalconstnode:=p;
  686. end;
  687. function genenumnode(v : penumsym) : ptree;
  688. var
  689. p : ptree;
  690. begin
  691. p:=getnode;
  692. p^.disposetyp:=dt_nothing;
  693. p^.treetype:=ordconstn;
  694. p^.registers32:=0;
  695. { p^.registers16:=0;
  696. p^.registers8:=0; }
  697. p^.registersfpu:=0;
  698. {$ifdef SUPPORT_MMX}
  699. p^.registersmmx:=0;
  700. {$endif SUPPORT_MMX}
  701. p^.resulttype:=v^.definition;
  702. p^.value:=v^.value;
  703. testrange(p^.resulttype,p^.value);
  704. genenumnode:=p;
  705. end;
  706. function genrealconstnode(v : bestreal) : ptree;
  707. var
  708. p : ptree;
  709. begin
  710. p:=getnode;
  711. p^.disposetyp:=dt_nothing;
  712. p^.treetype:=realconstn;
  713. p^.registers32:=0;
  714. { p^.registers16:=0;
  715. p^.registers8:=0; }
  716. p^.registersfpu:=0;
  717. {$ifdef SUPPORT_MMX}
  718. p^.registersmmx:=0;
  719. {$endif SUPPORT_MMX}
  720. {$ifdef i386}
  721. p^.resulttype:=c64floatdef;
  722. p^.value_real:=v;
  723. { default value is double }
  724. p^.realtyp:=ait_real_64bit;
  725. {$endif}
  726. {$ifdef m68k}
  727. p^.resulttype:=new(pfloatdef,init(s32real));
  728. p^.value_real:=v;
  729. { default value is double }
  730. p^.realtyp:=ait_real_32bit;
  731. {$endif}
  732. p^.lab_real:=nil;
  733. genrealconstnode:=p;
  734. end;
  735. function genstringconstnode(const s : string) : ptree;
  736. var
  737. p : ptree;
  738. l : longint;
  739. begin
  740. p:=getnode;
  741. p^.disposetyp:=dt_nothing;
  742. p^.treetype:=stringconstn;
  743. p^.registers32:=0;
  744. { p^.registers16:=0;
  745. p^.registers8:=0; }
  746. p^.registersfpu:=0;
  747. {$ifdef SUPPORT_MMX}
  748. p^.registersmmx:=0;
  749. {$endif SUPPORT_MMX}
  750. l:=length(s);
  751. p^.length:=l;
  752. { stringdup write even past a #0 }
  753. getmem(p^.value_str,l+1);
  754. move(s[1],p^.value_str^,l);
  755. p^.value_str[l]:=#0;
  756. p^.lab_str:=nil;
  757. if cs_ansistrings in aktlocalswitches then
  758. begin
  759. p^.stringtype:=st_ansistring;
  760. p^.resulttype:=cansistringdef;
  761. end
  762. else
  763. begin
  764. p^.stringtype:=st_shortstring;
  765. p^.resulttype:=cshortstringdef;
  766. end;
  767. genstringconstnode:=p;
  768. end;
  769. function getpcharcopy(p : ptree) : pchar;
  770. var
  771. pc : pchar;
  772. begin
  773. pc:=nil;
  774. getmem(pc,p^.length+1);
  775. if pc=nil then
  776. Message(general_f_no_memory_left);
  777. move(p^.value_str^,pc^,p^.length+1);
  778. getpcharcopy:=pc;
  779. end;
  780. function genpcharconstnode(s : pchar;length : longint) : ptree;
  781. var
  782. p : ptree;
  783. begin
  784. p:=getnode;
  785. p^.disposetyp:=dt_nothing;
  786. p^.treetype:=stringconstn;
  787. p^.registers32:=0;
  788. { p^.registers16:=0;
  789. p^.registers8:=0; }
  790. p^.registersfpu:=0;
  791. {$ifdef SUPPORT_MMX}
  792. p^.registersmmx:=0;
  793. {$endif SUPPORT_MMX}
  794. p^.resulttype:=cshortstringdef;
  795. p^.length:=length;
  796. p^.value_str:=s;
  797. p^.lab_str:=nil;
  798. genpcharconstnode:=p;
  799. end;
  800. function gensinglenode(t : ttreetyp;l : ptree) : ptree;
  801. var
  802. p : ptree;
  803. begin
  804. p:=getnode;
  805. p^.disposetyp:=dt_left;
  806. p^.treetype:=t;
  807. p^.left:=l;
  808. p^.registers32:=0;
  809. { p^.registers16:=0;
  810. p^.registers8:=0; }
  811. p^.registersfpu:=0;
  812. {$ifdef SUPPORT_MMX}
  813. p^.registersmmx:=0;
  814. {$endif SUPPORT_MMX}
  815. p^.resulttype:=nil;
  816. gensinglenode:=p;
  817. end;
  818. function genasmnode(p_asm : paasmoutput) : ptree;
  819. var
  820. p : ptree;
  821. begin
  822. p:=getnode;
  823. p^.disposetyp:=dt_nothing;
  824. p^.treetype:=asmn;
  825. p^.registers32:=4;
  826. p^.p_asm:=p_asm;
  827. p^.object_preserved:=false;
  828. { p^.registers16:=0;
  829. p^.registers8:=0; }
  830. p^.registersfpu:=8;
  831. {$ifdef SUPPORT_MMX}
  832. p^.registersmmx:=8;
  833. {$endif SUPPORT_MMX}
  834. p^.resulttype:=nil;
  835. genasmnode:=p;
  836. end;
  837. function genloadnode(v : pvarsym;st : psymtable) : ptree;
  838. var
  839. p : ptree;
  840. begin
  841. p:=getnode;
  842. p^.registers32:=0;
  843. { p^.registers16:=0;
  844. p^.registers8:=0; }
  845. p^.registersfpu:=0;
  846. {$ifdef SUPPORT_MMX}
  847. p^.registersmmx:=0;
  848. {$endif SUPPORT_MMX}
  849. p^.treetype:=loadn;
  850. p^.resulttype:=v^.definition;
  851. p^.symtableentry:=v;
  852. p^.symtable:=st;
  853. p^.is_first := False;
  854. { method pointer load nodes can use the left subtree }
  855. p^.disposetyp:=dt_left;
  856. p^.left:=nil;
  857. genloadnode:=p;
  858. end;
  859. function genloadcallnode(v: pprocsym;st: psymtable): ptree;
  860. var
  861. p : ptree;
  862. begin
  863. p:=getnode;
  864. p^.registers32:=0;
  865. { p^.registers16:=0;
  866. p^.registers8:=0; }
  867. p^.registersfpu:=0;
  868. {$ifdef SUPPORT_MMX}
  869. p^.registersmmx:=0;
  870. {$endif SUPPORT_MMX}
  871. p^.treetype:=loadn;
  872. p^.left:=nil;
  873. p^.resulttype:=v^.definition;
  874. p^.symtableentry:=v;
  875. p^.symtable:=st;
  876. p^.is_first := False;
  877. p^.disposetyp:=dt_nothing;
  878. genloadcallnode:=p;
  879. end;
  880. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : ptree;
  881. var
  882. p : ptree;
  883. begin
  884. p:=getnode;
  885. p^.registers32:=0;
  886. { p^.registers16:=0;
  887. p^.registers8:=0; }
  888. p^.registersfpu:=0;
  889. {$ifdef SUPPORT_MMX}
  890. p^.registersmmx:=0;
  891. {$endif SUPPORT_MMX}
  892. p^.treetype:=loadn;
  893. p^.left:=nil;
  894. p^.resulttype:=sym^.definition;
  895. p^.symtableentry:=pvarsym(sym);
  896. p^.symtable:=st;
  897. p^.disposetyp:=dt_nothing;
  898. gentypedconstloadnode:=p;
  899. end;
  900. function gentypeconvnode(node : ptree;t : pdef) : ptree;
  901. var
  902. p : ptree;
  903. begin
  904. p:=getnode;
  905. p^.disposetyp:=dt_typeconv;
  906. p^.treetype:=typeconvn;
  907. p^.left:=node;
  908. p^.registers32:=0;
  909. { p^.registers16:=0;
  910. p^.registers8:=0; }
  911. p^.convtyp:=tc_equal;
  912. p^.registersfpu:=0;
  913. {$ifdef SUPPORT_MMX}
  914. p^.registersmmx:=0;
  915. {$endif SUPPORT_MMX}
  916. p^.resulttype:=t;
  917. p^.explizit:=false;
  918. set_file_line(node,p);
  919. gentypeconvnode:=p;
  920. end;
  921. function gentypenode(t : pdef) : ptree;
  922. var
  923. p : ptree;
  924. begin
  925. p:=getnode;
  926. p^.disposetyp:=dt_nothing;
  927. p^.treetype:=typen;
  928. p^.registers32:=0;
  929. { p^.registers16:=0;
  930. p^.registers8:=0; }
  931. p^.registersfpu:=0;
  932. {$ifdef SUPPORT_MMX}
  933. p^.registersmmx:=0;
  934. {$endif SUPPORT_MMX}
  935. p^.resulttype:=generrordef;
  936. p^.typenodetype:=t;
  937. gentypenode:=p;
  938. end;
  939. function gencallnode(v : pprocsym;st : psymtable) : ptree;
  940. var
  941. p : ptree;
  942. begin
  943. p:=getnode;
  944. p^.registers32:=0;
  945. { p^.registers16:=0;
  946. p^.registers8:=0; }
  947. p^.registersfpu:=0;
  948. {$ifdef SUPPORT_MMX}
  949. p^.registersmmx:=0;
  950. {$endif SUPPORT_MMX}
  951. p^.treetype:=calln;
  952. p^.symtableprocentry:=v;
  953. p^.symtableproc:=st;
  954. p^.unit_specific:=false;
  955. p^.no_check:=false;
  956. p^.return_value_used:=true;
  957. p^.disposetyp := dt_leftright;
  958. p^.methodpointer:=nil;
  959. p^.left:=nil;
  960. p^.right:=nil;
  961. p^.procdefinition:=nil;
  962. gencallnode:=p;
  963. end;
  964. function genmethodcallnode(v : pprocsym;st : psymtable;mp : ptree) : ptree;
  965. var
  966. p : ptree;
  967. begin
  968. p:=getnode;
  969. p^.registers32:=0;
  970. { p^.registers16:=0;
  971. p^.registers8:=0; }
  972. p^.registersfpu:=0;
  973. {$ifdef SUPPORT_MMX}
  974. p^.registersmmx:=0;
  975. {$endif SUPPORT_MMX}
  976. p^.treetype:=calln;
  977. p^.return_value_used:=true;
  978. p^.symtableprocentry:=v;
  979. p^.symtableproc:=st;
  980. p^.disposetyp:=dt_mbleft_and_method;
  981. p^.left:=nil;
  982. p^.right:=nil;
  983. p^.methodpointer:=mp;
  984. p^.procdefinition:=nil;
  985. genmethodcallnode:=p;
  986. end;
  987. function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
  988. var
  989. p : ptree;
  990. begin
  991. p:=getnode;
  992. p^.disposetyp:=dt_left;
  993. p^.treetype:=subscriptn;
  994. p^.left:=l;
  995. p^.registers32:=0;
  996. p^.vs:=varsym;
  997. { p^.registers16:=0;
  998. p^.registers8:=0; }
  999. p^.registersfpu:=0;
  1000. {$ifdef SUPPORT_MMX}
  1001. p^.registersmmx:=0;
  1002. {$endif SUPPORT_MMX}
  1003. p^.resulttype:=nil;
  1004. gensubscriptnode:=p;
  1005. end;
  1006. function genzeronode(t : ttreetyp) : ptree;
  1007. var
  1008. p : ptree;
  1009. begin
  1010. p:=getnode;
  1011. p^.disposetyp:=dt_nothing;
  1012. p^.treetype:=t;
  1013. p^.registers32:=0;
  1014. { p^.registers16:=0;
  1015. p^.registers8:=0; }
  1016. p^.registersfpu:=0;
  1017. {$ifdef SUPPORT_MMX}
  1018. p^.registersmmx:=0;
  1019. {$endif SUPPORT_MMX}
  1020. p^.resulttype:=nil;
  1021. genzeronode:=p;
  1022. end;
  1023. function genlabelnode(t : ttreetyp;nr : plabel) : ptree;
  1024. var
  1025. p : ptree;
  1026. begin
  1027. p:=getnode;
  1028. p^.disposetyp:=dt_nothing;
  1029. p^.treetype:=t;
  1030. p^.registers32:=0;
  1031. { p^.registers16:=0;
  1032. p^.registers8:=0; }
  1033. p^.registersfpu:=0;
  1034. {$ifdef SUPPORT_MMX}
  1035. p^.registersmmx:=0;
  1036. {$endif SUPPORT_MMX}
  1037. p^.resulttype:=nil;
  1038. { for security }
  1039. { nr^.is_used:=true;}
  1040. p^.labelnr:=nr;
  1041. genlabelnode:=p;
  1042. end;
  1043. function genselfnode(_class : pdef) : ptree;
  1044. var
  1045. p : ptree;
  1046. begin
  1047. p:=getnode;
  1048. p^.disposetyp:=dt_nothing;
  1049. p^.treetype:=selfn;
  1050. p^.registers32:=0;
  1051. { p^.registers16:=0;
  1052. p^.registers8:=0; }
  1053. p^.registersfpu:=0;
  1054. {$ifdef SUPPORT_MMX}
  1055. p^.registersmmx:=0;
  1056. {$endif SUPPORT_MMX}
  1057. p^.resulttype:=_class;
  1058. genselfnode:=p;
  1059. end;
  1060. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  1061. var
  1062. p : ptree;
  1063. begin
  1064. p:=getnode;
  1065. p^.disposetyp:=dt_inlinen;
  1066. p^.treetype:=inlinen;
  1067. p^.left:=l;
  1068. p^.inlinenumber:=number;
  1069. p^.inlineconst:=is_const;
  1070. p^.registers32:=0;
  1071. { p^.registers16:=0;
  1072. p^.registers8:=0; }
  1073. p^.registersfpu:=0;
  1074. {$ifdef SUPPORT_MMX}
  1075. p^.registersmmx:=0;
  1076. {$endif SUPPORT_MMX}
  1077. p^.resulttype:=nil;
  1078. geninlinenode:=p;
  1079. end;
  1080. { uses the callnode to create the new procinline node }
  1081. function genprocinlinenode(callp,code : ptree) : ptree;
  1082. var
  1083. p : ptree;
  1084. begin
  1085. p:=getnode;
  1086. p^.disposetyp:=dt_left;
  1087. p^.treetype:=procinlinen;
  1088. p^.inlineprocdef:=callp^.procdefinition;
  1089. p^.retoffset:=-4; { less dangerous as zero (PM) }
  1090. p^.para_offset:=0;
  1091. p^.para_size:=p^.inlineprocdef^.para_size;
  1092. if ret_in_param(p^.inlineprocdef^.retdef) then
  1093. p^.para_size:=p^.para_size+target_os.size_of_pointer;
  1094. { copy args }
  1095. p^.left:=getcopy(code);
  1096. p^.registers32:=code^.registers32;
  1097. p^.registersfpu:=code^.registersfpu;
  1098. {$ifdef SUPPORT_MMX}
  1099. p^.registersmmx:=0;
  1100. {$endif SUPPORT_MMX}
  1101. p^.resulttype:=p^.inlineprocdef^.retdef;
  1102. genprocinlinenode:=p;
  1103. end;
  1104. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  1105. var
  1106. p : ptree;
  1107. begin
  1108. p:=getnode;
  1109. p^.disposetyp:=dt_nothing;
  1110. p^.treetype:=setconstn;
  1111. p^.registers32:=0;
  1112. p^.registersfpu:=0;
  1113. {$ifdef SUPPORT_MMX}
  1114. p^.registersmmx:=0;
  1115. {$endif SUPPORT_MMX}
  1116. p^.resulttype:=settype;
  1117. p^.left:=nil;
  1118. new(p^.value_set);
  1119. p^.value_set^:=s^;
  1120. gensetconstnode:=p;
  1121. end;
  1122. {$ifdef extdebug}
  1123. procedure compare_trees(oldp,p : ptree);
  1124. var
  1125. error_found : boolean;
  1126. begin
  1127. if oldp^.resulttype<>p^.resulttype then
  1128. begin
  1129. error_found:=true;
  1130. if is_equal(oldp^.resulttype,p^.resulttype) then
  1131. comment(v_debug,'resulttype fields are different but equal')
  1132. else
  1133. comment(v_warning,'resulttype fields are really different');
  1134. end;
  1135. if oldp^.treetype<>p^.treetype then
  1136. begin
  1137. comment(v_warning,'treetype field different');
  1138. error_found:=true;
  1139. end
  1140. else
  1141. comment(v_debug,' treetype '+tostr(longint(oldp^.treetype)));
  1142. if oldp^.error<>p^.error then
  1143. begin
  1144. comment(v_warning,'error field different');
  1145. error_found:=true;
  1146. end;
  1147. if oldp^.disposetyp<>p^.disposetyp then
  1148. begin
  1149. comment(v_warning,'disposetyp field different');
  1150. error_found:=true;
  1151. end;
  1152. { is true, if the right and left operand are swaped }
  1153. if oldp^.swaped<>p^.swaped then
  1154. begin
  1155. comment(v_warning,'swaped field different');
  1156. error_found:=true;
  1157. end;
  1158. { the location of the result of this node }
  1159. if oldp^.location.loc<>p^.location.loc then
  1160. begin
  1161. comment(v_warning,'location.loc field different');
  1162. error_found:=true;
  1163. end;
  1164. { the number of registers needed to evalute the node }
  1165. if oldp^.registers32<>p^.registers32 then
  1166. begin
  1167. comment(v_warning,'registers32 field different');
  1168. comment(v_warning,' old '+tostr(oldp^.registers32)+'<> new '+tostr(p^.registers32));
  1169. error_found:=true;
  1170. end;
  1171. if oldp^.registersfpu<>p^.registersfpu then
  1172. begin
  1173. comment(v_warning,'registersfpu field different');
  1174. error_found:=true;
  1175. end;
  1176. {$ifdef SUPPORT_MMX}
  1177. if oldp^.registersmmx<>p^.registersmmx then
  1178. begin
  1179. comment(v_warning,'registersmmx field different');
  1180. error_found:=true;
  1181. end;
  1182. {$endif SUPPORT_MMX}
  1183. if oldp^.left<>p^.left then
  1184. begin
  1185. comment(v_warning,'left field different');
  1186. error_found:=true;
  1187. end;
  1188. if oldp^.right<>p^.right then
  1189. begin
  1190. comment(v_warning,'right field different');
  1191. error_found:=true;
  1192. end;
  1193. if oldp^.fileinfo.line<>p^.fileinfo.line then
  1194. begin
  1195. comment(v_warning,'fileinfo.line field different');
  1196. error_found:=true;
  1197. end;
  1198. if oldp^.fileinfo.column<>p^.fileinfo.column then
  1199. begin
  1200. comment(v_warning,'fileinfo.column field different');
  1201. error_found:=true;
  1202. end;
  1203. if oldp^.fileinfo.fileindex<>p^.fileinfo.fileindex then
  1204. begin
  1205. comment(v_warning,'fileinfo.fileindex field different');
  1206. error_found:=true;
  1207. end;
  1208. if oldp^.localswitches<>p^.localswitches then
  1209. begin
  1210. comment(v_warning,'localswitches field different');
  1211. error_found:=true;
  1212. end;
  1213. {$ifdef extdebug}
  1214. if oldp^.firstpasscount<>p^.firstpasscount then
  1215. begin
  1216. comment(v_warning,'firstpasscount field different');
  1217. error_found:=true;
  1218. end;
  1219. {$endif extdebug}
  1220. if oldp^.treetype=p^.treetype then
  1221. case oldp^.treetype of
  1222. addn :
  1223. begin
  1224. if oldp^.use_strconcat<>p^.use_strconcat then
  1225. begin
  1226. comment(v_warning,'use_strconcat field different');
  1227. error_found:=true;
  1228. end;
  1229. if oldp^.string_typ<>p^.string_typ then
  1230. begin
  1231. comment(v_warning,'stringtyp field different');
  1232. error_found:=true;
  1233. end;
  1234. end;
  1235. callparan :
  1236. {(is_colon_para : boolean;exact_match_found : boolean);}
  1237. begin
  1238. if oldp^.is_colon_para<>p^.is_colon_para then
  1239. begin
  1240. comment(v_warning,'use_strconcat field different');
  1241. error_found:=true;
  1242. end;
  1243. if oldp^.exact_match_found<>p^.exact_match_found then
  1244. begin
  1245. comment(v_warning,'exact_match_found field different');
  1246. error_found:=true;
  1247. end;
  1248. end;
  1249. assignn :
  1250. {(assigntyp : tassigntyp;concat_string : boolean);}
  1251. begin
  1252. if oldp^.assigntyp<>p^.assigntyp then
  1253. begin
  1254. comment(v_warning,'assigntyp field different');
  1255. error_found:=true;
  1256. end;
  1257. if oldp^.concat_string<>p^.concat_string then
  1258. begin
  1259. comment(v_warning,'concat_string field different');
  1260. error_found:=true;
  1261. end;
  1262. end;
  1263. loadn :
  1264. {(symtableentry : psym;symtable : psymtable;
  1265. is_absolute,is_first : boolean);}
  1266. begin
  1267. if oldp^.symtableentry<>p^.symtableentry then
  1268. begin
  1269. comment(v_warning,'symtableentry field different');
  1270. error_found:=true;
  1271. end;
  1272. if oldp^.symtable<>p^.symtable then
  1273. begin
  1274. comment(v_warning,'symtable field different');
  1275. error_found:=true;
  1276. end;
  1277. if oldp^.is_absolute<>p^.is_absolute then
  1278. begin
  1279. comment(v_warning,'is_absolute field different');
  1280. error_found:=true;
  1281. end;
  1282. if oldp^.is_first<>p^.is_first then
  1283. begin
  1284. comment(v_warning,'is_first field different');
  1285. error_found:=true;
  1286. end;
  1287. end;
  1288. calln :
  1289. {(symtableprocentry : pprocsym;
  1290. symtableproc : psymtable;procdefinition : pprocdef;
  1291. methodpointer : ptree;
  1292. no_check,unit_specific : boolean);}
  1293. begin
  1294. if oldp^.symtableprocentry<>p^.symtableprocentry then
  1295. begin
  1296. comment(v_warning,'symtableprocentry field different');
  1297. error_found:=true;
  1298. end;
  1299. if oldp^.symtableproc<>p^.symtableproc then
  1300. begin
  1301. comment(v_warning,'symtableproc field different');
  1302. error_found:=true;
  1303. end;
  1304. if oldp^.procdefinition<>p^.procdefinition then
  1305. begin
  1306. comment(v_warning,'procdefinition field different');
  1307. error_found:=true;
  1308. end;
  1309. if oldp^.methodpointer<>p^.methodpointer then
  1310. begin
  1311. comment(v_warning,'methodpointer field different');
  1312. error_found:=true;
  1313. end;
  1314. if oldp^.no_check<>p^.no_check then
  1315. begin
  1316. comment(v_warning,'no_check field different');
  1317. error_found:=true;
  1318. end;
  1319. if oldp^.unit_specific<>p^.unit_specific then
  1320. begin
  1321. error_found:=true;
  1322. comment(v_warning,'unit_specific field different');
  1323. end;
  1324. end;
  1325. ordconstn :
  1326. begin
  1327. if oldp^.value<>p^.value then
  1328. begin
  1329. comment(v_warning,'value field different');
  1330. error_found:=true;
  1331. end;
  1332. end;
  1333. realconstn :
  1334. begin
  1335. if oldp^.value_real<>p^.value_real then
  1336. begin
  1337. comment(v_warning,'valued field different');
  1338. error_found:=true;
  1339. end;
  1340. if oldp^.lab_real<>p^.lab_real then
  1341. begin
  1342. comment(v_warning,'labnumber field different');
  1343. error_found:=true;
  1344. end;
  1345. if oldp^.realtyp<>p^.realtyp then
  1346. begin
  1347. comment(v_warning,'realtyp field different');
  1348. error_found:=true;
  1349. end;
  1350. end;
  1351. end;
  1352. if not error_found then
  1353. comment(v_warning,'did not find difference in trees');
  1354. end;
  1355. {$endif extdebug}
  1356. function equal_trees(t1,t2 : ptree) : boolean;
  1357. begin
  1358. if t1^.treetype=t2^.treetype then
  1359. begin
  1360. case t1^.treetype of
  1361. addn,
  1362. muln,
  1363. equaln,
  1364. orn,
  1365. xorn,
  1366. andn,
  1367. unequaln:
  1368. begin
  1369. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1370. equal_trees(t1^.right,t2^.right)) or
  1371. (equal_trees(t1^.right,t2^.left) and
  1372. equal_trees(t1^.left,t2^.right));
  1373. end;
  1374. subn,
  1375. divn,
  1376. modn,
  1377. assignn,
  1378. ltn,
  1379. lten,
  1380. gtn,
  1381. gten,
  1382. inn,
  1383. shrn,
  1384. shln,
  1385. slashn,
  1386. rangen:
  1387. begin
  1388. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1389. equal_trees(t1^.right,t2^.right));
  1390. end;
  1391. umminusn,
  1392. notn,
  1393. derefn,
  1394. addrn:
  1395. begin
  1396. equal_trees:=(equal_trees(t1^.left,t2^.left));
  1397. end;
  1398. loadn:
  1399. begin
  1400. equal_trees:=(t1^.symtableentry=t2^.symtableentry)
  1401. { not necessary
  1402. and (t1^.symtable=t2^.symtable)};
  1403. end;
  1404. {
  1405. subscriptn,
  1406. ordconstn,typeconvn,calln,callparan,
  1407. realconstn,asmn,vecn,
  1408. stringconstn,funcretn,selfn,
  1409. inlinen,niln,errorn,
  1410. typen,hnewn,hdisposen,newn,
  1411. disposen,setelen,setconstrn
  1412. }
  1413. else equal_trees:=false;
  1414. end;
  1415. end
  1416. else
  1417. equal_trees:=false;
  1418. end;
  1419. procedure set_unique(p : ptree);
  1420. begin
  1421. if assigned(p) then
  1422. begin
  1423. case p^.treetype of
  1424. vecn:
  1425. p^.callunique:=true;
  1426. typeconvn:
  1427. set_unique(p^.left);
  1428. end;
  1429. end;
  1430. end;
  1431. procedure clear_location(var loc : tlocation);
  1432. begin
  1433. if ((loc.loc=LOC_MEM) or (loc.loc=LOC_REFERENCE)) and
  1434. assigned(loc.reference.symbol) then
  1435. stringdispose(loc.reference.symbol);
  1436. loc.loc:=LOC_INVALID;
  1437. end;
  1438. {This is needed if you want to be able to delete the string with the nodes !!}
  1439. procedure set_location(var destloc,sourceloc : tlocation);
  1440. begin
  1441. if assigned(destloc.reference.symbol) then
  1442. stringdispose(destloc.reference.symbol);
  1443. destloc:= sourceloc;
  1444. if sourceloc.loc in [LOC_MEM,LOC_REFERENCE] then
  1445. begin
  1446. if assigned(sourceloc.reference.symbol) then
  1447. destloc.reference.symbol:=
  1448. stringdup(sourceloc.reference.symbol^);
  1449. end
  1450. else
  1451. destloc.reference.symbol:=nil;
  1452. end;
  1453. procedure swap_location(var destloc,sourceloc : tlocation);
  1454. var
  1455. swapl : tlocation;
  1456. begin
  1457. swapl := destloc;
  1458. destloc := sourceloc;
  1459. sourceloc := swapl;
  1460. end;
  1461. function get_ordinal_value(p : ptree) : longint;
  1462. begin
  1463. if p^.treetype=ordconstn then
  1464. get_ordinal_value:=p^.value
  1465. else
  1466. Message(type_e_ordinal_expr_expected);
  1467. end;
  1468. function is_constnode(p : ptree) : boolean;
  1469. begin
  1470. is_constnode:=(p^.treetype in [ordconstn,realconstn,stringconstn,fixconstn,setconstn]);
  1471. end;
  1472. function is_constintnode(p : ptree) : boolean;
  1473. begin
  1474. is_constintnode:=(p^.treetype=ordconstn) and is_integer(p^.resulttype);
  1475. end;
  1476. function is_constcharnode(p : ptree) : boolean;
  1477. begin
  1478. is_constcharnode:=((p^.treetype=ordconstn) and
  1479. (p^.resulttype^.deftype=orddef) and
  1480. (porddef(p^.resulttype)^.typ=uchar));
  1481. end;
  1482. function is_constrealnode(p : ptree) : boolean;
  1483. begin
  1484. is_constrealnode:=(p^.treetype=realconstn);
  1485. end;
  1486. function is_constboolnode(p : ptree) : boolean;
  1487. begin
  1488. is_constboolnode:=((p^.treetype=ordconstn) and
  1489. (p^.resulttype^.deftype=orddef) and
  1490. (porddef(p^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit]));
  1491. end;
  1492. function str_length(p : ptree) : longint;
  1493. begin
  1494. str_length:=p^.length;
  1495. end;
  1496. function is_emptyset(p : ptree):boolean;
  1497. {
  1498. return true if set s is empty
  1499. }
  1500. var
  1501. i : longint;
  1502. begin
  1503. i:=0;
  1504. if p^.treetype=setconstn then
  1505. begin
  1506. while (i<32) and (p^.value_set^[i]=0) do
  1507. inc(i);
  1508. end;
  1509. is_emptyset:=(i=32);
  1510. end;
  1511. end.
  1512. {
  1513. $Log$
  1514. Revision 1.66 1999-02-22 02:15:59 peter
  1515. * updates for ag386bin
  1516. Revision 1.65 1999/02/11 09:46:31 pierre
  1517. * fix for normal method calls inside static methods :
  1518. WARNING there were both parser and codegen errors !!
  1519. added static_call boolean to calln tree
  1520. Revision 1.64 1999/01/27 12:57:22 pierre
  1521. * memory leaks with hightree solved by adding a new disposetyp
  1522. dt_leftrighthigh
  1523. Revision 1.63 1999/01/27 00:14:00 florian
  1524. * "procedure of object"-stuff fixed
  1525. Revision 1.62 1999/01/21 22:10:52 peter
  1526. * fixed array of const
  1527. * generic platform independent high() support
  1528. Revision 1.61 1999/01/21 16:41:09 pierre
  1529. * fix for constructor inside with statements
  1530. Revision 1.60 1998/12/15 11:52:19 peter
  1531. * fixed dup release of statement label in case
  1532. Revision 1.59 1998/12/15 10:23:32 peter
  1533. + -iSO, -iSP, -iTO, -iTP
  1534. Revision 1.58 1998/12/11 00:04:02 peter
  1535. + globtype,tokens,version unit splitted from globals
  1536. Revision 1.57 1998/12/04 10:18:13 florian
  1537. * some stuff for procedures of object added
  1538. * bug with overridden virtual constructors fixed (reported by Italo Gomes)
  1539. Revision 1.56 1998/12/02 16:23:32 jonas
  1540. * changed "if longintvar in set" to case or "if () or () .." statements
  1541. * tree.pas: changed inlinenumber (and associated constructor/vars) to a byte
  1542. Revision 1.55 1998/11/29 12:40:20 peter
  1543. * newcnv -> not oldcnv
  1544. Revision 1.54 1998/11/26 13:10:44 peter
  1545. * new int - int conversion -dNEWCNV
  1546. * some function renamings
  1547. Revision 1.53 1998/11/24 12:52:42 peter
  1548. * sets are not written twice anymore
  1549. * optimize for emptyset+single element which uses a new routine from
  1550. set.inc FPC_SET_CREATE_ELEMENT
  1551. Revision 1.52 1998/11/23 17:51:58 pierre
  1552. * added checking before dispose of reference string
  1553. Revision 1.51 1998/11/13 10:15:53 peter
  1554. * fixed ptr() with constants
  1555. Revision 1.50 1998/11/10 10:09:20 peter
  1556. * va_list -> array of const
  1557. Revision 1.49 1998/11/05 12:03:07 peter
  1558. * released useansistring
  1559. * removed -Sv, its now available in fpc modes
  1560. Revision 1.48 1998/10/21 15:12:59 pierre
  1561. * bug fix for IOCHECK inside a procedure with iocheck modifier
  1562. * removed the GPF for unexistant overloading
  1563. (firstcall was called with procedinition=nil !)
  1564. * changed typen to what Florian proposed
  1565. gentypenode(p : pdef) sets the typenodetype field
  1566. and resulttype is only set if inside bt_type block !
  1567. Revision 1.47 1998/10/20 08:07:07 pierre
  1568. * several memory corruptions due to double freemem solved
  1569. => never use p^.loc.location:=p^.left^.loc.location;
  1570. + finally I added now by default
  1571. that ra386dir translates global and unit symbols
  1572. + added a first field in tsymtable and
  1573. a nextsym field in tsym
  1574. (this allows to obtain ordered type info for
  1575. records and objects in gdb !)
  1576. Revision 1.46 1998/10/08 17:17:37 pierre
  1577. * current_module old scanner tagged as invalid if unit is recompiled
  1578. + added ppheap for better info on tracegetmem of heaptrc
  1579. (adds line column and file index)
  1580. * several memory leaks removed ith help of heaptrc !!
  1581. Revision 1.45 1998/10/05 21:33:33 peter
  1582. * fixed 161,165,166,167,168
  1583. Revision 1.44 1998/09/28 16:57:28 pierre
  1584. * changed all length(p^.value_str^) into str_length(p)
  1585. to get it work with and without ansistrings
  1586. * changed sourcefiles field of tmodule to a pointer
  1587. Revision 1.43 1998/09/27 10:16:28 florian
  1588. * type casts pchar<->ansistring fixed
  1589. * ansistring[..] calls does now an unique call
  1590. Revision 1.42 1998/09/23 12:03:59 peter
  1591. * overloading fix for array of const
  1592. Revision 1.41 1998/09/23 09:58:55 peter
  1593. * first working array of const things
  1594. Revision 1.40 1998/09/22 15:34:07 peter
  1595. + pchar -> string conversion
  1596. Revision 1.39 1998/09/21 08:45:27 pierre
  1597. + added vmt_offset in tobjectdef.write for fututre use
  1598. (first steps to have objects without vmt if no virtual !!)
  1599. + added fpu_used field for tabstractprocdef :
  1600. sets this level to 2 if the functions return with value in FPU
  1601. (is then set to correct value at parsing of implementation)
  1602. THIS MIGHT refuse some code with FPU expression too complex
  1603. that were accepted before and even in some cases
  1604. that don't overflow in fact
  1605. ( like if f : float; is a forward that finally in implementation
  1606. only uses one fpu register !!)
  1607. Nevertheless I think that it will improve security on
  1608. FPU operations !!
  1609. * most other changes only for UseBrowser code
  1610. (added symtable references for record and objects)
  1611. local switch for refs to args and local of each function
  1612. (static symtable still missing)
  1613. UseBrowser still not stable and probably broken by
  1614. the definition hash array !!
  1615. Revision 1.38 1998/09/16 01:06:47 carl
  1616. * crash bugfix in firstaddr
  1617. Revision 1.37 1998/09/08 10:38:04 pierre
  1618. * some variable fields inside conditionnal were not updated
  1619. Revision 1.36 1998/09/07 18:46:17 peter
  1620. * update smartlinking, uses getdatalabel
  1621. * renamed ptree.value vars to value_str,value_real,value_set
  1622. Revision 1.35 1998/09/04 08:42:11 peter
  1623. * updated some error messages
  1624. Revision 1.34 1998/09/01 17:39:54 peter
  1625. + internal constant functions
  1626. Revision 1.33 1998/08/28 12:51:44 florian
  1627. + ansistring to pchar type cast fixed
  1628. Revision 1.32 1998/08/28 10:54:25 peter
  1629. * fixed smallset generation from elements, it has never worked before!
  1630. Revision 1.31 1998/08/21 14:08:58 pierre
  1631. + TEST_FUNCRET now default (old code removed)
  1632. works also for m68k (at least compiles)
  1633. Revision 1.30 1998/08/18 09:24:47 pierre
  1634. * small warning position bug fixed
  1635. * support_mmx switches splitting was missing
  1636. * rhide error and warning output corrected
  1637. Revision 1.29 1998/08/14 18:18:48 peter
  1638. + dynamic set contruction
  1639. * smallsets are now working (always longint size)
  1640. Revision 1.28 1998/08/13 11:00:13 peter
  1641. * fixed procedure<>procedure construct
  1642. Revision 1.27 1998/08/10 14:50:35 peter
  1643. + localswitches, moduleswitches, globalswitches splitting
  1644. Revision 1.26 1998/08/10 09:57:19 peter
  1645. - Remove InitTree which was empty and obsolete
  1646. Revision 1.25 1998/08/02 16:42:02 florian
  1647. * on o : tobject do should also work now, the exceptsymtable shouldn't be
  1648. disposed by dellexlevel
  1649. Revision 1.24 1998/07/30 11:18:23 florian
  1650. + first implementation of try ... except on .. do end;
  1651. * limitiation of 65535 bytes parameters for cdecl removed
  1652. Revision 1.23 1998/07/24 22:17:01 florian
  1653. * internal error 10 together with array access fixed. I hope
  1654. that's the final fix.
  1655. Revision 1.22 1998/07/20 10:23:05 florian
  1656. * better ansi string assignement
  1657. Revision 1.21 1998/07/14 21:46:56 peter
  1658. * updated messages file
  1659. Revision 1.20 1998/07/14 14:47:11 peter
  1660. * released NEWINPUT
  1661. Revision 1.19 1998/07/08 14:56:53 daniel
  1662. * Fixed $ifdef TP.
  1663. Revision 1.18 1998/07/07 11:20:18 peter
  1664. + NEWINPUT for a better inputfile and scanner object
  1665. Revision 1.17 1998/06/22 08:59:03 daniel
  1666. - Removed pool of nodes.
  1667. Revision 1.16 1998/06/12 14:50:49 peter
  1668. * removed the tree dependency to types.pas
  1669. * long_fil.pas support (not fully tested yet)
  1670. Revision 1.15 1998/06/06 08:39:07 peter
  1671. * it needs types
  1672. Revision 1.14 1998/06/05 14:37:40 pierre
  1673. * fixes for inline for operators
  1674. * inline procedure more correctly restricted
  1675. Revision 1.13 1998/06/04 09:55:49 pierre
  1676. * demangled name of procsym reworked to become independant of the mangling scheme
  1677. Revision 1.12 1998/06/03 22:49:06 peter
  1678. + wordbool,longbool
  1679. * rename bis,von -> high,low
  1680. * moved some systemunit loading/creating to psystem.pas
  1681. Revision 1.10 1998/05/20 09:42:38 pierre
  1682. + UseTokenInfo now default
  1683. * unit in interface uses and implementation uses gives error now
  1684. * only one error for unknown symbol (uses lastsymknown boolean)
  1685. the problem came from the label code !
  1686. + first inlined procedures and function work
  1687. (warning there might be allowed cases were the result is still wrong !!)
  1688. * UseBrower updated gives a global list of all position of all used symbols
  1689. with switch -gb
  1690. Revision 1.9 1998/05/12 10:47:00 peter
  1691. * moved printstatus to verb_def
  1692. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1693. prefix like error: warning: and is included in V_Default
  1694. * fixed some messages
  1695. * first time parameter scan is only for -v and -T
  1696. - removed old style messages
  1697. Revision 1.8 1998/05/07 00:17:01 peter
  1698. * smartlinking for sets
  1699. + consts labels are now concated/generated in hcodegen
  1700. * moved some cpu code to cga and some none cpu depended code from cga
  1701. to tree and hcodegen and cleanup of hcodegen
  1702. * assembling .. output reduced for smartlinking ;)
  1703. Revision 1.7 1998/05/06 15:04:21 pierre
  1704. + when trying to find source files of a ppufile
  1705. check the includepathlist for included files
  1706. the main file must still be in the same directory
  1707. Revision 1.6 1998/05/06 08:38:52 pierre
  1708. * better position info with UseTokenInfo
  1709. UseTokenInfo greatly simplified
  1710. + added check for changed tree after first time firstpass
  1711. (if we could remove all the cases were it happen
  1712. we could skip all firstpass if firstpasscount > 1)
  1713. Only with ExtDebug
  1714. Revision 1.5 1998/04/30 15:59:43 pierre
  1715. * GDB works again better :
  1716. correct type info in one pass
  1717. + UseTokenInfo for better source position
  1718. * fixed one remaining bug in scanner for line counts
  1719. * several little fixes
  1720. Revision 1.4 1998/04/29 10:34:08 pierre
  1721. + added some code for ansistring (not complete nor working yet)
  1722. * corrected operator overloading
  1723. * corrected nasm output
  1724. + started inline procedures
  1725. + added starstarn : use ** for exponentiation (^ gave problems)
  1726. + started UseTokenInfo cond to get accurate positions
  1727. Revision 1.3 1998/04/21 10:16:49 peter
  1728. * patches from strasbourg
  1729. * objects is not used anymore in the fpc compiled version
  1730. Revision 1.2 1998/04/07 22:45:05 florian
  1731. * bug0092, bug0115 and bug0121 fixed
  1732. + packed object/class/array
  1733. }