ncgset.pas 50 KB

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