tree.pas 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997
  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. unaryminusn, {Represents a sign change (i.e. -2).}
  63. asmn, {Represents an assembler node }
  64. vecn, {Represents array indexing.}
  65. pointerconstn,
  66. stringconstn, {Represents a string constant.}
  67. funcretn, {Represents the function result var.}
  68. selfn, {Represents the self parameter.}
  69. notn, {Represents the not operator.}
  70. inlinen, {Internal procedures (i.e. writeln).}
  71. niln, {Represents the nil pointer.}
  72. errorn, {This part of the tree could not be
  73. parsed because of a compiler error.}
  74. typen, {A type name. Used for i.e. typeof(obj).}
  75. hnewn, {The new operation, constructor call.}
  76. hdisposen, {The dispose operation with destructor call.}
  77. newn, {The new operation, constructor call.}
  78. simpledisposen, {The dispose operation.}
  79. setelementn, {A set element(s) (i.e. [a,b] and also [a..b]).}
  80. setconstn, {A set constant (i.e. [1,2]).}
  81. blockn, {A block of statements.}
  82. statementn, {One statement in a block of nodes.}
  83. loopn, { used in genloopnode, must be converted }
  84. ifn, {An if statement.}
  85. breakn, {A break statement.}
  86. continuen, {A continue statement.}
  87. repeatn, {A repeat until block.}
  88. whilen, {A while do statement.}
  89. forn, {A for loop.}
  90. exitn, {An exit statement.}
  91. withn, {A with statement.}
  92. casen, {A case statement.}
  93. labeln, {A label.}
  94. goton, {A goto statement.}
  95. simplenewn, {The new operation.}
  96. tryexceptn, {A try except block.}
  97. raisen, {A raise statement.}
  98. switchesn, {??? Currently unused...}
  99. tryfinallyn, {A try finally statement.}
  100. onn, { for an on statement in exception code }
  101. isn, {Represents the is operator.}
  102. asn, {Represents the as typecast.}
  103. caretn, {Represents the ^ operator.}
  104. failn, {Represents the fail statement.}
  105. starstarn, {Represents the ** operator exponentiation }
  106. procinlinen, {Procedures that can be inlined }
  107. arrayconstructn, {Construction node for [...] parsing}
  108. arrayconstructrangen, {Range element to allow sets in array construction tree}
  109. { added for optimizations where we cannot suppress }
  110. nothingn,
  111. loadvmtn
  112. );
  113. tconverttype = (
  114. tc_equal,
  115. tc_not_possible,
  116. tc_string_2_string,
  117. tc_char_2_string,
  118. tc_pchar_2_string,
  119. tc_cchar_2_pchar,
  120. tc_cstring_2_pchar,
  121. tc_ansistring_2_pchar,
  122. tc_string_2_chararray,
  123. tc_chararray_2_string,
  124. tc_array_2_pointer,
  125. tc_pointer_2_array,
  126. tc_int_2_int,
  127. tc_int_2_bool,
  128. tc_bool_2_bool,
  129. tc_bool_2_int,
  130. tc_real_2_real,
  131. tc_int_2_real,
  132. tc_int_2_fix,
  133. tc_real_2_fix,
  134. tc_fix_2_real,
  135. tc_proc_2_procvar,
  136. tc_arrayconstructor_2_set,
  137. tc_load_smallset,
  138. tc_cord_2_pointer
  139. );
  140. { allows to determine which elementes are to be replaced }
  141. tdisposetyp = (dt_nothing,dt_leftright,dt_left,dt_leftrighthigh,
  142. dt_mbleft,dt_typeconv,dt_inlinen,dt_leftrightmethod,
  143. dt_mbleft_and_method,dt_loop,dt_case,dt_with,dt_onn);
  144. { different assignment types }
  145. tassigntyp = (at_normal,at_plus,at_minus,at_star,at_slash);
  146. pcaserecord = ^tcaserecord;
  147. tcaserecord = record
  148. { range }
  149. _low,_high : longint;
  150. { only used by gentreejmp }
  151. _at : pasmlabel;
  152. { label of instruction }
  153. statement : pasmlabel;
  154. { is this the first of an case entry, needed to release statement
  155. label (PFV) }
  156. firstlabel : boolean;
  157. { left and right tree node }
  158. less,greater : pcaserecord;
  159. end;
  160. ptree = ^ttree;
  161. ttree = record
  162. error : boolean;
  163. disposetyp : tdisposetyp;
  164. { is true, if the right and left operand are swaped }
  165. swaped : boolean;
  166. { do we need to parse childs to set var state }
  167. varstateset : boolean;
  168. { the location of the result of this node }
  169. location : tlocation;
  170. { the number of registers needed to evalute the node }
  171. registers32,registersfpu : longint; { must be longint !!!! }
  172. {$ifdef SUPPORT_MMX}
  173. registersmmx : longint;
  174. {$endif SUPPORT_MMX}
  175. left,right : ptree;
  176. resulttype : pdef;
  177. fileinfo : tfileposinfo;
  178. localswitches : tlocalswitches;
  179. isproperty : boolean;
  180. {$ifdef extdebug}
  181. firstpasscount : longint;
  182. {$endif extdebug}
  183. {$ifdef TEMPREGDEBUG}
  184. usableregs : longint;
  185. {$endif TEMPREGDEBUG}
  186. {$ifdef EXTTEMPREGDEBUG}
  187. reallyusedregs : longint;
  188. {$endif EXTTEMPREGDEBUG}
  189. {$ifdef TEMPS_NOT_PUSH}
  190. temp_offset : longint;
  191. {$endif TEMPS_NOT_PUSH}
  192. case treetype : ttreetyp of
  193. addn : (use_strconcat : boolean;string_typ : tstringtype);
  194. callparan : (is_colon_para : boolean;exact_match_found,
  195. convlevel1found,convlevel2found:boolean;hightree:ptree);
  196. assignn : (assigntyp : tassigntyp;concat_string : boolean);
  197. loadn : (symtableentry : psym;symtable : psymtable;
  198. is_absolute,is_first : boolean);
  199. calln : (symtableprocentry : pprocsym;
  200. symtableproc : psymtable;procdefinition : pabstractprocdef;
  201. methodpointer : ptree;
  202. no_check,unit_specific,
  203. return_value_used,static_call : boolean);
  204. addrn : (procvarload:boolean);
  205. ordconstn : (value : longint);
  206. realconstn : (value_real : bestreal;lab_real : pasmlabel);
  207. fixconstn : (value_fix: longint);
  208. funcretn : (funcretprocinfo : pointer;rettype : ttype;
  209. is_first_funcret : boolean);
  210. subscriptn : (vs : pvarsym);
  211. vecn : (memindex,memseg:boolean;callunique : boolean);
  212. stringconstn : (value_str : pchar;length : longint; lab_str : pasmlabel;stringtype : tstringtype);
  213. typeconvn : (convtyp : tconverttype;explizit : boolean);
  214. typen : (typenodetype : pdef;typenodesym:ptypesym);
  215. inlinen : (inlinenumber : byte;inlineconst:boolean);
  216. procinlinen : (inlinetree:ptree;inlineprocsym:pprocsym;retoffset,para_offset,para_size : longint);
  217. setconstn : (value_set : pconstset;lab_set:pasmlabel);
  218. loopn : (t1,t2 : ptree;backward : boolean);
  219. asmn : (p_asm : paasmoutput;object_preserved : boolean);
  220. casen : (nodes : pcaserecord;elseblock : ptree);
  221. labeln,goton : (labelnr : pasmlabel;exceptionblock : ptree;labsym : plabelsym);
  222. withn : (withsymtable : pwithsymtable;tablecount : longint;withreference:preference;islocal:boolean);
  223. onn : (exceptsymtable : psymtable;excepttype : pobjectdef);
  224. arrayconstructn : (cargs,cargswap,forcevaria,novariaallowed: boolean;constructdef:pdef);
  225. end;
  226. function gennode(t : ttreetyp;l,r : ptree) : ptree;
  227. function genlabelnode(t : ttreetyp;nr : pasmlabel) : ptree;
  228. function genloadnode(v : pvarsym;st : psymtable) : ptree;
  229. function genloadcallnode(v: pprocsym;st: psymtable): ptree;
  230. function genloadmethodcallnode(v: pprocsym;st: psymtable; mp:ptree): ptree;
  231. function gensinglenode(t : ttreetyp;l : ptree) : ptree;
  232. function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
  233. function genordinalconstnode(v : longint;def : pdef) : ptree;
  234. function genpointerconstnode(v : longint;def : pdef) : ptree;
  235. function genfixconstnode(v : longint;def : pdef) : ptree;
  236. function gentypeconvnode(node : ptree;t : pdef) : ptree;
  237. function gentypenode(t : pdef;sym:ptypesym) : ptree;
  238. function gencallparanode(expr,next : ptree) : ptree;
  239. function genrealconstnode(v : bestreal;def : pdef) : ptree;
  240. function gencallnode(v : pprocsym;st : psymtable) : ptree;
  241. function genmethodcallnode(v : pprocsym;st : psymtable;mp : ptree) : ptree;
  242. { allow pchar or string for defining a pchar node }
  243. function genstringconstnode(const s : string) : ptree;
  244. { length is required for ansistrings }
  245. function genpcharconstnode(s : pchar;length : longint) : ptree;
  246. { helper routine for conststring node }
  247. function getpcharcopy(p : ptree) : pchar;
  248. function genzeronode(t : ttreetyp) : ptree;
  249. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  250. function genprocinlinenode(callp,code : ptree) : ptree;
  251. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : ptree;
  252. function genenumnode(v : penumsym) : ptree;
  253. function genselfnode(_class : pdef) : ptree;
  254. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  255. function genloopnode(t : ttreetyp;l,r,n1: ptree;back : boolean) : ptree;
  256. function genasmnode(p_asm : paasmoutput) : ptree;
  257. function gencasenode(l,r : ptree;nodes : pcaserecord) : ptree;
  258. function genwithnode(symtable : pwithsymtable;l,r : ptree;count : longint) : ptree;
  259. function getcopy(p : ptree) : ptree;
  260. function equal_trees(t1,t2 : ptree) : boolean;
  261. procedure swaptree(p:Ptree);
  262. procedure disposetree(p : ptree);
  263. procedure putnode(p : ptree);
  264. function getnode : ptree;
  265. procedure clear_location(var loc : tlocation);
  266. procedure set_location(var destloc,sourceloc : tlocation);
  267. procedure swap_location(var destloc,sourceloc : tlocation);
  268. procedure set_file_line(from,_to : ptree);
  269. procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
  270. {$ifdef extdebug}
  271. procedure compare_trees(oldp,p : ptree);
  272. const
  273. maxfirstpasscount : longint = 0;
  274. {$endif extdebug}
  275. { sets the callunique flag, if the node is a vecn, }
  276. { takes care of type casts etc. }
  277. procedure set_unique(p : ptree);
  278. { sets funcret_is_valid to true, if p contains a funcref node }
  279. procedure set_funcret_is_valid(p : ptree);
  280. {
  281. type
  282. tvarstaterequire = (vsr_can_be_undefined,vsr_must_be_valid,
  283. vsr_is_used_after,vsr_must_be_valid_and_is_used_after); }
  284. { sets varsym varstate field correctly }
  285. procedure set_varstate(p : ptree;must_be_valid : boolean);
  286. { gibt den ordinalen Werten der Node zurueck oder falls sie }
  287. { keinen ordinalen Wert hat, wird ein Fehler erzeugt }
  288. function get_ordinal_value(p : ptree) : longint;
  289. function is_constnode(p : ptree) : boolean;
  290. { true, if p is a pointer to a const int value }
  291. function is_constintnode(p : ptree) : boolean;
  292. function is_constboolnode(p : ptree) : boolean;
  293. function is_constrealnode(p : ptree) : boolean;
  294. function is_constcharnode(p : ptree) : boolean;
  295. function str_length(p : ptree) : longint;
  296. function is_emptyset(p : ptree):boolean;
  297. { counts the labels }
  298. function case_count_labels(root : pcaserecord) : longint;
  299. { searches the highest label }
  300. function case_get_max(root : pcaserecord) : longint;
  301. { searches the lowest label }
  302. function case_get_min(root : pcaserecord) : longint;
  303. type
  304. pptree = ^ptree;
  305. {$ifdef TEMPREGDEBUG}
  306. const
  307. curptree : pptree = nil;
  308. {$endif TEMPREGDEBUG}
  309. {$I innr.inc}
  310. implementation
  311. uses
  312. systems,
  313. globals,verbose,files,types,hcodegen;
  314. function getnode : ptree;
  315. var
  316. hp : ptree;
  317. begin
  318. new(hp);
  319. { makes error tracking easier }
  320. fillchar(hp^,sizeof(ttree),0);
  321. { reset }
  322. hp^.location.loc:=LOC_INVALID;
  323. { save local info }
  324. hp^.fileinfo:=aktfilepos;
  325. hp^.localswitches:=aktlocalswitches;
  326. getnode:=hp;
  327. end;
  328. procedure putnode(p : ptree);
  329. begin
  330. { clean up the contents of a node }
  331. case p^.treetype of
  332. asmn : if assigned(p^.p_asm) then
  333. dispose(p^.p_asm,done);
  334. stringconstn : begin
  335. ansistringdispose(p^.value_str,p^.length);
  336. end;
  337. setconstn : begin
  338. if assigned(p^.value_set) then
  339. dispose(p^.value_set);
  340. end;
  341. end;
  342. {$ifdef extdebug}
  343. if p^.firstpasscount>maxfirstpasscount then
  344. maxfirstpasscount:=p^.firstpasscount;
  345. {$endif extdebug}
  346. dispose(p);
  347. end;
  348. function getcopy(p : ptree) : ptree;
  349. var
  350. hp : ptree;
  351. begin
  352. if not assigned(p) then
  353. begin
  354. getcopy:=nil;
  355. exit;
  356. end;
  357. hp:=getnode;
  358. hp^:=p^;
  359. case p^.disposetyp of
  360. dt_leftright :
  361. begin
  362. if assigned(p^.left) then
  363. hp^.left:=getcopy(p^.left);
  364. if assigned(p^.right) then
  365. hp^.right:=getcopy(p^.right);
  366. end;
  367. dt_leftrighthigh :
  368. begin
  369. if assigned(p^.left) then
  370. hp^.left:=getcopy(p^.left);
  371. if assigned(p^.right) then
  372. hp^.right:=getcopy(p^.right);
  373. if assigned(p^.hightree) then
  374. hp^.left:=getcopy(p^.hightree);
  375. end;
  376. dt_leftrightmethod :
  377. begin
  378. if assigned(p^.left) then
  379. hp^.left:=getcopy(p^.left);
  380. if assigned(p^.right) then
  381. hp^.right:=getcopy(p^.right);
  382. if assigned(p^.methodpointer) then
  383. hp^.left:=getcopy(p^.methodpointer);
  384. end;
  385. dt_nothing : ;
  386. dt_left :
  387. if assigned(p^.left) then
  388. hp^.left:=getcopy(p^.left);
  389. dt_mbleft :
  390. if assigned(p^.left) then
  391. hp^.left:=getcopy(p^.left);
  392. dt_mbleft_and_method :
  393. begin
  394. if assigned(p^.left) then
  395. hp^.left:=getcopy(p^.left);
  396. hp^.methodpointer:=getcopy(p^.methodpointer);
  397. end;
  398. dt_loop :
  399. begin
  400. if assigned(p^.left) then
  401. hp^.left:=getcopy(p^.left);
  402. if assigned(p^.right) then
  403. hp^.right:=getcopy(p^.right);
  404. if assigned(p^.t1) then
  405. hp^.t1:=getcopy(p^.t1);
  406. if assigned(p^.t2) then
  407. hp^.t2:=getcopy(p^.t2);
  408. end;
  409. dt_typeconv : hp^.left:=getcopy(p^.left);
  410. dt_inlinen :
  411. if assigned(p^.left) then
  412. hp^.left:=getcopy(p^.left);
  413. else internalerror(11);
  414. end;
  415. { now check treetype }
  416. case p^.treetype of
  417. stringconstn : begin
  418. hp^.value_str:=getpcharcopy(p);
  419. hp^.length:=p^.length;
  420. end;
  421. setconstn : begin
  422. new(hp^.value_set);
  423. hp^.value_set:=p^.value_set;
  424. end;
  425. end;
  426. getcopy:=hp;
  427. end;
  428. procedure deletecaselabels(p : pcaserecord);
  429. begin
  430. if assigned(p^.greater) then
  431. deletecaselabels(p^.greater);
  432. if assigned(p^.less) then
  433. deletecaselabels(p^.less);
  434. freelabel(p^._at);
  435. if p^.firstlabel then
  436. freelabel(p^.statement);
  437. dispose(p);
  438. end;
  439. procedure swaptree(p:Ptree);
  440. var swapp:Ptree;
  441. begin
  442. swapp:=p^.right;
  443. p^.right:=p^.left;
  444. p^.left:=swapp;
  445. p^.swaped:=not(p^.swaped);
  446. end;
  447. procedure disposetree(p : ptree);
  448. var
  449. symt : pwithsymtable;
  450. i : longint;
  451. begin
  452. if not(assigned(p)) then
  453. exit;
  454. if not(p^.treetype in [addn..loadvmtn]) then
  455. internalerror(26219);
  456. case p^.disposetyp of
  457. dt_leftright :
  458. begin
  459. if assigned(p^.left) then
  460. disposetree(p^.left);
  461. if assigned(p^.right) then
  462. disposetree(p^.right);
  463. end;
  464. dt_leftrighthigh :
  465. begin
  466. if assigned(p^.left) then
  467. disposetree(p^.left);
  468. if assigned(p^.right) then
  469. disposetree(p^.right);
  470. if assigned(p^.hightree) then
  471. disposetree(p^.hightree);
  472. end;
  473. dt_leftrightmethod :
  474. begin
  475. if assigned(p^.left) then
  476. disposetree(p^.left);
  477. if assigned(p^.right) then
  478. disposetree(p^.right);
  479. if assigned(p^.methodpointer) then
  480. disposetree(p^.methodpointer);
  481. end;
  482. dt_case :
  483. begin
  484. if assigned(p^.left) then
  485. disposetree(p^.left);
  486. if assigned(p^.right) then
  487. disposetree(p^.right);
  488. if assigned(p^.nodes) then
  489. deletecaselabels(p^.nodes);
  490. if assigned(p^.elseblock) then
  491. disposetree(p^.elseblock);
  492. end;
  493. dt_nothing : ;
  494. dt_left :
  495. if assigned(p^.left) then
  496. disposetree(p^.left);
  497. dt_mbleft :
  498. if assigned(p^.left) then
  499. disposetree(p^.left);
  500. dt_mbleft_and_method :
  501. begin
  502. if assigned(p^.left) then disposetree(p^.left);
  503. disposetree(p^.methodpointer);
  504. end;
  505. dt_typeconv : disposetree(p^.left);
  506. dt_inlinen :
  507. if assigned(p^.left) then
  508. disposetree(p^.left);
  509. dt_loop :
  510. begin
  511. if assigned(p^.left) then
  512. disposetree(p^.left);
  513. if assigned(p^.right) then
  514. disposetree(p^.right);
  515. if assigned(p^.t1) then
  516. disposetree(p^.t1);
  517. if assigned(p^.t2) then
  518. disposetree(p^.t2);
  519. end;
  520. dt_onn:
  521. begin
  522. if assigned(p^.left) then
  523. disposetree(p^.left);
  524. if assigned(p^.right) then
  525. disposetree(p^.right);
  526. if assigned(p^.exceptsymtable) then
  527. dispose(p^.exceptsymtable,done);
  528. end;
  529. dt_with :
  530. begin
  531. if assigned(p^.left) then
  532. disposetree(p^.left);
  533. if assigned(p^.right) then
  534. disposetree(p^.right);
  535. symt:=p^.withsymtable;
  536. for i:=1 to p^.tablecount do
  537. begin
  538. if assigned(symt) then
  539. begin
  540. p^.withsymtable:=pwithsymtable(symt^.next);
  541. dispose(symt,done);
  542. end;
  543. symt:=p^.withsymtable;
  544. end;
  545. end;
  546. else internalerror(12);
  547. end;
  548. putnode(p);
  549. end;
  550. procedure set_file_line(from,_to : ptree);
  551. begin
  552. if assigned(from) then
  553. _to^.fileinfo:=from^.fileinfo;
  554. end;
  555. procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
  556. begin
  557. p^.fileinfo:=filepos;
  558. end;
  559. function genwithnode(symtable : pwithsymtable;l,r : ptree;count : longint) : ptree;
  560. var
  561. p : ptree;
  562. begin
  563. p:=getnode;
  564. p^.disposetyp:=dt_with;
  565. p^.treetype:=withn;
  566. p^.left:=l;
  567. p^.right:=r;
  568. p^.registers32:=0;
  569. { p^.registers16:=0;
  570. p^.registers8:=0; }
  571. p^.registersfpu:=0;
  572. {$ifdef SUPPORT_MMX}
  573. p^.registersmmx:=0;
  574. {$endif SUPPORT_MMX}
  575. p^.resulttype:=nil;
  576. p^.withsymtable:=symtable;
  577. p^.tablecount:=count;
  578. p^.withreference:=nil;
  579. p^.islocal:=false;
  580. set_file_line(l,p);
  581. genwithnode:=p;
  582. end;
  583. function genfixconstnode(v : longint;def : pdef) : ptree;
  584. var
  585. p : ptree;
  586. begin
  587. p:=getnode;
  588. p^.disposetyp:=dt_nothing;
  589. p^.treetype:=fixconstn;
  590. p^.registers32:=0;
  591. { p^.registers16:=0;
  592. p^.registers8:=0; }
  593. p^.registersfpu:=0;
  594. {$ifdef SUPPORT_MMX}
  595. p^.registersmmx:=0;
  596. {$endif SUPPORT_MMX}
  597. p^.resulttype:=def;
  598. p^.value:=v;
  599. genfixconstnode:=p;
  600. end;
  601. function gencallparanode(expr,next : ptree) : ptree;
  602. var
  603. p : ptree;
  604. begin
  605. p:=getnode;
  606. p^.disposetyp:=dt_leftrighthigh;
  607. p^.treetype:=callparan;
  608. p^.left:=expr;
  609. p^.right:=next;
  610. p^.registers32:=0;
  611. { p^.registers16:=0;
  612. p^.registers8:=0; }
  613. {$ifdef SUPPORT_MMX}
  614. p^.registersmmx:=0;
  615. {$endif SUPPORT_MMX}
  616. p^.registersfpu:=0;
  617. p^.resulttype:=nil;
  618. p^.exact_match_found:=false;
  619. p^.convlevel1found:=false;
  620. p^.convlevel2found:=false;
  621. p^.is_colon_para:=false;
  622. p^.hightree:=nil;
  623. set_file_line(expr,p);
  624. gencallparanode:=p;
  625. end;
  626. function gennode(t : ttreetyp;l,r : ptree) : ptree;
  627. var
  628. p : ptree;
  629. begin
  630. p:=getnode;
  631. p^.disposetyp:=dt_leftright;
  632. p^.treetype:=t;
  633. p^.left:=l;
  634. p^.right:=r;
  635. p^.registers32:=0;
  636. { p^.registers16:=0;
  637. p^.registers8:=0; }
  638. p^.registersfpu:=0;
  639. {$ifdef SUPPORT_MMX}
  640. p^.registersmmx:=0;
  641. {$endif SUPPORT_MMX}
  642. p^.resulttype:=nil;
  643. gennode:=p;
  644. end;
  645. function gencasenode(l,r : ptree;nodes : pcaserecord) : ptree;
  646. var
  647. p : ptree;
  648. begin
  649. p:=getnode;
  650. p^.disposetyp:=dt_case;
  651. p^.treetype:=casen;
  652. p^.left:=l;
  653. p^.right:=r;
  654. p^.nodes:=nodes;
  655. p^.registers32:=0;
  656. p^.registersfpu:=0;
  657. {$ifdef SUPPORT_MMX}
  658. p^.registersmmx:=0;
  659. {$endif SUPPORT_MMX}
  660. p^.resulttype:=nil;
  661. set_file_line(l,p);
  662. gencasenode:=p;
  663. end;
  664. function genloopnode(t : ttreetyp;l,r,n1 : ptree;back : boolean) : ptree;
  665. var
  666. p : ptree;
  667. begin
  668. p:=getnode;
  669. p^.disposetyp:=dt_loop;
  670. p^.treetype:=t;
  671. p^.left:=l;
  672. p^.right:=r;
  673. p^.t1:=n1;
  674. p^.t2:=nil;
  675. p^.registers32:=0;
  676. p^.backward:=back;
  677. { p^.registers16:=0;
  678. p^.registers8:=0; }
  679. p^.registersfpu:=0;
  680. {$ifdef SUPPORT_MMX}
  681. p^.registersmmx:=0;
  682. {$endif SUPPORT_MMX}
  683. p^.resulttype:=nil;
  684. set_file_line(l,p);
  685. genloopnode:=p;
  686. end;
  687. function genordinalconstnode(v : longint;def : pdef) : ptree;
  688. var
  689. p : ptree;
  690. begin
  691. p:=getnode;
  692. p^.disposetyp:=dt_nothing;
  693. p^.treetype:=ordconstn;
  694. p^.registers32:=0;
  695. { p^.registers16:=0;
  696. p^.registers8:=0; }
  697. p^.registersfpu:=0;
  698. {$ifdef SUPPORT_MMX}
  699. p^.registersmmx:=0;
  700. {$endif SUPPORT_MMX}
  701. p^.resulttype:=def;
  702. p^.value:=v;
  703. if p^.resulttype^.deftype=orddef then
  704. testrange(p^.resulttype,p^.value);
  705. genordinalconstnode:=p;
  706. end;
  707. function genpointerconstnode(v : longint;def : pdef) : ptree;
  708. var
  709. p : ptree;
  710. begin
  711. p:=getnode;
  712. p^.disposetyp:=dt_nothing;
  713. p^.treetype:=pointerconstn;
  714. p^.registers32:=0;
  715. { p^.registers16:=0;
  716. p^.registers8:=0; }
  717. p^.registersfpu:=0;
  718. {$ifdef SUPPORT_MMX}
  719. p^.registersmmx:=0;
  720. {$endif SUPPORT_MMX}
  721. p^.resulttype:=def;
  722. p^.value:=v;
  723. genpointerconstnode:=p;
  724. end;
  725. function genenumnode(v : penumsym) : ptree;
  726. var
  727. p : ptree;
  728. begin
  729. p:=getnode;
  730. p^.disposetyp:=dt_nothing;
  731. p^.treetype:=ordconstn;
  732. p^.registers32:=0;
  733. { p^.registers16:=0;
  734. p^.registers8:=0; }
  735. p^.registersfpu:=0;
  736. {$ifdef SUPPORT_MMX}
  737. p^.registersmmx:=0;
  738. {$endif SUPPORT_MMX}
  739. p^.resulttype:=v^.definition;
  740. p^.value:=v^.value;
  741. testrange(p^.resulttype,p^.value);
  742. genenumnode:=p;
  743. end;
  744. function genrealconstnode(v : bestreal;def : pdef) : ptree;
  745. var
  746. p : ptree;
  747. begin
  748. p:=getnode;
  749. p^.disposetyp:=dt_nothing;
  750. p^.treetype:=realconstn;
  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^.resulttype:=def;
  759. p^.value_real:=v;
  760. p^.lab_real:=nil;
  761. genrealconstnode:=p;
  762. end;
  763. function genstringconstnode(const s : string) : ptree;
  764. var
  765. p : ptree;
  766. l : longint;
  767. begin
  768. p:=getnode;
  769. p^.disposetyp:=dt_nothing;
  770. p^.treetype:=stringconstn;
  771. p^.registers32:=0;
  772. { p^.registers16:=0;
  773. p^.registers8:=0; }
  774. p^.registersfpu:=0;
  775. {$ifdef SUPPORT_MMX}
  776. p^.registersmmx:=0;
  777. {$endif SUPPORT_MMX}
  778. l:=length(s);
  779. p^.length:=l;
  780. { stringdup write even past a #0 }
  781. getmem(p^.value_str,l+1);
  782. move(s[1],p^.value_str^,l);
  783. p^.value_str[l]:=#0;
  784. p^.lab_str:=nil;
  785. if cs_ansistrings in aktlocalswitches then
  786. begin
  787. p^.stringtype:=st_ansistring;
  788. p^.resulttype:=cansistringdef;
  789. end
  790. else
  791. begin
  792. p^.stringtype:=st_shortstring;
  793. p^.resulttype:=cshortstringdef;
  794. end;
  795. genstringconstnode:=p;
  796. end;
  797. function getpcharcopy(p : ptree) : pchar;
  798. var
  799. pc : pchar;
  800. begin
  801. pc:=nil;
  802. getmem(pc,p^.length+1);
  803. if pc=nil then
  804. Message(general_f_no_memory_left);
  805. move(p^.value_str^,pc^,p^.length+1);
  806. getpcharcopy:=pc;
  807. end;
  808. function genpcharconstnode(s : pchar;length : longint) : ptree;
  809. var
  810. p : ptree;
  811. begin
  812. p:=getnode;
  813. p^.disposetyp:=dt_nothing;
  814. p^.treetype:=stringconstn;
  815. p^.registers32:=0;
  816. { p^.registers16:=0;
  817. p^.registers8:=0; }
  818. p^.registersfpu:=0;
  819. {$ifdef SUPPORT_MMX}
  820. p^.registersmmx:=0;
  821. {$endif SUPPORT_MMX}
  822. p^.length:=length;
  823. if (cs_ansistrings in aktlocalswitches) or
  824. (length>255) then
  825. begin
  826. p^.stringtype:=st_ansistring;
  827. p^.resulttype:=cansistringdef;
  828. end
  829. else
  830. begin
  831. p^.stringtype:=st_shortstring;
  832. p^.resulttype:=cshortstringdef;
  833. end;
  834. p^.value_str:=s;
  835. p^.lab_str:=nil;
  836. genpcharconstnode:=p;
  837. end;
  838. function gensinglenode(t : ttreetyp;l : ptree) : ptree;
  839. var
  840. p : ptree;
  841. begin
  842. p:=getnode;
  843. p^.disposetyp:=dt_left;
  844. p^.treetype:=t;
  845. p^.left:=l;
  846. p^.registers32:=0;
  847. { p^.registers16:=0;
  848. p^.registers8:=0; }
  849. p^.registersfpu:=0;
  850. {$ifdef SUPPORT_MMX}
  851. p^.registersmmx:=0;
  852. {$endif SUPPORT_MMX}
  853. p^.resulttype:=nil;
  854. gensinglenode:=p;
  855. end;
  856. function genasmnode(p_asm : paasmoutput) : ptree;
  857. var
  858. p : ptree;
  859. begin
  860. p:=getnode;
  861. p^.disposetyp:=dt_nothing;
  862. p^.treetype:=asmn;
  863. p^.registers32:=4;
  864. p^.p_asm:=p_asm;
  865. p^.object_preserved:=false;
  866. { p^.registers16:=0;
  867. p^.registers8:=0; }
  868. p^.registersfpu:=8;
  869. {$ifdef SUPPORT_MMX}
  870. p^.registersmmx:=8;
  871. {$endif SUPPORT_MMX}
  872. p^.resulttype:=nil;
  873. genasmnode:=p;
  874. end;
  875. function genloadnode(v : pvarsym;st : psymtable) : ptree;
  876. var
  877. p : ptree;
  878. begin
  879. p:=getnode;
  880. p^.registers32:=0;
  881. { p^.registers16:=0;
  882. p^.registers8:=0; }
  883. p^.registersfpu:=0;
  884. {$ifdef SUPPORT_MMX}
  885. p^.registersmmx:=0;
  886. {$endif SUPPORT_MMX}
  887. p^.treetype:=loadn;
  888. p^.resulttype:=v^.vartype.def;
  889. p^.symtableentry:=v;
  890. p^.symtable:=st;
  891. p^.is_first := False;
  892. { method pointer load nodes can use the left subtree }
  893. p^.disposetyp:=dt_left;
  894. p^.left:=nil;
  895. genloadnode:=p;
  896. end;
  897. function genloadcallnode(v: pprocsym;st: psymtable): ptree;
  898. var
  899. p : ptree;
  900. begin
  901. p:=getnode;
  902. p^.registers32:=0;
  903. { p^.registers16:=0;
  904. p^.registers8:=0; }
  905. p^.registersfpu:=0;
  906. {$ifdef SUPPORT_MMX}
  907. p^.registersmmx:=0;
  908. {$endif SUPPORT_MMX}
  909. p^.treetype:=loadn;
  910. p^.left:=nil;
  911. p^.resulttype:=v^.definition;
  912. p^.symtableentry:=v;
  913. p^.symtable:=st;
  914. p^.is_first := False;
  915. p^.disposetyp:=dt_nothing;
  916. genloadcallnode:=p;
  917. end;
  918. function genloadmethodcallnode(v: pprocsym;st: psymtable; mp:ptree): ptree;
  919. var
  920. p : ptree;
  921. begin
  922. p:=getnode;
  923. p^.registers32:=0;
  924. { p^.registers16:=0;
  925. p^.registers8:=0; }
  926. p^.registersfpu:=0;
  927. {$ifdef SUPPORT_MMX}
  928. p^.registersmmx:=0;
  929. {$endif SUPPORT_MMX}
  930. p^.treetype:=loadn;
  931. p^.left:=nil;
  932. p^.resulttype:=v^.definition;
  933. p^.symtableentry:=v;
  934. p^.symtable:=st;
  935. p^.is_first := False;
  936. p^.disposetyp:=dt_left;
  937. p^.left:=mp;
  938. genloadmethodcallnode:=p;
  939. end;
  940. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : ptree;
  941. var
  942. p : ptree;
  943. begin
  944. p:=getnode;
  945. p^.registers32:=0;
  946. { p^.registers16:=0;
  947. p^.registers8:=0; }
  948. p^.registersfpu:=0;
  949. {$ifdef SUPPORT_MMX}
  950. p^.registersmmx:=0;
  951. {$endif SUPPORT_MMX}
  952. p^.treetype:=loadn;
  953. p^.left:=nil;
  954. p^.resulttype:=sym^.typedconsttype.def;
  955. p^.symtableentry:=sym;
  956. p^.symtable:=st;
  957. p^.disposetyp:=dt_nothing;
  958. gentypedconstloadnode:=p;
  959. end;
  960. function gentypeconvnode(node : ptree;t : pdef) : ptree;
  961. var
  962. p : ptree;
  963. begin
  964. p:=getnode;
  965. p^.disposetyp:=dt_typeconv;
  966. p^.treetype:=typeconvn;
  967. p^.left:=node;
  968. p^.registers32:=0;
  969. { p^.registers16:=0;
  970. p^.registers8:=0; }
  971. p^.convtyp:=tc_equal;
  972. p^.registersfpu:=0;
  973. {$ifdef SUPPORT_MMX}
  974. p^.registersmmx:=0;
  975. {$endif SUPPORT_MMX}
  976. p^.resulttype:=t;
  977. p^.explizit:=false;
  978. set_file_line(node,p);
  979. gentypeconvnode:=p;
  980. end;
  981. function gentypenode(t : pdef;sym:ptypesym) : ptree;
  982. var
  983. p : ptree;
  984. begin
  985. p:=getnode;
  986. p^.disposetyp:=dt_nothing;
  987. p^.treetype:=typen;
  988. p^.registers32:=0;
  989. { p^.registers16:=0;
  990. p^.registers8:=0; }
  991. p^.registersfpu:=0;
  992. {$ifdef SUPPORT_MMX}
  993. p^.registersmmx:=0;
  994. {$endif SUPPORT_MMX}
  995. p^.resulttype:=generrordef;
  996. p^.typenodetype:=t;
  997. p^.typenodesym:=sym;
  998. gentypenode:=p;
  999. end;
  1000. function gencallnode(v : pprocsym;st : psymtable) : ptree;
  1001. var
  1002. p : ptree;
  1003. begin
  1004. p:=getnode;
  1005. p^.registers32:=0;
  1006. { p^.registers16:=0;
  1007. p^.registers8:=0; }
  1008. p^.registersfpu:=0;
  1009. {$ifdef SUPPORT_MMX}
  1010. p^.registersmmx:=0;
  1011. {$endif SUPPORT_MMX}
  1012. p^.treetype:=calln;
  1013. p^.symtableprocentry:=v;
  1014. p^.symtableproc:=st;
  1015. p^.unit_specific:=false;
  1016. p^.no_check:=false;
  1017. p^.return_value_used:=true;
  1018. p^.disposetyp := dt_leftrightmethod;
  1019. p^.methodpointer:=nil;
  1020. p^.left:=nil;
  1021. p^.right:=nil;
  1022. p^.procdefinition:=nil;
  1023. gencallnode:=p;
  1024. end;
  1025. function genmethodcallnode(v : pprocsym;st : psymtable;mp : ptree) : ptree;
  1026. var
  1027. p : ptree;
  1028. begin
  1029. p:=getnode;
  1030. p^.registers32:=0;
  1031. { p^.registers16:=0;
  1032. p^.registers8:=0; }
  1033. p^.registersfpu:=0;
  1034. {$ifdef SUPPORT_MMX}
  1035. p^.registersmmx:=0;
  1036. {$endif SUPPORT_MMX}
  1037. p^.treetype:=calln;
  1038. p^.return_value_used:=true;
  1039. p^.symtableprocentry:=v;
  1040. p^.symtableproc:=st;
  1041. p^.disposetyp:=dt_leftrightmethod;
  1042. p^.left:=nil;
  1043. p^.right:=nil;
  1044. p^.methodpointer:=mp;
  1045. p^.procdefinition:=nil;
  1046. genmethodcallnode:=p;
  1047. end;
  1048. function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
  1049. var
  1050. p : ptree;
  1051. begin
  1052. p:=getnode;
  1053. p^.disposetyp:=dt_left;
  1054. p^.treetype:=subscriptn;
  1055. p^.left:=l;
  1056. p^.registers32:=0;
  1057. p^.vs:=varsym;
  1058. { p^.registers16:=0;
  1059. p^.registers8:=0; }
  1060. p^.registersfpu:=0;
  1061. {$ifdef SUPPORT_MMX}
  1062. p^.registersmmx:=0;
  1063. {$endif SUPPORT_MMX}
  1064. p^.resulttype:=nil;
  1065. gensubscriptnode:=p;
  1066. end;
  1067. function genzeronode(t : ttreetyp) : ptree;
  1068. var
  1069. p : ptree;
  1070. begin
  1071. p:=getnode;
  1072. p^.disposetyp:=dt_nothing;
  1073. p^.treetype:=t;
  1074. p^.registers32:=0;
  1075. { p^.registers16:=0;
  1076. p^.registers8:=0; }
  1077. p^.registersfpu:=0;
  1078. {$ifdef SUPPORT_MMX}
  1079. p^.registersmmx:=0;
  1080. {$endif SUPPORT_MMX}
  1081. p^.resulttype:=nil;
  1082. genzeronode:=p;
  1083. end;
  1084. function genlabelnode(t : ttreetyp;nr : pasmlabel) : ptree;
  1085. var
  1086. p : ptree;
  1087. begin
  1088. p:=getnode;
  1089. p^.disposetyp:=dt_nothing;
  1090. p^.treetype:=t;
  1091. p^.registers32:=0;
  1092. { p^.registers16:=0;
  1093. p^.registers8:=0; }
  1094. p^.registersfpu:=0;
  1095. {$ifdef SUPPORT_MMX}
  1096. p^.registersmmx:=0;
  1097. {$endif SUPPORT_MMX}
  1098. p^.resulttype:=nil;
  1099. { for security }
  1100. { nr^.is_used:=true;}
  1101. p^.labelnr:=nr;
  1102. p^.exceptionblock:=nil;
  1103. genlabelnode:=p;
  1104. end;
  1105. function genselfnode(_class : pdef) : ptree;
  1106. var
  1107. p : ptree;
  1108. begin
  1109. p:=getnode;
  1110. p^.disposetyp:=dt_nothing;
  1111. p^.treetype:=selfn;
  1112. p^.registers32:=0;
  1113. { p^.registers16:=0;
  1114. p^.registers8:=0; }
  1115. p^.registersfpu:=0;
  1116. {$ifdef SUPPORT_MMX}
  1117. p^.registersmmx:=0;
  1118. {$endif SUPPORT_MMX}
  1119. p^.resulttype:=_class;
  1120. genselfnode:=p;
  1121. end;
  1122. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  1123. var
  1124. p : ptree;
  1125. begin
  1126. p:=getnode;
  1127. p^.disposetyp:=dt_inlinen;
  1128. p^.treetype:=inlinen;
  1129. p^.left:=l;
  1130. p^.inlinenumber:=number;
  1131. p^.inlineconst:=is_const;
  1132. p^.registers32:=0;
  1133. { p^.registers16:=0;
  1134. p^.registers8:=0; }
  1135. p^.registersfpu:=0;
  1136. {$ifdef SUPPORT_MMX}
  1137. p^.registersmmx:=0;
  1138. {$endif SUPPORT_MMX}
  1139. p^.resulttype:=nil;
  1140. geninlinenode:=p;
  1141. end;
  1142. { uses the callnode to create the new procinline node }
  1143. function genprocinlinenode(callp,code : ptree) : ptree;
  1144. var
  1145. p : ptree;
  1146. begin
  1147. p:=getnode;
  1148. p^.disposetyp:=dt_nothing;
  1149. p^.treetype:=procinlinen;
  1150. p^.inlineprocsym:=callp^.symtableprocentry;
  1151. p^.retoffset:=-4; { less dangerous as zero (PM) }
  1152. p^.para_offset:=0;
  1153. p^.para_size:=p^.inlineprocsym^.definition^.para_size;
  1154. if ret_in_param(p^.inlineprocsym^.definition^.rettype.def) then
  1155. p^.para_size:=p^.para_size+target_os.size_of_pointer;
  1156. { copy args }
  1157. p^.inlinetree:=code;
  1158. p^.registers32:=code^.registers32;
  1159. p^.registersfpu:=code^.registersfpu;
  1160. {$ifdef SUPPORT_MMX}
  1161. p^.registersmmx:=0;
  1162. {$endif SUPPORT_MMX}
  1163. p^.resulttype:=p^.inlineprocsym^.definition^.rettype.def;
  1164. genprocinlinenode:=p;
  1165. end;
  1166. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  1167. var
  1168. p : ptree;
  1169. begin
  1170. p:=getnode;
  1171. p^.disposetyp:=dt_nothing;
  1172. p^.treetype:=setconstn;
  1173. p^.registers32:=0;
  1174. p^.registersfpu:=0;
  1175. {$ifdef SUPPORT_MMX}
  1176. p^.registersmmx:=0;
  1177. {$endif SUPPORT_MMX}
  1178. p^.resulttype:=settype;
  1179. p^.left:=nil;
  1180. new(p^.value_set);
  1181. p^.value_set^:=s^;
  1182. gensetconstnode:=p;
  1183. end;
  1184. {$ifdef extdebug}
  1185. procedure compare_trees(oldp,p : ptree);
  1186. var
  1187. error_found : boolean;
  1188. begin
  1189. if oldp^.resulttype<>p^.resulttype then
  1190. begin
  1191. error_found:=true;
  1192. if is_equal(oldp^.resulttype,p^.resulttype) then
  1193. comment(v_debug,'resulttype fields are different but equal')
  1194. else
  1195. comment(v_warning,'resulttype fields are really different');
  1196. end;
  1197. if oldp^.treetype<>p^.treetype then
  1198. begin
  1199. comment(v_warning,'treetype field different');
  1200. error_found:=true;
  1201. end
  1202. else
  1203. comment(v_debug,' treetype '+tostr(longint(oldp^.treetype)));
  1204. if oldp^.error<>p^.error then
  1205. begin
  1206. comment(v_warning,'error field different');
  1207. error_found:=true;
  1208. end;
  1209. if oldp^.disposetyp<>p^.disposetyp then
  1210. begin
  1211. comment(v_warning,'disposetyp field different');
  1212. error_found:=true;
  1213. end;
  1214. { is true, if the right and left operand are swaped }
  1215. if oldp^.swaped<>p^.swaped then
  1216. begin
  1217. comment(v_warning,'swaped field different');
  1218. error_found:=true;
  1219. end;
  1220. { the location of the result of this node }
  1221. if oldp^.location.loc<>p^.location.loc then
  1222. begin
  1223. comment(v_warning,'location.loc field different');
  1224. error_found:=true;
  1225. end;
  1226. { the number of registers needed to evalute the node }
  1227. if oldp^.registers32<>p^.registers32 then
  1228. begin
  1229. comment(v_warning,'registers32 field different');
  1230. comment(v_warning,' old '+tostr(oldp^.registers32)+'<> new '+tostr(p^.registers32));
  1231. error_found:=true;
  1232. end;
  1233. if oldp^.registersfpu<>p^.registersfpu then
  1234. begin
  1235. comment(v_warning,'registersfpu field different');
  1236. error_found:=true;
  1237. end;
  1238. {$ifdef SUPPORT_MMX}
  1239. if oldp^.registersmmx<>p^.registersmmx then
  1240. begin
  1241. comment(v_warning,'registersmmx field different');
  1242. error_found:=true;
  1243. end;
  1244. {$endif SUPPORT_MMX}
  1245. if oldp^.left<>p^.left then
  1246. begin
  1247. comment(v_warning,'left field different');
  1248. error_found:=true;
  1249. end;
  1250. if oldp^.right<>p^.right then
  1251. begin
  1252. comment(v_warning,'right field different');
  1253. error_found:=true;
  1254. end;
  1255. if oldp^.fileinfo.line<>p^.fileinfo.line then
  1256. begin
  1257. comment(v_warning,'fileinfo.line field different');
  1258. error_found:=true;
  1259. end;
  1260. if oldp^.fileinfo.column<>p^.fileinfo.column then
  1261. begin
  1262. comment(v_warning,'fileinfo.column field different');
  1263. error_found:=true;
  1264. end;
  1265. if oldp^.fileinfo.fileindex<>p^.fileinfo.fileindex then
  1266. begin
  1267. comment(v_warning,'fileinfo.fileindex field different');
  1268. error_found:=true;
  1269. end;
  1270. if oldp^.localswitches<>p^.localswitches then
  1271. begin
  1272. comment(v_warning,'localswitches field different');
  1273. error_found:=true;
  1274. end;
  1275. {$ifdef extdebug}
  1276. if oldp^.firstpasscount<>p^.firstpasscount then
  1277. begin
  1278. comment(v_warning,'firstpasscount field different');
  1279. error_found:=true;
  1280. end;
  1281. {$endif extdebug}
  1282. if oldp^.treetype=p^.treetype then
  1283. case oldp^.treetype of
  1284. addn :
  1285. begin
  1286. if oldp^.use_strconcat<>p^.use_strconcat then
  1287. begin
  1288. comment(v_warning,'use_strconcat field different');
  1289. error_found:=true;
  1290. end;
  1291. if oldp^.string_typ<>p^.string_typ then
  1292. begin
  1293. comment(v_warning,'stringtyp field different');
  1294. error_found:=true;
  1295. end;
  1296. end;
  1297. callparan :
  1298. {(is_colon_para : boolean;exact_match_found : boolean);}
  1299. begin
  1300. if oldp^.is_colon_para<>p^.is_colon_para then
  1301. begin
  1302. comment(v_warning,'use_strconcat field different');
  1303. error_found:=true;
  1304. end;
  1305. if oldp^.exact_match_found<>p^.exact_match_found then
  1306. begin
  1307. comment(v_warning,'exact_match_found field different');
  1308. error_found:=true;
  1309. end;
  1310. end;
  1311. assignn :
  1312. {(assigntyp : tassigntyp;concat_string : boolean);}
  1313. begin
  1314. if oldp^.assigntyp<>p^.assigntyp then
  1315. begin
  1316. comment(v_warning,'assigntyp field different');
  1317. error_found:=true;
  1318. end;
  1319. if oldp^.concat_string<>p^.concat_string then
  1320. begin
  1321. comment(v_warning,'concat_string field different');
  1322. error_found:=true;
  1323. end;
  1324. end;
  1325. loadn :
  1326. {(symtableentry : psym;symtable : psymtable;
  1327. is_absolute,is_first : boolean);}
  1328. begin
  1329. if oldp^.symtableentry<>p^.symtableentry then
  1330. begin
  1331. comment(v_warning,'symtableentry field different');
  1332. error_found:=true;
  1333. end;
  1334. if oldp^.symtable<>p^.symtable then
  1335. begin
  1336. comment(v_warning,'symtable field different');
  1337. error_found:=true;
  1338. end;
  1339. if oldp^.is_absolute<>p^.is_absolute then
  1340. begin
  1341. comment(v_warning,'is_absolute field different');
  1342. error_found:=true;
  1343. end;
  1344. if oldp^.is_first<>p^.is_first then
  1345. begin
  1346. comment(v_warning,'is_first field different');
  1347. error_found:=true;
  1348. end;
  1349. end;
  1350. calln :
  1351. {(symtableprocentry : pprocsym;
  1352. symtableproc : psymtable;procdefinition : pprocdef;
  1353. methodpointer : ptree;
  1354. no_check,unit_specific : boolean);}
  1355. begin
  1356. if oldp^.symtableprocentry<>p^.symtableprocentry then
  1357. begin
  1358. comment(v_warning,'symtableprocentry field different');
  1359. error_found:=true;
  1360. end;
  1361. if oldp^.symtableproc<>p^.symtableproc then
  1362. begin
  1363. comment(v_warning,'symtableproc field different');
  1364. error_found:=true;
  1365. end;
  1366. if oldp^.procdefinition<>p^.procdefinition then
  1367. begin
  1368. comment(v_warning,'procdefinition field different');
  1369. error_found:=true;
  1370. end;
  1371. if oldp^.methodpointer<>p^.methodpointer then
  1372. begin
  1373. comment(v_warning,'methodpointer field different');
  1374. error_found:=true;
  1375. end;
  1376. if oldp^.no_check<>p^.no_check then
  1377. begin
  1378. comment(v_warning,'no_check field different');
  1379. error_found:=true;
  1380. end;
  1381. if oldp^.unit_specific<>p^.unit_specific then
  1382. begin
  1383. error_found:=true;
  1384. comment(v_warning,'unit_specific field different');
  1385. end;
  1386. end;
  1387. ordconstn :
  1388. begin
  1389. if oldp^.value<>p^.value then
  1390. begin
  1391. comment(v_warning,'value field different');
  1392. error_found:=true;
  1393. end;
  1394. end;
  1395. realconstn :
  1396. begin
  1397. if oldp^.value_real<>p^.value_real then
  1398. begin
  1399. comment(v_warning,'valued field different');
  1400. error_found:=true;
  1401. end;
  1402. if oldp^.lab_real<>p^.lab_real then
  1403. begin
  1404. comment(v_warning,'labnumber field different');
  1405. error_found:=true;
  1406. end;
  1407. { if oldp^.realtyp<>p^.realtyp then
  1408. begin
  1409. comment(v_warning,'realtyp field different');
  1410. error_found:=true;
  1411. end; }
  1412. end;
  1413. end;
  1414. if not error_found then
  1415. comment(v_warning,'did not find difference in trees');
  1416. end;
  1417. {$endif extdebug}
  1418. function equal_trees(t1,t2 : ptree) : boolean;
  1419. begin
  1420. if t1^.treetype=t2^.treetype then
  1421. begin
  1422. case t1^.treetype of
  1423. addn,
  1424. muln,
  1425. equaln,
  1426. orn,
  1427. xorn,
  1428. andn,
  1429. unequaln:
  1430. begin
  1431. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1432. equal_trees(t1^.right,t2^.right)) or
  1433. (equal_trees(t1^.right,t2^.left) and
  1434. equal_trees(t1^.left,t2^.right));
  1435. end;
  1436. subn,
  1437. divn,
  1438. modn,
  1439. assignn,
  1440. ltn,
  1441. lten,
  1442. gtn,
  1443. gten,
  1444. inn,
  1445. shrn,
  1446. shln,
  1447. slashn,
  1448. rangen:
  1449. begin
  1450. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1451. equal_trees(t1^.right,t2^.right));
  1452. end;
  1453. unaryminusn,
  1454. notn,
  1455. derefn,
  1456. addrn:
  1457. begin
  1458. equal_trees:=(equal_trees(t1^.left,t2^.left));
  1459. end;
  1460. loadn:
  1461. begin
  1462. equal_trees:=(t1^.symtableentry=t2^.symtableentry)
  1463. { not necessary
  1464. and (t1^.symtable=t2^.symtable)};
  1465. end;
  1466. {
  1467. subscriptn,
  1468. ordconstn,typeconvn,calln,callparan,
  1469. realconstn,asmn,vecn,
  1470. stringconstn,funcretn,selfn,
  1471. inlinen,niln,errorn,
  1472. typen,hnewn,hdisposen,newn,
  1473. disposen,setelen,setconstrn
  1474. }
  1475. else equal_trees:=false;
  1476. end;
  1477. end
  1478. else
  1479. equal_trees:=false;
  1480. end;
  1481. procedure set_unique(p : ptree);
  1482. begin
  1483. if assigned(p) then
  1484. begin
  1485. case p^.treetype of
  1486. vecn:
  1487. p^.callunique:=true;
  1488. typeconvn,subscriptn,derefn:
  1489. set_unique(p^.left);
  1490. end;
  1491. end;
  1492. end;
  1493. procedure set_funcret_is_valid(p : ptree);
  1494. begin
  1495. if assigned(p) then
  1496. begin
  1497. case p^.treetype of
  1498. funcretn:
  1499. begin
  1500. if p^.is_first_funcret then
  1501. pprocinfo(p^.funcretprocinfo)^.funcret_state:=vs_assigned;
  1502. end;
  1503. vecn,typeconvn,subscriptn,derefn:
  1504. set_funcret_is_valid(p^.left);
  1505. end;
  1506. end;
  1507. end;
  1508. procedure set_varstate(p : ptree;must_be_valid : boolean);
  1509. begin
  1510. if not assigned(p) then
  1511. exit
  1512. else
  1513. begin
  1514. if p^.varstateset then
  1515. exit;
  1516. case p^.treetype of
  1517. typeconvn,subscriptn :
  1518. set_varstate(p^.left,must_be_valid);
  1519. vecn:
  1520. begin
  1521. if (p^.left^.resulttype^.deftype in [stringdef,arraydef]) then
  1522. set_varstate(p^.left,must_be_valid)
  1523. else
  1524. set_varstate(p^.left,true);
  1525. set_varstate(p^.right,true);
  1526. end;
  1527. { do not parse calln }
  1528. calln : ;
  1529. callparan:
  1530. begin
  1531. set_varstate(p^.left,must_be_valid);
  1532. set_varstate(p^.right,must_be_valid);
  1533. end;
  1534. loadn :
  1535. if (p^.symtableentry^.typ=varsym) then
  1536. begin
  1537. if must_be_valid and p^.is_first then
  1538. begin
  1539. if (pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found) or
  1540. (pvarsym(p^.symtableentry)^.varstate=vs_set_but_first_not_passed) then
  1541. if (assigned(pvarsym(p^.symtableentry)^.owner) and
  1542. assigned(aktprocsym) and
  1543. (pvarsym(p^.symtableentry)^.owner = aktprocsym^.definition^.localst)) then
  1544. begin
  1545. if p^.symtable^.symtabletype=localsymtable then
  1546. CGMessage1(sym_n_uninitialized_local_variable,pvarsym(p^.symtableentry)^.name)
  1547. else
  1548. CGMessage1(sym_n_uninitialized_variable,pvarsym(p^.symtableentry)^.name);
  1549. end;
  1550. end;
  1551. if (p^.is_first) then
  1552. begin
  1553. if pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found then
  1554. { this can only happen at left of an assignment, no ? PM }
  1555. if (parsing_para_level=0) and not must_be_valid then
  1556. pvarsym(p^.symtableentry)^.varstate:=vs_assigned
  1557. else
  1558. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1559. if pvarsym(p^.symtableentry)^.varstate=vs_set_but_first_not_passed then
  1560. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1561. p^.is_first:=false;
  1562. end
  1563. else
  1564. begin
  1565. if (pvarsym(p^.symtableentry)^.varstate=vs_assigned) and
  1566. (must_be_valid or (parsing_para_level>0) or
  1567. (p^.resulttype^.deftype=procvardef)) then
  1568. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1569. if (pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found) and
  1570. (must_be_valid or (parsing_para_level>0) or
  1571. (p^.resulttype^.deftype=procvardef)) then
  1572. pvarsym(p^.symtableentry)^.varstate:=vs_set_but_first_not_passed;
  1573. end;
  1574. end;
  1575. funcretn:
  1576. begin
  1577. { no claim if setting higher return value_str }
  1578. if must_be_valid and
  1579. (procinfo=pprocinfo(p^.funcretprocinfo)) and
  1580. ((procinfo^.funcret_state=vs_declared) or
  1581. ((p^.is_first_funcret) and
  1582. (procinfo^.funcret_state=vs_declared_and_first_found))) then
  1583. begin
  1584. CGMessage(sym_w_function_result_not_set);
  1585. { avoid multiple warnings }
  1586. procinfo^.funcret_state:=vs_assigned;
  1587. end;
  1588. if p^.is_first_funcret and not must_be_valid then
  1589. pprocinfo(p^.funcretprocinfo)^.funcret_state:=vs_assigned;
  1590. end;
  1591. else
  1592. begin
  1593. {internalerror(565656);}
  1594. end;
  1595. end;{case }
  1596. p^.varstateset:=true;
  1597. end;
  1598. end;
  1599. procedure clear_location(var loc : tlocation);
  1600. begin
  1601. loc.loc:=LOC_INVALID;
  1602. end;
  1603. {This is needed if you want to be able to delete the string with the nodes !!}
  1604. procedure set_location(var destloc,sourceloc : tlocation);
  1605. begin
  1606. destloc:= sourceloc;
  1607. end;
  1608. procedure swap_location(var destloc,sourceloc : tlocation);
  1609. var
  1610. swapl : tlocation;
  1611. begin
  1612. swapl := destloc;
  1613. destloc := sourceloc;
  1614. sourceloc := swapl;
  1615. end;
  1616. function get_ordinal_value(p : ptree) : longint;
  1617. begin
  1618. if p^.treetype=ordconstn then
  1619. get_ordinal_value:=p^.value
  1620. else
  1621. begin
  1622. Message(type_e_ordinal_expr_expected);
  1623. get_ordinal_value:=0;
  1624. end;
  1625. end;
  1626. function is_constnode(p : ptree) : boolean;
  1627. begin
  1628. is_constnode:=(p^.treetype in [ordconstn,realconstn,stringconstn,fixconstn,setconstn]);
  1629. end;
  1630. function is_constintnode(p : ptree) : boolean;
  1631. begin
  1632. is_constintnode:=(p^.treetype=ordconstn) and is_integer(p^.resulttype);
  1633. end;
  1634. function is_constcharnode(p : ptree) : boolean;
  1635. begin
  1636. is_constcharnode:=(p^.treetype=ordconstn) and is_char(p^.resulttype);
  1637. end;
  1638. function is_constrealnode(p : ptree) : boolean;
  1639. begin
  1640. is_constrealnode:=(p^.treetype=realconstn);
  1641. end;
  1642. function is_constboolnode(p : ptree) : boolean;
  1643. begin
  1644. is_constboolnode:=(p^.treetype=ordconstn) and is_boolean(p^.resulttype);
  1645. end;
  1646. function str_length(p : ptree) : longint;
  1647. begin
  1648. str_length:=p^.length;
  1649. end;
  1650. function is_emptyset(p : ptree):boolean;
  1651. {
  1652. return true if set s is empty
  1653. }
  1654. var
  1655. i : longint;
  1656. begin
  1657. i:=0;
  1658. if p^.treetype=setconstn then
  1659. begin
  1660. while (i<32) and (p^.value_set^[i]=0) do
  1661. inc(i);
  1662. end;
  1663. is_emptyset:=(i=32);
  1664. end;
  1665. {*****************************************************************************
  1666. Case Helpers
  1667. *****************************************************************************}
  1668. function case_count_labels(root : pcaserecord) : longint;
  1669. var
  1670. _l : longint;
  1671. procedure count(p : pcaserecord);
  1672. begin
  1673. inc(_l);
  1674. if assigned(p^.less) then
  1675. count(p^.less);
  1676. if assigned(p^.greater) then
  1677. count(p^.greater);
  1678. end;
  1679. begin
  1680. _l:=0;
  1681. count(root);
  1682. case_count_labels:=_l;
  1683. end;
  1684. function case_get_max(root : pcaserecord) : longint;
  1685. var
  1686. hp : pcaserecord;
  1687. begin
  1688. hp:=root;
  1689. while assigned(hp^.greater) do
  1690. hp:=hp^.greater;
  1691. case_get_max:=hp^._high;
  1692. end;
  1693. function case_get_min(root : pcaserecord) : longint;
  1694. var
  1695. hp : pcaserecord;
  1696. begin
  1697. hp:=root;
  1698. while assigned(hp^.less) do
  1699. hp:=hp^.less;
  1700. case_get_min:=hp^._low;
  1701. end;
  1702. end.
  1703. {
  1704. $Log$
  1705. Revision 1.105 1999-12-14 09:58:42 florian
  1706. + compiler checks now if a goto leaves an exception block
  1707. Revision 1.104 1999/11/30 10:40:59 peter
  1708. + ttype, tsymlist
  1709. Revision 1.103 1999/11/18 15:34:51 pierre
  1710. * Notes/Hints for local syms changed to
  1711. Set_varstate function
  1712. Revision 1.102 1999/11/17 17:05:07 pierre
  1713. * Notes/hints changes
  1714. Revision 1.101 1999/11/06 14:34:31 peter
  1715. * truncated log to 20 revs
  1716. Revision 1.100 1999/10/22 14:37:31 peter
  1717. * error when properties are passed to var parameters
  1718. Revision 1.99 1999/09/27 23:45:03 peter
  1719. * procinfo is now a pointer
  1720. * support for result setting in sub procedure
  1721. Revision 1.98 1999/09/26 21:30:22 peter
  1722. + constant pointer support which can happend with typecasting like
  1723. const p=pointer(1)
  1724. * better procvar parsing in typed consts
  1725. Revision 1.97 1999/09/17 17:14:13 peter
  1726. * @procvar fixes for tp mode
  1727. * @<id>:= gives now an error
  1728. Revision 1.96 1999/09/16 11:34:59 pierre
  1729. * typo correction
  1730. Revision 1.95 1999/09/10 18:48:11 florian
  1731. * some bug fixes (e.g. must_be_valid and procinfo^.funcret_is_valid)
  1732. * most things for stored properties fixed
  1733. Revision 1.94 1999/09/07 07:52:20 peter
  1734. * > < >= <= support for boolean
  1735. * boolean constants are now calculated like integer constants
  1736. Revision 1.93 1999/08/27 10:38:31 pierre
  1737. + EXTTEMPREGDEBUG code added
  1738. Revision 1.92 1999/08/26 21:10:08 peter
  1739. * better error recovery for case
  1740. Revision 1.91 1999/08/23 23:26:00 pierre
  1741. + TEMPREGDEBUG code, test of register allocation
  1742. if a tree uses more than registers32 regs then
  1743. internalerror(10) is issued
  1744. + EXTTEMPREGDEBUG will also give internalerror(10) if
  1745. a same register is freed twice (happens in several part
  1746. of current compiler like addn for strings and sets)
  1747. Revision 1.90 1999/08/17 13:26:09 peter
  1748. * arrayconstructor -> arrayofconst fixed when arraycosntructor was not
  1749. variant.
  1750. Revision 1.89 1999/08/16 23:23:42 peter
  1751. * arrayconstructor -> openarray type conversions for element types
  1752. Revision 1.88 1999/08/13 21:33:18 peter
  1753. * support for array constructors extended and more error checking
  1754. Revision 1.87 1999/08/09 22:14:46 peter
  1755. * fixed disposing of tree node
  1756. Revision 1.86 1999/08/04 00:23:49 florian
  1757. * renamed i386asm and i386base to cpuasm and cpubase
  1758. Revision 1.85 1999/08/03 22:03:40 peter
  1759. * moved bitmask constants to sets
  1760. * some other type/const renamings
  1761. Revision 1.84 1999/07/27 23:42:24 peter
  1762. * indirect type referencing is now allowed
  1763. Revision 1.83 1999/05/27 19:45:29 peter
  1764. * removed oldasm
  1765. * plabel -> pasmlabel
  1766. * -a switches to source writing automaticly
  1767. * assembler readers OOPed
  1768. * asmsymbol automaticly external
  1769. * jumptables and other label fixes for asm readers
  1770. Revision 1.82 1999/05/18 14:15:59 peter
  1771. * containsself fixes
  1772. * checktypes()
  1773. Revision 1.81 1999/05/18 09:52:22 peter
  1774. * procedure of object and addrn fixes
  1775. }