ncgset.pas 51 KB

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