tree.pas 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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;st:tstringtype) : 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. dispose(p);
  435. end;
  436. procedure swaptree(p:Ptree);
  437. var swapp:Ptree;
  438. begin
  439. swapp:=p^.right;
  440. p^.right:=p^.left;
  441. p^.left:=swapp;
  442. p^.swaped:=not(p^.swaped);
  443. end;
  444. procedure disposetree(p : ptree);
  445. var
  446. symt : pwithsymtable;
  447. i : longint;
  448. begin
  449. if not(assigned(p)) then
  450. exit;
  451. if not(p^.treetype in [addn..loadvmtn]) then
  452. internalerror(26219);
  453. case p^.disposetyp of
  454. dt_leftright :
  455. begin
  456. if assigned(p^.left) then
  457. disposetree(p^.left);
  458. if assigned(p^.right) then
  459. disposetree(p^.right);
  460. end;
  461. dt_leftrighthigh :
  462. begin
  463. if assigned(p^.left) then
  464. disposetree(p^.left);
  465. if assigned(p^.right) then
  466. disposetree(p^.right);
  467. if assigned(p^.hightree) then
  468. disposetree(p^.hightree);
  469. end;
  470. dt_leftrightmethod :
  471. begin
  472. if assigned(p^.left) then
  473. disposetree(p^.left);
  474. if assigned(p^.right) then
  475. disposetree(p^.right);
  476. if assigned(p^.methodpointer) then
  477. disposetree(p^.methodpointer);
  478. end;
  479. dt_case :
  480. begin
  481. if assigned(p^.left) then
  482. disposetree(p^.left);
  483. if assigned(p^.right) then
  484. disposetree(p^.right);
  485. if assigned(p^.nodes) then
  486. deletecaselabels(p^.nodes);
  487. if assigned(p^.elseblock) then
  488. disposetree(p^.elseblock);
  489. end;
  490. dt_nothing : ;
  491. dt_left :
  492. if assigned(p^.left) then
  493. disposetree(p^.left);
  494. dt_mbleft :
  495. if assigned(p^.left) then
  496. disposetree(p^.left);
  497. dt_mbleft_and_method :
  498. begin
  499. if assigned(p^.left) then disposetree(p^.left);
  500. disposetree(p^.methodpointer);
  501. end;
  502. dt_typeconv : disposetree(p^.left);
  503. dt_inlinen :
  504. if assigned(p^.left) then
  505. disposetree(p^.left);
  506. dt_loop :
  507. begin
  508. if assigned(p^.left) then
  509. disposetree(p^.left);
  510. if assigned(p^.right) then
  511. disposetree(p^.right);
  512. if assigned(p^.t1) then
  513. disposetree(p^.t1);
  514. if assigned(p^.t2) then
  515. disposetree(p^.t2);
  516. end;
  517. dt_onn:
  518. begin
  519. if assigned(p^.left) then
  520. disposetree(p^.left);
  521. if assigned(p^.right) then
  522. disposetree(p^.right);
  523. if assigned(p^.exceptsymtable) then
  524. dispose(p^.exceptsymtable,done);
  525. end;
  526. dt_with :
  527. begin
  528. if assigned(p^.left) then
  529. disposetree(p^.left);
  530. if assigned(p^.right) then
  531. disposetree(p^.right);
  532. symt:=p^.withsymtable;
  533. for i:=1 to p^.tablecount do
  534. begin
  535. if assigned(symt) then
  536. begin
  537. p^.withsymtable:=pwithsymtable(symt^.next);
  538. dispose(symt,done);
  539. end;
  540. symt:=p^.withsymtable;
  541. end;
  542. end;
  543. else internalerror(12);
  544. end;
  545. putnode(p);
  546. end;
  547. procedure set_file_line(from,_to : ptree);
  548. begin
  549. if assigned(from) then
  550. _to^.fileinfo:=from^.fileinfo;
  551. end;
  552. procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
  553. begin
  554. p^.fileinfo:=filepos;
  555. end;
  556. function genwithnode(symtable : pwithsymtable;l,r : ptree;count : longint) : ptree;
  557. var
  558. p : ptree;
  559. begin
  560. p:=getnode;
  561. p^.disposetyp:=dt_with;
  562. p^.treetype:=withn;
  563. p^.left:=l;
  564. p^.right:=r;
  565. p^.registers32:=0;
  566. { p^.registers16:=0;
  567. p^.registers8:=0; }
  568. p^.registersfpu:=0;
  569. {$ifdef SUPPORT_MMX}
  570. p^.registersmmx:=0;
  571. {$endif SUPPORT_MMX}
  572. p^.resulttype:=nil;
  573. p^.withsymtable:=symtable;
  574. p^.tablecount:=count;
  575. p^.withreference:=nil;
  576. p^.islocal:=false;
  577. set_file_line(l,p);
  578. genwithnode:=p;
  579. end;
  580. function genfixconstnode(v : longint;def : pdef) : ptree;
  581. var
  582. p : ptree;
  583. begin
  584. p:=getnode;
  585. p^.disposetyp:=dt_nothing;
  586. p^.treetype:=fixconstn;
  587. p^.registers32:=0;
  588. { p^.registers16:=0;
  589. p^.registers8:=0; }
  590. p^.registersfpu:=0;
  591. {$ifdef SUPPORT_MMX}
  592. p^.registersmmx:=0;
  593. {$endif SUPPORT_MMX}
  594. p^.resulttype:=def;
  595. p^.value:=v;
  596. genfixconstnode:=p;
  597. end;
  598. function gencallparanode(expr,next : ptree) : ptree;
  599. var
  600. p : ptree;
  601. begin
  602. p:=getnode;
  603. p^.disposetyp:=dt_leftrighthigh;
  604. p^.treetype:=callparan;
  605. p^.left:=expr;
  606. p^.right:=next;
  607. p^.registers32:=0;
  608. { p^.registers16:=0;
  609. p^.registers8:=0; }
  610. {$ifdef SUPPORT_MMX}
  611. p^.registersmmx:=0;
  612. {$endif SUPPORT_MMX}
  613. p^.registersfpu:=0;
  614. p^.resulttype:=nil;
  615. p^.exact_match_found:=false;
  616. p^.convlevel1found:=false;
  617. p^.convlevel2found:=false;
  618. p^.is_colon_para:=false;
  619. p^.hightree:=nil;
  620. set_file_line(expr,p);
  621. gencallparanode:=p;
  622. end;
  623. function gennode(t : ttreetyp;l,r : ptree) : ptree;
  624. var
  625. p : ptree;
  626. begin
  627. p:=getnode;
  628. p^.disposetyp:=dt_leftright;
  629. p^.treetype:=t;
  630. p^.left:=l;
  631. p^.right:=r;
  632. p^.registers32:=0;
  633. { p^.registers16:=0;
  634. p^.registers8:=0; }
  635. p^.registersfpu:=0;
  636. {$ifdef SUPPORT_MMX}
  637. p^.registersmmx:=0;
  638. {$endif SUPPORT_MMX}
  639. p^.resulttype:=nil;
  640. gennode:=p;
  641. end;
  642. function gencasenode(l,r : ptree;nodes : pcaserecord) : ptree;
  643. var
  644. p : ptree;
  645. begin
  646. p:=getnode;
  647. p^.disposetyp:=dt_case;
  648. p^.treetype:=casen;
  649. p^.left:=l;
  650. p^.right:=r;
  651. p^.nodes:=nodes;
  652. p^.registers32:=0;
  653. p^.registersfpu:=0;
  654. {$ifdef SUPPORT_MMX}
  655. p^.registersmmx:=0;
  656. {$endif SUPPORT_MMX}
  657. p^.resulttype:=nil;
  658. set_file_line(l,p);
  659. gencasenode:=p;
  660. end;
  661. function genloopnode(t : ttreetyp;l,r,n1 : ptree;back : boolean) : ptree;
  662. var
  663. p : ptree;
  664. begin
  665. p:=getnode;
  666. p^.disposetyp:=dt_loop;
  667. p^.treetype:=t;
  668. p^.left:=l;
  669. p^.right:=r;
  670. p^.t1:=n1;
  671. p^.t2:=nil;
  672. p^.registers32:=0;
  673. p^.backward:=back;
  674. { p^.registers16:=0;
  675. p^.registers8:=0; }
  676. p^.registersfpu:=0;
  677. {$ifdef SUPPORT_MMX}
  678. p^.registersmmx:=0;
  679. {$endif SUPPORT_MMX}
  680. p^.resulttype:=nil;
  681. set_file_line(l,p);
  682. genloopnode:=p;
  683. end;
  684. function genordinalconstnode(v : longint;def : pdef) : ptree;
  685. var
  686. p : ptree;
  687. begin
  688. p:=getnode;
  689. p^.disposetyp:=dt_nothing;
  690. p^.treetype:=ordconstn;
  691. p^.registers32:=0;
  692. { p^.registers16:=0;
  693. p^.registers8:=0; }
  694. p^.registersfpu:=0;
  695. {$ifdef SUPPORT_MMX}
  696. p^.registersmmx:=0;
  697. {$endif SUPPORT_MMX}
  698. p^.resulttype:=def;
  699. p^.value:=v;
  700. if p^.resulttype^.deftype=orddef then
  701. testrange(p^.resulttype,p^.value);
  702. genordinalconstnode:=p;
  703. end;
  704. function genpointerconstnode(v : longint;def : pdef) : ptree;
  705. var
  706. p : ptree;
  707. begin
  708. p:=getnode;
  709. p^.disposetyp:=dt_nothing;
  710. p^.treetype:=pointerconstn;
  711. p^.registers32:=0;
  712. { p^.registers16:=0;
  713. p^.registers8:=0; }
  714. p^.registersfpu:=0;
  715. {$ifdef SUPPORT_MMX}
  716. p^.registersmmx:=0;
  717. {$endif SUPPORT_MMX}
  718. p^.resulttype:=def;
  719. p^.value:=v;
  720. genpointerconstnode:=p;
  721. end;
  722. function genenumnode(v : penumsym) : ptree;
  723. var
  724. p : ptree;
  725. begin
  726. p:=getnode;
  727. p^.disposetyp:=dt_nothing;
  728. p^.treetype:=ordconstn;
  729. p^.registers32:=0;
  730. { p^.registers16:=0;
  731. p^.registers8:=0; }
  732. p^.registersfpu:=0;
  733. {$ifdef SUPPORT_MMX}
  734. p^.registersmmx:=0;
  735. {$endif SUPPORT_MMX}
  736. p^.resulttype:=v^.definition;
  737. p^.value:=v^.value;
  738. testrange(p^.resulttype,p^.value);
  739. genenumnode:=p;
  740. end;
  741. function genrealconstnode(v : bestreal;def : pdef) : ptree;
  742. var
  743. p : ptree;
  744. begin
  745. p:=getnode;
  746. p^.disposetyp:=dt_nothing;
  747. p^.treetype:=realconstn;
  748. p^.registers32:=0;
  749. { p^.registers16:=0;
  750. p^.registers8:=0; }
  751. p^.registersfpu:=0;
  752. {$ifdef SUPPORT_MMX}
  753. p^.registersmmx:=0;
  754. {$endif SUPPORT_MMX}
  755. p^.resulttype:=def;
  756. p^.value_real:=v;
  757. p^.lab_real:=nil;
  758. genrealconstnode:=p;
  759. end;
  760. function genstringconstnode(const s : string;st:tstringtype) : ptree;
  761. var
  762. p : ptree;
  763. l : longint;
  764. begin
  765. p:=getnode;
  766. p^.disposetyp:=dt_nothing;
  767. p^.treetype:=stringconstn;
  768. p^.registers32:=0;
  769. { p^.registers16:=0;
  770. p^.registers8:=0; }
  771. p^.registersfpu:=0;
  772. {$ifdef SUPPORT_MMX}
  773. p^.registersmmx:=0;
  774. {$endif SUPPORT_MMX}
  775. l:=length(s);
  776. p^.length:=l;
  777. { stringdup write even past a #0 }
  778. getmem(p^.value_str,l+1);
  779. move(s[1],p^.value_str^,l);
  780. p^.value_str[l]:=#0;
  781. p^.lab_str:=nil;
  782. if st=st_default then
  783. begin
  784. if cs_ansistrings in aktlocalswitches then
  785. p^.stringtype:=st_ansistring
  786. else
  787. p^.stringtype:=st_shortstring;
  788. end
  789. else
  790. p^.stringtype:=st;
  791. case p^.stringtype of
  792. st_shortstring :
  793. p^.resulttype:=cshortstringdef;
  794. st_ansistring :
  795. p^.resulttype:=cansistringdef;
  796. else
  797. internalerror(44990099);
  798. end;
  799. genstringconstnode:=p;
  800. end;
  801. function getpcharcopy(p : ptree) : pchar;
  802. var
  803. pc : pchar;
  804. begin
  805. pc:=nil;
  806. getmem(pc,p^.length+1);
  807. if pc=nil then
  808. Message(general_f_no_memory_left);
  809. move(p^.value_str^,pc^,p^.length+1);
  810. getpcharcopy:=pc;
  811. end;
  812. function genpcharconstnode(s : pchar;length : longint) : ptree;
  813. var
  814. p : ptree;
  815. begin
  816. p:=getnode;
  817. p^.disposetyp:=dt_nothing;
  818. p^.treetype:=stringconstn;
  819. p^.registers32:=0;
  820. { p^.registers16:=0;
  821. p^.registers8:=0; }
  822. p^.registersfpu:=0;
  823. {$ifdef SUPPORT_MMX}
  824. p^.registersmmx:=0;
  825. {$endif SUPPORT_MMX}
  826. p^.length:=length;
  827. if (cs_ansistrings in aktlocalswitches) or
  828. (length>255) then
  829. begin
  830. p^.stringtype:=st_ansistring;
  831. p^.resulttype:=cansistringdef;
  832. end
  833. else
  834. begin
  835. p^.stringtype:=st_shortstring;
  836. p^.resulttype:=cshortstringdef;
  837. end;
  838. p^.value_str:=s;
  839. p^.lab_str:=nil;
  840. genpcharconstnode:=p;
  841. end;
  842. function gensinglenode(t : ttreetyp;l : ptree) : ptree;
  843. var
  844. p : ptree;
  845. begin
  846. p:=getnode;
  847. p^.disposetyp:=dt_left;
  848. p^.treetype:=t;
  849. p^.left:=l;
  850. p^.registers32:=0;
  851. { p^.registers16:=0;
  852. p^.registers8:=0; }
  853. p^.registersfpu:=0;
  854. {$ifdef SUPPORT_MMX}
  855. p^.registersmmx:=0;
  856. {$endif SUPPORT_MMX}
  857. p^.resulttype:=nil;
  858. gensinglenode:=p;
  859. end;
  860. function genasmnode(p_asm : paasmoutput) : ptree;
  861. var
  862. p : ptree;
  863. begin
  864. p:=getnode;
  865. p^.disposetyp:=dt_nothing;
  866. p^.treetype:=asmn;
  867. p^.registers32:=4;
  868. p^.p_asm:=p_asm;
  869. p^.object_preserved:=false;
  870. { p^.registers16:=0;
  871. p^.registers8:=0; }
  872. p^.registersfpu:=8;
  873. {$ifdef SUPPORT_MMX}
  874. p^.registersmmx:=8;
  875. {$endif SUPPORT_MMX}
  876. p^.resulttype:=nil;
  877. genasmnode:=p;
  878. end;
  879. function genloadnode(v : pvarsym;st : psymtable) : ptree;
  880. var
  881. p : ptree;
  882. begin
  883. p:=getnode;
  884. p^.registers32:=0;
  885. { p^.registers16:=0;
  886. p^.registers8:=0; }
  887. p^.registersfpu:=0;
  888. {$ifdef SUPPORT_MMX}
  889. p^.registersmmx:=0;
  890. {$endif SUPPORT_MMX}
  891. p^.treetype:=loadn;
  892. p^.resulttype:=v^.vartype.def;
  893. p^.symtableentry:=v;
  894. p^.symtable:=st;
  895. p^.is_first := False;
  896. { method pointer load nodes can use the left subtree }
  897. p^.disposetyp:=dt_left;
  898. p^.left:=nil;
  899. genloadnode:=p;
  900. end;
  901. function genloadcallnode(v: pprocsym;st: psymtable): ptree;
  902. var
  903. p : ptree;
  904. begin
  905. p:=getnode;
  906. p^.registers32:=0;
  907. { p^.registers16:=0;
  908. p^.registers8:=0; }
  909. p^.registersfpu:=0;
  910. {$ifdef SUPPORT_MMX}
  911. p^.registersmmx:=0;
  912. {$endif SUPPORT_MMX}
  913. p^.treetype:=loadn;
  914. p^.left:=nil;
  915. p^.resulttype:=v^.definition;
  916. p^.symtableentry:=v;
  917. p^.symtable:=st;
  918. p^.is_first := False;
  919. p^.disposetyp:=dt_nothing;
  920. genloadcallnode:=p;
  921. end;
  922. function genloadmethodcallnode(v: pprocsym;st: psymtable; mp:ptree): ptree;
  923. var
  924. p : ptree;
  925. begin
  926. p:=getnode;
  927. p^.registers32:=0;
  928. { p^.registers16:=0;
  929. p^.registers8:=0; }
  930. p^.registersfpu:=0;
  931. {$ifdef SUPPORT_MMX}
  932. p^.registersmmx:=0;
  933. {$endif SUPPORT_MMX}
  934. p^.treetype:=loadn;
  935. p^.left:=nil;
  936. p^.resulttype:=v^.definition;
  937. p^.symtableentry:=v;
  938. p^.symtable:=st;
  939. p^.is_first := False;
  940. p^.disposetyp:=dt_left;
  941. p^.left:=mp;
  942. genloadmethodcallnode:=p;
  943. end;
  944. function gentypedconstloadnode(sym : ptypedconstsym;st : psymtable) : ptree;
  945. var
  946. p : ptree;
  947. begin
  948. p:=getnode;
  949. p^.registers32:=0;
  950. { p^.registers16:=0;
  951. p^.registers8:=0; }
  952. p^.registersfpu:=0;
  953. {$ifdef SUPPORT_MMX}
  954. p^.registersmmx:=0;
  955. {$endif SUPPORT_MMX}
  956. p^.treetype:=loadn;
  957. p^.left:=nil;
  958. p^.resulttype:=sym^.typedconsttype.def;
  959. p^.symtableentry:=sym;
  960. p^.symtable:=st;
  961. p^.disposetyp:=dt_nothing;
  962. gentypedconstloadnode:=p;
  963. end;
  964. function gentypeconvnode(node : ptree;t : pdef) : ptree;
  965. var
  966. p : ptree;
  967. begin
  968. p:=getnode;
  969. p^.disposetyp:=dt_typeconv;
  970. p^.treetype:=typeconvn;
  971. p^.left:=node;
  972. p^.registers32:=0;
  973. { p^.registers16:=0;
  974. p^.registers8:=0; }
  975. p^.convtyp:=tc_equal;
  976. p^.registersfpu:=0;
  977. {$ifdef SUPPORT_MMX}
  978. p^.registersmmx:=0;
  979. {$endif SUPPORT_MMX}
  980. p^.resulttype:=t;
  981. p^.explizit:=false;
  982. set_file_line(node,p);
  983. gentypeconvnode:=p;
  984. end;
  985. function gentypenode(t : pdef;sym:ptypesym) : ptree;
  986. var
  987. p : ptree;
  988. begin
  989. p:=getnode;
  990. p^.disposetyp:=dt_nothing;
  991. p^.treetype:=typen;
  992. p^.registers32:=0;
  993. { p^.registers16:=0;
  994. p^.registers8:=0; }
  995. p^.registersfpu:=0;
  996. {$ifdef SUPPORT_MMX}
  997. p^.registersmmx:=0;
  998. {$endif SUPPORT_MMX}
  999. p^.resulttype:=generrordef;
  1000. p^.typenodetype:=t;
  1001. p^.typenodesym:=sym;
  1002. gentypenode:=p;
  1003. end;
  1004. function gencallnode(v : pprocsym;st : psymtable) : ptree;
  1005. var
  1006. p : ptree;
  1007. begin
  1008. p:=getnode;
  1009. p^.registers32:=0;
  1010. { p^.registers16:=0;
  1011. p^.registers8:=0; }
  1012. p^.registersfpu:=0;
  1013. {$ifdef SUPPORT_MMX}
  1014. p^.registersmmx:=0;
  1015. {$endif SUPPORT_MMX}
  1016. p^.treetype:=calln;
  1017. p^.symtableprocentry:=v;
  1018. p^.symtableproc:=st;
  1019. p^.unit_specific:=false;
  1020. p^.no_check:=false;
  1021. p^.return_value_used:=true;
  1022. p^.disposetyp := dt_leftrightmethod;
  1023. p^.methodpointer:=nil;
  1024. p^.left:=nil;
  1025. p^.right:=nil;
  1026. p^.procdefinition:=nil;
  1027. gencallnode:=p;
  1028. end;
  1029. function genmethodcallnode(v : pprocsym;st : psymtable;mp : ptree) : ptree;
  1030. var
  1031. p : ptree;
  1032. begin
  1033. p:=getnode;
  1034. p^.registers32:=0;
  1035. { p^.registers16:=0;
  1036. p^.registers8:=0; }
  1037. p^.registersfpu:=0;
  1038. {$ifdef SUPPORT_MMX}
  1039. p^.registersmmx:=0;
  1040. {$endif SUPPORT_MMX}
  1041. p^.treetype:=calln;
  1042. p^.return_value_used:=true;
  1043. p^.symtableprocentry:=v;
  1044. p^.symtableproc:=st;
  1045. p^.disposetyp:=dt_leftrightmethod;
  1046. p^.left:=nil;
  1047. p^.right:=nil;
  1048. p^.methodpointer:=mp;
  1049. p^.procdefinition:=nil;
  1050. genmethodcallnode:=p;
  1051. end;
  1052. function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
  1053. var
  1054. p : ptree;
  1055. begin
  1056. p:=getnode;
  1057. p^.disposetyp:=dt_left;
  1058. p^.treetype:=subscriptn;
  1059. p^.left:=l;
  1060. p^.registers32:=0;
  1061. p^.vs:=varsym;
  1062. { p^.registers16:=0;
  1063. p^.registers8:=0; }
  1064. p^.registersfpu:=0;
  1065. {$ifdef SUPPORT_MMX}
  1066. p^.registersmmx:=0;
  1067. {$endif SUPPORT_MMX}
  1068. p^.resulttype:=nil;
  1069. gensubscriptnode:=p;
  1070. end;
  1071. function genzeronode(t : ttreetyp) : ptree;
  1072. var
  1073. p : ptree;
  1074. begin
  1075. p:=getnode;
  1076. p^.disposetyp:=dt_nothing;
  1077. p^.treetype:=t;
  1078. p^.registers32:=0;
  1079. { p^.registers16:=0;
  1080. p^.registers8:=0; }
  1081. p^.registersfpu:=0;
  1082. {$ifdef SUPPORT_MMX}
  1083. p^.registersmmx:=0;
  1084. {$endif SUPPORT_MMX}
  1085. p^.resulttype:=nil;
  1086. genzeronode:=p;
  1087. end;
  1088. function genlabelnode(t : ttreetyp;nr : pasmlabel) : ptree;
  1089. var
  1090. p : ptree;
  1091. begin
  1092. p:=getnode;
  1093. p^.disposetyp:=dt_nothing;
  1094. p^.treetype:=t;
  1095. p^.registers32:=0;
  1096. { p^.registers16:=0;
  1097. p^.registers8:=0; }
  1098. p^.registersfpu:=0;
  1099. {$ifdef SUPPORT_MMX}
  1100. p^.registersmmx:=0;
  1101. {$endif SUPPORT_MMX}
  1102. p^.resulttype:=nil;
  1103. { for security }
  1104. { nr^.is_used:=true;}
  1105. p^.labelnr:=nr;
  1106. p^.exceptionblock:=nil;
  1107. genlabelnode:=p;
  1108. end;
  1109. function genselfnode(_class : pdef) : ptree;
  1110. var
  1111. p : ptree;
  1112. begin
  1113. p:=getnode;
  1114. p^.disposetyp:=dt_nothing;
  1115. p^.treetype:=selfn;
  1116. p^.registers32:=0;
  1117. { p^.registers16:=0;
  1118. p^.registers8:=0; }
  1119. p^.registersfpu:=0;
  1120. {$ifdef SUPPORT_MMX}
  1121. p^.registersmmx:=0;
  1122. {$endif SUPPORT_MMX}
  1123. p^.resulttype:=_class;
  1124. genselfnode:=p;
  1125. end;
  1126. function geninlinenode(number : byte;is_const:boolean;l : ptree) : ptree;
  1127. var
  1128. p : ptree;
  1129. begin
  1130. p:=getnode;
  1131. p^.disposetyp:=dt_inlinen;
  1132. p^.treetype:=inlinen;
  1133. p^.left:=l;
  1134. p^.inlinenumber:=number;
  1135. p^.inlineconst:=is_const;
  1136. p^.registers32:=0;
  1137. { p^.registers16:=0;
  1138. p^.registers8:=0; }
  1139. p^.registersfpu:=0;
  1140. {$ifdef SUPPORT_MMX}
  1141. p^.registersmmx:=0;
  1142. {$endif SUPPORT_MMX}
  1143. p^.resulttype:=nil;
  1144. geninlinenode:=p;
  1145. end;
  1146. { uses the callnode to create the new procinline node }
  1147. function genprocinlinenode(callp,code : ptree) : ptree;
  1148. var
  1149. p : ptree;
  1150. begin
  1151. p:=getnode;
  1152. p^.disposetyp:=dt_nothing;
  1153. p^.treetype:=procinlinen;
  1154. p^.inlineprocsym:=callp^.symtableprocentry;
  1155. p^.retoffset:=-4; { less dangerous as zero (PM) }
  1156. p^.para_offset:=0;
  1157. p^.para_size:=p^.inlineprocsym^.definition^.para_size(target_os.stackalignment);
  1158. if ret_in_param(p^.inlineprocsym^.definition^.rettype.def) then
  1159. p^.para_size:=p^.para_size+target_os.size_of_pointer;
  1160. { copy args }
  1161. p^.inlinetree:=code;
  1162. p^.registers32:=code^.registers32;
  1163. p^.registersfpu:=code^.registersfpu;
  1164. {$ifdef SUPPORT_MMX}
  1165. p^.registersmmx:=0;
  1166. {$endif SUPPORT_MMX}
  1167. p^.resulttype:=p^.inlineprocsym^.definition^.rettype.def;
  1168. genprocinlinenode:=p;
  1169. end;
  1170. function gensetconstnode(s : pconstset;settype : psetdef) : ptree;
  1171. var
  1172. p : ptree;
  1173. begin
  1174. p:=getnode;
  1175. p^.disposetyp:=dt_nothing;
  1176. p^.treetype:=setconstn;
  1177. p^.registers32:=0;
  1178. p^.registersfpu:=0;
  1179. {$ifdef SUPPORT_MMX}
  1180. p^.registersmmx:=0;
  1181. {$endif SUPPORT_MMX}
  1182. p^.resulttype:=settype;
  1183. p^.left:=nil;
  1184. new(p^.value_set);
  1185. p^.value_set^:=s^;
  1186. gensetconstnode:=p;
  1187. end;
  1188. {$ifdef extdebug}
  1189. procedure compare_trees(oldp,p : ptree);
  1190. var
  1191. error_found : boolean;
  1192. begin
  1193. if oldp^.resulttype<>p^.resulttype then
  1194. begin
  1195. error_found:=true;
  1196. if is_equal(oldp^.resulttype,p^.resulttype) then
  1197. comment(v_debug,'resulttype fields are different but equal')
  1198. else
  1199. comment(v_warning,'resulttype fields are really different');
  1200. end;
  1201. if oldp^.treetype<>p^.treetype then
  1202. begin
  1203. comment(v_warning,'treetype field different');
  1204. error_found:=true;
  1205. end
  1206. else
  1207. comment(v_debug,' treetype '+tostr(longint(oldp^.treetype)));
  1208. if oldp^.error<>p^.error then
  1209. begin
  1210. comment(v_warning,'error field different');
  1211. error_found:=true;
  1212. end;
  1213. if oldp^.disposetyp<>p^.disposetyp then
  1214. begin
  1215. comment(v_warning,'disposetyp field different');
  1216. error_found:=true;
  1217. end;
  1218. { is true, if the right and left operand are swaped }
  1219. if oldp^.swaped<>p^.swaped then
  1220. begin
  1221. comment(v_warning,'swaped field different');
  1222. error_found:=true;
  1223. end;
  1224. { the location of the result of this node }
  1225. if oldp^.location.loc<>p^.location.loc then
  1226. begin
  1227. comment(v_warning,'location.loc field different');
  1228. error_found:=true;
  1229. end;
  1230. { the number of registers needed to evalute the node }
  1231. if oldp^.registers32<>p^.registers32 then
  1232. begin
  1233. comment(v_warning,'registers32 field different');
  1234. comment(v_warning,' old '+tostr(oldp^.registers32)+'<> new '+tostr(p^.registers32));
  1235. error_found:=true;
  1236. end;
  1237. if oldp^.registersfpu<>p^.registersfpu then
  1238. begin
  1239. comment(v_warning,'registersfpu field different');
  1240. error_found:=true;
  1241. end;
  1242. {$ifdef SUPPORT_MMX}
  1243. if oldp^.registersmmx<>p^.registersmmx then
  1244. begin
  1245. comment(v_warning,'registersmmx field different');
  1246. error_found:=true;
  1247. end;
  1248. {$endif SUPPORT_MMX}
  1249. if oldp^.left<>p^.left then
  1250. begin
  1251. comment(v_warning,'left field different');
  1252. error_found:=true;
  1253. end;
  1254. if oldp^.right<>p^.right then
  1255. begin
  1256. comment(v_warning,'right field different');
  1257. error_found:=true;
  1258. end;
  1259. if oldp^.fileinfo.line<>p^.fileinfo.line then
  1260. begin
  1261. comment(v_warning,'fileinfo.line field different');
  1262. error_found:=true;
  1263. end;
  1264. if oldp^.fileinfo.column<>p^.fileinfo.column then
  1265. begin
  1266. comment(v_warning,'fileinfo.column field different');
  1267. error_found:=true;
  1268. end;
  1269. if oldp^.fileinfo.fileindex<>p^.fileinfo.fileindex then
  1270. begin
  1271. comment(v_warning,'fileinfo.fileindex field different');
  1272. error_found:=true;
  1273. end;
  1274. if oldp^.localswitches<>p^.localswitches then
  1275. begin
  1276. comment(v_warning,'localswitches field different');
  1277. error_found:=true;
  1278. end;
  1279. {$ifdef extdebug}
  1280. if oldp^.firstpasscount<>p^.firstpasscount then
  1281. begin
  1282. comment(v_warning,'firstpasscount field different');
  1283. error_found:=true;
  1284. end;
  1285. {$endif extdebug}
  1286. if oldp^.treetype=p^.treetype then
  1287. case oldp^.treetype of
  1288. addn :
  1289. begin
  1290. if oldp^.use_strconcat<>p^.use_strconcat then
  1291. begin
  1292. comment(v_warning,'use_strconcat field different');
  1293. error_found:=true;
  1294. end;
  1295. if oldp^.string_typ<>p^.string_typ then
  1296. begin
  1297. comment(v_warning,'stringtyp field different');
  1298. error_found:=true;
  1299. end;
  1300. end;
  1301. callparan :
  1302. {(is_colon_para : boolean;exact_match_found : boolean);}
  1303. begin
  1304. if oldp^.is_colon_para<>p^.is_colon_para then
  1305. begin
  1306. comment(v_warning,'use_strconcat field different');
  1307. error_found:=true;
  1308. end;
  1309. if oldp^.exact_match_found<>p^.exact_match_found then
  1310. begin
  1311. comment(v_warning,'exact_match_found field different');
  1312. error_found:=true;
  1313. end;
  1314. end;
  1315. assignn :
  1316. {(assigntyp : tassigntyp;concat_string : boolean);}
  1317. begin
  1318. if oldp^.assigntyp<>p^.assigntyp then
  1319. begin
  1320. comment(v_warning,'assigntyp field different');
  1321. error_found:=true;
  1322. end;
  1323. if oldp^.concat_string<>p^.concat_string then
  1324. begin
  1325. comment(v_warning,'concat_string field different');
  1326. error_found:=true;
  1327. end;
  1328. end;
  1329. loadn :
  1330. {(symtableentry : psym;symtable : psymtable;
  1331. is_absolute,is_first : boolean);}
  1332. begin
  1333. if oldp^.symtableentry<>p^.symtableentry then
  1334. begin
  1335. comment(v_warning,'symtableentry field different');
  1336. error_found:=true;
  1337. end;
  1338. if oldp^.symtable<>p^.symtable then
  1339. begin
  1340. comment(v_warning,'symtable field different');
  1341. error_found:=true;
  1342. end;
  1343. if oldp^.is_absolute<>p^.is_absolute then
  1344. begin
  1345. comment(v_warning,'is_absolute field different');
  1346. error_found:=true;
  1347. end;
  1348. if oldp^.is_first<>p^.is_first then
  1349. begin
  1350. comment(v_warning,'is_first field different');
  1351. error_found:=true;
  1352. end;
  1353. end;
  1354. calln :
  1355. {(symtableprocentry : pprocsym;
  1356. symtableproc : psymtable;procdefinition : pprocdef;
  1357. methodpointer : ptree;
  1358. no_check,unit_specific : boolean);}
  1359. begin
  1360. if oldp^.symtableprocentry<>p^.symtableprocentry then
  1361. begin
  1362. comment(v_warning,'symtableprocentry field different');
  1363. error_found:=true;
  1364. end;
  1365. if oldp^.symtableproc<>p^.symtableproc then
  1366. begin
  1367. comment(v_warning,'symtableproc field different');
  1368. error_found:=true;
  1369. end;
  1370. if oldp^.procdefinition<>p^.procdefinition then
  1371. begin
  1372. comment(v_warning,'procdefinition field different');
  1373. error_found:=true;
  1374. end;
  1375. if oldp^.methodpointer<>p^.methodpointer then
  1376. begin
  1377. comment(v_warning,'methodpointer field different');
  1378. error_found:=true;
  1379. end;
  1380. if oldp^.no_check<>p^.no_check then
  1381. begin
  1382. comment(v_warning,'no_check field different');
  1383. error_found:=true;
  1384. end;
  1385. if oldp^.unit_specific<>p^.unit_specific then
  1386. begin
  1387. error_found:=true;
  1388. comment(v_warning,'unit_specific field different');
  1389. end;
  1390. end;
  1391. ordconstn :
  1392. begin
  1393. if oldp^.value<>p^.value then
  1394. begin
  1395. comment(v_warning,'value field different');
  1396. error_found:=true;
  1397. end;
  1398. end;
  1399. realconstn :
  1400. begin
  1401. if oldp^.value_real<>p^.value_real then
  1402. begin
  1403. comment(v_warning,'valued field different');
  1404. error_found:=true;
  1405. end;
  1406. if oldp^.lab_real<>p^.lab_real then
  1407. begin
  1408. comment(v_warning,'labnumber field different');
  1409. error_found:=true;
  1410. end;
  1411. { if oldp^.realtyp<>p^.realtyp then
  1412. begin
  1413. comment(v_warning,'realtyp field different');
  1414. error_found:=true;
  1415. end; }
  1416. end;
  1417. end;
  1418. if not error_found then
  1419. comment(v_warning,'did not find difference in trees');
  1420. end;
  1421. {$endif extdebug}
  1422. function equal_trees(t1,t2 : ptree) : boolean;
  1423. begin
  1424. if t1^.treetype=t2^.treetype then
  1425. begin
  1426. case t1^.treetype of
  1427. addn,
  1428. muln,
  1429. equaln,
  1430. orn,
  1431. xorn,
  1432. andn,
  1433. unequaln:
  1434. begin
  1435. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1436. equal_trees(t1^.right,t2^.right)) or
  1437. (equal_trees(t1^.right,t2^.left) and
  1438. equal_trees(t1^.left,t2^.right));
  1439. end;
  1440. subn,
  1441. divn,
  1442. modn,
  1443. assignn,
  1444. ltn,
  1445. lten,
  1446. gtn,
  1447. gten,
  1448. inn,
  1449. shrn,
  1450. shln,
  1451. slashn,
  1452. rangen:
  1453. begin
  1454. equal_trees:=(equal_trees(t1^.left,t2^.left) and
  1455. equal_trees(t1^.right,t2^.right));
  1456. end;
  1457. unaryminusn,
  1458. notn,
  1459. derefn,
  1460. addrn:
  1461. begin
  1462. equal_trees:=(equal_trees(t1^.left,t2^.left));
  1463. end;
  1464. loadn:
  1465. begin
  1466. equal_trees:=(t1^.symtableentry=t2^.symtableentry)
  1467. { not necessary
  1468. and (t1^.symtable=t2^.symtable)};
  1469. end;
  1470. {
  1471. subscriptn,
  1472. ordconstn,typeconvn,calln,callparan,
  1473. realconstn,asmn,vecn,
  1474. stringconstn,funcretn,selfn,
  1475. inlinen,niln,errorn,
  1476. typen,hnewn,hdisposen,newn,
  1477. disposen,setelen,setconstrn
  1478. }
  1479. else equal_trees:=false;
  1480. end;
  1481. end
  1482. else
  1483. equal_trees:=false;
  1484. end;
  1485. procedure set_unique(p : ptree);
  1486. begin
  1487. if assigned(p) then
  1488. begin
  1489. case p^.treetype of
  1490. vecn:
  1491. p^.callunique:=true;
  1492. typeconvn,subscriptn,derefn:
  1493. set_unique(p^.left);
  1494. end;
  1495. end;
  1496. end;
  1497. procedure set_funcret_is_valid(p : ptree);
  1498. begin
  1499. if assigned(p) then
  1500. begin
  1501. case p^.treetype of
  1502. funcretn:
  1503. begin
  1504. if p^.is_first_funcret then
  1505. pprocinfo(p^.funcretprocinfo)^.funcret_state:=vs_assigned;
  1506. end;
  1507. vecn,typeconvn,subscriptn,derefn:
  1508. set_funcret_is_valid(p^.left);
  1509. end;
  1510. end;
  1511. end;
  1512. procedure set_varstate(p : ptree;must_be_valid : boolean);
  1513. begin
  1514. if not assigned(p) then
  1515. exit
  1516. else
  1517. begin
  1518. if p^.varstateset then
  1519. exit;
  1520. case p^.treetype of
  1521. typeconvn :
  1522. if p^.convtyp in
  1523. [
  1524. tc_cchar_2_pchar,
  1525. tc_cstring_2_pchar,
  1526. tc_array_2_pointer
  1527. ] then
  1528. set_varstate(p^.left,false)
  1529. else if p^.convtyp in
  1530. [
  1531. tc_pchar_2_string,
  1532. tc_pointer_2_array
  1533. ] then
  1534. set_varstate(p^.left,true)
  1535. else
  1536. set_varstate(p^.left,must_be_valid);
  1537. subscriptn :
  1538. set_varstate(p^.left,must_be_valid);
  1539. vecn:
  1540. begin
  1541. if (p^.left^.resulttype^.deftype in [stringdef,arraydef]) then
  1542. set_varstate(p^.left,must_be_valid)
  1543. else
  1544. set_varstate(p^.left,true);
  1545. set_varstate(p^.right,true);
  1546. end;
  1547. { do not parse calln }
  1548. calln : ;
  1549. callparan:
  1550. begin
  1551. set_varstate(p^.left,must_be_valid);
  1552. set_varstate(p^.right,must_be_valid);
  1553. end;
  1554. loadn :
  1555. if (p^.symtableentry^.typ=varsym) then
  1556. begin
  1557. if must_be_valid and p^.is_first then
  1558. begin
  1559. if (pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found) or
  1560. (pvarsym(p^.symtableentry)^.varstate=vs_set_but_first_not_passed) then
  1561. if (assigned(pvarsym(p^.symtableentry)^.owner) and
  1562. assigned(aktprocsym) and
  1563. (pvarsym(p^.symtableentry)^.owner = aktprocsym^.definition^.localst)) then
  1564. begin
  1565. if p^.symtable^.symtabletype=localsymtable then
  1566. CGMessage1(sym_n_uninitialized_local_variable,pvarsym(p^.symtableentry)^.name)
  1567. else
  1568. CGMessage1(sym_n_uninitialized_variable,pvarsym(p^.symtableentry)^.name);
  1569. end;
  1570. end;
  1571. if (p^.is_first) then
  1572. begin
  1573. if pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found then
  1574. { this can only happen at left of an assignment, no ? PM }
  1575. if (parsing_para_level=0) and not must_be_valid then
  1576. pvarsym(p^.symtableentry)^.varstate:=vs_assigned
  1577. else
  1578. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1579. if pvarsym(p^.symtableentry)^.varstate=vs_set_but_first_not_passed then
  1580. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1581. p^.is_first:=false;
  1582. end
  1583. else
  1584. begin
  1585. if (pvarsym(p^.symtableentry)^.varstate=vs_assigned) and
  1586. (must_be_valid or (parsing_para_level>0) or
  1587. (p^.resulttype^.deftype=procvardef)) then
  1588. pvarsym(p^.symtableentry)^.varstate:=vs_used;
  1589. if (pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found) and
  1590. (must_be_valid or (parsing_para_level>0) or
  1591. (p^.resulttype^.deftype=procvardef)) then
  1592. pvarsym(p^.symtableentry)^.varstate:=vs_set_but_first_not_passed;
  1593. end;
  1594. end;
  1595. funcretn:
  1596. begin
  1597. { no claim if setting higher return value_str }
  1598. if must_be_valid and
  1599. (procinfo=pprocinfo(p^.funcretprocinfo)) and
  1600. ((procinfo^.funcret_state=vs_declared) or
  1601. ((p^.is_first_funcret) and
  1602. (procinfo^.funcret_state=vs_declared_and_first_found))) then
  1603. begin
  1604. CGMessage(sym_w_function_result_not_set);
  1605. { avoid multiple warnings }
  1606. procinfo^.funcret_state:=vs_assigned;
  1607. end;
  1608. if p^.is_first_funcret and not must_be_valid then
  1609. pprocinfo(p^.funcretprocinfo)^.funcret_state:=vs_assigned;
  1610. end;
  1611. else
  1612. begin
  1613. {internalerror(565656);}
  1614. end;
  1615. end;{case }
  1616. p^.varstateset:=true;
  1617. end;
  1618. end;
  1619. procedure clear_location(var loc : tlocation);
  1620. begin
  1621. loc.loc:=LOC_INVALID;
  1622. end;
  1623. {This is needed if you want to be able to delete the string with the nodes !!}
  1624. procedure set_location(var destloc,sourceloc : tlocation);
  1625. begin
  1626. destloc:= sourceloc;
  1627. end;
  1628. procedure swap_location(var destloc,sourceloc : tlocation);
  1629. var
  1630. swapl : tlocation;
  1631. begin
  1632. swapl := destloc;
  1633. destloc := sourceloc;
  1634. sourceloc := swapl;
  1635. end;
  1636. function get_ordinal_value(p : ptree) : longint;
  1637. begin
  1638. if p^.treetype=ordconstn then
  1639. get_ordinal_value:=p^.value
  1640. else
  1641. begin
  1642. Message(type_e_ordinal_expr_expected);
  1643. get_ordinal_value:=0;
  1644. end;
  1645. end;
  1646. function is_constnode(p : ptree) : boolean;
  1647. begin
  1648. is_constnode:=(p^.treetype in [ordconstn,realconstn,stringconstn,fixconstn,setconstn]);
  1649. end;
  1650. function is_constintnode(p : ptree) : boolean;
  1651. begin
  1652. is_constintnode:=(p^.treetype=ordconstn) and is_integer(p^.resulttype);
  1653. end;
  1654. function is_constcharnode(p : ptree) : boolean;
  1655. begin
  1656. is_constcharnode:=(p^.treetype=ordconstn) and is_char(p^.resulttype);
  1657. end;
  1658. function is_constrealnode(p : ptree) : boolean;
  1659. begin
  1660. is_constrealnode:=(p^.treetype=realconstn);
  1661. end;
  1662. function is_constboolnode(p : ptree) : boolean;
  1663. begin
  1664. is_constboolnode:=(p^.treetype=ordconstn) and is_boolean(p^.resulttype);
  1665. end;
  1666. function str_length(p : ptree) : longint;
  1667. begin
  1668. str_length:=p^.length;
  1669. end;
  1670. function is_emptyset(p : ptree):boolean;
  1671. {
  1672. return true if set s is empty
  1673. }
  1674. var
  1675. i : longint;
  1676. begin
  1677. i:=0;
  1678. if p^.treetype=setconstn then
  1679. begin
  1680. while (i<32) and (p^.value_set^[i]=0) do
  1681. inc(i);
  1682. end;
  1683. is_emptyset:=(i=32);
  1684. end;
  1685. {*****************************************************************************
  1686. Case Helpers
  1687. *****************************************************************************}
  1688. function case_count_labels(root : pcaserecord) : longint;
  1689. var
  1690. _l : longint;
  1691. procedure count(p : pcaserecord);
  1692. begin
  1693. inc(_l);
  1694. if assigned(p^.less) then
  1695. count(p^.less);
  1696. if assigned(p^.greater) then
  1697. count(p^.greater);
  1698. end;
  1699. begin
  1700. _l:=0;
  1701. count(root);
  1702. case_count_labels:=_l;
  1703. end;
  1704. function case_get_max(root : pcaserecord) : longint;
  1705. var
  1706. hp : pcaserecord;
  1707. begin
  1708. hp:=root;
  1709. while assigned(hp^.greater) do
  1710. hp:=hp^.greater;
  1711. case_get_max:=hp^._high;
  1712. end;
  1713. function case_get_min(root : pcaserecord) : longint;
  1714. var
  1715. hp : pcaserecord;
  1716. begin
  1717. hp:=root;
  1718. while assigned(hp^.less) do
  1719. hp:=hp^.less;
  1720. case_get_min:=hp^._low;
  1721. end;
  1722. end.
  1723. {
  1724. $Log$
  1725. Revision 1.111 2000-02-09 13:23:09 peter
  1726. * log truncated
  1727. Revision 1.110 2000/01/26 12:02:30 peter
  1728. * abstractprocdef.para_size needs alignment parameter
  1729. * secondcallparan gets para_alignment size instead of dword_align
  1730. Revision 1.109 2000/01/09 23:16:07 peter
  1731. * added st_default stringtype
  1732. * genstringconstnode extended with stringtype parameter using st_default
  1733. will do the old behaviour
  1734. Revision 1.108 2000/01/07 01:14:48 peter
  1735. * updated copyright to 2000
  1736. Revision 1.107 2000/01/06 01:10:33 pierre
  1737. * fixes for set_varstate on conversions
  1738. Revision 1.106 1999/12/22 01:01:52 peter
  1739. - removed freelabel()
  1740. * added undefined label detection in internal assembler, this prevents
  1741. a lot of ld crashes and wrong .o files
  1742. * .o files aren't written anymore if errors have occured
  1743. * inlining of assembler labels is now correct
  1744. Revision 1.105 1999/12/14 09:58:42 florian
  1745. + compiler checks now if a goto leaves an exception block
  1746. Revision 1.104 1999/11/30 10:40:59 peter
  1747. + ttype, tsymlist
  1748. Revision 1.103 1999/11/18 15:34:51 pierre
  1749. * Notes/Hints for local syms changed to
  1750. Set_varstate function
  1751. Revision 1.102 1999/11/17 17:05:07 pierre
  1752. * Notes/hints changes
  1753. Revision 1.101 1999/11/06 14:34:31 peter
  1754. * truncated log to 20 revs
  1755. Revision 1.100 1999/10/22 14:37:31 peter
  1756. * error when properties are passed to var parameters
  1757. Revision 1.99 1999/09/27 23:45:03 peter
  1758. * procinfo is now a pointer
  1759. * support for result setting in sub procedure
  1760. Revision 1.98 1999/09/26 21:30:22 peter
  1761. + constant pointer support which can happend with typecasting like
  1762. const p=pointer(1)
  1763. * better procvar parsing in typed consts
  1764. Revision 1.97 1999/09/17 17:14:13 peter
  1765. * @procvar fixes for tp mode
  1766. * @<id>:= gives now an error
  1767. Revision 1.96 1999/09/16 11:34:59 pierre
  1768. * typo correction
  1769. Revision 1.95 1999/09/10 18:48:11 florian
  1770. * some bug fixes (e.g. must_be_valid and procinfo^.funcret_is_valid)
  1771. * most things for stored properties fixed
  1772. Revision 1.94 1999/09/07 07:52:20 peter
  1773. * > < >= <= support for boolean
  1774. * boolean constants are now calculated like integer constants
  1775. Revision 1.93 1999/08/27 10:38:31 pierre
  1776. + EXTTEMPREGDEBUG code added
  1777. Revision 1.92 1999/08/26 21:10:08 peter
  1778. * better error recovery for case
  1779. Revision 1.91 1999/08/23 23:26:00 pierre
  1780. + TEMPREGDEBUG code, test of register allocation
  1781. if a tree uses more than registers32 regs then
  1782. internalerror(10) is issued
  1783. + EXTTEMPREGDEBUG will also give internalerror(10) if
  1784. a same register is freed twice (happens in several part
  1785. of current compiler like addn for strings and sets)
  1786. }