ncgset.pas 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278
  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. location_force_reg(exprasmlist,left.location,OS_INT,true);
  507. pleftreg := left.location.register;
  508. location_freetemp(exprasmlist,left.location);
  509. hr := rg.getaddressregister(exprasmlist);
  510. cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,5,pleftreg,hr);
  511. cg.a_op_const_reg(exprasmlist,OP_SHL,OS_32,2,hr);
  512. href := right.location.reference;
  513. if (href.base.number = NR_NO) then
  514. href.base := hr
  515. else if (right.location.reference.index.number = NR_NO) then
  516. href.index := hr
  517. else
  518. begin
  519. reference_release(exprasmlist,href);
  520. hr2 := rg.getaddressregister(exprasmlist);
  521. cg.a_loadaddr_ref_reg(exprasmlist,href, hr2);
  522. reference_reset_base(href,hr2,0);
  523. href.index := hr;
  524. end;
  525. reference_release(exprasmlist,href);
  526. cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,href,location.register);
  527. rg.ungetregisterint(exprasmlist,pleftreg);
  528. hr := rg.getregisterint(exprasmlist,OS_32);
  529. cg.a_op_const_reg_reg(exprasmlist,OP_AND,OS_32,31,pleftreg,hr);
  530. cg.a_op_reg_reg(exprasmlist,OP_SHR,OS_32,hr,location.register);
  531. rg.ungetregisterint(exprasmlist,hr);
  532. cg.a_op_const_reg(exprasmlist,OP_AND,OS_32,1,location.register);
  533. end;
  534. end;
  535. end;
  536. location_freetemp(exprasmlist,right.location);
  537. end;
  538. {*****************************************************************************
  539. TCGCASENODE
  540. *****************************************************************************}
  541. procedure tcgcasenode.optimizevalues(var max_linear_list:longint;var max_dist:cardinal);
  542. begin
  543. { no changes by default }
  544. end;
  545. function tcgcasenode.has_jumptable : boolean;
  546. begin
  547. { No jumptable support in the default implementation }
  548. has_jumptable:=false;
  549. end;
  550. procedure tcgcasenode.genjumptable(hp : pcaserecord;min_,max_ : longint);
  551. begin
  552. internalerror(200209161);
  553. end;
  554. procedure tcgcasenode.genlinearlist(hp : pcaserecord);
  555. var
  556. first : boolean;
  557. last : TConstExprInt;
  558. scratch_reg: tregister;
  559. procedure genitem(t : pcaserecord);
  560. procedure gensub(value:longint);
  561. begin
  562. { here, since the sub and cmp are separate we need
  563. to move the result before subtract to a help
  564. register.
  565. }
  566. cg.a_load_reg_reg(exprasmlist, opsize, opsize, hregister, scratch_reg);
  567. cg.a_op_const_reg(exprasmlist, OP_SUB, opsize, value, hregister);
  568. end;
  569. begin
  570. if assigned(t^.less) then
  571. genitem(t^.less);
  572. { need we to test the first value }
  573. if first and (t^._low>get_min_value(left.resulttype.def)) then
  574. begin
  575. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,aword(t^._low),hregister,elselabel);
  576. end;
  577. if t^._low=t^._high then
  578. begin
  579. if t^._low-last=0 then
  580. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,0,hregister,t^.statement)
  581. else
  582. begin
  583. gensub(longint(t^._low-last));
  584. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,aword(t^._low-last),scratch_reg,t^.statement);
  585. end;
  586. last:=t^._low;
  587. end
  588. else
  589. begin
  590. { it begins with the smallest label, if the value }
  591. { is even smaller then jump immediately to the }
  592. { ELSE-label }
  593. if first then
  594. begin
  595. { have we to ajust the first value ? }
  596. if (t^._low>get_min_value(left.resulttype.def)) then
  597. gensub(longint(t^._low));
  598. end
  599. else
  600. begin
  601. { if there is no unused label between the last and the }
  602. { present label then the lower limit can be checked }
  603. { immediately. else check the range in between: }
  604. gensub(longint(t^._low-last));
  605. cg.a_cmp_const_reg_label(exprasmlist, opsize,jmp_lt,aword(t^._low-last),scratch_reg,elselabel);
  606. end;
  607. gensub(longint(t^._high-t^._low));
  608. cg.a_cmp_const_reg_label(exprasmlist, opsize,jmp_le,aword(t^._high-t^._low),scratch_reg,t^.statement);
  609. last:=t^._high;
  610. end;
  611. first:=false;
  612. if assigned(t^.greater) then
  613. genitem(t^.greater);
  614. end;
  615. begin
  616. { do we need to generate cmps? }
  617. if (with_sign and (min_label<0)) then
  618. genlinearcmplist(hp)
  619. else
  620. begin
  621. last:=0;
  622. first:=true;
  623. {$ifdef newra}
  624. scratch_reg:=rg.getregisterint(exprasmlist,opsize);
  625. {$else newra}
  626. scratch_reg := cg.get_scratch_reg_int(exprasmlist,opsize);
  627. {$endif}
  628. genitem(hp);
  629. {$ifdef newra}
  630. rg.ungetregisterint(exprasmlist,scratch_reg);
  631. {$else}
  632. cg.free_scratch_reg(exprasmlist,scratch_reg);
  633. {$endif}
  634. cg.a_jmp_always(exprasmlist,elselabel);
  635. end;
  636. end;
  637. procedure tcgcasenode.genlinearcmplist(hp : pcaserecord);
  638. var
  639. first : boolean;
  640. last : TConstExprInt;
  641. procedure genitem(t : pcaserecord);
  642. var
  643. l1 : tasmlabel;
  644. begin
  645. if assigned(t^.less) then
  646. genitem(t^.less);
  647. if t^._low=t^._high then
  648. begin
  649. if opsize in [OS_S64,OS_64] then
  650. begin
  651. objectlibrary.getlabel(l1);
  652. {$ifdef Delphi}
  653. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_NE, hi((t^._low)),hregister2,l1);
  654. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_EQ, lo((t^._low)),hregister, t^.statement);
  655. {$else}
  656. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_NE, aword(hi(int64(t^._low))),hregister2,l1);
  657. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_EQ, aword(lo(int64(t^._low))),hregister, t^.statement);
  658. {$endif}
  659. cg.a_label(exprasmlist,l1);
  660. end
  661. else
  662. begin
  663. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ, aword(t^._low),hregister, t^.statement);
  664. last:=t^._low;
  665. end;
  666. end
  667. else
  668. begin
  669. { it begins with the smallest label, if the value }
  670. { is even smaller then jump immediately to the }
  671. { ELSE-label }
  672. if first or (t^._low-last>1) then
  673. begin
  674. if opsize in [OS_64,OS_S64] then
  675. begin
  676. objectlibrary.getlabel(l1);
  677. {$ifdef Delphi}
  678. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi((t^._low))),
  679. hregister2, elselabel);
  680. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi((t^._low))),
  681. hregister2, l1);
  682. { the comparisation of the low dword must be always unsigned! }
  683. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_B, aword(lo((t^._low))), hregister, elselabel);
  684. {$else}
  685. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(int64(t^._low))),
  686. hregister2, elselabel);
  687. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(int64(t^._low))),
  688. hregister2, l1);
  689. { the comparisation of the low dword must be always unsigned! }
  690. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_B, aword(lo(int64(t^._low))), hregister, elselabel);
  691. {$endif}
  692. cg.a_label(exprasmlist,l1);
  693. end
  694. else
  695. begin
  696. cg.a_cmp_const_reg_label(exprasmlist, opsize, jmp_lt, aword(t^._low), hregister,
  697. elselabel);
  698. end;
  699. end;
  700. if opsize in [OS_S64,OS_64] then
  701. begin
  702. objectlibrary.getlabel(l1);
  703. {$ifdef Delphi}
  704. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(t^._high)), hregister2,
  705. t^.statement);
  706. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(t^._high)), hregister2,
  707. l1);
  708. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_BE, aword(lo(t^._high)), hregister, t^.statement);
  709. {$else}
  710. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(int64(t^._high))), hregister2,
  711. t^.statement);
  712. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(int64(t^._high))), hregister2,
  713. l1);
  714. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_BE, aword(lo(int64(t^._high))), hregister, t^.statement);
  715. {$endif}
  716. cg.a_label(exprasmlist,l1);
  717. end
  718. else
  719. begin
  720. cg.a_cmp_const_reg_label(exprasmlist, opsize, jmp_le, aword(t^._high), hregister, t^.statement);
  721. end;
  722. last:=t^._high;
  723. end;
  724. first:=false;
  725. if assigned(t^.greater) then
  726. genitem(t^.greater);
  727. end;
  728. begin
  729. last:=0;
  730. first:=true;
  731. genitem(hp);
  732. cg.a_jmp_always(exprasmlist,elselabel);
  733. end;
  734. procedure tcgcasenode.gentreejmp(p : pcaserecord);
  735. var
  736. lesslabel,greaterlabel : tasmlabel;
  737. begin
  738. cg.a_label(exprasmlist,p^._at);
  739. { calculate labels for left and right }
  740. if (p^.less=nil) then
  741. lesslabel:=elselabel
  742. else
  743. lesslabel:=p^.less^._at;
  744. if (p^.greater=nil) then
  745. greaterlabel:=elselabel
  746. else
  747. greaterlabel:=p^.greater^._at;
  748. { calculate labels for left and right }
  749. { no range label: }
  750. if p^._low=p^._high then
  751. begin
  752. if greaterlabel=lesslabel then
  753. begin
  754. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_NE,p^._low,hregister, lesslabel);
  755. end
  756. else
  757. begin
  758. cg.a_cmp_const_reg_label(exprasmlist,opsize, jmp_lt,p^._low,hregister, lesslabel);
  759. cg.a_cmp_const_reg_label(exprasmlist,opsize, jmp_gt,p^._low,hregister, greaterlabel);
  760. end;
  761. cg.a_jmp_always(exprasmlist,p^.statement);
  762. end
  763. else
  764. begin
  765. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,p^._low, hregister, lesslabel);
  766. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_gt,p^._high,hregister, greaterlabel);
  767. cg.a_jmp_always(exprasmlist,p^.statement);
  768. end;
  769. if assigned(p^.less) then
  770. gentreejmp(p^.less);
  771. if assigned(p^.greater) then
  772. gentreejmp(p^.greater);
  773. end;
  774. procedure ReLabel(var p:tasmsymbol);
  775. begin
  776. if p.defbind = AB_LOCAL then
  777. begin
  778. if not assigned(p.altsymbol) then
  779. objectlibrary.GenerateAltSymbol(p);
  780. p:=p.altsymbol;
  781. p.increfs;
  782. end;
  783. end;
  784. procedure relabelcaserecord(p : pcaserecord);
  785. begin
  786. Relabel(p^.statement);
  787. Relabel(p^._at);
  788. if assigned(p^.greater) then
  789. relabelcaserecord(p^.greater);
  790. if assigned(p^.less) then
  791. relabelcaserecord(p^.less);
  792. end;
  793. procedure tcgcasenode.pass_2;
  794. var
  795. lv,hv,
  796. max_label: tconstexprint;
  797. labels : longint;
  798. max_linear_list : longint;
  799. otl, ofl: tasmlabel;
  800. isjump : boolean;
  801. max_dist,
  802. dist : cardinal;
  803. hp : tstatementnode;
  804. begin
  805. location_reset(location,LOC_VOID,OS_NO);
  806. { Relabel for inlining? }
  807. if inlining_procedure and assigned(nodes) then
  808. begin
  809. objectlibrary.CreateUsedAsmSymbolList;
  810. relabelcaserecord(nodes);
  811. end;
  812. objectlibrary.getlabel(endlabel);
  813. objectlibrary.getlabel(elselabel);
  814. with_sign:=is_signed(left.resulttype.def);
  815. if with_sign then
  816. begin
  817. jmp_gt:=OC_GT;
  818. jmp_lt:=OC_LT;
  819. jmp_le:=OC_LTE;
  820. end
  821. else
  822. begin
  823. jmp_gt:=OC_A;
  824. jmp_lt:=OC_B;
  825. jmp_le:=OC_BE;
  826. end;
  827. {$ifndef newra}
  828. rg.cleartempgen;
  829. {$endif}
  830. { save current truelabel and falselabel }
  831. isjump:=false;
  832. if left.location.loc=LOC_JUMP then
  833. begin
  834. otl:=truelabel;
  835. objectlibrary.getlabel(truelabel);
  836. ofl:=falselabel;
  837. objectlibrary.getlabel(falselabel);
  838. isjump:=true;
  839. end;
  840. secondpass(left);
  841. { determines the size of the operand }
  842. opsize:=def_cgsize(left.resulttype.def);
  843. { copy the case expression to a register }
  844. location_force_reg(exprasmlist,left.location,opsize,false);
  845. if opsize in [OS_S64,OS_64] then
  846. begin
  847. hregister:=left.location.registerlow;
  848. hregister2:=left.location.registerhigh;
  849. end
  850. else
  851. hregister:=left.location.register;
  852. if isjump then
  853. begin
  854. truelabel:=otl;
  855. falselabel:=ofl;
  856. end;
  857. { we need the min_label always to choose between }
  858. { cmps and subs/decs }
  859. min_label:=case_get_min(nodes);
  860. load_all_regvars(exprasmlist);
  861. { now generate the jumps }
  862. if opsize in [OS_64,OS_S64] then
  863. genlinearcmplist(nodes)
  864. else
  865. begin
  866. if cs_optimize in aktglobalswitches then
  867. begin
  868. { procedures are empirically passed on }
  869. { consumption can also be calculated }
  870. { but does it pay on the different }
  871. { processors? }
  872. { moreover can the size only be appro- }
  873. { ximated as it is not known if rel8, }
  874. { rel16 or rel32 jumps are used }
  875. max_label:=case_get_max(nodes);
  876. labels:=case_count_labels(nodes);
  877. { can we omit the range check of the jump table ? }
  878. getrange(left.resulttype.def,lv,hv);
  879. jumptable_no_range:=(lv=min_label) and (hv=max_label);
  880. { hack a little bit, because the range can be greater }
  881. { than the positive range of a longint }
  882. if (min_label<0) and (max_label>0) then
  883. begin
  884. if min_label=TConstExprInt($80000000) then
  885. dist:=Cardinal(max_label)+Cardinal($80000000)
  886. else
  887. dist:=Cardinal(max_label)+Cardinal(-min_label)
  888. end
  889. else
  890. dist:=max_label-min_label;
  891. { optimize for size ? }
  892. if cs_littlesize in aktglobalswitches then
  893. begin
  894. if (has_jumptable) and
  895. not((labels<=2) or
  896. ((max_label-min_label)<0) or
  897. ((max_label-min_label)>3*labels)) then
  898. begin
  899. { if the labels less or more a continuum then }
  900. genjumptable(nodes,min_label,max_label);
  901. end
  902. else
  903. begin
  904. { a linear list is always smaller than a jump tree }
  905. genlinearlist(nodes);
  906. end;
  907. end
  908. else
  909. begin
  910. max_dist:=4*cardinal(labels);
  911. if jumptable_no_range then
  912. max_linear_list:=4
  913. else
  914. max_linear_list:=2;
  915. { allow processor specific values }
  916. optimizevalues(max_linear_list,max_dist);
  917. if (labels<=max_linear_list) then
  918. genlinearlist(nodes)
  919. else
  920. begin
  921. if (has_jumptable) and
  922. (dist<max_dist) then
  923. genjumptable(nodes,min_label,max_label)
  924. else
  925. begin
  926. {
  927. This one expects that the case labels are a
  928. perfectly balanced tree, which is not the case
  929. very often -> generates really bad code (JM)
  930. if labels>16 then
  931. gentreejmp(nodes)
  932. else
  933. }
  934. genlinearlist(nodes);
  935. end;
  936. end;
  937. end;
  938. end
  939. else
  940. { it's always not bad }
  941. genlinearlist(nodes);
  942. end;
  943. rg.ungetregisterint(exprasmlist,hregister);
  944. { now generate the instructions }
  945. hp:=tstatementnode(right);
  946. while assigned(hp) do
  947. begin
  948. {$ifndef newra}
  949. rg.cleartempgen;
  950. {$endif}
  951. { relabel when inlining }
  952. if inlining_procedure then
  953. begin
  954. if hp.left.nodetype<>labeln then
  955. internalerror(200211261);
  956. Relabel(tlabelnode(hp.left).labelnr);
  957. end;
  958. secondpass(hp.left);
  959. { don't come back to case line }
  960. aktfilepos:=exprasmList.getlasttaifilepos^;
  961. load_all_regvars(exprasmlist);
  962. cg.a_jmp_always(exprasmlist,endlabel);
  963. hp:=tstatementnode(hp.right);
  964. end;
  965. cg.a_label(exprasmlist,elselabel);
  966. { ...and the else block }
  967. if assigned(elseblock) then
  968. begin
  969. {$ifndef newra}
  970. rg.cleartempgen;
  971. {$endif}
  972. secondpass(elseblock);
  973. load_all_regvars(exprasmlist);
  974. end;
  975. cg.a_label(exprasmlist,endlabel);
  976. { Remove relabels for inlining }
  977. if inlining_procedure and
  978. assigned(nodes) then
  979. begin
  980. { restore used symbols }
  981. objectlibrary.UsedAsmSymbolListResetAltSym;
  982. objectlibrary.DestroyUsedAsmSymbolList;
  983. end;
  984. end;
  985. begin
  986. csetelementnode:=tcgsetelementnode;
  987. cinnode:=tcginnode;
  988. ccasenode:=tcgcasenode;
  989. end.
  990. {
  991. $Log$
  992. Revision 1.46 2003-07-23 11:02:53 jonas
  993. * final (?) fix to in-code
  994. Revision 1.45 2003/07/20 18:03:27 jonas
  995. * fixed bug in tcginnode.pass_2
  996. Revision 1.44 2003/07/06 14:28:04 jonas
  997. * fixed register leak
  998. * changed a couple of case-statements to location_force_reg()
  999. Revision 1.43 2003/06/12 22:09:54 jonas
  1000. * tcginnode.pass_2 doesn't call a helper anymore in any case
  1001. * fixed ungetregisterfpu compilation problems
  1002. Revision 1.42 2003/06/08 16:03:22 jonas
  1003. - disabled gentreejmp for now, it expects that the case labels are
  1004. ordered as a perfectly balanced tree, while they are often a linked
  1005. list -> generates extremely bad code
  1006. Revision 1.41 2003/06/07 18:57:04 jonas
  1007. + added freeintparaloc
  1008. * ppc get/freeintparaloc now check whether the parameter regs are
  1009. properly allocated/deallocated (and get an extra list para)
  1010. * ppc a_call_* now internalerrors if pi_do_call is not yet set
  1011. * fixed lot of missing pi_do_call's
  1012. Revision 1.40 2003/06/03 21:11:09 peter
  1013. * cg.a_load_* get a from and to size specifier
  1014. * makeregsize only accepts newregister
  1015. * i386 uses generic tcgnotnode,tcgunaryminus
  1016. Revision 1.39 2003/06/01 21:38:06 peter
  1017. * getregisterfpu size parameter added
  1018. * op_const_reg size parameter added
  1019. * sparc updates
  1020. Revision 1.38 2003/05/30 23:57:08 peter
  1021. * more sparc cleanup
  1022. * accumulator removed, splitted in function_return_reg (called) and
  1023. function_result_reg (caller)
  1024. Revision 1.37 2003/05/30 23:49:18 jonas
  1025. * a_load_loc_reg now has an extra size parameter for the destination
  1026. register (properly fixes what I worked around in revision 1.106 of
  1027. ncgutil.pas)
  1028. Revision 1.36 2003/05/24 19:48:49 jonas
  1029. * fixed tcginnode endian bug again, but correcty this time :)
  1030. Revision 1.35 2003/05/23 21:10:50 florian
  1031. * fixed sparc compiler compilation
  1032. Revision 1.34 2003/05/23 19:52:28 jonas
  1033. * corrected fix for endian differences in tcginnode
  1034. Revision 1.33 2003/05/17 19:17:35 jonas
  1035. * fixed size setting of result location of innodes
  1036. Revision 1.32 2003/05/01 12:26:50 jonas
  1037. * fixed endian issue in inlined in-test for smallsets
  1038. * pass the address of normalsets to fpc_set_in_set_byte instead of the
  1039. contents of the first 4 bytes
  1040. Revision 1.31 2003/04/25 08:25:26 daniel
  1041. * Ifdefs around a lot of calls to cleartempgen
  1042. * Fixed registers that are allocated but not freed in several nodes
  1043. * Tweak to register allocator to cause less spills
  1044. * 8-bit registers now interfere with esi,edi and ebp
  1045. Compiler can now compile rtl successfully when using new register
  1046. allocator
  1047. Revision 1.30 2003/04/22 23:50:23 peter
  1048. * firstpass uses expectloc
  1049. * checks if there are differences between the expectloc and
  1050. location.loc from secondpass in EXTDEBUG
  1051. Revision 1.29 2003/04/22 14:33:38 peter
  1052. * removed some notes/hints
  1053. Revision 1.28 2003/04/22 12:45:58 florian
  1054. * fixed generic in operator code
  1055. + added debug code to check if all scratch registers are released
  1056. Revision 1.27 2003/04/22 10:09:35 daniel
  1057. + Implemented the actual register allocator
  1058. + Scratch registers unavailable when new register allocator used
  1059. + maybe_save/maybe_restore unavailable when new register allocator used
  1060. Revision 1.26 2003/02/19 22:00:14 daniel
  1061. * Code generator converted to new register notation
  1062. - Horribily outdated todo.txt removed
  1063. Revision 1.25 2003/01/08 18:43:56 daniel
  1064. * Tregister changed into a record
  1065. Revision 1.24 2002/11/27 02:37:13 peter
  1066. * case statement inlining added
  1067. * fixed inlining of write()
  1068. * switched statementnode left and right parts so the statements are
  1069. processed in the correct order when getcopy is used. This is
  1070. required for tempnodes
  1071. Revision 1.23 2002/11/25 17:43:18 peter
  1072. * splitted defbase in defutil,symutil,defcmp
  1073. * merged isconvertable and is_equal into compare_defs(_ext)
  1074. * made operator search faster by walking the list only once
  1075. Revision 1.22 2002/10/05 12:43:25 carl
  1076. * fixes for Delphi 6 compilation
  1077. (warning : Some features do not work under Delphi)
  1078. Revision 1.21 2002/10/03 21:31:10 carl
  1079. * range check error fixes
  1080. Revision 1.20 2002/09/17 18:54:03 jonas
  1081. * a_load_reg_reg() now has two size parameters: source and dest. This
  1082. allows some optimizations on architectures that don't encode the
  1083. register size in the register name.
  1084. Revision 1.19 2002/09/16 18:08:26 peter
  1085. * fix last optimization in genlinearlist, detected by bug tw1066
  1086. * use generic casenode.pass2 routine and override genlinearlist
  1087. * add jumptable support to generic casenode, by default there is
  1088. no jumptable support
  1089. Revision 1.18 2002/08/15 15:11:53 carl
  1090. * oldset define is now correct for all cpu's except i386
  1091. * correct compilation problems because of the above
  1092. Revision 1.17 2002/08/13 18:01:52 carl
  1093. * rename swatoperands to swapoperands
  1094. + m68k first compilable version (still needs a lot of testing):
  1095. assembler generator, system information , inline
  1096. assembler reader.
  1097. Revision 1.16 2002/08/11 14:32:27 peter
  1098. * renamed current_library to objectlibrary
  1099. Revision 1.15 2002/08/11 13:24:12 peter
  1100. * saving of asmsymbols in ppu supported
  1101. * asmsymbollist global is removed and moved into a new class
  1102. tasmlibrarydata that will hold the info of a .a file which
  1103. corresponds with a single module. Added librarydata to tmodule
  1104. to keep the library info stored for the module. In the future the
  1105. objectfiles will also be stored to the tasmlibrarydata class
  1106. * all getlabel/newasmsymbol and friends are moved to the new class
  1107. Revision 1.14 2002/08/11 11:37:42 jonas
  1108. * genlinear(cmp)list can now be overridden by descendents
  1109. Revision 1.13 2002/08/11 06:14:40 florian
  1110. * fixed powerpc compilation problems
  1111. Revision 1.12 2002/08/10 17:15:12 jonas
  1112. * optimizations and bugfix
  1113. Revision 1.11 2002/07/28 09:24:18 carl
  1114. + generic case node
  1115. Revision 1.10 2002/07/23 14:31:00 daniel
  1116. * Added internal error when asked to generate code for 'if expr in []'
  1117. Revision 1.9 2002/07/23 12:34:30 daniel
  1118. * Readded old set code. To use it define 'oldset'. Activated by default
  1119. for ppc.
  1120. Revision 1.8 2002/07/22 11:48:04 daniel
  1121. * Sets are now internally sets.
  1122. Revision 1.7 2002/07/21 16:58:20 jonas
  1123. * fixed some bugs in tcginnode.pass_2() and optimized the bit test
  1124. Revision 1.6 2002/07/20 11:57:54 florian
  1125. * types.pas renamed to defbase.pas because D6 contains a types
  1126. unit so this would conflicts if D6 programms are compiled
  1127. + Willamette/SSE2 instructions to assembler added
  1128. Revision 1.5 2002/07/11 14:41:28 florian
  1129. * start of the new generic parameter handling
  1130. Revision 1.4 2002/07/07 10:16:29 florian
  1131. * problems with last commit fixed
  1132. Revision 1.3 2002/07/06 20:19:25 carl
  1133. + generic set handling
  1134. Revision 1.2 2002/07/01 16:23:53 peter
  1135. * cg64 patch
  1136. * basics for currency
  1137. * asnode updates for class and interface (not finished)
  1138. Revision 1.1 2002/06/16 08:14:56 carl
  1139. + generic sets
  1140. }