tree.pas 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108
  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,novariaallowed: boolean);
  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.88 1999-08-13 21:33:18 peter
  1554. * support for array constructors extended and more error checking
  1555. Revision 1.87 1999/08/09 22:14:46 peter
  1556. * fixed disposing of tree node
  1557. Revision 1.86 1999/08/04 00:23:49 florian
  1558. * renamed i386asm and i386base to cpuasm and cpubase
  1559. Revision 1.85 1999/08/03 22:03:40 peter
  1560. * moved bitmask constants to sets
  1561. * some other type/const renamings
  1562. Revision 1.84 1999/07/27 23:42:24 peter
  1563. * indirect type referencing is now allowed
  1564. Revision 1.83 1999/05/27 19:45:29 peter
  1565. * removed oldasm
  1566. * plabel -> pasmlabel
  1567. * -a switches to source writing automaticly
  1568. * assembler readers OOPed
  1569. * asmsymbol automaticly external
  1570. * jumptables and other label fixes for asm readers
  1571. Revision 1.82 1999/05/18 14:15:59 peter
  1572. * containsself fixes
  1573. * checktypes()
  1574. Revision 1.81 1999/05/18 09:52:22 peter
  1575. * procedure of object and addrn fixes
  1576. Revision 1.80 1999/05/17 23:51:48 peter
  1577. * with temp vars now use a reference with a persistant temp instead
  1578. of setting datasize
  1579. Revision 1.79 1999/05/17 13:00:36 pierre
  1580. * old field suppressed was still in debug code
  1581. Revision 1.78 1999/05/12 00:20:03 peter
  1582. * removed R_DEFAULT_SEG
  1583. * uniform float names
  1584. Revision 1.77 1999/05/06 09:05:39 peter
  1585. * generic write_float and str_float
  1586. * fixed constant float conversions
  1587. Revision 1.76 1999/05/04 14:27:04 pierre
  1588. * avoid RTE220 in gentypedconstloadnode
  1589. Revision 1.75 1999/05/01 13:25:02 peter
  1590. * merged nasm compiler
  1591. * old asm moved to oldasm/
  1592. Revision 1.74 1999/04/21 21:45:31 pierre
  1593. * wrong log fro v1.73 corrected
  1594. Revision 1.73 1999/04/21 16:31:49 pierre
  1595. + offset field for temp storage added $ifdef TEMPS_NOT_PUSH
  1596. Revision 1.72 1999/04/15 09:01:35 peter
  1597. * fixed set loading
  1598. * object inheritance support for browser
  1599. Revision 1.71 1999/03/31 13:55:28 peter
  1600. * assembler inlining working for ag386bin
  1601. Revision 1.70 1999/03/26 00:05:49 peter
  1602. * released valintern
  1603. + deffile is now removed when compiling is finished
  1604. * ^( compiles now correct
  1605. + static directive
  1606. * shrd fixed
  1607. Revision 1.69 1999/03/24 23:17:41 peter
  1608. * fixed bugs 212,222,225,227,229,231,233
  1609. Revision 1.68 1999/03/02 18:24:25 peter
  1610. * fixed overloading of array of char
  1611. Revision 1.67 1999/02/25 21:02:56 peter
  1612. * ag386bin updates
  1613. + coff writer
  1614. Revision 1.66 1999/02/22 02:15:59 peter
  1615. * updates for ag386bin
  1616. Revision 1.65 1999/02/11 09:46:31 pierre
  1617. * fix for normal method calls inside static methods :
  1618. WARNING there were both parser and codegen errors !!
  1619. added static_call boolean to calln tree
  1620. Revision 1.64 1999/01/27 12:57:22 pierre
  1621. * memory leaks with hightree solved by adding a new disposetyp
  1622. dt_leftrighthigh
  1623. Revision 1.63 1999/01/27 00:14:00 florian
  1624. * "procedure of object"-stuff fixed
  1625. Revision 1.62 1999/01/21 22:10:52 peter
  1626. * fixed array of const
  1627. * generic platform independent high() support
  1628. Revision 1.61 1999/01/21 16:41:09 pierre
  1629. * fix for constructor inside with statements
  1630. Revision 1.60 1998/12/15 11:52:19 peter
  1631. * fixed dup release of statement label in case
  1632. Revision 1.59 1998/12/15 10:23:32 peter
  1633. + -iSO, -iSP, -iTO, -iTP
  1634. Revision 1.58 1998/12/11 00:04:02 peter
  1635. + globtype,tokens,version unit splitted from globals
  1636. Revision 1.57 1998/12/04 10:18:13 florian
  1637. * some stuff for procedures of object added
  1638. * bug with overridden virtual constructors fixed (reported by Italo Gomes)
  1639. Revision 1.56 1998/12/02 16:23:32 jonas
  1640. * changed "if longintvar in set" to case or "if () or () .." statements
  1641. * tree.pas: changed inlinenumber (and associated constructor/vars) to a byte
  1642. Revision 1.55 1998/11/29 12:40:20 peter
  1643. * newcnv -> not oldcnv
  1644. Revision 1.54 1998/11/26 13:10:44 peter
  1645. * new int - int conversion -dNEWCNV
  1646. * some function renamings
  1647. Revision 1.53 1998/11/24 12:52:42 peter
  1648. * sets are not written twice anymore
  1649. * optimize for emptyset+single element which uses a new routine from
  1650. set.inc FPC_SET_CREATE_ELEMENT
  1651. Revision 1.52 1998/11/23 17:51:58 pierre
  1652. * added checking before dispose of reference string
  1653. Revision 1.51 1998/11/13 10:15:53 peter
  1654. * fixed ptr() with constants
  1655. Revision 1.50 1998/11/10 10:09:20 peter
  1656. * va_list -> array of const
  1657. Revision 1.49 1998/11/05 12:03:07 peter
  1658. * released useansistring
  1659. * removed -Sv, its now available in fpc modes
  1660. Revision 1.48 1998/10/21 15:12:59 pierre
  1661. * bug fix for IOCHECK inside a procedure with iocheck modifier
  1662. * removed the GPF for unexistant overloading
  1663. (firstcall was called with procedinition=nil !)
  1664. * changed typen to what Florian proposed
  1665. gentypenode(p : pdef) sets the typenodetype field
  1666. and resulttype is only set if inside bt_type block !
  1667. Revision 1.47 1998/10/20 08:07:07 pierre
  1668. * several memory corruptions due to double freemem solved
  1669. => never use p^.loc.location:=p^.left^.loc.location;
  1670. + finally I added now by default
  1671. that ra386dir translates global and unit symbols
  1672. + added a first field in tsymtable and
  1673. a nextsym field in tsym
  1674. (this allows to obtain ordered type info for
  1675. records and objects in gdb !)
  1676. Revision 1.46 1998/10/08 17:17:37 pierre
  1677. * current_module old scanner tagged as invalid if unit is recompiled
  1678. + added ppheap for better info on tracegetmem of heaptrc
  1679. (adds line column and file index)
  1680. * several memory leaks removed ith help of heaptrc !!
  1681. Revision 1.45 1998/10/05 21:33:33 peter
  1682. * fixed 161,165,166,167,168
  1683. Revision 1.44 1998/09/28 16:57:28 pierre
  1684. * changed all length(p^.value_str^) into str_length(p)
  1685. to get it work with and without ansistrings
  1686. * changed sourcefiles field of tmodule to a pointer
  1687. Revision 1.43 1998/09/27 10:16:28 florian
  1688. * type casts pchar<->ansistring fixed
  1689. * ansistring[..] calls does now an unique call
  1690. Revision 1.42 1998/09/23 12:03:59 peter
  1691. * overloading fix for array of const
  1692. Revision 1.41 1998/09/23 09:58:55 peter
  1693. * first working array of const things
  1694. Revision 1.40 1998/09/22 15:34:07 peter
  1695. + pchar -> string conversion
  1696. Revision 1.39 1998/09/21 08:45:27 pierre
  1697. + added vmt_offset in tobjectdef.write for fututre use
  1698. (first steps to have objects without vmt if no virtual !!)
  1699. + added fpu_used field for tabstractprocdef :
  1700. sets this level to 2 if the functions return with value in FPU
  1701. (is then set to correct value at parsing of implementation)
  1702. THIS MIGHT refuse some code with FPU expression too complex
  1703. that were accepted before and even in some cases
  1704. that don't overflow in fact
  1705. ( like if f : float; is a forward that finally in implementation
  1706. only uses one fpu register !!)
  1707. Nevertheless I think that it will improve security on
  1708. FPU operations !!
  1709. * most other changes only for UseBrowser code
  1710. (added symtable references for record and objects)
  1711. local switch for refs to args and local of each function
  1712. (static symtable still missing)
  1713. UseBrowser still not stable and probably broken by
  1714. the definition hash array !!
  1715. Revision 1.38 1998/09/16 01:06:47 carl
  1716. * crash bugfix in firstaddr
  1717. Revision 1.37 1998/09/08 10:38:04 pierre
  1718. * some variable fields inside conditionnal were not updated
  1719. Revision 1.36 1998/09/07 18:46:17 peter
  1720. * update smartlinking, uses getdatalabel
  1721. * renamed ptree.value vars to value_str,value_real,value_set
  1722. Revision 1.35 1998/09/04 08:42:11 peter
  1723. * updated some error messages
  1724. Revision 1.34 1998/09/01 17:39:54 peter
  1725. + internal constant functions
  1726. Revision 1.33 1998/08/28 12:51:44 florian
  1727. + ansistring to pchar type cast fixed
  1728. Revision 1.32 1998/08/28 10:54:25 peter
  1729. * fixed smallset generation from elements, it has never worked before!
  1730. Revision 1.31 1998/08/21 14:08:58 pierre
  1731. + TEST_FUNCRET now default (old code removed)
  1732. works also for m68k (at least compiles)
  1733. Revision 1.30 1998/08/18 09:24:47 pierre
  1734. * small warning position bug fixed
  1735. * support_mmx switches splitting was missing
  1736. * rhide error and warning output corrected
  1737. Revision 1.29 1998/08/14 18:18:48 peter
  1738. + dynamic set contruction
  1739. * smallsets are now working (always longint size)
  1740. Revision 1.28 1998/08/13 11:00:13 peter
  1741. * fixed procedure<>procedure construct
  1742. Revision 1.27 1998/08/10 14:50:35 peter
  1743. + localswitches, moduleswitches, globalswitches splitting
  1744. Revision 1.26 1998/08/10 09:57:19 peter
  1745. - Remove InitTree which was empty and obsolete
  1746. Revision 1.25 1998/08/02 16:42:02 florian
  1747. * on o : tobject do should also work now, the exceptsymtable shouldn't be
  1748. disposed by dellexlevel
  1749. Revision 1.24 1998/07/30 11:18:23 florian
  1750. + first implementation of try ... except on .. do end;
  1751. * limitiation of 65535 bytes parameters for cdecl removed
  1752. Revision 1.23 1998/07/24 22:17:01 florian
  1753. * internal error 10 together with array access fixed. I hope
  1754. that's the final fix.
  1755. Revision 1.22 1998/07/20 10:23:05 florian
  1756. * better ansi string assignement
  1757. Revision 1.21 1998/07/14 21:46:56 peter
  1758. * updated messages file
  1759. Revision 1.20 1998/07/14 14:47:11 peter
  1760. * released NEWINPUT
  1761. Revision 1.19 1998/07/08 14:56:53 daniel
  1762. * Fixed $ifdef TP.
  1763. Revision 1.18 1998/07/07 11:20:18 peter
  1764. + NEWINPUT for a better inputfile and scanner object
  1765. Revision 1.17 1998/06/22 08:59:03 daniel
  1766. - Removed pool of nodes.
  1767. Revision 1.16 1998/06/12 14:50:49 peter
  1768. * removed the tree dependency to types.pas
  1769. * long_fil.pas support (not fully tested yet)
  1770. Revision 1.15 1998/06/06 08:39:07 peter
  1771. * it needs types
  1772. Revision 1.14 1998/06/05 14:37:40 pierre
  1773. * fixes for inline for operators
  1774. * inline procedure more correctly restricted
  1775. Revision 1.13 1998/06/04 09:55:49 pierre
  1776. * demangled name of procsym reworked to become independant of the mangling scheme
  1777. Revision 1.12 1998/06/03 22:49:06 peter
  1778. + wordbool,longbool
  1779. * rename bis,von -> high,low
  1780. * moved some systemunit loading/creating to psystem.pas
  1781. Revision 1.10 1998/05/20 09:42:38 pierre
  1782. + UseTokenInfo now default
  1783. * unit in interface uses and implementation uses gives error now
  1784. * only one error for unknown symbol (uses lastsymknown boolean)
  1785. the problem came from the label code !
  1786. + first inlined procedures and function work
  1787. (warning there might be allowed cases were the result is still wrong !!)
  1788. * UseBrower updated gives a global list of all position of all used symbols
  1789. with switch -gb
  1790. Revision 1.9 1998/05/12 10:47:00 peter
  1791. * moved printstatus to verb_def
  1792. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1793. prefix like error: warning: and is included in V_Default
  1794. * fixed some messages
  1795. * first time parameter scan is only for -v and -T
  1796. - removed old style messages
  1797. Revision 1.8 1998/05/07 00:17:01 peter
  1798. * smartlinking for sets
  1799. + consts labels are now concated/generated in hcodegen
  1800. * moved some cpu code to cga and some none cpu depended code from cga
  1801. to tree and hcodegen and cleanup of hcodegen
  1802. * assembling .. output reduced for smartlinking ;)
  1803. Revision 1.7 1998/05/06 15:04:21 pierre
  1804. + when trying to find source files of a ppufile
  1805. check the includepathlist for included files
  1806. the main file must still be in the same directory
  1807. Revision 1.6 1998/05/06 08:38:52 pierre
  1808. * better position info with UseTokenInfo
  1809. UseTokenInfo greatly simplified
  1810. + added check for changed tree after first time firstpass
  1811. (if we could remove all the cases were it happen
  1812. we could skip all firstpass if firstpasscount > 1)
  1813. Only with ExtDebug
  1814. Revision 1.5 1998/04/30 15:59:43 pierre
  1815. * GDB works again better :
  1816. correct type info in one pass
  1817. + UseTokenInfo for better source position
  1818. * fixed one remaining bug in scanner for line counts
  1819. * several little fixes
  1820. Revision 1.4 1998/04/29 10:34:08 pierre
  1821. + added some code for ansistring (not complete nor working yet)
  1822. * corrected operator overloading
  1823. * corrected nasm output
  1824. + started inline procedures
  1825. + added starstarn : use ** for exponentiation (^ gave problems)
  1826. + started UseTokenInfo cond to get accurate positions
  1827. Revision 1.3 1998/04/21 10:16:49 peter
  1828. * patches from strasbourg
  1829. * objects is not used anymore in the fpc compiled version
  1830. Revision 1.2 1998/04/07 22:45:05 florian
  1831. * bug0092, bug0115 and bug0121 fixed
  1832. + packed object/class/array
  1833. }