tree.pas 65 KB

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