ncgset.pas 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl and Carl Eric Codere
  4. Generate generic assembler for in set/case nodes
  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. unit ncgset;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. node,nset,cpubase,cgbase,cgobj,aasmbase,aasmtai,globals;
  23. type
  24. tcgsetelementnode = class(tsetelementnode)
  25. procedure pass_2;override;
  26. end;
  27. tcginnode = class(tinnode)
  28. procedure pass_2;override;
  29. protected
  30. {# Routine to test bitnumber in bitnumber register on value
  31. in value register. The __result register should be set
  32. to one if the bit is set, otherwise __result register
  33. should be set to zero.
  34. Should be overriden on processors which have specific
  35. instructions to do bit tests.
  36. }
  37. procedure emit_bit_test_reg_reg(list : taasmoutput; bitnumber : tregister;
  38. value : tregister; __result :tregister);virtual;
  39. end;
  40. tcgcasenode = class(tcasenode)
  41. {
  42. Emits the case node statement. Contrary to the intel
  43. 80x86 version, this version does not emit jump tables,
  44. because of portability problems.
  45. }
  46. procedure pass_2;override;
  47. protected
  48. with_sign : boolean;
  49. opsize : tcgsize;
  50. jmp_gt,jmp_lt,jmp_le : topcmp;
  51. { register with case expression }
  52. hregister,hregister2 : tregister;
  53. endlabel,elselabel : tasmlabel;
  54. { true, if we can omit the range check of the jump table }
  55. jumptable_no_range : boolean;
  56. { has the implementation jumptable support }
  57. min_label : tconstexprint;
  58. procedure optimizevalues(var max_linear_list:longint;var max_dist:cardinal);virtual;
  59. function has_jumptable : boolean;virtual;
  60. procedure genjumptable(hp : pcaserecord;min_,max_ : longint); virtual;
  61. procedure genlinearlist(hp : pcaserecord); virtual;
  62. procedure genlinearcmplist(hp : pcaserecord); virtual;
  63. procedure gentreejmp(p : pcaserecord);
  64. end;
  65. implementation
  66. uses
  67. globtype,systems,
  68. verbose,
  69. symconst,symdef,defutil,
  70. paramgr,
  71. pass_2,
  72. nbas,ncon,nflw,
  73. tgobj,ncgutil,regvars,rgobj,cpuinfo;
  74. {*****************************************************************************
  75. TCGSETELEMENTNODE
  76. *****************************************************************************}
  77. procedure tcgsetelementnode.pass_2;
  78. begin
  79. { load first value in 32bit register }
  80. secondpass(left);
  81. if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
  82. location_force_reg(exprasmlist,left.location,OS_32,false);
  83. { also a second value ? }
  84. if assigned(right) then
  85. begin
  86. secondpass(right);
  87. if codegenerror then
  88. exit;
  89. if right.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
  90. location_force_reg(exprasmlist,right.location,OS_32,false);
  91. end;
  92. { we doesn't modify the left side, we check only the type }
  93. location_copy(location,left.location);
  94. end;
  95. {*****************************************************************************
  96. *****************************************************************************}
  97. {**********************************************************************}
  98. { Description: Emit operation to do a bit test, where the bitnumber }
  99. { to test is in the bitnumber register. The value to test against is }
  100. { located in the value register. }
  101. { WARNING: Bitnumber register value is DESTROYED! }
  102. { __Result register is set to 1, if the bit is set otherwise, __Result}
  103. { is set to zero. __RESULT register is also used as scratch. }
  104. {**********************************************************************}
  105. procedure tcginnode.emit_bit_test_reg_reg(list : taasmoutput; bitnumber : tregister; value : tregister; __result :tregister);
  106. begin
  107. { first make sure that the bit number is modulo 32 }
  108. { not necessary, since if it's > 31, we have a range error -> will }
  109. { be caught when range checking is on! (JM) }
  110. { cg.a_op_const_reg(list,OP_AND,31,bitnumber); }
  111. { rotate value register "bitnumber" bits to the right }
  112. cg.a_op_reg_reg_reg(list,OP_SHR,OS_INT,bitnumber,value,__result);
  113. { extract the bit we want }
  114. cg.a_op_const_reg(list,OP_AND,OS_INT,1,__result);
  115. end;
  116. procedure tcginnode.pass_2;
  117. type
  118. Tsetpart=record
  119. range : boolean; {Part is a range.}
  120. start,stop : byte; {Start/stop when range; Stop=element when an element.}
  121. end;
  122. var
  123. l,l2,l3 : tasmlabel;
  124. adjustment : longint;
  125. href : treference;
  126. hr,hr2,hr3,
  127. pleftreg : tregister;
  128. setparts : array[1..8] of Tsetpart;
  129. opsize : tcgsize;
  130. genjumps,
  131. use_small,
  132. ranges : boolean;
  133. i,numparts : byte;
  134. function analizeset(const Aset:Tconstset;is_small:boolean):boolean;
  135. var
  136. compares,maxcompares:word;
  137. i:byte;
  138. begin
  139. analizeset:=false;
  140. ranges:=false;
  141. numparts:=0;
  142. compares:=0;
  143. { Lots of comparisions take a lot of time, so do not allow
  144. too much comparisions. 8 comparisions are, however, still
  145. smalller than emitting the set }
  146. if cs_littlesize in aktglobalswitches then
  147. maxcompares:=8
  148. else
  149. maxcompares:=5;
  150. { when smallset is possible allow only 3 compares the smallset
  151. code is for littlesize also smaller when more compares are used }
  152. if is_small then
  153. maxcompares:=3;
  154. for i:=0 to 255 do
  155. if i in Aset then
  156. begin
  157. if (numparts=0) or (i<>setparts[numparts].stop+1) then
  158. begin
  159. {Set element is a separate element.}
  160. inc(compares);
  161. if compares>maxcompares then
  162. exit;
  163. inc(numparts);
  164. setparts[numparts].range:=false;
  165. setparts[numparts].stop:=i;
  166. end
  167. else
  168. {Set element is part of a range.}
  169. if not setparts[numparts].range then
  170. begin
  171. {Transform an element into a range.}
  172. setparts[numparts].range:=true;
  173. setparts[numparts].start:=setparts[numparts].stop;
  174. setparts[numparts].stop:=i;
  175. ranges := true;
  176. { there's only one compare per range anymore. Only a }
  177. { sub is added, but that's much faster than a }
  178. { cmp/jcc combo so neglect its effect }
  179. { inc(compares);
  180. if compares>maxcompares then
  181. exit; }
  182. end
  183. else
  184. begin
  185. {Extend a range.}
  186. setparts[numparts].stop:=i;
  187. end;
  188. end;
  189. analizeset:=true;
  190. end;
  191. begin
  192. { We check first if we can generate jumps, this can be done
  193. because the resulttype.def is already set in firstpass }
  194. { check if we can use smallset operation using btl which is limited
  195. to 32 bits, the left side may also not contain higher values !! }
  196. use_small:=(tsetdef(right.resulttype.def).settype=smallset) and
  197. ((left.resulttype.def.deftype=orddef) and (torddef(left.resulttype.def).high<=32) or
  198. (left.resulttype.def.deftype=enumdef) and (tenumdef(left.resulttype.def).max<=32));
  199. { Can we generate jumps? Possible for all types of sets }
  200. genjumps:=(right.nodetype=setconstn) and
  201. analizeset(Tsetconstnode(right).value_set^,use_small);
  202. { calculate both operators }
  203. { the complex one first }
  204. firstcomplex(self);
  205. secondpass(left);
  206. { Only process the right if we are not generating jumps }
  207. if not genjumps then
  208. secondpass(right);
  209. if codegenerror then
  210. exit;
  211. { ofcourse not commutative }
  212. if nf_swaped in flags then
  213. swapleftright;
  214. { location is always LOC_JUMP }
  215. location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
  216. { allocate a register for the result }
  217. location.register := rg.getregisterint(exprasmlist,location.size);
  218. if genjumps then
  219. begin
  220. { Get a label to jump to the end }
  221. objectlibrary.getlabel(l);
  222. { clear the register value, indicating result is FALSE }
  223. cg.a_load_const_reg(exprasmlist,location.size,0,location.register);
  224. opsize := def_cgsize(left.resulttype.def);
  225. { If register is used, use only lower 8 bits }
  226. if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
  227. begin
  228. { for ranges we always need a 32bit register, because then we }
  229. { use the register as base in a reference (JM) }
  230. if ranges then
  231. begin
  232. pleftreg:=rg.makeregsize(left.location.register,OS_INT);
  233. cg.a_load_reg_reg(exprasmlist,left.location.size,OS_INT,left.location.register,pleftreg);
  234. if opsize <> OS_INT then
  235. cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,255,pleftreg);
  236. opsize := OS_INT;
  237. end
  238. else
  239. { otherwise simply use the lower 8 bits (no "and" }
  240. { necessary this way) (JM) }
  241. begin
  242. pleftreg:=rg.makeregsize(left.location.register,OS_8);
  243. opsize := OS_8;
  244. end;
  245. end
  246. else
  247. begin
  248. { load the value in a register }
  249. opsize := OS_INT;
  250. pleftreg:=rg.getregisterint(exprasmlist,opsize);
  251. cg.a_load_ref_reg(exprasmlist,def_cgsize(left.resulttype.def),opsize,left.location.reference,pleftreg);
  252. end;
  253. { how much have we already substracted from the x in the }
  254. { "x in [y..z]" expression }
  255. adjustment := 0;
  256. hr:=NR_NO;
  257. for i:=1 to numparts do
  258. if setparts[i].range then
  259. { use fact that a <= x <= b <=> cardinal(x-a) <= cardinal(b-a) }
  260. begin
  261. { is the range different from all legal values? }
  262. if (setparts[i].stop-setparts[i].start <> 255) then
  263. begin
  264. { yes, is the lower bound <> 0? }
  265. if (setparts[i].start <> 0) then
  266. { we're going to substract from the left register, }
  267. { so in case of a LOC_CREGISTER first move the value }
  268. { to edi (not done before because now we can do the }
  269. { move and substract in one instruction with LEA) }
  270. if (left.location.loc = LOC_CREGISTER) and
  271. (hr<>pleftreg) then
  272. begin
  273. hr:=rg.getregisterint(exprasmlist,OS_INT);
  274. cg.a_op_const_reg_reg(exprasmlist,OP_SUB,opsize,setparts[i].start,pleftreg,hr);
  275. pleftreg:=hr;
  276. opsize := OS_INT;
  277. end
  278. else
  279. begin
  280. { otherwise, the value is already in a register }
  281. { that can be modified }
  282. cg.a_op_const_reg(exprasmlist,OP_SUB,opsize,
  283. setparts[i].start-adjustment,pleftreg)
  284. end;
  285. { new total value substracted from x: }
  286. { adjustment + (setparts[i].start - adjustment) }
  287. adjustment := setparts[i].start;
  288. { check if result < b-a+1 (not "result <= b-a", since }
  289. { we need a carry in case the element is in the range }
  290. { (this will never overflow since we check at the }
  291. { beginning whether stop-start <> 255) }
  292. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_B,
  293. setparts[i].stop-setparts[i].start+1,pleftreg,l);
  294. end
  295. else
  296. { if setparts[i].start = 0 and setparts[i].stop = 255, }
  297. { it's always true since "in" is only allowed for bytes }
  298. begin
  299. cg.a_jmp_always(exprasmlist,l);
  300. end;
  301. end
  302. else
  303. begin
  304. { Emit code to check if left is an element }
  305. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,
  306. setparts[i].stop-adjustment,pleftreg,l);
  307. end;
  308. { To compensate for not doing a second pass }
  309. right.location.reference.symbol:=nil;
  310. objectlibrary.getlabel(l3);
  311. cg.a_jmp_always(exprasmlist,l3);
  312. { Now place the end label if IN success }
  313. cg.a_label(exprasmlist,l);
  314. { result register is 1 }
  315. cg.a_load_const_reg(exprasmlist,location.size,1,location.register);
  316. { in case value is not found }
  317. cg.a_label(exprasmlist,l3);
  318. case left.location.loc of
  319. LOC_CREGISTER :
  320. rg.ungetregisterint(exprasmlist,pleftreg);
  321. LOC_REGISTER :
  322. rg.ungetregisterint(exprasmlist,pleftreg);
  323. else
  324. begin
  325. reference_release(exprasmlist,left.location.reference);
  326. rg.ungetregisterint(exprasmlist,pleftreg);
  327. end;
  328. end;
  329. end
  330. else
  331. {*****************************************************************}
  332. { NO JUMP TABLE GENERATION }
  333. {*****************************************************************}
  334. begin
  335. { We will now generated code to check the set itself, no jmps,
  336. handle smallsets separate, because it allows faster checks }
  337. if use_small then
  338. begin
  339. {**************************** SMALL SET **********************}
  340. if left.nodetype=ordconstn then
  341. begin
  342. location_force_reg(exprasmlist,right.location,OS_32,true);
  343. { then SHR the register }
  344. cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_INT,
  345. tordconstnode(left).value and 31,right.location.register,location.register);
  346. rg.ungetregisterint(exprasmlist,right.location.register);
  347. { then extract the lowest bit }
  348. cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,1,location.register);
  349. end
  350. else
  351. begin
  352. case left.location.loc of
  353. LOC_REGISTER,
  354. LOC_CREGISTER:
  355. begin
  356. hr3:=rg.makeregsize(left.location.register,OS_INT);
  357. cg.a_load_reg_reg(exprasmlist,left.location.size,OS_INT,left.location.register,hr3);
  358. hr:=rg.getregisterint(exprasmlist,OS_INT);
  359. cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,hr3,hr);
  360. end;
  361. else
  362. begin
  363. hr:=rg.getregisterint(exprasmlist,OS_INT);
  364. cg.a_load_ref_reg(exprasmlist,def_cgsize(left.resulttype.def),OS_INT,
  365. left.location.reference,hr);
  366. location_release(exprasmlist,left.location);
  367. end;
  368. end;
  369. location_force_reg(exprasmlist,right.location,OS_32,true);
  370. { emit bit test operation }
  371. emit_bit_test_reg_reg(exprasmlist,hr,right.location.register,location.register);
  372. { free the resources }
  373. rg.ungetregisterint(exprasmlist,right.location.register);
  374. { free bitnumber register }
  375. rg.ungetregisterint(exprasmlist,hr);
  376. end;
  377. end
  378. else
  379. {************************** NOT SMALL SET ********************}
  380. begin
  381. if right.location.loc=LOC_CONSTANT then
  382. begin
  383. { this section has not been tested! }
  384. { can it actually occur currently? CEC }
  385. { yes: "if bytevar in [1,3,5,7,9,11,13,15]" (JM) }
  386. objectlibrary.getlabel(l);
  387. objectlibrary.getlabel(l2);
  388. case left.location.loc of
  389. LOC_REGISTER,
  390. LOC_CREGISTER:
  391. begin
  392. hr:=rg.makeregsize(left.location.register,OS_INT);
  393. cg.a_load_reg_reg(exprasmlist,left.location.size,OS_INT,left.location.register,hr);
  394. cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_BE,31,hr,l);
  395. { reset of result register is done in routine entry }
  396. cg.a_jmp_always(exprasmlist,l2);
  397. cg.a_label(exprasmlist,l);
  398. { We have to load the value into a register because
  399. btl does not accept values only refs or regs (PFV) }
  400. hr2:=rg.getregisterint(exprasmlist,OS_INT);
  401. cg.a_load_const_reg(exprasmlist,OS_INT,right.location.value,hr2);
  402. end;
  403. LOC_REFERENCE,
  404. LOC_CREFERENCE:
  405. begin
  406. cg.a_cmp_const_ref_label(exprasmlist,OS_8,OC_BE,31,left.location.reference,l);
  407. cg.a_jmp_always(exprasmlist,l2);
  408. cg.a_label(exprasmlist,l);
  409. location_release(exprasmlist,left.location);
  410. hr:=rg.getregisterint(exprasmlist,OS_INT);
  411. cg.a_load_ref_reg(exprasmlist,OS_INT,OS_INT,left.location.reference,hr);
  412. { We have to load the value into a register because
  413. btl does not accept values only refs or regs (PFV) }
  414. hr2:=rg.getregisterint(exprasmlist,OS_INT);
  415. cg.a_load_const_reg(exprasmlist,OS_INT,right.location.value,hr2);
  416. end;
  417. else
  418. internalerror(2002081002);
  419. end;
  420. { emit bit test operation }
  421. emit_bit_test_reg_reg(exprasmlist,hr,hr2,location.register);
  422. rg.ungetregisterint(exprasmlist,hr2);
  423. if not (left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
  424. rg.ungetregisterint(exprasmlist,hr);
  425. cg.a_label(exprasmlist,l2);
  426. end { of right.location.loc=LOC_CONSTANT }
  427. { do search in a normal set which could have >32 elementsm
  428. but also used if the left side contains higher values > 32 }
  429. else if left.nodetype=ordconstn then
  430. begin
  431. { use location.register as scratch register here }
  432. if (target_info.endian = endian_little) then
  433. inc(right.location.reference.offset,tordconstnode(left).value shr 3)
  434. else
  435. { adjust for endianess differences }
  436. inc(right.location.reference.offset,(tordconstnode(left).value shr 3) xor 3);
  437. cg.a_load_ref_reg(exprasmlist,OS_8,location.size,right.location.reference, location.register);
  438. location_release(exprasmlist,right.location);
  439. cg.a_op_const_reg(exprasmlist,OP_SHR,location.size,tordconstnode(left).value and 7,
  440. location.register);
  441. cg.a_op_const_reg(exprasmlist,OP_AND,location.size,1,location.register);
  442. end
  443. else
  444. begin
  445. location_force_reg(exprasmlist,left.location,OS_INT,true);
  446. pleftreg := left.location.register;
  447. location_freetemp(exprasmlist,left.location);
  448. hr := rg.getaddressregister(exprasmlist);
  449. cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,5,pleftreg,hr);
  450. cg.a_op_const_reg(exprasmlist,OP_SHL,OS_32,2,hr);
  451. href := right.location.reference;
  452. if (href.base = NR_NO) then
  453. href.base := hr
  454. else if (right.location.reference.index = NR_NO) then
  455. href.index := hr
  456. else
  457. begin
  458. reference_release(exprasmlist,href);
  459. hr2 := rg.getaddressregister(exprasmlist);
  460. cg.a_loadaddr_ref_reg(exprasmlist,href, hr2);
  461. reference_reset_base(href,hr2,0);
  462. href.index := hr;
  463. end;
  464. reference_release(exprasmlist,href);
  465. cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,href,location.register);
  466. rg.ungetregisterint(exprasmlist,pleftreg);
  467. hr := rg.getregisterint(exprasmlist,OS_32);
  468. cg.a_op_const_reg_reg(exprasmlist,OP_AND,OS_32,31,pleftreg,hr);
  469. cg.a_op_reg_reg(exprasmlist,OP_SHR,OS_32,hr,location.register);
  470. rg.ungetregisterint(exprasmlist,hr);
  471. cg.a_op_const_reg(exprasmlist,OP_AND,OS_32,1,location.register);
  472. end;
  473. end;
  474. end;
  475. location_freetemp(exprasmlist,right.location);
  476. end;
  477. {*****************************************************************************
  478. TCGCASENODE
  479. *****************************************************************************}
  480. procedure tcgcasenode.optimizevalues(var max_linear_list:longint;var max_dist:cardinal);
  481. begin
  482. { no changes by default }
  483. end;
  484. function tcgcasenode.has_jumptable : boolean;
  485. begin
  486. { No jumptable support in the default implementation }
  487. has_jumptable:=false;
  488. end;
  489. procedure tcgcasenode.genjumptable(hp : pcaserecord;min_,max_ : longint);
  490. begin
  491. internalerror(200209161);
  492. end;
  493. procedure tcgcasenode.genlinearlist(hp : pcaserecord);
  494. var
  495. first : boolean;
  496. last : TConstExprInt;
  497. scratch_reg: tregister;
  498. procedure genitem(t : pcaserecord);
  499. procedure gensub(value:longint);
  500. begin
  501. { here, since the sub and cmp are separate we need
  502. to move the result before subtract to a help
  503. register.
  504. }
  505. cg.a_load_reg_reg(exprasmlist, opsize, opsize, hregister, scratch_reg);
  506. cg.a_op_const_reg(exprasmlist, OP_SUB, opsize, value, hregister);
  507. end;
  508. begin
  509. if assigned(t^.less) then
  510. genitem(t^.less);
  511. { need we to test the first value }
  512. if first and (t^._low>get_min_value(left.resulttype.def)) then
  513. begin
  514. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,aword(t^._low),hregister,elselabel);
  515. end;
  516. if t^._low=t^._high then
  517. begin
  518. if t^._low-last=0 then
  519. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,0,hregister,t^.statement)
  520. else
  521. begin
  522. gensub(longint(t^._low-last));
  523. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,aword(t^._low-last),scratch_reg,t^.statement);
  524. end;
  525. last:=t^._low;
  526. end
  527. else
  528. begin
  529. { it begins with the smallest label, if the value }
  530. { is even smaller then jump immediately to the }
  531. { ELSE-label }
  532. if first then
  533. begin
  534. { have we to ajust the first value ? }
  535. if (t^._low>get_min_value(left.resulttype.def)) then
  536. gensub(longint(t^._low));
  537. end
  538. else
  539. begin
  540. { if there is no unused label between the last and the }
  541. { present label then the lower limit can be checked }
  542. { immediately. else check the range in between: }
  543. gensub(longint(t^._low-last));
  544. cg.a_cmp_const_reg_label(exprasmlist, opsize,jmp_lt,aword(t^._low-last),scratch_reg,elselabel);
  545. end;
  546. gensub(longint(t^._high-t^._low));
  547. cg.a_cmp_const_reg_label(exprasmlist, opsize,jmp_le,aword(t^._high-t^._low),scratch_reg,t^.statement);
  548. last:=t^._high;
  549. end;
  550. first:=false;
  551. if assigned(t^.greater) then
  552. genitem(t^.greater);
  553. end;
  554. begin
  555. { do we need to generate cmps? }
  556. if (with_sign and (min_label<0)) then
  557. genlinearcmplist(hp)
  558. else
  559. begin
  560. last:=0;
  561. first:=true;
  562. scratch_reg:=rg.getregisterint(exprasmlist,opsize);
  563. genitem(hp);
  564. rg.ungetregisterint(exprasmlist,scratch_reg);
  565. cg.a_jmp_always(exprasmlist,elselabel);
  566. end;
  567. end;
  568. procedure tcgcasenode.genlinearcmplist(hp : pcaserecord);
  569. var
  570. first : boolean;
  571. last : TConstExprInt;
  572. procedure genitem(t : pcaserecord);
  573. var
  574. l1 : tasmlabel;
  575. begin
  576. if assigned(t^.less) then
  577. genitem(t^.less);
  578. if t^._low=t^._high then
  579. begin
  580. if opsize in [OS_S64,OS_64] then
  581. begin
  582. objectlibrary.getlabel(l1);
  583. {$ifdef Delphi}
  584. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_NE, hi((t^._low)),hregister2,l1);
  585. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_EQ, lo((t^._low)),hregister, t^.statement);
  586. {$else}
  587. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_NE, aword(hi(int64(t^._low))),hregister2,l1);
  588. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_EQ, aword(lo(int64(t^._low))),hregister, t^.statement);
  589. {$endif}
  590. cg.a_label(exprasmlist,l1);
  591. end
  592. else
  593. begin
  594. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ, aword(t^._low),hregister, t^.statement);
  595. last:=t^._low;
  596. end;
  597. end
  598. else
  599. begin
  600. { it begins with the smallest label, if the value }
  601. { is even smaller then jump immediately to the }
  602. { ELSE-label }
  603. if first or (t^._low-last>1) then
  604. begin
  605. if opsize in [OS_64,OS_S64] then
  606. begin
  607. objectlibrary.getlabel(l1);
  608. {$ifdef Delphi}
  609. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi((t^._low))),
  610. hregister2, elselabel);
  611. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi((t^._low))),
  612. hregister2, l1);
  613. { the comparisation of the low dword must be always unsigned! }
  614. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_B, aword(lo((t^._low))), hregister, elselabel);
  615. {$else}
  616. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(int64(t^._low))),
  617. hregister2, elselabel);
  618. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(int64(t^._low))),
  619. hregister2, l1);
  620. { the comparisation of the low dword must be always unsigned! }
  621. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_B, aword(lo(int64(t^._low))), hregister, elselabel);
  622. {$endif}
  623. cg.a_label(exprasmlist,l1);
  624. end
  625. else
  626. begin
  627. cg.a_cmp_const_reg_label(exprasmlist, opsize, jmp_lt, aword(t^._low), hregister,
  628. elselabel);
  629. end;
  630. end;
  631. if opsize in [OS_S64,OS_64] then
  632. begin
  633. objectlibrary.getlabel(l1);
  634. {$ifdef Delphi}
  635. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(t^._high)), hregister2,
  636. t^.statement);
  637. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(t^._high)), hregister2,
  638. l1);
  639. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_BE, aword(lo(t^._high)), hregister, t^.statement);
  640. {$else}
  641. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(int64(t^._high))), hregister2,
  642. t^.statement);
  643. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(int64(t^._high))), hregister2,
  644. l1);
  645. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_BE, aword(lo(int64(t^._high))), hregister, t^.statement);
  646. {$endif}
  647. cg.a_label(exprasmlist,l1);
  648. end
  649. else
  650. begin
  651. cg.a_cmp_const_reg_label(exprasmlist, opsize, jmp_le, aword(t^._high), hregister, t^.statement);
  652. end;
  653. last:=t^._high;
  654. end;
  655. first:=false;
  656. if assigned(t^.greater) then
  657. genitem(t^.greater);
  658. end;
  659. begin
  660. last:=0;
  661. first:=true;
  662. genitem(hp);
  663. cg.a_jmp_always(exprasmlist,elselabel);
  664. end;
  665. procedure tcgcasenode.gentreejmp(p : pcaserecord);
  666. var
  667. lesslabel,greaterlabel : tasmlabel;
  668. begin
  669. cg.a_label(exprasmlist,p^._at);
  670. { calculate labels for left and right }
  671. if (p^.less=nil) then
  672. lesslabel:=elselabel
  673. else
  674. lesslabel:=p^.less^._at;
  675. if (p^.greater=nil) then
  676. greaterlabel:=elselabel
  677. else
  678. greaterlabel:=p^.greater^._at;
  679. { calculate labels for left and right }
  680. { no range label: }
  681. if p^._low=p^._high then
  682. begin
  683. if greaterlabel=lesslabel then
  684. begin
  685. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_NE,p^._low,hregister, lesslabel);
  686. end
  687. else
  688. begin
  689. cg.a_cmp_const_reg_label(exprasmlist,opsize, jmp_lt,p^._low,hregister, lesslabel);
  690. cg.a_cmp_const_reg_label(exprasmlist,opsize, jmp_gt,p^._low,hregister, greaterlabel);
  691. end;
  692. cg.a_jmp_always(exprasmlist,p^.statement);
  693. end
  694. else
  695. begin
  696. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,p^._low, hregister, lesslabel);
  697. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_gt,p^._high,hregister, greaterlabel);
  698. cg.a_jmp_always(exprasmlist,p^.statement);
  699. end;
  700. if assigned(p^.less) then
  701. gentreejmp(p^.less);
  702. if assigned(p^.greater) then
  703. gentreejmp(p^.greater);
  704. end;
  705. procedure ReLabel(var p:tasmsymbol);
  706. begin
  707. if p.defbind = AB_LOCAL then
  708. begin
  709. if not assigned(p.altsymbol) then
  710. objectlibrary.GenerateAltSymbol(p);
  711. p:=p.altsymbol;
  712. p.increfs;
  713. end;
  714. end;
  715. procedure relabelcaserecord(p : pcaserecord);
  716. begin
  717. Relabel(p^.statement);
  718. Relabel(p^._at);
  719. if assigned(p^.greater) then
  720. relabelcaserecord(p^.greater);
  721. if assigned(p^.less) then
  722. relabelcaserecord(p^.less);
  723. end;
  724. procedure tcgcasenode.pass_2;
  725. var
  726. lv,hv,
  727. max_label: tconstexprint;
  728. labels : longint;
  729. max_linear_list : longint;
  730. otl, ofl: tasmlabel;
  731. isjump : boolean;
  732. max_dist,
  733. dist : cardinal;
  734. hp : tstatementnode;
  735. begin
  736. location_reset(location,LOC_VOID,OS_NO);
  737. { Relabel for inlining? }
  738. if inlining_procedure and assigned(nodes) then
  739. begin
  740. objectlibrary.CreateUsedAsmSymbolList;
  741. relabelcaserecord(nodes);
  742. end;
  743. objectlibrary.getlabel(endlabel);
  744. objectlibrary.getlabel(elselabel);
  745. with_sign:=is_signed(left.resulttype.def);
  746. if with_sign then
  747. begin
  748. jmp_gt:=OC_GT;
  749. jmp_lt:=OC_LT;
  750. jmp_le:=OC_LTE;
  751. end
  752. else
  753. begin
  754. jmp_gt:=OC_A;
  755. jmp_lt:=OC_B;
  756. jmp_le:=OC_BE;
  757. end;
  758. { save current truelabel and falselabel }
  759. isjump:=false;
  760. if left.location.loc=LOC_JUMP then
  761. begin
  762. otl:=truelabel;
  763. objectlibrary.getlabel(truelabel);
  764. ofl:=falselabel;
  765. objectlibrary.getlabel(falselabel);
  766. isjump:=true;
  767. end;
  768. secondpass(left);
  769. { determines the size of the operand }
  770. opsize:=def_cgsize(left.resulttype.def);
  771. { copy the case expression to a register }
  772. location_force_reg(exprasmlist,left.location,opsize,false);
  773. if opsize in [OS_S64,OS_64] then
  774. begin
  775. hregister:=left.location.registerlow;
  776. hregister2:=left.location.registerhigh;
  777. end
  778. else
  779. hregister:=left.location.register;
  780. if isjump then
  781. begin
  782. truelabel:=otl;
  783. falselabel:=ofl;
  784. end;
  785. { we need the min_label always to choose between }
  786. { cmps and subs/decs }
  787. min_label:=case_get_min(nodes);
  788. load_all_regvars(exprasmlist);
  789. { now generate the jumps }
  790. if opsize in [OS_64,OS_S64] then
  791. genlinearcmplist(nodes)
  792. else
  793. begin
  794. if cs_optimize in aktglobalswitches then
  795. begin
  796. { procedures are empirically passed on }
  797. { consumption can also be calculated }
  798. { but does it pay on the different }
  799. { processors? }
  800. { moreover can the size only be appro- }
  801. { ximated as it is not known if rel8, }
  802. { rel16 or rel32 jumps are used }
  803. max_label:=case_get_max(nodes);
  804. labels:=case_count_labels(nodes);
  805. { can we omit the range check of the jump table ? }
  806. getrange(left.resulttype.def,lv,hv);
  807. jumptable_no_range:=(lv=min_label) and (hv=max_label);
  808. { hack a little bit, because the range can be greater }
  809. { than the positive range of a longint }
  810. if (min_label<0) and (max_label>0) then
  811. begin
  812. if min_label=TConstExprInt($80000000) then
  813. dist:=Cardinal(max_label)+Cardinal($80000000)
  814. else
  815. dist:=Cardinal(max_label)+Cardinal(-min_label)
  816. end
  817. else
  818. dist:=max_label-min_label;
  819. { optimize for size ? }
  820. if cs_littlesize in aktglobalswitches then
  821. begin
  822. if (has_jumptable) and
  823. not((labels<=2) or
  824. ((max_label-min_label)<0) or
  825. ((max_label-min_label)>3*labels)) then
  826. begin
  827. { if the labels less or more a continuum then }
  828. genjumptable(nodes,min_label,max_label);
  829. end
  830. else
  831. begin
  832. { a linear list is always smaller than a jump tree }
  833. genlinearlist(nodes);
  834. end;
  835. end
  836. else
  837. begin
  838. max_dist:=4*cardinal(labels);
  839. if jumptable_no_range then
  840. max_linear_list:=4
  841. else
  842. max_linear_list:=2;
  843. { allow processor specific values }
  844. optimizevalues(max_linear_list,max_dist);
  845. if (labels<=max_linear_list) then
  846. genlinearlist(nodes)
  847. else
  848. begin
  849. if (has_jumptable) and
  850. (dist<max_dist) then
  851. genjumptable(nodes,min_label,max_label)
  852. else
  853. begin
  854. {
  855. This one expects that the case labels are a
  856. perfectly balanced tree, which is not the case
  857. very often -> generates really bad code (JM)
  858. if labels>16 then
  859. gentreejmp(nodes)
  860. else
  861. }
  862. genlinearlist(nodes);
  863. end;
  864. end;
  865. end;
  866. end
  867. else
  868. { it's always not bad }
  869. genlinearlist(nodes);
  870. end;
  871. rg.ungetregisterint(exprasmlist,hregister);
  872. { now generate the instructions }
  873. hp:=tstatementnode(right);
  874. while assigned(hp) do
  875. begin
  876. { relabel when inlining }
  877. if inlining_procedure then
  878. begin
  879. if hp.left.nodetype<>labeln then
  880. internalerror(200211261);
  881. Relabel(tlabelnode(hp.left).labelnr);
  882. end;
  883. secondpass(hp.left);
  884. { don't come back to case line }
  885. aktfilepos:=exprasmList.getlasttaifilepos^;
  886. load_all_regvars(exprasmlist);
  887. cg.a_jmp_always(exprasmlist,endlabel);
  888. hp:=tstatementnode(hp.right);
  889. end;
  890. cg.a_label(exprasmlist,elselabel);
  891. { ...and the else block }
  892. if assigned(elseblock) then
  893. begin
  894. secondpass(elseblock);
  895. load_all_regvars(exprasmlist);
  896. end;
  897. cg.a_label(exprasmlist,endlabel);
  898. { Remove relabels for inlining }
  899. if inlining_procedure and
  900. assigned(nodes) then
  901. begin
  902. { restore used symbols }
  903. objectlibrary.UsedAsmSymbolListResetAltSym;
  904. objectlibrary.DestroyUsedAsmSymbolList;
  905. end;
  906. end;
  907. begin
  908. csetelementnode:=tcgsetelementnode;
  909. cinnode:=tcginnode;
  910. ccasenode:=tcgcasenode;
  911. end.
  912. {
  913. $Log$
  914. Revision 1.49 2003-10-01 20:34:48 peter
  915. * procinfo unit contains tprocinfo
  916. * cginfo renamed to cgbase
  917. * moved cgmessage to verbose
  918. * fixed ppc and sparc compiles
  919. Revision 1.48 2003/09/03 15:55:01 peter
  920. * NEWRA branch merged
  921. Revision 1.47.2.1 2003/08/29 17:28:59 peter
  922. * next batch of updates
  923. Revision 1.47 2003/08/20 20:29:06 daniel
  924. * Some more R_NO changes
  925. * Preventive code to loadref added
  926. Revision 1.46 2003/07/23 11:02:53 jonas
  927. * final (?) fix to in-code
  928. Revision 1.45 2003/07/20 18:03:27 jonas
  929. * fixed bug in tcginnode.pass_2
  930. Revision 1.44 2003/07/06 14:28:04 jonas
  931. * fixed register leak
  932. * changed a couple of case-statements to location_force_reg()
  933. Revision 1.43 2003/06/12 22:09:54 jonas
  934. * tcginnode.pass_2 doesn't call a helper anymore in any case
  935. * fixed ungetregisterfpu compilation problems
  936. Revision 1.42 2003/06/08 16:03:22 jonas
  937. - disabled gentreejmp for now, it expects that the case labels are
  938. ordered as a perfectly balanced tree, while they are often a linked
  939. list -> generates extremely bad code
  940. Revision 1.41 2003/06/07 18:57:04 jonas
  941. + added freeintparaloc
  942. * ppc get/freeintparaloc now check whether the parameter regs are
  943. properly allocated/deallocated (and get an extra list para)
  944. * ppc a_call_* now internalerrors if pi_do_call is not yet set
  945. * fixed lot of missing pi_do_call's
  946. Revision 1.40 2003/06/03 21:11:09 peter
  947. * cg.a_load_* get a from and to size specifier
  948. * makeregsize only accepts newregister
  949. * i386 uses generic tcgnotnode,tcgunaryminus
  950. Revision 1.39 2003/06/01 21:38:06 peter
  951. * getregisterfpu size parameter added
  952. * op_const_reg size parameter added
  953. * sparc updates
  954. Revision 1.38 2003/05/30 23:57:08 peter
  955. * more sparc cleanup
  956. * accumulator removed, splitted in function_return_reg (called) and
  957. function_result_reg (caller)
  958. Revision 1.37 2003/05/30 23:49:18 jonas
  959. * a_load_loc_reg now has an extra size parameter for the destination
  960. register (properly fixes what I worked around in revision 1.106 of
  961. ncgutil.pas)
  962. Revision 1.36 2003/05/24 19:48:49 jonas
  963. * fixed tcginnode endian bug again, but correcty this time :)
  964. Revision 1.35 2003/05/23 21:10:50 florian
  965. * fixed sparc compiler compilation
  966. Revision 1.34 2003/05/23 19:52:28 jonas
  967. * corrected fix for endian differences in tcginnode
  968. Revision 1.33 2003/05/17 19:17:35 jonas
  969. * fixed size setting of result location of innodes
  970. Revision 1.32 2003/05/01 12:26:50 jonas
  971. * fixed endian issue in inlined in-test for smallsets
  972. * pass the address of normalsets to fpc_set_in_set_byte instead of the
  973. contents of the first 4 bytes
  974. Revision 1.31 2003/04/25 08:25:26 daniel
  975. * Ifdefs around a lot of calls to cleartempgen
  976. * Fixed registers that are allocated but not freed in several nodes
  977. * Tweak to register allocator to cause less spills
  978. * 8-bit registers now interfere with esi,edi and ebp
  979. Compiler can now compile rtl successfully when using new register
  980. allocator
  981. Revision 1.30 2003/04/22 23:50:23 peter
  982. * firstpass uses expectloc
  983. * checks if there are differences between the expectloc and
  984. location.loc from secondpass in EXTDEBUG
  985. Revision 1.29 2003/04/22 14:33:38 peter
  986. * removed some notes/hints
  987. Revision 1.28 2003/04/22 12:45:58 florian
  988. * fixed generic in operator code
  989. + added debug code to check if all scratch registers are released
  990. Revision 1.27 2003/04/22 10:09:35 daniel
  991. + Implemented the actual register allocator
  992. + Scratch registers unavailable when new register allocator used
  993. + maybe_save/maybe_restore unavailable when new register allocator used
  994. Revision 1.26 2003/02/19 22:00:14 daniel
  995. * Code generator converted to new register notation
  996. - Horribily outdated todo.txt removed
  997. Revision 1.25 2003/01/08 18:43:56 daniel
  998. * Tregister changed into a record
  999. Revision 1.24 2002/11/27 02:37:13 peter
  1000. * case statement inlining added
  1001. * fixed inlining of write()
  1002. * switched statementnode left and right parts so the statements are
  1003. processed in the correct order when getcopy is used. This is
  1004. required for tempnodes
  1005. Revision 1.23 2002/11/25 17:43:18 peter
  1006. * splitted defbase in defutil,symutil,defcmp
  1007. * merged isconvertable and is_equal into compare_defs(_ext)
  1008. * made operator search faster by walking the list only once
  1009. Revision 1.22 2002/10/05 12:43:25 carl
  1010. * fixes for Delphi 6 compilation
  1011. (warning : Some features do not work under Delphi)
  1012. Revision 1.21 2002/10/03 21:31:10 carl
  1013. * range check error fixes
  1014. Revision 1.20 2002/09/17 18:54:03 jonas
  1015. * a_load_reg_reg() now has two size parameters: source and dest. This
  1016. allows some optimizations on architectures that don't encode the
  1017. register size in the register name.
  1018. Revision 1.19 2002/09/16 18:08:26 peter
  1019. * fix last optimization in genlinearlist, detected by bug tw1066
  1020. * use generic casenode.pass2 routine and override genlinearlist
  1021. * add jumptable support to generic casenode, by default there is
  1022. no jumptable support
  1023. Revision 1.18 2002/08/15 15:11:53 carl
  1024. * oldset define is now correct for all cpu's except i386
  1025. * correct compilation problems because of the above
  1026. Revision 1.17 2002/08/13 18:01:52 carl
  1027. * rename swatoperands to swapoperands
  1028. + m68k first compilable version (still needs a lot of testing):
  1029. assembler generator, system information , inline
  1030. assembler reader.
  1031. Revision 1.16 2002/08/11 14:32:27 peter
  1032. * renamed current_library to objectlibrary
  1033. Revision 1.15 2002/08/11 13:24:12 peter
  1034. * saving of asmsymbols in ppu supported
  1035. * asmsymbollist global is removed and moved into a new class
  1036. tasmlibrarydata that will hold the info of a .a file which
  1037. corresponds with a single module. Added librarydata to tmodule
  1038. to keep the library info stored for the module. In the future the
  1039. objectfiles will also be stored to the tasmlibrarydata class
  1040. * all getlabel/newasmsymbol and friends are moved to the new class
  1041. Revision 1.14 2002/08/11 11:37:42 jonas
  1042. * genlinear(cmp)list can now be overridden by descendents
  1043. Revision 1.13 2002/08/11 06:14:40 florian
  1044. * fixed powerpc compilation problems
  1045. Revision 1.12 2002/08/10 17:15:12 jonas
  1046. * optimizations and bugfix
  1047. Revision 1.11 2002/07/28 09:24:18 carl
  1048. + generic case node
  1049. Revision 1.10 2002/07/23 14:31:00 daniel
  1050. * Added internal error when asked to generate code for 'if expr in []'
  1051. Revision 1.9 2002/07/23 12:34:30 daniel
  1052. * Readded old set code. To use it define 'oldset'. Activated by default
  1053. for ppc.
  1054. Revision 1.8 2002/07/22 11:48:04 daniel
  1055. * Sets are now internally sets.
  1056. Revision 1.7 2002/07/21 16:58:20 jonas
  1057. * fixed some bugs in tcginnode.pass_2() and optimized the bit test
  1058. Revision 1.6 2002/07/20 11:57:54 florian
  1059. * types.pas renamed to defbase.pas because D6 contains a types
  1060. unit so this would conflicts if D6 programms are compiled
  1061. + Willamette/SSE2 instructions to assembler added
  1062. Revision 1.5 2002/07/11 14:41:28 florian
  1063. * start of the new generic parameter handling
  1064. Revision 1.4 2002/07/07 10:16:29 florian
  1065. * problems with last commit fixed
  1066. Revision 1.3 2002/07/06 20:19:25 carl
  1067. + generic set handling
  1068. Revision 1.2 2002/07/01 16:23:53 peter
  1069. * cg64 patch
  1070. * basics for currency
  1071. * asnode updates for class and interface (not finished)
  1072. Revision 1.1 2002/06/16 08:14:56 carl
  1073. + generic sets
  1074. }