tree.pas 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993
  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);
  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. genlabelnode:=p;
  1103. end;
  1104. function genselfnode(_class : pdef) : ptree;
  1105. var
  1106. p : ptree;
  1107. begin
  1108. p:=getnode;
  1109. p^.disposetyp:=dt_nothing;
  1110. p^.treetype:=selfn;
  1111. p^.registers32:=0;
  1112. { p^.registers16:=0;
  1113. p^.registers8:=0; }
  1114. p^.registersfpu:=0;
  1115. {$ifdef SUPPORT_MMX}
  1116. p^.registersmmx:=0;
  1117. {$endif SUPPORT_MMX}
  1118. p^.resulttype:=_class;
  1119. genselfnode:=p;
  1120. end;
  1121. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  1122. var
  1123. p : ptree;
  1124. begin
  1125. p:=getnode;
  1126. p^.disposetyp:=dt_inlinen;
  1127. p^.treetype:=inlinen;
  1128. p^.left:=l;
  1129. p^.inlinenumber:=number;
  1130. p^.inlineconst:=is_const;
  1131. p^.registers32:=0;
  1132. { p^.registers16:=0;
  1133. p^.registers8:=0; }
  1134. p^.registersfpu:=0;
  1135. {$ifdef SUPPORT_MMX}
  1136. p^.registersmmx:=0;
  1137. {$endif SUPPORT_MMX}
  1138. p^.resulttype:=nil;
  1139. geninlinenode:=p;
  1140. end;
  1141. { uses the callnode to create the new procinline node }
  1142. function genprocinlinenode(callp,code : ptree) : ptree;
  1143. var
  1144. p : ptree;
  1145. begin
  1146. p:=getnode;
  1147. p^.disposetyp:=dt_nothing;
  1148. p^.treetype:=procinlinen;
  1149. p^.inlineprocsym:=callp^.symtableprocentry;
  1150. p^.retoffset:=-4; { less dangerous as zero (PM) }
  1151. p^.para_offset:=0;
  1152. p^.para_size:=p^.inlineprocsym^.definition^.para_size;
  1153. if ret_in_param(p^.inlineprocsym^.definition^.rettype.def) then
  1154. p^.para_size:=p^.para_size+target_os.size_of_pointer;
  1155. { copy args }
  1156. p^.inlinetree:=code;
  1157. p^.registers32:=code^.registers32;
  1158. p^.registersfpu:=code^.registersfpu;
  1159. {$ifdef SUPPORT_MMX}
  1160. p^.registersmmx:=0;
  1161. {$endif SUPPORT_MMX}
  1162. p^.resulttype:=p^.inlineprocsym^.definition^.rettype.def;
  1163. genprocinlinenode:=p;
  1164. end;
  1165. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  1166. var
  1167. p : ptree;
  1168. begin
  1169. p:=getnode;
  1170. p^.disposetyp:=dt_nothing;
  1171. p^.treetype:=setconstn;
  1172. p^.registers32:=0;
  1173. p^.registersfpu:=0;
  1174. {$ifdef SUPPORT_MMX}
  1175. p^.registersmmx:=0;
  1176. {$endif SUPPORT_MMX}
  1177. p^.resulttype:=settype;
  1178. p^.left:=nil;
  1179. new(p^.value_set);
  1180. p^.value_set^:=s^;
  1181. gensetconstnode:=p;
  1182. end;
  1183. {$ifdef extdebug}
  1184. procedure compare_trees(oldp,p : ptree);
  1185. var
  1186. error_found : boolean;
  1187. begin
  1188. if oldp^.resulttype<>p^.resulttype then
  1189. begin
  1190. error_found:=true;
  1191. if is_equal(oldp^.resulttype,p^.resulttype) then
  1192. comment(v_debug,'resulttype fields are different but equal')
  1193. else
  1194. comment(v_warning,'resulttype fields are really different');
  1195. end;
  1196. if oldp^.treetype<>p^.treetype then
  1197. begin
  1198. comment(v_warning,'treetype field different');
  1199. error_found:=true;
  1200. end
  1201. else
  1202. comment(v_debug,' treetype '+tostr(longint(oldp^.treetype)));
  1203. if oldp^.error<>p^.error then
  1204. begin
  1205. comment(v_warning,'error field different');
  1206. error_found:=true;
  1207. end;
  1208. if oldp^.disposetyp<>p^.disposetyp then
  1209. begin
  1210. comment(v_warning,'disposetyp field different');
  1211. error_found:=true;
  1212. end;
  1213. { is true, if the right and left operand are swaped }
  1214. if oldp^.swaped<>p^.swaped then
  1215. begin
  1216. comment(v_warning,'swaped field different');
  1217. error_found:=true;
  1218. end;
  1219. { the location of the result of this node }
  1220. if oldp^.location.loc<>p^.location.loc then
  1221. begin
  1222. comment(v_warning,'location.loc field different');
  1223. error_found:=true;
  1224. end;
  1225. { the number of registers needed to evalute the node }
  1226. if oldp^.registers32<>p^.registers32 then
  1227. begin
  1228. comment(v_warning,'registers32 field different');
  1229. comment(v_warning,' old '+tostr(oldp^.registers32)+'<> new '+tostr(p^.registers32));
  1230. error_found:=true;
  1231. end;
  1232. if oldp^.registersfpu<>p^.registersfpu then
  1233. begin
  1234. comment(v_warning,'registersfpu field different');
  1235. error_found:=true;
  1236. end;
  1237. {$ifdef SUPPORT_MMX}
  1238. if oldp^.registersmmx<>p^.registersmmx then
  1239. begin
  1240. comment(v_warning,'registersmmx field different');
  1241. error_found:=true;
  1242. end;
  1243. {$endif SUPPORT_MMX}
  1244. if oldp^.left<>p^.left then
  1245. begin
  1246. comment(v_warning,'left field different');
  1247. error_found:=true;
  1248. end;
  1249. if oldp^.right<>p^.right then
  1250. begin
  1251. comment(v_warning,'right field different');
  1252. error_found:=true;
  1253. end;
  1254. if oldp^.fileinfo.line<>p^.fileinfo.line then
  1255. begin
  1256. comment(v_warning,'fileinfo.line field different');
  1257. error_found:=true;
  1258. end;
  1259. if oldp^.fileinfo.column<>p^.fileinfo.column then
  1260. begin
  1261. comment(v_warning,'fileinfo.column field different');
  1262. error_found:=true;
  1263. end;
  1264. if oldp^.fileinfo.fileindex<>p^.fileinfo.fileindex then
  1265. begin
  1266. comment(v_warning,'fileinfo.fileindex field different');
  1267. error_found:=true;
  1268. end;
  1269. if oldp^.localswitches<>p^.localswitches then
  1270. begin
  1271. comment(v_warning,'localswitches field different');
  1272. error_found:=true;
  1273. end;
  1274. {$ifdef extdebug}
  1275. if oldp^.firstpasscount<>p^.firstpasscount then
  1276. begin
  1277. comment(v_warning,'firstpasscount field different');
  1278. error_found:=true;
  1279. end;
  1280. {$endif extdebug}
  1281. if oldp^.treetype=p^.treetype then
  1282. case oldp^.treetype of
  1283. addn :
  1284. begin
  1285. if oldp^.use_strconcat<>p^.use_strconcat then
  1286. begin
  1287. comment(v_warning,'use_strconcat field different');
  1288. error_found:=true;
  1289. end;
  1290. if oldp^.string_typ<>p^.string_typ then
  1291. begin
  1292. comment(v_warning,'stringtyp field different');
  1293. error_found:=true;
  1294. end;
  1295. end;
  1296. callparan :
  1297. {(is_colon_para : boolean;exact_match_found : boolean);}
  1298. begin
  1299. if oldp^.is_colon_para<>p^.is_colon_para then
  1300. begin
  1301. comment(v_warning,'use_strconcat field different');
  1302. error_found:=true;
  1303. end;
  1304. if oldp^.exact_match_found<>p^.exact_match_found then
  1305. begin
  1306. comment(v_warning,'exact_match_found field different');
  1307. error_found:=true;
  1308. end;
  1309. end;
  1310. assignn :
  1311. {(assigntyp : tassigntyp;concat_string : boolean);}
  1312. begin
  1313. if oldp^.assigntyp<>p^.assigntyp then
  1314. begin
  1315. comment(v_warning,'assigntyp field different');
  1316. error_found:=true;
  1317. end;
  1318. if oldp^.concat_string<>p^.concat_string then
  1319. begin
  1320. comment(v_warning,'concat_string field different');
  1321. error_found:=true;
  1322. end;
  1323. end;
  1324. loadn :
  1325. {(symtableentry : psym;symtable : psymtable;
  1326. is_absolute,is_first : boolean);}
  1327. begin
  1328. if oldp^.symtableentry<>p^.symtableentry then
  1329. begin
  1330. comment(v_warning,'symtableentry field different');
  1331. error_found:=true;
  1332. end;
  1333. if oldp^.symtable<>p^.symtable then
  1334. begin
  1335. comment(v_warning,'symtable field different');
  1336. error_found:=true;
  1337. end;
  1338. if oldp^.is_absolute<>p^.is_absolute then
  1339. begin
  1340. comment(v_warning,'is_absolute field different');
  1341. error_found:=true;
  1342. end;
  1343. if oldp^.is_first<>p^.is_first then
  1344. begin
  1345. comment(v_warning,'is_first field different');
  1346. error_found:=true;
  1347. end;
  1348. end;
  1349. calln :
  1350. {(symtableprocentry : pprocsym;
  1351. symtableproc : psymtable;procdefinition : pprocdef;
  1352. methodpointer : ptree;
  1353. no_check,unit_specific : boolean);}
  1354. begin
  1355. if oldp^.symtableprocentry<>p^.symtableprocentry then
  1356. begin
  1357. comment(v_warning,'symtableprocentry field different');
  1358. error_found:=true;
  1359. end;
  1360. if oldp^.symtableproc<>p^.symtableproc then
  1361. begin
  1362. comment(v_warning,'symtableproc field different');
  1363. error_found:=true;
  1364. end;
  1365. if oldp^.procdefinition<>p^.procdefinition then
  1366. begin
  1367. comment(v_warning,'procdefinition field different');
  1368. error_found:=true;
  1369. end;
  1370. if oldp^.methodpointer<>p^.methodpointer then
  1371. begin
  1372. comment(v_warning,'methodpointer field different');
  1373. error_found:=true;
  1374. end;
  1375. if oldp^.no_check<>p^.no_check then
  1376. begin
  1377. comment(v_warning,'no_check field different');
  1378. error_found:=true;
  1379. end;
  1380. if oldp^.unit_specific<>p^.unit_specific then
  1381. begin
  1382. error_found:=true;
  1383. comment(v_warning,'unit_specific field different');
  1384. end;
  1385. end;
  1386. ordconstn :
  1387. begin
  1388. if oldp^.value<>p^.value then
  1389. begin
  1390. comment(v_warning,'value field different');
  1391. error_found:=true;
  1392. end;
  1393. end;
  1394. realconstn :
  1395. begin
  1396. if oldp^.value_real<>p^.value_real then
  1397. begin
  1398. comment(v_warning,'valued field different');
  1399. error_found:=true;
  1400. end;
  1401. if oldp^.lab_real<>p^.lab_real then
  1402. begin
  1403. comment(v_warning,'labnumber field different');
  1404. error_found:=true;
  1405. end;
  1406. { if oldp^.realtyp<>p^.realtyp then
  1407. begin
  1408. comment(v_warning,'realtyp field different');
  1409. error_found:=true;
  1410. end; }
  1411. end;
  1412. end;
  1413. if not error_found then
  1414. comment(v_warning,'did not find difference in trees');
  1415. end;
  1416. {$endif extdebug}
  1417. function equal_trees(t1,t2 : ptree) : boolean;
  1418. begin
  1419. if t1^.treetype=t2^.treetype then
  1420. begin
  1421. case t1^.treetype of
  1422. addn,
  1423. muln,
  1424. equaln,
  1425. orn,
  1426. xorn,
  1427. andn,
  1428. unequaln:
  1429. begin
  1430. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1431. equal_trees(t1^.right,t2^.right)) or
  1432. (equal_trees(t1^.right,t2^.left) and
  1433. equal_trees(t1^.left,t2^.right));
  1434. end;
  1435. subn,
  1436. divn,
  1437. modn,
  1438. assignn,
  1439. ltn,
  1440. lten,
  1441. gtn,
  1442. gten,
  1443. inn,
  1444. shrn,
  1445. shln,
  1446. slashn,
  1447. rangen:
  1448. begin
  1449. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1450. equal_trees(t1^.right,t2^.right));
  1451. end;
  1452. unaryminusn,
  1453. notn,
  1454. derefn,
  1455. addrn:
  1456. begin
  1457. equal_trees:=(equal_trees(t1^.left,t2^.left));
  1458. end;
  1459. loadn:
  1460. begin
  1461. equal_trees:=(t1^.symtableentry=t2^.symtableentry)
  1462. { not necessary
  1463. and (t1^.symtable=t2^.symtable)};
  1464. end;
  1465. {
  1466. subscriptn,
  1467. ordconstn,typeconvn,calln,callparan,
  1468. realconstn,asmn,vecn,
  1469. stringconstn,funcretn,selfn,
  1470. inlinen,niln,errorn,
  1471. typen,hnewn,hdisposen,newn,
  1472. disposen,setelen,setconstrn
  1473. }
  1474. else equal_trees:=false;
  1475. end;
  1476. end
  1477. else
  1478. equal_trees:=false;
  1479. end;
  1480. procedure set_unique(p : ptree);
  1481. begin
  1482. if assigned(p) then
  1483. begin
  1484. case p^.treetype of
  1485. vecn:
  1486. p^.callunique:=true;
  1487. typeconvn,subscriptn,derefn:
  1488. set_unique(p^.left);
  1489. end;
  1490. end;
  1491. end;
  1492. procedure set_funcret_is_valid(p : ptree);
  1493. begin
  1494. if assigned(p) then
  1495. begin
  1496. case p^.treetype of
  1497. funcretn:
  1498. begin
  1499. if p^.is_first_funcret then
  1500. pprocinfo(p^.funcretprocinfo)^.funcret_state:=vs_assigned;
  1501. end;
  1502. vecn,typeconvn,subscriptn,derefn:
  1503. set_funcret_is_valid(p^.left);
  1504. end;
  1505. end;
  1506. end;
  1507. procedure set_varstate(p : ptree;must_be_valid : boolean);
  1508. begin
  1509. if not assigned(p) then
  1510. exit
  1511. else
  1512. begin
  1513. if p^.varstateset then
  1514. exit;
  1515. case p^.treetype of
  1516. typeconvn,subscriptn :
  1517. set_varstate(p^.left,must_be_valid);
  1518. vecn:
  1519. begin
  1520. if (p^.left^.resulttype^.deftype in [stringdef,arraydef]) then
  1521. set_varstate(p^.left,must_be_valid)
  1522. else
  1523. set_varstate(p^.left,true);
  1524. set_varstate(p^.right,true);
  1525. end;
  1526. { do not parse calln }
  1527. calln : ;
  1528. callparan:
  1529. begin
  1530. set_varstate(p^.left,must_be_valid);
  1531. set_varstate(p^.right,must_be_valid);
  1532. end;
  1533. loadn :
  1534. if (p^.symtableentry^.typ=varsym) then
  1535. begin
  1536. if must_be_valid and p^.is_first then
  1537. begin
  1538. if (pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found) or
  1539. (pvarsym(p^.symtableentry)^.varstate=vs_set_but_first_not_passed) then
  1540. if (assigned(pvarsym(p^.symtableentry)^.owner) and
  1541. assigned(aktprocsym) and
  1542. (pvarsym(p^.symtableentry)^.owner = aktprocsym^.definition^.localst)) then
  1543. begin
  1544. if p^.symtable^.symtabletype=localsymtable then
  1545. CGMessage1(sym_n_uninitialized_local_variable,pvarsym(p^.symtableentry)^.name)
  1546. else
  1547. CGMessage1(sym_n_uninitialized_variable,pvarsym(p^.symtableentry)^.name);
  1548. end;
  1549. end;
  1550. if (p^.is_first) then
  1551. begin
  1552. if pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found then
  1553. { this can only happen at left of an assignment, no ? PM }
  1554. if (parsing_para_level=0) and not must_be_valid then
  1555. pvarsym(p^.symtableentry)^.varstate:=vs_assigned
  1556. else
  1557. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1558. if pvarsym(p^.symtableentry)^.varstate=vs_set_but_first_not_passed then
  1559. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1560. p^.is_first:=false;
  1561. end
  1562. else
  1563. begin
  1564. if (pvarsym(p^.symtableentry)^.varstate=vs_assigned) and
  1565. (must_be_valid or (parsing_para_level>0) or
  1566. (p^.resulttype^.deftype=procvardef)) then
  1567. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1568. if (pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found) and
  1569. (must_be_valid or (parsing_para_level>0) or
  1570. (p^.resulttype^.deftype=procvardef)) then
  1571. pvarsym(p^.symtableentry)^.varstate:=vs_set_but_first_not_passed;
  1572. end;
  1573. end;
  1574. funcretn:
  1575. begin
  1576. { no claim if setting higher return value_str }
  1577. if must_be_valid and
  1578. (procinfo=pprocinfo(p^.funcretprocinfo)) and
  1579. ((procinfo^.funcret_state=vs_declared) or
  1580. ((p^.is_first_funcret) and
  1581. (procinfo^.funcret_state=vs_declared_and_first_found))) then
  1582. begin
  1583. CGMessage(sym_w_function_result_not_set);
  1584. { avoid multiple warnings }
  1585. procinfo^.funcret_state:=vs_assigned;
  1586. end;
  1587. if p^.is_first_funcret and not must_be_valid then
  1588. pprocinfo(p^.funcretprocinfo)^.funcret_state:=vs_assigned;
  1589. end;
  1590. else
  1591. begin
  1592. {internalerror(565656);}
  1593. end;
  1594. end;{case }
  1595. p^.varstateset:=true;
  1596. end;
  1597. end;
  1598. procedure clear_location(var loc : tlocation);
  1599. begin
  1600. loc.loc:=LOC_INVALID;
  1601. end;
  1602. {This is needed if you want to be able to delete the string with the nodes !!}
  1603. procedure set_location(var destloc,sourceloc : tlocation);
  1604. begin
  1605. destloc:= sourceloc;
  1606. end;
  1607. procedure swap_location(var destloc,sourceloc : tlocation);
  1608. var
  1609. swapl : tlocation;
  1610. begin
  1611. swapl := destloc;
  1612. destloc := sourceloc;
  1613. sourceloc := swapl;
  1614. end;
  1615. function get_ordinal_value(p : ptree) : longint;
  1616. begin
  1617. if p^.treetype=ordconstn then
  1618. get_ordinal_value:=p^.value
  1619. else
  1620. begin
  1621. Message(type_e_ordinal_expr_expected);
  1622. get_ordinal_value:=0;
  1623. end;
  1624. end;
  1625. function is_constnode(p : ptree) : boolean;
  1626. begin
  1627. is_constnode:=(p^.treetype in [ordconstn,realconstn,stringconstn,fixconstn,setconstn]);
  1628. end;
  1629. function is_constintnode(p : ptree) : boolean;
  1630. begin
  1631. is_constintnode:=(p^.treetype=ordconstn) and is_integer(p^.resulttype);
  1632. end;
  1633. function is_constcharnode(p : ptree) : boolean;
  1634. begin
  1635. is_constcharnode:=(p^.treetype=ordconstn) and is_char(p^.resulttype);
  1636. end;
  1637. function is_constrealnode(p : ptree) : boolean;
  1638. begin
  1639. is_constrealnode:=(p^.treetype=realconstn);
  1640. end;
  1641. function is_constboolnode(p : ptree) : boolean;
  1642. begin
  1643. is_constboolnode:=(p^.treetype=ordconstn) and is_boolean(p^.resulttype);
  1644. end;
  1645. function str_length(p : ptree) : longint;
  1646. begin
  1647. str_length:=p^.length;
  1648. end;
  1649. function is_emptyset(p : ptree):boolean;
  1650. {
  1651. return true if set s is empty
  1652. }
  1653. var
  1654. i : longint;
  1655. begin
  1656. i:=0;
  1657. if p^.treetype=setconstn then
  1658. begin
  1659. while (i<32) and (p^.value_set^[i]=0) do
  1660. inc(i);
  1661. end;
  1662. is_emptyset:=(i=32);
  1663. end;
  1664. {*****************************************************************************
  1665. Case Helpers
  1666. *****************************************************************************}
  1667. function case_count_labels(root : pcaserecord) : longint;
  1668. var
  1669. _l : longint;
  1670. procedure count(p : pcaserecord);
  1671. begin
  1672. inc(_l);
  1673. if assigned(p^.less) then
  1674. count(p^.less);
  1675. if assigned(p^.greater) then
  1676. count(p^.greater);
  1677. end;
  1678. begin
  1679. _l:=0;
  1680. count(root);
  1681. case_count_labels:=_l;
  1682. end;
  1683. function case_get_max(root : pcaserecord) : longint;
  1684. var
  1685. hp : pcaserecord;
  1686. begin
  1687. hp:=root;
  1688. while assigned(hp^.greater) do
  1689. hp:=hp^.greater;
  1690. case_get_max:=hp^._high;
  1691. end;
  1692. function case_get_min(root : pcaserecord) : longint;
  1693. var
  1694. hp : pcaserecord;
  1695. begin
  1696. hp:=root;
  1697. while assigned(hp^.less) do
  1698. hp:=hp^.less;
  1699. case_get_min:=hp^._low;
  1700. end;
  1701. end.
  1702. {
  1703. $Log$
  1704. Revision 1.104 1999-11-30 10:40:59 peter
  1705. + ttype, tsymlist
  1706. Revision 1.103 1999/11/18 15:34:51 pierre
  1707. * Notes/Hints for local syms changed to
  1708. Set_varstate function
  1709. Revision 1.102 1999/11/17 17:05:07 pierre
  1710. * Notes/hints changes
  1711. Revision 1.101 1999/11/06 14:34:31 peter
  1712. * truncated log to 20 revs
  1713. Revision 1.100 1999/10/22 14:37:31 peter
  1714. * error when properties are passed to var parameters
  1715. Revision 1.99 1999/09/27 23:45:03 peter
  1716. * procinfo is now a pointer
  1717. * support for result setting in sub procedure
  1718. Revision 1.98 1999/09/26 21:30:22 peter
  1719. + constant pointer support which can happend with typecasting like
  1720. const p=pointer(1)
  1721. * better procvar parsing in typed consts
  1722. Revision 1.97 1999/09/17 17:14:13 peter
  1723. * @procvar fixes for tp mode
  1724. * @<id>:= gives now an error
  1725. Revision 1.96 1999/09/16 11:34:59 pierre
  1726. * typo correction
  1727. Revision 1.95 1999/09/10 18:48:11 florian
  1728. * some bug fixes (e.g. must_be_valid and procinfo^.funcret_is_valid)
  1729. * most things for stored properties fixed
  1730. Revision 1.94 1999/09/07 07:52:20 peter
  1731. * > < >= <= support for boolean
  1732. * boolean constants are now calculated like integer constants
  1733. Revision 1.93 1999/08/27 10:38:31 pierre
  1734. + EXTTEMPREGDEBUG code added
  1735. Revision 1.92 1999/08/26 21:10:08 peter
  1736. * better error recovery for case
  1737. Revision 1.91 1999/08/23 23:26:00 pierre
  1738. + TEMPREGDEBUG code, test of register allocation
  1739. if a tree uses more than registers32 regs then
  1740. internalerror(10) is issued
  1741. + EXTTEMPREGDEBUG will also give internalerror(10) if
  1742. a same register is freed twice (happens in several part
  1743. of current compiler like addn for strings and sets)
  1744. Revision 1.90 1999/08/17 13:26:09 peter
  1745. * arrayconstructor -> arrayofconst fixed when arraycosntructor was not
  1746. variant.
  1747. Revision 1.89 1999/08/16 23:23:42 peter
  1748. * arrayconstructor -> openarray type conversions for element types
  1749. Revision 1.88 1999/08/13 21:33:18 peter
  1750. * support for array constructors extended and more error checking
  1751. Revision 1.87 1999/08/09 22:14:46 peter
  1752. * fixed disposing of tree node
  1753. Revision 1.86 1999/08/04 00:23:49 florian
  1754. * renamed i386asm and i386base to cpuasm and cpubase
  1755. Revision 1.85 1999/08/03 22:03:40 peter
  1756. * moved bitmask constants to sets
  1757. * some other type/const renamings
  1758. Revision 1.84 1999/07/27 23:42:24 peter
  1759. * indirect type referencing is now allowed
  1760. Revision 1.83 1999/05/27 19:45:29 peter
  1761. * removed oldasm
  1762. * plabel -> pasmlabel
  1763. * -a switches to source writing automaticly
  1764. * assembler readers OOPed
  1765. * asmsymbol automaticly external
  1766. * jumptables and other label fixes for asm readers
  1767. Revision 1.82 1999/05/18 14:15:59 peter
  1768. * containsself fixes
  1769. * checktypes()
  1770. Revision 1.81 1999/05/18 09:52:22 peter
  1771. * procedure of object and addrn fixes
  1772. }