tree.pas 64 KB

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