ncgset.pas 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249
  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. ncgutil,regvars,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. if genjumps then
  217. begin
  218. { allocate a register for the result }
  219. location.register := cg.getintregister(exprasmlist,location.size);
  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:=cg.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:=cg.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:=cg.getintregister(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:=cg.getintregister(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. cg.ungetregister(exprasmlist,pleftreg);
  321. LOC_REGISTER :
  322. cg.ungetregister(exprasmlist,pleftreg);
  323. else
  324. begin
  325. reference_release(exprasmlist,left.location.reference);
  326. cg.ungetregister(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. cg.ungetregister(exprasmlist,right.location.register);
  344. { allocate a register for the result }
  345. location.register := cg.getintregister(exprasmlist,location.size);
  346. { then SHR the register }
  347. cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_INT,
  348. tordconstnode(left).value and 31,right.location.register,location.register);
  349. { then extract the lowest bit }
  350. cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,1,location.register);
  351. end
  352. else
  353. begin
  354. case left.location.loc of
  355. LOC_REGISTER,
  356. LOC_CREGISTER:
  357. begin
  358. hr3:=cg.makeregsize(left.location.register,OS_INT);
  359. cg.a_load_reg_reg(exprasmlist,left.location.size,OS_INT,left.location.register,hr3);
  360. hr:=cg.getintregister(exprasmlist,OS_INT);
  361. cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,hr3,hr);
  362. end;
  363. else
  364. begin
  365. hr:=cg.getintregister(exprasmlist,OS_INT);
  366. cg.a_load_ref_reg(exprasmlist,def_cgsize(left.resulttype.def),OS_INT,
  367. left.location.reference,hr);
  368. location_release(exprasmlist,left.location);
  369. end;
  370. end;
  371. location_force_reg(exprasmlist,right.location,OS_32,true);
  372. { free the resources }
  373. cg.ungetregister(exprasmlist,right.location.register);
  374. { allocate a register for the result }
  375. location.register := cg.getintregister(exprasmlist,location.size);
  376. { emit bit test operation }
  377. emit_bit_test_reg_reg(exprasmlist,hr,right.location.register,location.register);
  378. { free bitnumber register }
  379. cg.ungetregister(exprasmlist,hr);
  380. end;
  381. end
  382. else
  383. {************************** NOT SMALL SET ********************}
  384. begin
  385. if right.location.loc=LOC_CONSTANT then
  386. begin
  387. { can it actually occur currently? CEC }
  388. { yes: "if bytevar in [1,3,5,7,9,11,13,15]" (JM) }
  389. { note: this code assumes that left in [0..255], which is a valid }
  390. { assumption (other cases will be caught by range checking) (JM) }
  391. { load left in register }
  392. location_force_reg(exprasmlist,left.location,OS_INT,true);
  393. if left.location.loc = LOC_CREGISTER then
  394. hr := cg.getintregister(exprasmlist,OS_INT)
  395. else
  396. hr := left.location.register;
  397. { load right in register }
  398. hr2:=cg.getintregister(exprasmlist,OS_INT);
  399. cg.a_load_const_reg(exprasmlist,OS_INT,right.location.value,hr2);
  400. { emit bit test operation }
  401. emit_bit_test_reg_reg(exprasmlist,left.location.register,hr2,hr2);
  402. { if left > 31 then hr := 0 else hr := $ffffffff }
  403. cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,32,left.location.register,hr);
  404. cg.a_op_const_reg(exprasmlist,OP_SAR,OS_INT,31,hr);
  405. { free registers }
  406. cg.ungetregister(exprasmlist,hr2);
  407. if (left.location.loc in [LOC_CREGISTER]) then
  408. cg.ungetregister(exprasmlist,hr)
  409. else
  410. cg.ungetregister(exprasmlist,left.location.register);
  411. { allocate a register for the result }
  412. location.register := cg.getintregister(exprasmlist,location.size);
  413. { if left > 31, then result := 0 else result := result of bit test }
  414. cg.a_op_reg_reg_reg(exprasmlist,OP_AND,OS_INT,hr,hr2,location.register);
  415. end { of right.location.loc=LOC_CONSTANT }
  416. { do search in a normal set which could have >32 elementsm
  417. but also used if the left side contains higher values > 32 }
  418. else if left.nodetype=ordconstn then
  419. begin
  420. { use location.register as scratch register here }
  421. if (target_info.endian = endian_little) then
  422. inc(right.location.reference.offset,tordconstnode(left).value shr 3)
  423. else
  424. { adjust for endianess differences }
  425. inc(right.location.reference.offset,(tordconstnode(left).value shr 3) xor 3);
  426. { allocate a register for the result }
  427. location.register := cg.getintregister(exprasmlist,location.size);
  428. cg.a_load_ref_reg(exprasmlist,OS_8,location.size,right.location.reference, location.register);
  429. location_release(exprasmlist,right.location);
  430. cg.a_op_const_reg(exprasmlist,OP_SHR,location.size,tordconstnode(left).value and 7,
  431. location.register);
  432. cg.a_op_const_reg(exprasmlist,OP_AND,location.size,1,location.register);
  433. end
  434. else
  435. begin
  436. location_force_reg(exprasmlist,left.location,OS_INT,true);
  437. pleftreg := left.location.register;
  438. location_freetemp(exprasmlist,left.location);
  439. hr := cg.getaddressregister(exprasmlist);
  440. cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,5,pleftreg,hr);
  441. cg.a_op_const_reg(exprasmlist,OP_SHL,OS_32,2,hr);
  442. href := right.location.reference;
  443. if (href.base = NR_NO) then
  444. href.base := hr
  445. else if (right.location.reference.index = NR_NO) then
  446. href.index := hr
  447. else
  448. begin
  449. reference_release(exprasmlist,href);
  450. hr2 := cg.getaddressregister(exprasmlist);
  451. cg.a_loadaddr_ref_reg(exprasmlist,href, hr2);
  452. reference_reset_base(href,hr2,0);
  453. href.index := hr;
  454. end;
  455. reference_release(exprasmlist,href);
  456. { allocate a register for the result }
  457. location.register := cg.getintregister(exprasmlist,location.size);
  458. cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,href,location.register);
  459. cg.ungetregister(exprasmlist,pleftreg);
  460. hr := cg.getintregister(exprasmlist,OS_32);
  461. cg.a_op_const_reg_reg(exprasmlist,OP_AND,OS_32,31,pleftreg,hr);
  462. cg.a_op_reg_reg(exprasmlist,OP_SHR,OS_32,hr,location.register);
  463. cg.ungetregister(exprasmlist,hr);
  464. cg.a_op_const_reg(exprasmlist,OP_AND,OS_32,1,location.register);
  465. end;
  466. end;
  467. end;
  468. location_freetemp(exprasmlist,right.location);
  469. end;
  470. {*****************************************************************************
  471. TCGCASENODE
  472. *****************************************************************************}
  473. procedure tcgcasenode.optimizevalues(var max_linear_list:longint;var max_dist:cardinal);
  474. begin
  475. { no changes by default }
  476. end;
  477. function tcgcasenode.has_jumptable : boolean;
  478. begin
  479. { No jumptable support in the default implementation }
  480. has_jumptable:=false;
  481. end;
  482. procedure tcgcasenode.genjumptable(hp : pcaserecord;min_,max_ : longint);
  483. begin
  484. internalerror(200209161);
  485. end;
  486. procedure tcgcasenode.genlinearlist(hp : pcaserecord);
  487. var
  488. first : boolean;
  489. last : TConstExprInt;
  490. scratch_reg: tregister;
  491. procedure genitem(t : pcaserecord);
  492. procedure gensub(value:longint);
  493. begin
  494. { here, since the sub and cmp are separate we need
  495. to move the result before subtract to a help
  496. register.
  497. }
  498. cg.a_load_reg_reg(exprasmlist, opsize, opsize, hregister, scratch_reg);
  499. cg.a_op_const_reg(exprasmlist, OP_SUB, opsize, value, hregister);
  500. end;
  501. begin
  502. if assigned(t^.less) then
  503. genitem(t^.less);
  504. { need we to test the first value }
  505. if first and (t^._low>get_min_value(left.resulttype.def)) then
  506. begin
  507. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,aword(t^._low),hregister,elselabel);
  508. end;
  509. if t^._low=t^._high then
  510. begin
  511. if t^._low-last=0 then
  512. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,0,hregister,t^.statement)
  513. else
  514. begin
  515. gensub(longint(t^._low-last));
  516. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,aword(t^._low-last),scratch_reg,t^.statement);
  517. end;
  518. last:=t^._low;
  519. end
  520. else
  521. begin
  522. { it begins with the smallest label, if the value }
  523. { is even smaller then jump immediately to the }
  524. { ELSE-label }
  525. if first then
  526. begin
  527. { have we to ajust the first value ? }
  528. if (t^._low>get_min_value(left.resulttype.def)) then
  529. gensub(longint(t^._low));
  530. end
  531. else
  532. begin
  533. { if there is no unused label between the last and the }
  534. { present label then the lower limit can be checked }
  535. { immediately. else check the range in between: }
  536. gensub(longint(t^._low-last));
  537. cg.a_cmp_const_reg_label(exprasmlist, opsize,jmp_lt,aword(t^._low-last),scratch_reg,elselabel);
  538. end;
  539. gensub(longint(t^._high-t^._low));
  540. cg.a_cmp_const_reg_label(exprasmlist, opsize,jmp_le,aword(t^._high-t^._low),scratch_reg,t^.statement);
  541. last:=t^._high;
  542. end;
  543. first:=false;
  544. if assigned(t^.greater) then
  545. genitem(t^.greater);
  546. end;
  547. begin
  548. { do we need to generate cmps? }
  549. if (with_sign and (min_label<0)) then
  550. genlinearcmplist(hp)
  551. else
  552. begin
  553. last:=0;
  554. first:=true;
  555. scratch_reg:=cg.getintregister(exprasmlist,opsize);
  556. genitem(hp);
  557. cg.ungetregister(exprasmlist,scratch_reg);
  558. cg.a_jmp_always(exprasmlist,elselabel);
  559. end;
  560. end;
  561. procedure tcgcasenode.genlinearcmplist(hp : pcaserecord);
  562. var
  563. first : boolean;
  564. last : TConstExprInt;
  565. procedure genitem(t : pcaserecord);
  566. var
  567. l1 : tasmlabel;
  568. begin
  569. if assigned(t^.less) then
  570. genitem(t^.less);
  571. if t^._low=t^._high then
  572. begin
  573. if opsize in [OS_S64,OS_64] then
  574. begin
  575. objectlibrary.getlabel(l1);
  576. {$ifdef Delphi}
  577. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_NE, hi((t^._low)),hregister2,l1);
  578. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_EQ, lo((t^._low)),hregister, t^.statement);
  579. {$else}
  580. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_NE, aword(hi(int64(t^._low))),hregister2,l1);
  581. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_EQ, aword(lo(int64(t^._low))),hregister, t^.statement);
  582. {$endif}
  583. cg.a_label(exprasmlist,l1);
  584. end
  585. else
  586. begin
  587. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ, aword(t^._low),hregister, t^.statement);
  588. end;
  589. { Reset last here, because we've only checked for one value and need to compare
  590. for the next range both the lower and upper bound }
  591. last:=0;
  592. end
  593. else
  594. begin
  595. { it begins with the smallest label, if the value }
  596. { is even smaller then jump immediately to the }
  597. { ELSE-label }
  598. if first or (t^._low-last>1) then
  599. begin
  600. if opsize in [OS_64,OS_S64] then
  601. begin
  602. objectlibrary.getlabel(l1);
  603. {$ifdef Delphi}
  604. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi((t^._low))),
  605. hregister2, elselabel);
  606. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi((t^._low))),
  607. hregister2, l1);
  608. { the comparisation of the low dword must be always unsigned! }
  609. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_B, aword(lo((t^._low))), hregister, elselabel);
  610. {$else}
  611. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(int64(t^._low))),
  612. hregister2, elselabel);
  613. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(int64(t^._low))),
  614. hregister2, l1);
  615. { the comparisation of the low dword must be always unsigned! }
  616. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_B, aword(lo(int64(t^._low))), hregister, elselabel);
  617. {$endif}
  618. cg.a_label(exprasmlist,l1);
  619. end
  620. else
  621. begin
  622. cg.a_cmp_const_reg_label(exprasmlist, opsize, jmp_lt, aword(t^._low), hregister,
  623. elselabel);
  624. end;
  625. end;
  626. if opsize in [OS_S64,OS_64] then
  627. begin
  628. objectlibrary.getlabel(l1);
  629. {$ifdef Delphi}
  630. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(t^._high)), hregister2,
  631. t^.statement);
  632. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(t^._high)), hregister2,
  633. l1);
  634. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_BE, aword(lo(t^._high)), hregister, t^.statement);
  635. {$else}
  636. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(int64(t^._high))), hregister2,
  637. t^.statement);
  638. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(int64(t^._high))), hregister2,
  639. l1);
  640. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_BE, aword(lo(int64(t^._high))), hregister, t^.statement);
  641. {$endif}
  642. cg.a_label(exprasmlist,l1);
  643. end
  644. else
  645. begin
  646. cg.a_cmp_const_reg_label(exprasmlist, opsize, jmp_le, aword(t^._high), hregister, t^.statement);
  647. end;
  648. last:=t^._high;
  649. end;
  650. first:=false;
  651. if assigned(t^.greater) then
  652. genitem(t^.greater);
  653. end;
  654. begin
  655. last:=0;
  656. first:=true;
  657. genitem(hp);
  658. cg.a_jmp_always(exprasmlist,elselabel);
  659. end;
  660. procedure tcgcasenode.gentreejmp(p : pcaserecord);
  661. var
  662. lesslabel,greaterlabel : tasmlabel;
  663. begin
  664. cg.a_label(exprasmlist,p^._at);
  665. { calculate labels for left and right }
  666. if (p^.less=nil) then
  667. lesslabel:=elselabel
  668. else
  669. lesslabel:=p^.less^._at;
  670. if (p^.greater=nil) then
  671. greaterlabel:=elselabel
  672. else
  673. greaterlabel:=p^.greater^._at;
  674. { calculate labels for left and right }
  675. { no range label: }
  676. if p^._low=p^._high then
  677. begin
  678. if greaterlabel=lesslabel then
  679. begin
  680. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_NE,p^._low,hregister, lesslabel);
  681. end
  682. else
  683. begin
  684. cg.a_cmp_const_reg_label(exprasmlist,opsize, jmp_lt,p^._low,hregister, lesslabel);
  685. cg.a_cmp_const_reg_label(exprasmlist,opsize, jmp_gt,p^._low,hregister, greaterlabel);
  686. end;
  687. cg.a_jmp_always(exprasmlist,p^.statement);
  688. end
  689. else
  690. begin
  691. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,p^._low, hregister, lesslabel);
  692. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_gt,p^._high,hregister, greaterlabel);
  693. cg.a_jmp_always(exprasmlist,p^.statement);
  694. end;
  695. if assigned(p^.less) then
  696. gentreejmp(p^.less);
  697. if assigned(p^.greater) then
  698. gentreejmp(p^.greater);
  699. end;
  700. procedure ReLabel(var p:tasmsymbol);
  701. begin
  702. if p.defbind = AB_LOCAL then
  703. begin
  704. if not assigned(p.altsymbol) then
  705. objectlibrary.GenerateAltSymbol(p);
  706. p:=p.altsymbol;
  707. p.increfs;
  708. end;
  709. end;
  710. procedure relabelcaserecord(p : pcaserecord);
  711. begin
  712. Relabel(p^.statement);
  713. Relabel(p^._at);
  714. if assigned(p^.greater) then
  715. relabelcaserecord(p^.greater);
  716. if assigned(p^.less) then
  717. relabelcaserecord(p^.less);
  718. end;
  719. procedure tcgcasenode.pass_2;
  720. var
  721. lv,hv,
  722. max_label: tconstexprint;
  723. labels : longint;
  724. max_linear_list : longint;
  725. otl, ofl: tasmlabel;
  726. isjump : boolean;
  727. max_dist,
  728. dist : cardinal;
  729. hp : tstatementnode;
  730. begin
  731. location_reset(location,LOC_VOID,OS_NO);
  732. { Relabel for inlining? }
  733. if inlining_procedure and assigned(nodes) then
  734. begin
  735. objectlibrary.CreateUsedAsmSymbolList;
  736. relabelcaserecord(nodes);
  737. end;
  738. objectlibrary.getlabel(endlabel);
  739. objectlibrary.getlabel(elselabel);
  740. with_sign:=is_signed(left.resulttype.def);
  741. if with_sign then
  742. begin
  743. jmp_gt:=OC_GT;
  744. jmp_lt:=OC_LT;
  745. jmp_le:=OC_LTE;
  746. end
  747. else
  748. begin
  749. jmp_gt:=OC_A;
  750. jmp_lt:=OC_B;
  751. jmp_le:=OC_BE;
  752. end;
  753. { save current truelabel and falselabel }
  754. isjump:=false;
  755. if left.location.loc=LOC_JUMP then
  756. begin
  757. otl:=truelabel;
  758. objectlibrary.getlabel(truelabel);
  759. ofl:=falselabel;
  760. objectlibrary.getlabel(falselabel);
  761. isjump:=true;
  762. end;
  763. secondpass(left);
  764. { determines the size of the operand }
  765. opsize:=def_cgsize(left.resulttype.def);
  766. { copy the case expression to a register }
  767. location_force_reg(exprasmlist,left.location,opsize,false);
  768. if opsize in [OS_S64,OS_64] then
  769. begin
  770. hregister:=left.location.registerlow;
  771. hregister2:=left.location.registerhigh;
  772. end
  773. else
  774. hregister:=left.location.register;
  775. if isjump then
  776. begin
  777. truelabel:=otl;
  778. falselabel:=ofl;
  779. end;
  780. { we need the min_label always to choose between }
  781. { cmps and subs/decs }
  782. min_label:=case_get_min(nodes);
  783. {$ifdef OLDREGVARS}
  784. load_all_regvars(exprasmlist);
  785. {$endif OLDREGVARS}
  786. { now generate the jumps }
  787. if opsize in [OS_64,OS_S64] then
  788. genlinearcmplist(nodes)
  789. else
  790. begin
  791. if cs_optimize in aktglobalswitches then
  792. begin
  793. { procedures are empirically passed on }
  794. { consumption can also be calculated }
  795. { but does it pay on the different }
  796. { processors? }
  797. { moreover can the size only be appro- }
  798. { ximated as it is not known if rel8, }
  799. { rel16 or rel32 jumps are used }
  800. max_label:=case_get_max(nodes);
  801. labels:=case_count_labels(nodes);
  802. { can we omit the range check of the jump table ? }
  803. getrange(left.resulttype.def,lv,hv);
  804. jumptable_no_range:=(lv=min_label) and (hv=max_label);
  805. { hack a little bit, because the range can be greater }
  806. { than the positive range of a longint }
  807. if (min_label<0) and (max_label>0) then
  808. begin
  809. if min_label=TConstExprInt($80000000) then
  810. dist:=Cardinal(max_label)+Cardinal($80000000)
  811. else
  812. dist:=Cardinal(max_label)+Cardinal(-min_label)
  813. end
  814. else
  815. dist:=max_label-min_label;
  816. { optimize for size ? }
  817. if cs_littlesize in aktglobalswitches then
  818. begin
  819. if (has_jumptable) and
  820. not((labels<=2) or
  821. ((max_label-min_label)<0) or
  822. ((max_label-min_label)>3*labels)) then
  823. begin
  824. { if the labels less or more a continuum then }
  825. genjumptable(nodes,min_label,max_label);
  826. end
  827. else
  828. begin
  829. { a linear list is always smaller than a jump tree }
  830. genlinearlist(nodes);
  831. end;
  832. end
  833. else
  834. begin
  835. max_dist:=4*cardinal(labels);
  836. if jumptable_no_range then
  837. max_linear_list:=4
  838. else
  839. max_linear_list:=2;
  840. { allow processor specific values }
  841. optimizevalues(max_linear_list,max_dist);
  842. if (labels<=max_linear_list) then
  843. genlinearlist(nodes)
  844. else
  845. begin
  846. if (has_jumptable) and
  847. (dist<max_dist) then
  848. genjumptable(nodes,min_label,max_label)
  849. else
  850. begin
  851. {
  852. This one expects that the case labels are a
  853. perfectly balanced tree, which is not the case
  854. very often -> generates really bad code (JM)
  855. if labels>16 then
  856. gentreejmp(nodes)
  857. else
  858. }
  859. genlinearlist(nodes);
  860. end;
  861. end;
  862. end;
  863. end
  864. else
  865. { it's always not bad }
  866. genlinearlist(nodes);
  867. end;
  868. cg.ungetregister(exprasmlist,hregister);
  869. { now generate the instructions }
  870. hp:=tstatementnode(right);
  871. while assigned(hp) do
  872. begin
  873. { relabel when inlining }
  874. if inlining_procedure then
  875. begin
  876. if hp.left.nodetype<>labeln then
  877. internalerror(200211261);
  878. Relabel(tlabelnode(hp.left).labelnr);
  879. end;
  880. secondpass(hp.left);
  881. { don't come back to case line }
  882. aktfilepos:=exprasmList.getlasttaifilepos^;
  883. {$ifdef OLDREGVARS}
  884. load_all_regvars(exprasmlist);
  885. {$endif OLDREGVARS}
  886. cg.a_jmp_always(exprasmlist,endlabel);
  887. hp:=tstatementnode(hp.right);
  888. end;
  889. cg.a_label(exprasmlist,elselabel);
  890. { ...and the else block }
  891. if assigned(elseblock) then
  892. begin
  893. secondpass(elseblock);
  894. {$ifdef OLDREGVARS}
  895. load_all_regvars(exprasmlist);
  896. {$endif OLDREGVARS}
  897. end;
  898. cg.a_label(exprasmlist,endlabel);
  899. { Remove relabels for inlining }
  900. if inlining_procedure and
  901. assigned(nodes) then
  902. begin
  903. { restore used symbols }
  904. objectlibrary.UsedAsmSymbolListResetAltSym;
  905. objectlibrary.DestroyUsedAsmSymbolList;
  906. end;
  907. end;
  908. begin
  909. csetelementnode:=tcgsetelementnode;
  910. cinnode:=tcginnode;
  911. ccasenode:=tcgcasenode;
  912. end.
  913. {
  914. $Log$
  915. Revision 1.55 2004-01-28 15:36:46 florian
  916. * fixed another couple of arm bugs
  917. Revision 1.54 2003/12/09 19:14:50 jonas
  918. * fixed and optimized in-node with constant smallset
  919. * some register usage optimisations.
  920. Revision 1.53 2003/11/10 19:10:31 peter
  921. * fixed range compare when the last value was an equal
  922. compare. The compare for the lower range was skipped
  923. Revision 1.52 2003/10/17 14:38:32 peter
  924. * 64k registers supported
  925. * fixed some memory leaks
  926. Revision 1.51 2003/10/10 17:48:13 peter
  927. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  928. * tregisteralloctor renamed to trgobj
  929. * removed rgobj from a lot of units
  930. * moved location_* and reference_* to cgobj
  931. * first things for mmx register allocation
  932. Revision 1.50 2003/10/09 21:31:37 daniel
  933. * Register allocator splitted, ans abstract now
  934. Revision 1.49 2003/10/01 20:34:48 peter
  935. * procinfo unit contains tprocinfo
  936. * cginfo renamed to cgbase
  937. * moved cgmessage to verbose
  938. * fixed ppc and sparc compiles
  939. Revision 1.48 2003/09/03 15:55:01 peter
  940. * NEWRA branch merged
  941. Revision 1.47.2.1 2003/08/29 17:28:59 peter
  942. * next batch of updates
  943. Revision 1.47 2003/08/20 20:29:06 daniel
  944. * Some more R_NO changes
  945. * Preventive code to loadref added
  946. Revision 1.46 2003/07/23 11:02:53 jonas
  947. * final (?) fix to in-code
  948. Revision 1.45 2003/07/20 18:03:27 jonas
  949. * fixed bug in tcginnode.pass_2
  950. Revision 1.44 2003/07/06 14:28:04 jonas
  951. * fixed register leak
  952. * changed a couple of case-statements to location_force_reg()
  953. Revision 1.43 2003/06/12 22:09:54 jonas
  954. * tcginnode.pass_2 doesn't call a helper anymore in any case
  955. * fixed ungetregisterfpu compilation problems
  956. Revision 1.42 2003/06/08 16:03:22 jonas
  957. - disabled gentreejmp for now, it expects that the case labels are
  958. ordered as a perfectly balanced tree, while they are often a linked
  959. list -> generates extremely bad code
  960. Revision 1.41 2003/06/07 18:57:04 jonas
  961. + added freeintparaloc
  962. * ppc get/freeintparaloc now check whether the parameter regs are
  963. properly allocated/deallocated (and get an extra list para)
  964. * ppc a_call_* now internalerrors if pi_do_call is not yet set
  965. * fixed lot of missing pi_do_call's
  966. Revision 1.40 2003/06/03 21:11:09 peter
  967. * cg.a_load_* get a from and to size specifier
  968. * makeregsize only accepts newregister
  969. * i386 uses generic tcgnotnode,tcgunaryminus
  970. Revision 1.39 2003/06/01 21:38:06 peter
  971. * getregisterfpu size parameter added
  972. * op_const_reg size parameter added
  973. * sparc updates
  974. Revision 1.38 2003/05/30 23:57:08 peter
  975. * more sparc cleanup
  976. * accumulator removed, splitted in function_return_reg (called) and
  977. function_result_reg (caller)
  978. Revision 1.37 2003/05/30 23:49:18 jonas
  979. * a_load_loc_reg now has an extra size parameter for the destination
  980. register (properly fixes what I worked around in revision 1.106 of
  981. ncgutil.pas)
  982. Revision 1.36 2003/05/24 19:48:49 jonas
  983. * fixed tcginnode endian bug again, but correcty this time :)
  984. Revision 1.35 2003/05/23 21:10:50 florian
  985. * fixed sparc compiler compilation
  986. Revision 1.34 2003/05/23 19:52:28 jonas
  987. * corrected fix for endian differences in tcginnode
  988. Revision 1.33 2003/05/17 19:17:35 jonas
  989. * fixed size setting of result location of innodes
  990. Revision 1.32 2003/05/01 12:26:50 jonas
  991. * fixed endian issue in inlined in-test for smallsets
  992. * pass the address of normalsets to fpc_set_in_set_byte instead of the
  993. contents of the first 4 bytes
  994. Revision 1.31 2003/04/25 08:25:26 daniel
  995. * Ifdefs around a lot of calls to cleartempgen
  996. * Fixed registers that are allocated but not freed in several nodes
  997. * Tweak to register allocator to cause less spills
  998. * 8-bit registers now interfere with esi,edi and ebp
  999. Compiler can now compile rtl successfully when using new register
  1000. allocator
  1001. Revision 1.30 2003/04/22 23:50:23 peter
  1002. * firstpass uses expectloc
  1003. * checks if there are differences between the expectloc and
  1004. location.loc from secondpass in EXTDEBUG
  1005. Revision 1.29 2003/04/22 14:33:38 peter
  1006. * removed some notes/hints
  1007. Revision 1.28 2003/04/22 12:45:58 florian
  1008. * fixed generic in operator code
  1009. + added debug code to check if all scratch registers are released
  1010. Revision 1.27 2003/04/22 10:09:35 daniel
  1011. + Implemented the actual register allocator
  1012. + Scratch registers unavailable when new register allocator used
  1013. + maybe_save/maybe_restore unavailable when new register allocator used
  1014. Revision 1.26 2003/02/19 22:00:14 daniel
  1015. * Code generator converted to new register notation
  1016. - Horribily outdated todo.txt removed
  1017. Revision 1.25 2003/01/08 18:43:56 daniel
  1018. * Tregister changed into a record
  1019. Revision 1.24 2002/11/27 02:37:13 peter
  1020. * case statement inlining added
  1021. * fixed inlining of write()
  1022. * switched statementnode left and right parts so the statements are
  1023. processed in the correct order when getcopy is used. This is
  1024. required for tempnodes
  1025. Revision 1.23 2002/11/25 17:43:18 peter
  1026. * splitted defbase in defutil,symutil,defcmp
  1027. * merged isconvertable and is_equal into compare_defs(_ext)
  1028. * made operator search faster by walking the list only once
  1029. Revision 1.22 2002/10/05 12:43:25 carl
  1030. * fixes for Delphi 6 compilation
  1031. (warning : Some features do not work under Delphi)
  1032. Revision 1.21 2002/10/03 21:31:10 carl
  1033. * range check error fixes
  1034. Revision 1.20 2002/09/17 18:54:03 jonas
  1035. * a_load_reg_reg() now has two size parameters: source and dest. This
  1036. allows some optimizations on architectures that don't encode the
  1037. register size in the register name.
  1038. Revision 1.19 2002/09/16 18:08:26 peter
  1039. * fix last optimization in genlinearlist, detected by bug tw1066
  1040. * use generic casenode.pass2 routine and override genlinearlist
  1041. * add jumptable support to generic casenode, by default there is
  1042. no jumptable support
  1043. Revision 1.18 2002/08/15 15:11:53 carl
  1044. * oldset define is now correct for all cpu's except i386
  1045. * correct compilation problems because of the above
  1046. Revision 1.17 2002/08/13 18:01:52 carl
  1047. * rename swatoperands to swapoperands
  1048. + m68k first compilable version (still needs a lot of testing):
  1049. assembler generator, system information , inline
  1050. assembler reader.
  1051. Revision 1.16 2002/08/11 14:32:27 peter
  1052. * renamed current_library to objectlibrary
  1053. Revision 1.15 2002/08/11 13:24:12 peter
  1054. * saving of asmsymbols in ppu supported
  1055. * asmsymbollist global is removed and moved into a new class
  1056. tasmlibrarydata that will hold the info of a .a file which
  1057. corresponds with a single module. Added librarydata to tmodule
  1058. to keep the library info stored for the module. In the future the
  1059. objectfiles will also be stored to the tasmlibrarydata class
  1060. * all getlabel/newasmsymbol and friends are moved to the new class
  1061. Revision 1.14 2002/08/11 11:37:42 jonas
  1062. * genlinear(cmp)list can now be overridden by descendents
  1063. Revision 1.13 2002/08/11 06:14:40 florian
  1064. * fixed powerpc compilation problems
  1065. Revision 1.12 2002/08/10 17:15:12 jonas
  1066. * optimizations and bugfix
  1067. Revision 1.11 2002/07/28 09:24:18 carl
  1068. + generic case node
  1069. Revision 1.10 2002/07/23 14:31:00 daniel
  1070. * Added internal error when asked to generate code for 'if expr in []'
  1071. Revision 1.9 2002/07/23 12:34:30 daniel
  1072. * Readded old set code. To use it define 'oldset'. Activated by default
  1073. for ppc.
  1074. Revision 1.8 2002/07/22 11:48:04 daniel
  1075. * Sets are now internally sets.
  1076. Revision 1.7 2002/07/21 16:58:20 jonas
  1077. * fixed some bugs in tcginnode.pass_2() and optimized the bit test
  1078. Revision 1.6 2002/07/20 11:57:54 florian
  1079. * types.pas renamed to defbase.pas because D6 contains a types
  1080. unit so this would conflicts if D6 programms are compiled
  1081. + Willamette/SSE2 instructions to assembler added
  1082. Revision 1.5 2002/07/11 14:41:28 florian
  1083. * start of the new generic parameter handling
  1084. Revision 1.4 2002/07/07 10:16:29 florian
  1085. * problems with last commit fixed
  1086. Revision 1.3 2002/07/06 20:19:25 carl
  1087. + generic set handling
  1088. Revision 1.2 2002/07/01 16:23:53 peter
  1089. * cg64 patch
  1090. * basics for currency
  1091. * asnode updates for class and interface (not finished)
  1092. Revision 1.1 2002/06/16 08:14:56 carl
  1093. + generic sets
  1094. }