tree.pas 63 KB

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