tree.pas 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091
  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,
  25. symconst,symtable,aasm
  26. {$ifdef i386}
  27. ,i386base
  28. {$endif}
  29. {$ifdef m68k}
  30. ,m68k
  31. {$endif}
  32. {$ifdef alpha}
  33. ,alpha
  34. {$endif}
  35. ;
  36. type
  37. pconstset = ^tconstset;
  38. tconstset = array[0..31] of byte;
  39. ttreetyp = (
  40. addn, {Represents the + operator.}
  41. muln, {Represents the * operator.}
  42. subn, {Represents the - operator.}
  43. divn, {Represents the div operator.}
  44. symdifn, {Represents the >< operator.}
  45. modn, {Represents the mod operator.}
  46. assignn, {Represents an assignment.}
  47. loadn, {Represents the use of a variabele.}
  48. rangen, {Represents a range (i.e. 0..9).}
  49. ltn, {Represents the < operator.}
  50. lten, {Represents the <= operator.}
  51. gtn, {Represents the > operator.}
  52. gten, {Represents the >= operator.}
  53. equaln, {Represents the = operator.}
  54. unequaln, {Represents the <> operator.}
  55. inn, {Represents the in operator.}
  56. orn, {Represents the or operator.}
  57. xorn, {Represents the xor operator.}
  58. shrn, {Represents the shr operator.}
  59. shln, {Represents the shl operator.}
  60. slashn, {Represents the / operator.}
  61. andn, {Represents the and operator.}
  62. subscriptn, {??? Field in a record/object?}
  63. derefn, {Dereferences a pointer.}
  64. addrn, {Represents the @ operator.}
  65. doubleaddrn, {Represents the @@ operator.}
  66. ordconstn, {Represents an ordinal value.}
  67. typeconvn, {Represents type-conversion/typecast.}
  68. calln, {Represents a call node.}
  69. callparan, {Represents a parameter.}
  70. realconstn, {Represents a real value.}
  71. fixconstn, {Represents a fixed value.}
  72. umminusn, {Represents a sign change (i.e. -2).}
  73. asmn, {Represents an assembler node }
  74. vecn, {Represents array indexing.}
  75. stringconstn, {Represents a string constant.}
  76. funcretn, {Represents the function result var.}
  77. selfn, {Represents the self parameter.}
  78. notn, {Represents the not operator.}
  79. inlinen, {Internal procedures (i.e. writeln).}
  80. niln, {Represents the nil pointer.}
  81. errorn, {This part of the tree could not be
  82. parsed because of a compiler error.}
  83. typen, {A type name. Used for i.e. typeof(obj).}
  84. hnewn, {The new operation, constructor call.}
  85. hdisposen, {The dispose operation with destructor call.}
  86. newn, {The new operation, constructor call.}
  87. simpledisposen, {The dispose operation.}
  88. setelementn, {A set element(s) (i.e. [a,b] and also [a..b]).}
  89. setconstn, {A set constant (i.e. [1,2]).}
  90. blockn, {A block of statements.}
  91. statementn, {One statement in a block of nodes.}
  92. loopn, { used in genloopnode, must be converted }
  93. ifn, {An if statement.}
  94. breakn, {A break statement.}
  95. continuen, {A continue statement.}
  96. repeatn, {A repeat until block.}
  97. whilen, {A while do statement.}
  98. forn, {A for loop.}
  99. exitn, {An exit statement.}
  100. withn, {A with statement.}
  101. casen, {A case statement.}
  102. labeln, {A label.}
  103. goton, {A goto statement.}
  104. simplenewn, {The new operation.}
  105. tryexceptn, {A try except block.}
  106. raisen, {A raise statement.}
  107. switchesn, {??? Currently unused...}
  108. tryfinallyn, {A try finally statement.}
  109. onn, { for an on statement in exception code }
  110. isn, {Represents the is operator.}
  111. asn, {Represents the as typecast.}
  112. caretn, {Represents the ^ operator.}
  113. failn, {Represents the fail statement.}
  114. starstarn, {Represents the ** operator exponentiation }
  115. procinlinen, {Procedures that can be inlined }
  116. arrayconstructn, {Construction node for [...] parsing}
  117. arrayconstructrangen, {Range element to allow sets in array construction tree}
  118. { added for optimizations where we cannot suppress }
  119. nothingn,
  120. loadvmtn
  121. );
  122. tconverttype = (
  123. tc_equal,
  124. tc_not_possible,
  125. tc_string_2_string,
  126. tc_char_2_string,
  127. tc_pchar_2_string,
  128. tc_cchar_2_pchar,
  129. tc_cstring_2_pchar,
  130. tc_ansistring_2_pchar,
  131. tc_string_2_chararray,
  132. tc_chararray_2_string,
  133. tc_array_2_pointer,
  134. tc_pointer_2_array,
  135. tc_int_2_int,
  136. tc_int_2_bool,
  137. tc_bool_2_bool,
  138. tc_bool_2_int,
  139. tc_real_2_real,
  140. tc_int_2_real,
  141. tc_int_2_fix,
  142. tc_real_2_fix,
  143. tc_fix_2_real,
  144. tc_proc_2_procvar,
  145. tc_arrayconstructor_2_set,
  146. tc_load_smallset
  147. );
  148. { allows to determine which elementes are to be replaced }
  149. tdisposetyp = (dt_nothing,dt_leftright,dt_left,dt_leftrighthigh,
  150. dt_mbleft,dt_typeconv,dt_inlinen,
  151. dt_mbleft_and_method,dt_loop,dt_case,dt_with,dt_onn);
  152. { different assignment types }
  153. tassigntyp = (at_normal,at_plus,at_minus,at_star,at_slash);
  154. pcaserecord = ^tcaserecord;
  155. tcaserecord = record
  156. { range }
  157. _low,_high : longint;
  158. { only used by gentreejmp }
  159. _at : pasmlabel;
  160. { label of instruction }
  161. statement : pasmlabel;
  162. { is this the first of an case entry, needed to release statement
  163. label (PFV) }
  164. firstlabel : boolean;
  165. { left and right tree node }
  166. less,greater : pcaserecord;
  167. end;
  168. ptree = ^ttree;
  169. ttree = record
  170. error : boolean;
  171. disposetyp : tdisposetyp;
  172. { is true, if the right and left operand are swaped }
  173. swaped : boolean;
  174. { the location of the result of this node }
  175. location : tlocation;
  176. { the number of registers needed to evalute the node }
  177. registers32,registersfpu : longint; { must be longint !!!! }
  178. {$ifdef SUPPORT_MMX}
  179. registersmmx : longint;
  180. {$endif SUPPORT_MMX}
  181. left,right : ptree;
  182. resulttype : pdef;
  183. fileinfo : tfileposinfo;
  184. localswitches : tlocalswitches;
  185. {$ifdef extdebug}
  186. firstpasscount : longint;
  187. {$endif extdebug}
  188. {$ifdef TEMPS_NOT_PUSH}
  189. temp_offset : longint;
  190. {$endif TEMPS_NOT_PUSH}
  191. case treetype : ttreetyp of
  192. addn : (use_strconcat : boolean;string_typ : tstringtype);
  193. callparan : (is_colon_para : boolean;exact_match_found,
  194. convlevel1found,convlevel2found:boolean;hightree:ptree);
  195. assignn : (assigntyp : tassigntyp;concat_string : boolean);
  196. loadn : (symtableentry : psym;symtable : psymtable;
  197. is_absolute,is_first : boolean);
  198. calln : (symtableprocentry : pprocsym;
  199. symtableproc : psymtable;procdefinition : pabstractprocdef;
  200. methodpointer : ptree;
  201. no_check,unit_specific,
  202. return_value_used,static_call : boolean);
  203. ordconstn : (value : longint);
  204. realconstn : (value_real : bestreal;lab_real : pasmlabel);
  205. fixconstn : (value_fix: longint);
  206. funcretn : (funcretprocinfo : pointer;retdef : pdef);
  207. subscriptn : (vs : pvarsym);
  208. vecn : (memindex,memseg:boolean;callunique : boolean);
  209. stringconstn : (value_str : pchar;length : longint; lab_str : pasmlabel;stringtype : tstringtype);
  210. typeconvn : (convtyp : tconverttype;explizit : boolean);
  211. typen : (typenodetype : pdef;typenodesym:ptypesym);
  212. inlinen : (inlinenumber : byte;inlineconst:boolean);
  213. procinlinen : (inlinetree:ptree;inlineprocsym:pprocsym;retoffset,para_offset,para_size : longint);
  214. setconstn : (value_set : pconstset;lab_set:pasmlabel);
  215. loopn : (t1,t2 : ptree;backward : boolean);
  216. asmn : (p_asm : paasmoutput;object_preserved : boolean);
  217. casen : (nodes : pcaserecord;elseblock : ptree);
  218. labeln,goton : (labelnr : pasmlabel);
  219. withn : (withsymtable : pwithsymtable;tablecount : longint;withreference:preference;islocal:boolean);
  220. onn : (exceptsymtable : psymtable;excepttype : pobjectdef);
  221. arrayconstructn : (cargs,cargswap: boolean);
  222. end;
  223. function gennode(t : ttreetyp;l,r : ptree) : ptree;
  224. function genlabelnode(t : ttreetyp;nr : pasmlabel) : ptree;
  225. function genloadnode(v : pvarsym;st : psymtable) : ptree;
  226. function genloadcallnode(v: pprocsym;st: psymtable): ptree;
  227. function genloadmethodcallnode(v: pprocsym;st: psymtable; mp:ptree): 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;sym:ptypesym) : 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 genloadmethodcallnode(v: pprocsym;st: psymtable; mp:ptree): 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:=v^.definition;
  879. p^.symtableentry:=v;
  880. p^.symtable:=st;
  881. p^.is_first := False;
  882. p^.disposetyp:=dt_left;
  883. p^.left:=mp;
  884. genloadmethodcallnode:=p;
  885. end;
  886. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : ptree;
  887. var
  888. p : ptree;
  889. begin
  890. p:=getnode;
  891. p^.registers32:=0;
  892. { p^.registers16:=0;
  893. p^.registers8:=0; }
  894. p^.registersfpu:=0;
  895. {$ifdef SUPPORT_MMX}
  896. p^.registersmmx:=0;
  897. {$endif SUPPORT_MMX}
  898. p^.treetype:=loadn;
  899. p^.left:=nil;
  900. p^.resulttype:=sym^.definition;
  901. p^.symtableentry:=sym;
  902. p^.symtable:=st;
  903. p^.disposetyp:=dt_nothing;
  904. gentypedconstloadnode:=p;
  905. end;
  906. function gentypeconvnode(node : ptree;t : pdef) : ptree;
  907. var
  908. p : ptree;
  909. begin
  910. p:=getnode;
  911. p^.disposetyp:=dt_typeconv;
  912. p^.treetype:=typeconvn;
  913. p^.left:=node;
  914. p^.registers32:=0;
  915. { p^.registers16:=0;
  916. p^.registers8:=0; }
  917. p^.convtyp:=tc_equal;
  918. p^.registersfpu:=0;
  919. {$ifdef SUPPORT_MMX}
  920. p^.registersmmx:=0;
  921. {$endif SUPPORT_MMX}
  922. p^.resulttype:=t;
  923. p^.explizit:=false;
  924. set_file_line(node,p);
  925. gentypeconvnode:=p;
  926. end;
  927. function gentypenode(t : pdef;sym:ptypesym) : ptree;
  928. var
  929. p : ptree;
  930. begin
  931. p:=getnode;
  932. p^.disposetyp:=dt_nothing;
  933. p^.treetype:=typen;
  934. p^.registers32:=0;
  935. { p^.registers16:=0;
  936. p^.registers8:=0; }
  937. p^.registersfpu:=0;
  938. {$ifdef SUPPORT_MMX}
  939. p^.registersmmx:=0;
  940. {$endif SUPPORT_MMX}
  941. p^.resulttype:=generrordef;
  942. p^.typenodetype:=t;
  943. p^.typenodesym:=sym;
  944. gentypenode:=p;
  945. end;
  946. function gencallnode(v : pprocsym;st : psymtable) : ptree;
  947. var
  948. p : ptree;
  949. begin
  950. p:=getnode;
  951. p^.registers32:=0;
  952. { p^.registers16:=0;
  953. p^.registers8:=0; }
  954. p^.registersfpu:=0;
  955. {$ifdef SUPPORT_MMX}
  956. p^.registersmmx:=0;
  957. {$endif SUPPORT_MMX}
  958. p^.treetype:=calln;
  959. p^.symtableprocentry:=v;
  960. p^.symtableproc:=st;
  961. p^.unit_specific:=false;
  962. p^.no_check:=false;
  963. p^.return_value_used:=true;
  964. p^.disposetyp := dt_leftright;
  965. p^.methodpointer:=nil;
  966. p^.left:=nil;
  967. p^.right:=nil;
  968. p^.procdefinition:=nil;
  969. gencallnode:=p;
  970. end;
  971. function genmethodcallnode(v : pprocsym;st : psymtable;mp : ptree) : ptree;
  972. var
  973. p : ptree;
  974. begin
  975. p:=getnode;
  976. p^.registers32:=0;
  977. { p^.registers16:=0;
  978. p^.registers8:=0; }
  979. p^.registersfpu:=0;
  980. {$ifdef SUPPORT_MMX}
  981. p^.registersmmx:=0;
  982. {$endif SUPPORT_MMX}
  983. p^.treetype:=calln;
  984. p^.return_value_used:=true;
  985. p^.symtableprocentry:=v;
  986. p^.symtableproc:=st;
  987. p^.disposetyp:=dt_mbleft_and_method;
  988. p^.left:=nil;
  989. p^.right:=nil;
  990. p^.methodpointer:=mp;
  991. p^.procdefinition:=nil;
  992. genmethodcallnode:=p;
  993. end;
  994. function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
  995. var
  996. p : ptree;
  997. begin
  998. p:=getnode;
  999. p^.disposetyp:=dt_left;
  1000. p^.treetype:=subscriptn;
  1001. p^.left:=l;
  1002. p^.registers32:=0;
  1003. p^.vs:=varsym;
  1004. { p^.registers16:=0;
  1005. p^.registers8:=0; }
  1006. p^.registersfpu:=0;
  1007. {$ifdef SUPPORT_MMX}
  1008. p^.registersmmx:=0;
  1009. {$endif SUPPORT_MMX}
  1010. p^.resulttype:=nil;
  1011. gensubscriptnode:=p;
  1012. end;
  1013. function genzeronode(t : ttreetyp) : ptree;
  1014. var
  1015. p : ptree;
  1016. begin
  1017. p:=getnode;
  1018. p^.disposetyp:=dt_nothing;
  1019. p^.treetype:=t;
  1020. p^.registers32:=0;
  1021. { p^.registers16:=0;
  1022. p^.registers8:=0; }
  1023. p^.registersfpu:=0;
  1024. {$ifdef SUPPORT_MMX}
  1025. p^.registersmmx:=0;
  1026. {$endif SUPPORT_MMX}
  1027. p^.resulttype:=nil;
  1028. genzeronode:=p;
  1029. end;
  1030. function genlabelnode(t : ttreetyp;nr : pasmlabel) : ptree;
  1031. var
  1032. p : ptree;
  1033. begin
  1034. p:=getnode;
  1035. p^.disposetyp:=dt_nothing;
  1036. p^.treetype:=t;
  1037. p^.registers32:=0;
  1038. { p^.registers16:=0;
  1039. p^.registers8:=0; }
  1040. p^.registersfpu:=0;
  1041. {$ifdef SUPPORT_MMX}
  1042. p^.registersmmx:=0;
  1043. {$endif SUPPORT_MMX}
  1044. p^.resulttype:=nil;
  1045. { for security }
  1046. { nr^.is_used:=true;}
  1047. p^.labelnr:=nr;
  1048. genlabelnode:=p;
  1049. end;
  1050. function genselfnode(_class : pdef) : ptree;
  1051. var
  1052. p : ptree;
  1053. begin
  1054. p:=getnode;
  1055. p^.disposetyp:=dt_nothing;
  1056. p^.treetype:=selfn;
  1057. p^.registers32:=0;
  1058. { p^.registers16:=0;
  1059. p^.registers8:=0; }
  1060. p^.registersfpu:=0;
  1061. {$ifdef SUPPORT_MMX}
  1062. p^.registersmmx:=0;
  1063. {$endif SUPPORT_MMX}
  1064. p^.resulttype:=_class;
  1065. genselfnode:=p;
  1066. end;
  1067. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  1068. var
  1069. p : ptree;
  1070. begin
  1071. p:=getnode;
  1072. p^.disposetyp:=dt_inlinen;
  1073. p^.treetype:=inlinen;
  1074. p^.left:=l;
  1075. p^.inlinenumber:=number;
  1076. p^.inlineconst:=is_const;
  1077. p^.registers32:=0;
  1078. { p^.registers16:=0;
  1079. p^.registers8:=0; }
  1080. p^.registersfpu:=0;
  1081. {$ifdef SUPPORT_MMX}
  1082. p^.registersmmx:=0;
  1083. {$endif SUPPORT_MMX}
  1084. p^.resulttype:=nil;
  1085. geninlinenode:=p;
  1086. end;
  1087. { uses the callnode to create the new procinline node }
  1088. function genprocinlinenode(callp,code : ptree) : ptree;
  1089. var
  1090. p : ptree;
  1091. begin
  1092. p:=getnode;
  1093. p^.disposetyp:=dt_nothing;
  1094. p^.treetype:=procinlinen;
  1095. p^.inlineprocsym:=callp^.symtableprocentry;
  1096. p^.retoffset:=-4; { less dangerous as zero (PM) }
  1097. p^.para_offset:=0;
  1098. p^.para_size:=p^.inlineprocsym^.definition^.para_size;
  1099. if ret_in_param(p^.inlineprocsym^.definition^.retdef) then
  1100. p^.para_size:=p^.para_size+target_os.size_of_pointer;
  1101. { copy args }
  1102. p^.inlinetree:=code;
  1103. p^.registers32:=code^.registers32;
  1104. p^.registersfpu:=code^.registersfpu;
  1105. {$ifdef SUPPORT_MMX}
  1106. p^.registersmmx:=0;
  1107. {$endif SUPPORT_MMX}
  1108. p^.resulttype:=p^.inlineprocsym^.definition^.retdef;
  1109. genprocinlinenode:=p;
  1110. end;
  1111. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  1112. var
  1113. p : ptree;
  1114. begin
  1115. p:=getnode;
  1116. p^.disposetyp:=dt_nothing;
  1117. p^.treetype:=setconstn;
  1118. p^.registers32:=0;
  1119. p^.registersfpu:=0;
  1120. {$ifdef SUPPORT_MMX}
  1121. p^.registersmmx:=0;
  1122. {$endif SUPPORT_MMX}
  1123. p^.resulttype:=settype;
  1124. p^.left:=nil;
  1125. new(p^.value_set);
  1126. p^.value_set^:=s^;
  1127. gensetconstnode:=p;
  1128. end;
  1129. {$ifdef extdebug}
  1130. procedure compare_trees(oldp,p : ptree);
  1131. var
  1132. error_found : boolean;
  1133. begin
  1134. if oldp^.resulttype<>p^.resulttype then
  1135. begin
  1136. error_found:=true;
  1137. if is_equal(oldp^.resulttype,p^.resulttype) then
  1138. comment(v_debug,'resulttype fields are different but equal')
  1139. else
  1140. comment(v_warning,'resulttype fields are really different');
  1141. end;
  1142. if oldp^.treetype<>p^.treetype then
  1143. begin
  1144. comment(v_warning,'treetype field different');
  1145. error_found:=true;
  1146. end
  1147. else
  1148. comment(v_debug,' treetype '+tostr(longint(oldp^.treetype)));
  1149. if oldp^.error<>p^.error then
  1150. begin
  1151. comment(v_warning,'error field different');
  1152. error_found:=true;
  1153. end;
  1154. if oldp^.disposetyp<>p^.disposetyp then
  1155. begin
  1156. comment(v_warning,'disposetyp field different');
  1157. error_found:=true;
  1158. end;
  1159. { is true, if the right and left operand are swaped }
  1160. if oldp^.swaped<>p^.swaped then
  1161. begin
  1162. comment(v_warning,'swaped field different');
  1163. error_found:=true;
  1164. end;
  1165. { the location of the result of this node }
  1166. if oldp^.location.loc<>p^.location.loc then
  1167. begin
  1168. comment(v_warning,'location.loc field different');
  1169. error_found:=true;
  1170. end;
  1171. { the number of registers needed to evalute the node }
  1172. if oldp^.registers32<>p^.registers32 then
  1173. begin
  1174. comment(v_warning,'registers32 field different');
  1175. comment(v_warning,' old '+tostr(oldp^.registers32)+'<> new '+tostr(p^.registers32));
  1176. error_found:=true;
  1177. end;
  1178. if oldp^.registersfpu<>p^.registersfpu then
  1179. begin
  1180. comment(v_warning,'registersfpu field different');
  1181. error_found:=true;
  1182. end;
  1183. {$ifdef SUPPORT_MMX}
  1184. if oldp^.registersmmx<>p^.registersmmx then
  1185. begin
  1186. comment(v_warning,'registersmmx field different');
  1187. error_found:=true;
  1188. end;
  1189. {$endif SUPPORT_MMX}
  1190. if oldp^.left<>p^.left then
  1191. begin
  1192. comment(v_warning,'left field different');
  1193. error_found:=true;
  1194. end;
  1195. if oldp^.right<>p^.right then
  1196. begin
  1197. comment(v_warning,'right field different');
  1198. error_found:=true;
  1199. end;
  1200. if oldp^.fileinfo.line<>p^.fileinfo.line then
  1201. begin
  1202. comment(v_warning,'fileinfo.line field different');
  1203. error_found:=true;
  1204. end;
  1205. if oldp^.fileinfo.column<>p^.fileinfo.column then
  1206. begin
  1207. comment(v_warning,'fileinfo.column field different');
  1208. error_found:=true;
  1209. end;
  1210. if oldp^.fileinfo.fileindex<>p^.fileinfo.fileindex then
  1211. begin
  1212. comment(v_warning,'fileinfo.fileindex field different');
  1213. error_found:=true;
  1214. end;
  1215. if oldp^.localswitches<>p^.localswitches then
  1216. begin
  1217. comment(v_warning,'localswitches field different');
  1218. error_found:=true;
  1219. end;
  1220. {$ifdef extdebug}
  1221. if oldp^.firstpasscount<>p^.firstpasscount then
  1222. begin
  1223. comment(v_warning,'firstpasscount field different');
  1224. error_found:=true;
  1225. end;
  1226. {$endif extdebug}
  1227. if oldp^.treetype=p^.treetype then
  1228. case oldp^.treetype of
  1229. addn :
  1230. begin
  1231. if oldp^.use_strconcat<>p^.use_strconcat then
  1232. begin
  1233. comment(v_warning,'use_strconcat field different');
  1234. error_found:=true;
  1235. end;
  1236. if oldp^.string_typ<>p^.string_typ then
  1237. begin
  1238. comment(v_warning,'stringtyp field different');
  1239. error_found:=true;
  1240. end;
  1241. end;
  1242. callparan :
  1243. {(is_colon_para : boolean;exact_match_found : boolean);}
  1244. begin
  1245. if oldp^.is_colon_para<>p^.is_colon_para then
  1246. begin
  1247. comment(v_warning,'use_strconcat field different');
  1248. error_found:=true;
  1249. end;
  1250. if oldp^.exact_match_found<>p^.exact_match_found then
  1251. begin
  1252. comment(v_warning,'exact_match_found field different');
  1253. error_found:=true;
  1254. end;
  1255. end;
  1256. assignn :
  1257. {(assigntyp : tassigntyp;concat_string : boolean);}
  1258. begin
  1259. if oldp^.assigntyp<>p^.assigntyp then
  1260. begin
  1261. comment(v_warning,'assigntyp field different');
  1262. error_found:=true;
  1263. end;
  1264. if oldp^.concat_string<>p^.concat_string then
  1265. begin
  1266. comment(v_warning,'concat_string field different');
  1267. error_found:=true;
  1268. end;
  1269. end;
  1270. loadn :
  1271. {(symtableentry : psym;symtable : psymtable;
  1272. is_absolute,is_first : boolean);}
  1273. begin
  1274. if oldp^.symtableentry<>p^.symtableentry then
  1275. begin
  1276. comment(v_warning,'symtableentry field different');
  1277. error_found:=true;
  1278. end;
  1279. if oldp^.symtable<>p^.symtable then
  1280. begin
  1281. comment(v_warning,'symtable field different');
  1282. error_found:=true;
  1283. end;
  1284. if oldp^.is_absolute<>p^.is_absolute then
  1285. begin
  1286. comment(v_warning,'is_absolute field different');
  1287. error_found:=true;
  1288. end;
  1289. if oldp^.is_first<>p^.is_first then
  1290. begin
  1291. comment(v_warning,'is_first field different');
  1292. error_found:=true;
  1293. end;
  1294. end;
  1295. calln :
  1296. {(symtableprocentry : pprocsym;
  1297. symtableproc : psymtable;procdefinition : pprocdef;
  1298. methodpointer : ptree;
  1299. no_check,unit_specific : boolean);}
  1300. begin
  1301. if oldp^.symtableprocentry<>p^.symtableprocentry then
  1302. begin
  1303. comment(v_warning,'symtableprocentry field different');
  1304. error_found:=true;
  1305. end;
  1306. if oldp^.symtableproc<>p^.symtableproc then
  1307. begin
  1308. comment(v_warning,'symtableproc field different');
  1309. error_found:=true;
  1310. end;
  1311. if oldp^.procdefinition<>p^.procdefinition then
  1312. begin
  1313. comment(v_warning,'procdefinition field different');
  1314. error_found:=true;
  1315. end;
  1316. if oldp^.methodpointer<>p^.methodpointer then
  1317. begin
  1318. comment(v_warning,'methodpointer field different');
  1319. error_found:=true;
  1320. end;
  1321. if oldp^.no_check<>p^.no_check then
  1322. begin
  1323. comment(v_warning,'no_check field different');
  1324. error_found:=true;
  1325. end;
  1326. if oldp^.unit_specific<>p^.unit_specific then
  1327. begin
  1328. error_found:=true;
  1329. comment(v_warning,'unit_specific field different');
  1330. end;
  1331. end;
  1332. ordconstn :
  1333. begin
  1334. if oldp^.value<>p^.value then
  1335. begin
  1336. comment(v_warning,'value field different');
  1337. error_found:=true;
  1338. end;
  1339. end;
  1340. realconstn :
  1341. begin
  1342. if oldp^.value_real<>p^.value_real then
  1343. begin
  1344. comment(v_warning,'valued field different');
  1345. error_found:=true;
  1346. end;
  1347. if oldp^.lab_real<>p^.lab_real then
  1348. begin
  1349. comment(v_warning,'labnumber field different');
  1350. error_found:=true;
  1351. end;
  1352. { if oldp^.realtyp<>p^.realtyp then
  1353. begin
  1354. comment(v_warning,'realtyp field different');
  1355. error_found:=true;
  1356. end; }
  1357. end;
  1358. end;
  1359. if not error_found then
  1360. comment(v_warning,'did not find difference in trees');
  1361. end;
  1362. {$endif extdebug}
  1363. function equal_trees(t1,t2 : ptree) : boolean;
  1364. begin
  1365. if t1^.treetype=t2^.treetype then
  1366. begin
  1367. case t1^.treetype of
  1368. addn,
  1369. muln,
  1370. equaln,
  1371. orn,
  1372. xorn,
  1373. andn,
  1374. unequaln:
  1375. begin
  1376. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1377. equal_trees(t1^.right,t2^.right)) or
  1378. (equal_trees(t1^.right,t2^.left) and
  1379. equal_trees(t1^.left,t2^.right));
  1380. end;
  1381. subn,
  1382. divn,
  1383. modn,
  1384. assignn,
  1385. ltn,
  1386. lten,
  1387. gtn,
  1388. gten,
  1389. inn,
  1390. shrn,
  1391. shln,
  1392. slashn,
  1393. rangen:
  1394. begin
  1395. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1396. equal_trees(t1^.right,t2^.right));
  1397. end;
  1398. umminusn,
  1399. notn,
  1400. derefn,
  1401. addrn:
  1402. begin
  1403. equal_trees:=(equal_trees(t1^.left,t2^.left));
  1404. end;
  1405. loadn:
  1406. begin
  1407. equal_trees:=(t1^.symtableentry=t2^.symtableentry)
  1408. { not necessary
  1409. and (t1^.symtable=t2^.symtable)};
  1410. end;
  1411. {
  1412. subscriptn,
  1413. ordconstn,typeconvn,calln,callparan,
  1414. realconstn,asmn,vecn,
  1415. stringconstn,funcretn,selfn,
  1416. inlinen,niln,errorn,
  1417. typen,hnewn,hdisposen,newn,
  1418. disposen,setelen,setconstrn
  1419. }
  1420. else equal_trees:=false;
  1421. end;
  1422. end
  1423. else
  1424. equal_trees:=false;
  1425. end;
  1426. procedure set_unique(p : ptree);
  1427. begin
  1428. if assigned(p) then
  1429. begin
  1430. case p^.treetype of
  1431. vecn:
  1432. p^.callunique:=true;
  1433. typeconvn:
  1434. set_unique(p^.left);
  1435. end;
  1436. end;
  1437. end;
  1438. procedure clear_location(var loc : tlocation);
  1439. begin
  1440. loc.loc:=LOC_INVALID;
  1441. end;
  1442. {This is needed if you want to be able to delete the string with the nodes !!}
  1443. procedure set_location(var destloc,sourceloc : tlocation);
  1444. begin
  1445. destloc:= sourceloc;
  1446. end;
  1447. procedure swap_location(var destloc,sourceloc : tlocation);
  1448. var
  1449. swapl : tlocation;
  1450. begin
  1451. swapl := destloc;
  1452. destloc := sourceloc;
  1453. sourceloc := swapl;
  1454. end;
  1455. function get_ordinal_value(p : ptree) : longint;
  1456. begin
  1457. if p^.treetype=ordconstn then
  1458. get_ordinal_value:=p^.value
  1459. else
  1460. Message(type_e_ordinal_expr_expected);
  1461. end;
  1462. function is_constnode(p : ptree) : boolean;
  1463. begin
  1464. is_constnode:=(p^.treetype in [ordconstn,realconstn,stringconstn,fixconstn,setconstn]);
  1465. end;
  1466. function is_constintnode(p : ptree) : boolean;
  1467. begin
  1468. is_constintnode:=(p^.treetype=ordconstn) and is_integer(p^.resulttype);
  1469. end;
  1470. function is_constcharnode(p : ptree) : boolean;
  1471. begin
  1472. is_constcharnode:=((p^.treetype=ordconstn) and
  1473. (p^.resulttype^.deftype=orddef) and
  1474. (porddef(p^.resulttype)^.typ=uchar));
  1475. end;
  1476. function is_constrealnode(p : ptree) : boolean;
  1477. begin
  1478. is_constrealnode:=(p^.treetype=realconstn);
  1479. end;
  1480. function is_constboolnode(p : ptree) : boolean;
  1481. begin
  1482. is_constboolnode:=((p^.treetype=ordconstn) and
  1483. (p^.resulttype^.deftype=orddef) and
  1484. (porddef(p^.resulttype)^.typ in [bool8bit,bool16bit,bool32bit]));
  1485. end;
  1486. function str_length(p : ptree) : longint;
  1487. begin
  1488. str_length:=p^.length;
  1489. end;
  1490. function is_emptyset(p : ptree):boolean;
  1491. {
  1492. return true if set s is empty
  1493. }
  1494. var
  1495. i : longint;
  1496. begin
  1497. i:=0;
  1498. if p^.treetype=setconstn then
  1499. begin
  1500. while (i<32) and (p^.value_set^[i]=0) do
  1501. inc(i);
  1502. end;
  1503. is_emptyset:=(i=32);
  1504. end;
  1505. {*****************************************************************************
  1506. Case Helpers
  1507. *****************************************************************************}
  1508. function case_count_labels(root : pcaserecord) : longint;
  1509. var
  1510. _l : longint;
  1511. procedure count(p : pcaserecord);
  1512. begin
  1513. inc(_l);
  1514. if assigned(p^.less) then
  1515. count(p^.less);
  1516. if assigned(p^.greater) then
  1517. count(p^.greater);
  1518. end;
  1519. begin
  1520. _l:=0;
  1521. count(root);
  1522. case_count_labels:=_l;
  1523. end;
  1524. function case_get_max(root : pcaserecord) : longint;
  1525. var
  1526. hp : pcaserecord;
  1527. begin
  1528. hp:=root;
  1529. while assigned(hp^.greater) do
  1530. hp:=hp^.greater;
  1531. case_get_max:=hp^._high;
  1532. end;
  1533. function case_get_min(root : pcaserecord) : longint;
  1534. var
  1535. hp : pcaserecord;
  1536. begin
  1537. hp:=root;
  1538. while assigned(hp^.less) do
  1539. hp:=hp^.less;
  1540. case_get_min:=hp^._low;
  1541. end;
  1542. end.
  1543. {
  1544. $Log$
  1545. Revision 1.85 1999-08-03 22:03:40 peter
  1546. * moved bitmask constants to sets
  1547. * some other type/const renamings
  1548. Revision 1.84 1999/07/27 23:42:24 peter
  1549. * indirect type referencing is now allowed
  1550. Revision 1.83 1999/05/27 19:45:29 peter
  1551. * removed oldasm
  1552. * plabel -> pasmlabel
  1553. * -a switches to source writing automaticly
  1554. * assembler readers OOPed
  1555. * asmsymbol automaticly external
  1556. * jumptables and other label fixes for asm readers
  1557. Revision 1.82 1999/05/18 14:15:59 peter
  1558. * containsself fixes
  1559. * checktypes()
  1560. Revision 1.81 1999/05/18 09:52:22 peter
  1561. * procedure of object and addrn fixes
  1562. Revision 1.80 1999/05/17 23:51:48 peter
  1563. * with temp vars now use a reference with a persistant temp instead
  1564. of setting datasize
  1565. Revision 1.79 1999/05/17 13:00:36 pierre
  1566. * old field suppressed was still in debug code
  1567. Revision 1.78 1999/05/12 00:20:03 peter
  1568. * removed R_DEFAULT_SEG
  1569. * uniform float names
  1570. Revision 1.77 1999/05/06 09:05:39 peter
  1571. * generic write_float and str_float
  1572. * fixed constant float conversions
  1573. Revision 1.76 1999/05/04 14:27:04 pierre
  1574. * avoid RTE220 in gentypedconstloadnode
  1575. Revision 1.75 1999/05/01 13:25:02 peter
  1576. * merged nasm compiler
  1577. * old asm moved to oldasm/
  1578. Revision 1.74 1999/04/21 21:45:31 pierre
  1579. * wrong log fro v1.73 corrected
  1580. Revision 1.73 1999/04/21 16:31:49 pierre
  1581. + offset field for temp storage added $ifdef TEMPS_NOT_PUSH
  1582. Revision 1.72 1999/04/15 09:01:35 peter
  1583. * fixed set loading
  1584. * object inheritance support for browser
  1585. Revision 1.71 1999/03/31 13:55:28 peter
  1586. * assembler inlining working for ag386bin
  1587. Revision 1.70 1999/03/26 00:05:49 peter
  1588. * released valintern
  1589. + deffile is now removed when compiling is finished
  1590. * ^( compiles now correct
  1591. + static directive
  1592. * shrd fixed
  1593. Revision 1.69 1999/03/24 23:17:41 peter
  1594. * fixed bugs 212,222,225,227,229,231,233
  1595. Revision 1.68 1999/03/02 18:24:25 peter
  1596. * fixed overloading of array of char
  1597. Revision 1.67 1999/02/25 21:02:56 peter
  1598. * ag386bin updates
  1599. + coff writer
  1600. Revision 1.66 1999/02/22 02:15:59 peter
  1601. * updates for ag386bin
  1602. Revision 1.65 1999/02/11 09:46:31 pierre
  1603. * fix for normal method calls inside static methods :
  1604. WARNING there were both parser and codegen errors !!
  1605. added static_call boolean to calln tree
  1606. Revision 1.64 1999/01/27 12:57:22 pierre
  1607. * memory leaks with hightree solved by adding a new disposetyp
  1608. dt_leftrighthigh
  1609. Revision 1.63 1999/01/27 00:14:00 florian
  1610. * "procedure of object"-stuff fixed
  1611. Revision 1.62 1999/01/21 22:10:52 peter
  1612. * fixed array of const
  1613. * generic platform independent high() support
  1614. Revision 1.61 1999/01/21 16:41:09 pierre
  1615. * fix for constructor inside with statements
  1616. Revision 1.60 1998/12/15 11:52:19 peter
  1617. * fixed dup release of statement label in case
  1618. Revision 1.59 1998/12/15 10:23:32 peter
  1619. + -iSO, -iSP, -iTO, -iTP
  1620. Revision 1.58 1998/12/11 00:04:02 peter
  1621. + globtype,tokens,version unit splitted from globals
  1622. Revision 1.57 1998/12/04 10:18:13 florian
  1623. * some stuff for procedures of object added
  1624. * bug with overridden virtual constructors fixed (reported by Italo Gomes)
  1625. Revision 1.56 1998/12/02 16:23:32 jonas
  1626. * changed "if longintvar in set" to case or "if () or () .." statements
  1627. * tree.pas: changed inlinenumber (and associated constructor/vars) to a byte
  1628. Revision 1.55 1998/11/29 12:40:20 peter
  1629. * newcnv -> not oldcnv
  1630. Revision 1.54 1998/11/26 13:10:44 peter
  1631. * new int - int conversion -dNEWCNV
  1632. * some function renamings
  1633. Revision 1.53 1998/11/24 12:52:42 peter
  1634. * sets are not written twice anymore
  1635. * optimize for emptyset+single element which uses a new routine from
  1636. set.inc FPC_SET_CREATE_ELEMENT
  1637. Revision 1.52 1998/11/23 17:51:58 pierre
  1638. * added checking before dispose of reference string
  1639. Revision 1.51 1998/11/13 10:15:53 peter
  1640. * fixed ptr() with constants
  1641. Revision 1.50 1998/11/10 10:09:20 peter
  1642. * va_list -> array of const
  1643. Revision 1.49 1998/11/05 12:03:07 peter
  1644. * released useansistring
  1645. * removed -Sv, its now available in fpc modes
  1646. Revision 1.48 1998/10/21 15:12:59 pierre
  1647. * bug fix for IOCHECK inside a procedure with iocheck modifier
  1648. * removed the GPF for unexistant overloading
  1649. (firstcall was called with procedinition=nil !)
  1650. * changed typen to what Florian proposed
  1651. gentypenode(p : pdef) sets the typenodetype field
  1652. and resulttype is only set if inside bt_type block !
  1653. Revision 1.47 1998/10/20 08:07:07 pierre
  1654. * several memory corruptions due to double freemem solved
  1655. => never use p^.loc.location:=p^.left^.loc.location;
  1656. + finally I added now by default
  1657. that ra386dir translates global and unit symbols
  1658. + added a first field in tsymtable and
  1659. a nextsym field in tsym
  1660. (this allows to obtain ordered type info for
  1661. records and objects in gdb !)
  1662. Revision 1.46 1998/10/08 17:17:37 pierre
  1663. * current_module old scanner tagged as invalid if unit is recompiled
  1664. + added ppheap for better info on tracegetmem of heaptrc
  1665. (adds line column and file index)
  1666. * several memory leaks removed ith help of heaptrc !!
  1667. Revision 1.45 1998/10/05 21:33:33 peter
  1668. * fixed 161,165,166,167,168
  1669. Revision 1.44 1998/09/28 16:57:28 pierre
  1670. * changed all length(p^.value_str^) into str_length(p)
  1671. to get it work with and without ansistrings
  1672. * changed sourcefiles field of tmodule to a pointer
  1673. Revision 1.43 1998/09/27 10:16:28 florian
  1674. * type casts pchar<->ansistring fixed
  1675. * ansistring[..] calls does now an unique call
  1676. Revision 1.42 1998/09/23 12:03:59 peter
  1677. * overloading fix for array of const
  1678. Revision 1.41 1998/09/23 09:58:55 peter
  1679. * first working array of const things
  1680. Revision 1.40 1998/09/22 15:34:07 peter
  1681. + pchar -> string conversion
  1682. Revision 1.39 1998/09/21 08:45:27 pierre
  1683. + added vmt_offset in tobjectdef.write for fututre use
  1684. (first steps to have objects without vmt if no virtual !!)
  1685. + added fpu_used field for tabstractprocdef :
  1686. sets this level to 2 if the functions return with value in FPU
  1687. (is then set to correct value at parsing of implementation)
  1688. THIS MIGHT refuse some code with FPU expression too complex
  1689. that were accepted before and even in some cases
  1690. that don't overflow in fact
  1691. ( like if f : float; is a forward that finally in implementation
  1692. only uses one fpu register !!)
  1693. Nevertheless I think that it will improve security on
  1694. FPU operations !!
  1695. * most other changes only for UseBrowser code
  1696. (added symtable references for record and objects)
  1697. local switch for refs to args and local of each function
  1698. (static symtable still missing)
  1699. UseBrowser still not stable and probably broken by
  1700. the definition hash array !!
  1701. Revision 1.38 1998/09/16 01:06:47 carl
  1702. * crash bugfix in firstaddr
  1703. Revision 1.37 1998/09/08 10:38:04 pierre
  1704. * some variable fields inside conditionnal were not updated
  1705. Revision 1.36 1998/09/07 18:46:17 peter
  1706. * update smartlinking, uses getdatalabel
  1707. * renamed ptree.value vars to value_str,value_real,value_set
  1708. Revision 1.35 1998/09/04 08:42:11 peter
  1709. * updated some error messages
  1710. Revision 1.34 1998/09/01 17:39:54 peter
  1711. + internal constant functions
  1712. Revision 1.33 1998/08/28 12:51:44 florian
  1713. + ansistring to pchar type cast fixed
  1714. Revision 1.32 1998/08/28 10:54:25 peter
  1715. * fixed smallset generation from elements, it has never worked before!
  1716. Revision 1.31 1998/08/21 14:08:58 pierre
  1717. + TEST_FUNCRET now default (old code removed)
  1718. works also for m68k (at least compiles)
  1719. Revision 1.30 1998/08/18 09:24:47 pierre
  1720. * small warning position bug fixed
  1721. * support_mmx switches splitting was missing
  1722. * rhide error and warning output corrected
  1723. Revision 1.29 1998/08/14 18:18:48 peter
  1724. + dynamic set contruction
  1725. * smallsets are now working (always longint size)
  1726. Revision 1.28 1998/08/13 11:00:13 peter
  1727. * fixed procedure<>procedure construct
  1728. Revision 1.27 1998/08/10 14:50:35 peter
  1729. + localswitches, moduleswitches, globalswitches splitting
  1730. Revision 1.26 1998/08/10 09:57:19 peter
  1731. - Remove InitTree which was empty and obsolete
  1732. Revision 1.25 1998/08/02 16:42:02 florian
  1733. * on o : tobject do should also work now, the exceptsymtable shouldn't be
  1734. disposed by dellexlevel
  1735. Revision 1.24 1998/07/30 11:18:23 florian
  1736. + first implementation of try ... except on .. do end;
  1737. * limitiation of 65535 bytes parameters for cdecl removed
  1738. Revision 1.23 1998/07/24 22:17:01 florian
  1739. * internal error 10 together with array access fixed. I hope
  1740. that's the final fix.
  1741. Revision 1.22 1998/07/20 10:23:05 florian
  1742. * better ansi string assignement
  1743. Revision 1.21 1998/07/14 21:46:56 peter
  1744. * updated messages file
  1745. Revision 1.20 1998/07/14 14:47:11 peter
  1746. * released NEWINPUT
  1747. Revision 1.19 1998/07/08 14:56:53 daniel
  1748. * Fixed $ifdef TP.
  1749. Revision 1.18 1998/07/07 11:20:18 peter
  1750. + NEWINPUT for a better inputfile and scanner object
  1751. Revision 1.17 1998/06/22 08:59:03 daniel
  1752. - Removed pool of nodes.
  1753. Revision 1.16 1998/06/12 14:50:49 peter
  1754. * removed the tree dependency to types.pas
  1755. * long_fil.pas support (not fully tested yet)
  1756. Revision 1.15 1998/06/06 08:39:07 peter
  1757. * it needs types
  1758. Revision 1.14 1998/06/05 14:37:40 pierre
  1759. * fixes for inline for operators
  1760. * inline procedure more correctly restricted
  1761. Revision 1.13 1998/06/04 09:55:49 pierre
  1762. * demangled name of procsym reworked to become independant of the mangling scheme
  1763. Revision 1.12 1998/06/03 22:49:06 peter
  1764. + wordbool,longbool
  1765. * rename bis,von -> high,low
  1766. * moved some systemunit loading/creating to psystem.pas
  1767. Revision 1.10 1998/05/20 09:42:38 pierre
  1768. + UseTokenInfo now default
  1769. * unit in interface uses and implementation uses gives error now
  1770. * only one error for unknown symbol (uses lastsymknown boolean)
  1771. the problem came from the label code !
  1772. + first inlined procedures and function work
  1773. (warning there might be allowed cases were the result is still wrong !!)
  1774. * UseBrower updated gives a global list of all position of all used symbols
  1775. with switch -gb
  1776. Revision 1.9 1998/05/12 10:47:00 peter
  1777. * moved printstatus to verb_def
  1778. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1779. prefix like error: warning: and is included in V_Default
  1780. * fixed some messages
  1781. * first time parameter scan is only for -v and -T
  1782. - removed old style messages
  1783. Revision 1.8 1998/05/07 00:17:01 peter
  1784. * smartlinking for sets
  1785. + consts labels are now concated/generated in hcodegen
  1786. * moved some cpu code to cga and some none cpu depended code from cga
  1787. to tree and hcodegen and cleanup of hcodegen
  1788. * assembling .. output reduced for smartlinking ;)
  1789. Revision 1.7 1998/05/06 15:04:21 pierre
  1790. + when trying to find source files of a ppufile
  1791. check the includepathlist for included files
  1792. the main file must still be in the same directory
  1793. Revision 1.6 1998/05/06 08:38:52 pierre
  1794. * better position info with UseTokenInfo
  1795. UseTokenInfo greatly simplified
  1796. + added check for changed tree after first time firstpass
  1797. (if we could remove all the cases were it happen
  1798. we could skip all firstpass if firstpasscount > 1)
  1799. Only with ExtDebug
  1800. Revision 1.5 1998/04/30 15:59:43 pierre
  1801. * GDB works again better :
  1802. correct type info in one pass
  1803. + UseTokenInfo for better source position
  1804. * fixed one remaining bug in scanner for line counts
  1805. * several little fixes
  1806. Revision 1.4 1998/04/29 10:34:08 pierre
  1807. + added some code for ansistring (not complete nor working yet)
  1808. * corrected operator overloading
  1809. * corrected nasm output
  1810. + started inline procedures
  1811. + added starstarn : use ** for exponentiation (^ gave problems)
  1812. + started UseTokenInfo cond to get accurate positions
  1813. Revision 1.3 1998/04/21 10:16:49 peter
  1814. * patches from strasbourg
  1815. * objects is not used anymore in the fpc compiled version
  1816. Revision 1.2 1998/04/07 22:45:05 florian
  1817. * bug0092, bug0115 and bug0121 fixed
  1818. + packed object/class/array
  1819. }