ncgset.pas 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283
  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_INTREGISTER;
  294. hr.number:=NR_NO;
  295. for i:=1 to numparts do
  296. if setparts[i].range then
  297. { use fact that a <= x <= b <=> cardinal(x-a) <= cardinal(b-a) }
  298. begin
  299. { is the range different from all legal values? }
  300. if (setparts[i].stop-setparts[i].start <> 255) then
  301. begin
  302. { yes, is the lower bound <> 0? }
  303. if (setparts[i].start <> 0) then
  304. { we're going to substract from the left register, }
  305. { so in case of a LOC_CREGISTER first move the value }
  306. { to edi (not done before because now we can do the }
  307. { move and substract in one instruction with LEA) }
  308. if (left.location.loc = LOC_CREGISTER) and
  309. (hr.enum <> pleftreg.enum) then
  310. begin
  311. {$ifdef newra}
  312. hr:=rg.getregisterint(exprasmlist,OS_INT);
  313. {$else}
  314. hr:=cg.get_scratch_reg_int(exprasmlist,OS_INT);
  315. {$endif}
  316. cg.a_op_const_reg_reg(exprasmlist,OP_SUB,opsize,setparts[i].start,pleftreg,hr);
  317. pleftreg:=hr;
  318. opsize := OS_INT;
  319. end
  320. else
  321. begin
  322. { otherwise, the value is already in a register }
  323. { that can be modified }
  324. cg.a_op_const_reg(exprasmlist,OP_SUB,opsize,
  325. setparts[i].start-adjustment,pleftreg)
  326. end;
  327. { new total value substracted from x: }
  328. { adjustment + (setparts[i].start - adjustment) }
  329. adjustment := setparts[i].start;
  330. { check if result < b-a+1 (not "result <= b-a", since }
  331. { we need a carry in case the element is in the range }
  332. { (this will never overflow since we check at the }
  333. { beginning whether stop-start <> 255) }
  334. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_B,
  335. setparts[i].stop-setparts[i].start+1,pleftreg,l);
  336. end
  337. else
  338. { if setparts[i].start = 0 and setparts[i].stop = 255, }
  339. { it's always true since "in" is only allowed for bytes }
  340. begin
  341. cg.a_jmp_always(exprasmlist,l);
  342. end;
  343. end
  344. else
  345. begin
  346. { Emit code to check if left is an element }
  347. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,
  348. setparts[i].stop-adjustment,pleftreg,l);
  349. end;
  350. { To compensate for not doing a second pass }
  351. right.location.reference.symbol:=nil;
  352. objectlibrary.getlabel(l3);
  353. cg.a_jmp_always(exprasmlist,l3);
  354. { Now place the end label if IN success }
  355. cg.a_label(exprasmlist,l);
  356. { result register is 1 }
  357. cg.a_load_const_reg(exprasmlist,location.size,1,location.register);
  358. { in case value is not found }
  359. cg.a_label(exprasmlist,l3);
  360. case left.location.loc of
  361. LOC_CREGISTER :
  362. {$ifdef newra}
  363. rg.ungetregisterint(exprasmlist,pleftreg);
  364. {$else}
  365. cg.free_scratch_reg(exprasmlist,pleftreg);
  366. {$endif}
  367. LOC_REGISTER :
  368. rg.ungetregisterint(exprasmlist,pleftreg);
  369. else
  370. begin
  371. reference_release(exprasmlist,left.location.reference);
  372. {$ifdef newra}
  373. rg.ungetregisterint(exprasmlist,pleftreg);
  374. {$else}
  375. cg.free_scratch_reg(exprasmlist,pleftreg);
  376. {$endif}
  377. end;
  378. end;
  379. end
  380. else
  381. {*****************************************************************}
  382. { NO JUMP TABLE GENERATION }
  383. {*****************************************************************}
  384. begin
  385. { We will now generated code to check the set itself, no jmps,
  386. handle smallsets separate, because it allows faster checks }
  387. if use_small then
  388. begin
  389. {**************************** SMALL SET **********************}
  390. if left.nodetype=ordconstn then
  391. begin
  392. location_force_reg(exprasmlist,right.location,OS_32,true);
  393. { then SHR the register }
  394. cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_INT,
  395. tordconstnode(left).value and 31,right.location.register,location.register);
  396. rg.ungetregisterint(exprasmlist,right.location.register);
  397. { then extract the lowest bit }
  398. cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,1,location.register);
  399. end
  400. else
  401. begin
  402. case left.location.loc of
  403. LOC_REGISTER,
  404. LOC_CREGISTER:
  405. begin
  406. hr3:=rg.makeregsize(left.location.register,OS_INT);
  407. cg.a_load_reg_reg(exprasmlist,left.location.size,OS_INT,left.location.register,hr3);
  408. {$ifdef newra}
  409. hr:=rg.getregisterint(exprasmlist,OS_INT);
  410. {$else}
  411. hr:=cg.get_scratch_reg_int(exprasmlist,OS_INT);
  412. {$endif}
  413. cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,hr3,hr);
  414. end;
  415. else
  416. begin
  417. {$ifdef newra}
  418. hr:=rg.getregisterint(exprasmlist,OS_INT);
  419. {$else}
  420. hr:=cg.get_scratch_reg_int(exprasmlist,OS_INT);
  421. {$endif}
  422. cg.a_load_ref_reg(exprasmlist,def_cgsize(left.resulttype.def),OS_INT,
  423. left.location.reference,hr);
  424. location_release(exprasmlist,left.location);
  425. end;
  426. end;
  427. location_force_reg(exprasmlist,right.location,OS_32,true);
  428. { emit bit test operation }
  429. emit_bit_test_reg_reg(exprasmlist,hr,right.location.register,location.register);
  430. { free the resources }
  431. rg.ungetregisterint(exprasmlist,right.location.register);
  432. { free bitnumber register }
  433. {$ifdef newra}
  434. rg.ungetregisterint(exprasmlist,hr);
  435. {$else}
  436. cg.free_scratch_reg(exprasmlist,hr);
  437. {$endif}
  438. end;
  439. end
  440. else
  441. {************************** NOT SMALL SET ********************}
  442. begin
  443. if right.location.loc=LOC_CONSTANT then
  444. begin
  445. { this section has not been tested! }
  446. { can it actually occur currently? CEC }
  447. { yes: "if bytevar in [1,3,5,7,9,11,13,15]" (JM) }
  448. objectlibrary.getlabel(l);
  449. objectlibrary.getlabel(l2);
  450. case left.location.loc of
  451. LOC_REGISTER,
  452. LOC_CREGISTER:
  453. begin
  454. hr:=rg.makeregsize(left.location.register,OS_INT);
  455. cg.a_load_reg_reg(exprasmlist,left.location.size,OS_INT,left.location.register,hr);
  456. cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_BE,31,hr,l);
  457. { reset of result register is done in routine entry }
  458. cg.a_jmp_always(exprasmlist,l2);
  459. cg.a_label(exprasmlist,l);
  460. { We have to load the value into a register because
  461. btl does not accept values only refs or regs (PFV) }
  462. hr2:=rg.getregisterint(exprasmlist,OS_INT);
  463. cg.a_load_const_reg(exprasmlist,OS_INT,right.location.value,hr2);
  464. end;
  465. LOC_REFERENCE,
  466. LOC_CREFERENCE:
  467. begin
  468. cg.a_cmp_const_ref_label(exprasmlist,OS_8,OC_BE,31,left.location.reference,l);
  469. cg.a_jmp_always(exprasmlist,l2);
  470. cg.a_label(exprasmlist,l);
  471. location_release(exprasmlist,left.location);
  472. hr:=rg.getregisterint(exprasmlist,OS_INT);
  473. cg.a_load_ref_reg(exprasmlist,OS_INT,OS_INT,left.location.reference,hr);
  474. { We have to load the value into a register because
  475. btl does not accept values only refs or regs (PFV) }
  476. hr2:=rg.getregisterint(exprasmlist,OS_INT);
  477. cg.a_load_const_reg(exprasmlist,OS_INT,right.location.value,hr2);
  478. end;
  479. else
  480. internalerror(2002081002);
  481. end;
  482. { emit bit test operation }
  483. emit_bit_test_reg_reg(exprasmlist,hr,hr2,location.register);
  484. rg.ungetregisterint(exprasmlist,hr2);
  485. if not (left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
  486. rg.ungetregisterint(exprasmlist,hr);
  487. cg.a_label(exprasmlist,l2);
  488. end { of right.location.loc=LOC_CONSTANT }
  489. { do search in a normal set which could have >32 elementsm
  490. but also used if the left side contains higher values > 32 }
  491. else if left.nodetype=ordconstn then
  492. begin
  493. { use location.register as scratch register here }
  494. if (target_info.endian = endian_little) then
  495. inc(right.location.reference.offset,tordconstnode(left).value shr 3)
  496. else
  497. { adjust for endianess differences }
  498. inc(right.location.reference.offset,(tordconstnode(left).value shr 3) xor 3);
  499. cg.a_load_ref_reg(exprasmlist,OS_8,location.size,right.location.reference, location.register);
  500. location_release(exprasmlist,right.location);
  501. cg.a_op_const_reg(exprasmlist,OP_SHR,location.size,tordconstnode(left).value and 7,
  502. location.register);
  503. cg.a_op_const_reg(exprasmlist,OP_AND,location.size,1,location.register);
  504. end
  505. else
  506. begin
  507. location_force_reg(exprasmlist,left.location,OS_INT,true);
  508. pleftreg := left.location.register;
  509. location_freetemp(exprasmlist,left.location);
  510. hr := rg.getaddressregister(exprasmlist);
  511. cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,5,pleftreg,hr);
  512. cg.a_op_const_reg(exprasmlist,OP_SHL,OS_32,2,hr);
  513. href := right.location.reference;
  514. if (href.base.number = NR_NO) then
  515. href.base := hr
  516. else if (right.location.reference.index.number = NR_NO) then
  517. href.index := hr
  518. else
  519. begin
  520. reference_release(exprasmlist,href);
  521. hr2 := rg.getaddressregister(exprasmlist);
  522. cg.a_loadaddr_ref_reg(exprasmlist,href, hr2);
  523. reference_reset_base(href,hr2,0);
  524. href.index := hr;
  525. end;
  526. reference_release(exprasmlist,href);
  527. cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,href,location.register);
  528. rg.ungetregisterint(exprasmlist,pleftreg);
  529. hr := rg.getregisterint(exprasmlist,OS_32);
  530. cg.a_op_const_reg_reg(exprasmlist,OP_AND,OS_32,31,pleftreg,hr);
  531. cg.a_op_reg_reg(exprasmlist,OP_SHR,OS_32,hr,location.register);
  532. rg.ungetregisterint(exprasmlist,hr);
  533. cg.a_op_const_reg(exprasmlist,OP_AND,OS_32,1,location.register);
  534. end;
  535. end;
  536. end;
  537. location_freetemp(exprasmlist,right.location);
  538. end;
  539. {*****************************************************************************
  540. TCGCASENODE
  541. *****************************************************************************}
  542. procedure tcgcasenode.optimizevalues(var max_linear_list:longint;var max_dist:cardinal);
  543. begin
  544. { no changes by default }
  545. end;
  546. function tcgcasenode.has_jumptable : boolean;
  547. begin
  548. { No jumptable support in the default implementation }
  549. has_jumptable:=false;
  550. end;
  551. procedure tcgcasenode.genjumptable(hp : pcaserecord;min_,max_ : longint);
  552. begin
  553. internalerror(200209161);
  554. end;
  555. procedure tcgcasenode.genlinearlist(hp : pcaserecord);
  556. var
  557. first : boolean;
  558. last : TConstExprInt;
  559. scratch_reg: tregister;
  560. procedure genitem(t : pcaserecord);
  561. procedure gensub(value:longint);
  562. begin
  563. { here, since the sub and cmp are separate we need
  564. to move the result before subtract to a help
  565. register.
  566. }
  567. cg.a_load_reg_reg(exprasmlist, opsize, opsize, hregister, scratch_reg);
  568. cg.a_op_const_reg(exprasmlist, OP_SUB, opsize, value, hregister);
  569. end;
  570. begin
  571. if assigned(t^.less) then
  572. genitem(t^.less);
  573. { need we to test the first value }
  574. if first and (t^._low>get_min_value(left.resulttype.def)) then
  575. begin
  576. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,aword(t^._low),hregister,elselabel);
  577. end;
  578. if t^._low=t^._high then
  579. begin
  580. if t^._low-last=0 then
  581. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,0,hregister,t^.statement)
  582. else
  583. begin
  584. gensub(longint(t^._low-last));
  585. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,aword(t^._low-last),scratch_reg,t^.statement);
  586. end;
  587. last:=t^._low;
  588. end
  589. else
  590. begin
  591. { it begins with the smallest label, if the value }
  592. { is even smaller then jump immediately to the }
  593. { ELSE-label }
  594. if first then
  595. begin
  596. { have we to ajust the first value ? }
  597. if (t^._low>get_min_value(left.resulttype.def)) then
  598. gensub(longint(t^._low));
  599. end
  600. else
  601. begin
  602. { if there is no unused label between the last and the }
  603. { present label then the lower limit can be checked }
  604. { immediately. else check the range in between: }
  605. gensub(longint(t^._low-last));
  606. cg.a_cmp_const_reg_label(exprasmlist, opsize,jmp_lt,aword(t^._low-last),scratch_reg,elselabel);
  607. end;
  608. gensub(longint(t^._high-t^._low));
  609. cg.a_cmp_const_reg_label(exprasmlist, opsize,jmp_le,aword(t^._high-t^._low),scratch_reg,t^.statement);
  610. last:=t^._high;
  611. end;
  612. first:=false;
  613. if assigned(t^.greater) then
  614. genitem(t^.greater);
  615. end;
  616. begin
  617. { do we need to generate cmps? }
  618. if (with_sign and (min_label<0)) then
  619. genlinearcmplist(hp)
  620. else
  621. begin
  622. last:=0;
  623. first:=true;
  624. {$ifdef newra}
  625. scratch_reg:=rg.getregisterint(exprasmlist,opsize);
  626. {$else newra}
  627. scratch_reg := cg.get_scratch_reg_int(exprasmlist,opsize);
  628. {$endif}
  629. genitem(hp);
  630. {$ifdef newra}
  631. rg.ungetregisterint(exprasmlist,scratch_reg);
  632. {$else}
  633. cg.free_scratch_reg(exprasmlist,scratch_reg);
  634. {$endif}
  635. cg.a_jmp_always(exprasmlist,elselabel);
  636. end;
  637. end;
  638. procedure tcgcasenode.genlinearcmplist(hp : pcaserecord);
  639. var
  640. first : boolean;
  641. last : TConstExprInt;
  642. procedure genitem(t : pcaserecord);
  643. var
  644. l1 : tasmlabel;
  645. begin
  646. if assigned(t^.less) then
  647. genitem(t^.less);
  648. if t^._low=t^._high then
  649. begin
  650. if opsize in [OS_S64,OS_64] then
  651. begin
  652. objectlibrary.getlabel(l1);
  653. {$ifdef Delphi}
  654. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_NE, hi((t^._low)),hregister2,l1);
  655. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_EQ, lo((t^._low)),hregister, t^.statement);
  656. {$else}
  657. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_NE, aword(hi(int64(t^._low))),hregister2,l1);
  658. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_EQ, aword(lo(int64(t^._low))),hregister, t^.statement);
  659. {$endif}
  660. cg.a_label(exprasmlist,l1);
  661. end
  662. else
  663. begin
  664. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ, aword(t^._low),hregister, t^.statement);
  665. last:=t^._low;
  666. end;
  667. end
  668. else
  669. begin
  670. { it begins with the smallest label, if the value }
  671. { is even smaller then jump immediately to the }
  672. { ELSE-label }
  673. if first or (t^._low-last>1) then
  674. begin
  675. if opsize in [OS_64,OS_S64] then
  676. begin
  677. objectlibrary.getlabel(l1);
  678. {$ifdef Delphi}
  679. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi((t^._low))),
  680. hregister2, elselabel);
  681. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi((t^._low))),
  682. hregister2, l1);
  683. { the comparisation of the low dword must be always unsigned! }
  684. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_B, aword(lo((t^._low))), hregister, elselabel);
  685. {$else}
  686. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(int64(t^._low))),
  687. hregister2, elselabel);
  688. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(int64(t^._low))),
  689. hregister2, l1);
  690. { the comparisation of the low dword must be always unsigned! }
  691. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_B, aword(lo(int64(t^._low))), hregister, elselabel);
  692. {$endif}
  693. cg.a_label(exprasmlist,l1);
  694. end
  695. else
  696. begin
  697. cg.a_cmp_const_reg_label(exprasmlist, opsize, jmp_lt, aword(t^._low), hregister,
  698. elselabel);
  699. end;
  700. end;
  701. if opsize in [OS_S64,OS_64] then
  702. begin
  703. objectlibrary.getlabel(l1);
  704. {$ifdef Delphi}
  705. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(t^._high)), hregister2,
  706. t^.statement);
  707. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(t^._high)), hregister2,
  708. l1);
  709. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_BE, aword(lo(t^._high)), hregister, t^.statement);
  710. {$else}
  711. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aword(hi(int64(t^._high))), hregister2,
  712. t^.statement);
  713. cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aword(hi(int64(t^._high))), hregister2,
  714. l1);
  715. cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_BE, aword(lo(int64(t^._high))), hregister, t^.statement);
  716. {$endif}
  717. cg.a_label(exprasmlist,l1);
  718. end
  719. else
  720. begin
  721. cg.a_cmp_const_reg_label(exprasmlist, opsize, jmp_le, aword(t^._high), hregister, t^.statement);
  722. end;
  723. last:=t^._high;
  724. end;
  725. first:=false;
  726. if assigned(t^.greater) then
  727. genitem(t^.greater);
  728. end;
  729. begin
  730. last:=0;
  731. first:=true;
  732. genitem(hp);
  733. cg.a_jmp_always(exprasmlist,elselabel);
  734. end;
  735. procedure tcgcasenode.gentreejmp(p : pcaserecord);
  736. var
  737. lesslabel,greaterlabel : tasmlabel;
  738. begin
  739. cg.a_label(exprasmlist,p^._at);
  740. { calculate labels for left and right }
  741. if (p^.less=nil) then
  742. lesslabel:=elselabel
  743. else
  744. lesslabel:=p^.less^._at;
  745. if (p^.greater=nil) then
  746. greaterlabel:=elselabel
  747. else
  748. greaterlabel:=p^.greater^._at;
  749. { calculate labels for left and right }
  750. { no range label: }
  751. if p^._low=p^._high then
  752. begin
  753. if greaterlabel=lesslabel then
  754. begin
  755. cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_NE,p^._low,hregister, lesslabel);
  756. end
  757. else
  758. begin
  759. cg.a_cmp_const_reg_label(exprasmlist,opsize, jmp_lt,p^._low,hregister, lesslabel);
  760. cg.a_cmp_const_reg_label(exprasmlist,opsize, jmp_gt,p^._low,hregister, greaterlabel);
  761. end;
  762. cg.a_jmp_always(exprasmlist,p^.statement);
  763. end
  764. else
  765. begin
  766. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,p^._low, hregister, lesslabel);
  767. cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_gt,p^._high,hregister, greaterlabel);
  768. cg.a_jmp_always(exprasmlist,p^.statement);
  769. end;
  770. if assigned(p^.less) then
  771. gentreejmp(p^.less);
  772. if assigned(p^.greater) then
  773. gentreejmp(p^.greater);
  774. end;
  775. procedure ReLabel(var p:tasmsymbol);
  776. begin
  777. if p.defbind = AB_LOCAL then
  778. begin
  779. if not assigned(p.altsymbol) then
  780. objectlibrary.GenerateAltSymbol(p);
  781. p:=p.altsymbol;
  782. p.increfs;
  783. end;
  784. end;
  785. procedure relabelcaserecord(p : pcaserecord);
  786. begin
  787. Relabel(p^.statement);
  788. Relabel(p^._at);
  789. if assigned(p^.greater) then
  790. relabelcaserecord(p^.greater);
  791. if assigned(p^.less) then
  792. relabelcaserecord(p^.less);
  793. end;
  794. procedure tcgcasenode.pass_2;
  795. var
  796. lv,hv,
  797. max_label: tconstexprint;
  798. labels : longint;
  799. max_linear_list : longint;
  800. otl, ofl: tasmlabel;
  801. isjump : boolean;
  802. max_dist,
  803. dist : cardinal;
  804. hp : tstatementnode;
  805. begin
  806. location_reset(location,LOC_VOID,OS_NO);
  807. { Relabel for inlining? }
  808. if inlining_procedure and assigned(nodes) then
  809. begin
  810. objectlibrary.CreateUsedAsmSymbolList;
  811. relabelcaserecord(nodes);
  812. end;
  813. objectlibrary.getlabel(endlabel);
  814. objectlibrary.getlabel(elselabel);
  815. with_sign:=is_signed(left.resulttype.def);
  816. if with_sign then
  817. begin
  818. jmp_gt:=OC_GT;
  819. jmp_lt:=OC_LT;
  820. jmp_le:=OC_LTE;
  821. end
  822. else
  823. begin
  824. jmp_gt:=OC_A;
  825. jmp_lt:=OC_B;
  826. jmp_le:=OC_BE;
  827. end;
  828. {$ifndef newra}
  829. rg.cleartempgen;
  830. {$endif}
  831. { save current truelabel and falselabel }
  832. isjump:=false;
  833. if left.location.loc=LOC_JUMP then
  834. begin
  835. otl:=truelabel;
  836. objectlibrary.getlabel(truelabel);
  837. ofl:=falselabel;
  838. objectlibrary.getlabel(falselabel);
  839. isjump:=true;
  840. end;
  841. secondpass(left);
  842. { determines the size of the operand }
  843. opsize:=def_cgsize(left.resulttype.def);
  844. { copy the case expression to a register }
  845. location_force_reg(exprasmlist,left.location,opsize,false);
  846. if opsize in [OS_S64,OS_64] then
  847. begin
  848. hregister:=left.location.registerlow;
  849. hregister2:=left.location.registerhigh;
  850. end
  851. else
  852. hregister:=left.location.register;
  853. if isjump then
  854. begin
  855. truelabel:=otl;
  856. falselabel:=ofl;
  857. end;
  858. { we need the min_label always to choose between }
  859. { cmps and subs/decs }
  860. min_label:=case_get_min(nodes);
  861. load_all_regvars(exprasmlist);
  862. { now generate the jumps }
  863. if opsize in [OS_64,OS_S64] then
  864. genlinearcmplist(nodes)
  865. else
  866. begin
  867. if cs_optimize in aktglobalswitches then
  868. begin
  869. { procedures are empirically passed on }
  870. { consumption can also be calculated }
  871. { but does it pay on the different }
  872. { processors? }
  873. { moreover can the size only be appro- }
  874. { ximated as it is not known if rel8, }
  875. { rel16 or rel32 jumps are used }
  876. max_label:=case_get_max(nodes);
  877. labels:=case_count_labels(nodes);
  878. { can we omit the range check of the jump table ? }
  879. getrange(left.resulttype.def,lv,hv);
  880. jumptable_no_range:=(lv=min_label) and (hv=max_label);
  881. { hack a little bit, because the range can be greater }
  882. { than the positive range of a longint }
  883. if (min_label<0) and (max_label>0) then
  884. begin
  885. if min_label=TConstExprInt($80000000) then
  886. dist:=Cardinal(max_label)+Cardinal($80000000)
  887. else
  888. dist:=Cardinal(max_label)+Cardinal(-min_label)
  889. end
  890. else
  891. dist:=max_label-min_label;
  892. { optimize for size ? }
  893. if cs_littlesize in aktglobalswitches then
  894. begin
  895. if (has_jumptable) and
  896. not((labels<=2) or
  897. ((max_label-min_label)<0) or
  898. ((max_label-min_label)>3*labels)) then
  899. begin
  900. { if the labels less or more a continuum then }
  901. genjumptable(nodes,min_label,max_label);
  902. end
  903. else
  904. begin
  905. { a linear list is always smaller than a jump tree }
  906. genlinearlist(nodes);
  907. end;
  908. end
  909. else
  910. begin
  911. max_dist:=4*cardinal(labels);
  912. if jumptable_no_range then
  913. max_linear_list:=4
  914. else
  915. max_linear_list:=2;
  916. { allow processor specific values }
  917. optimizevalues(max_linear_list,max_dist);
  918. if (labels<=max_linear_list) then
  919. genlinearlist(nodes)
  920. else
  921. begin
  922. if (has_jumptable) and
  923. (dist<max_dist) then
  924. genjumptable(nodes,min_label,max_label)
  925. else
  926. begin
  927. {
  928. This one expects that the case labels are a
  929. perfectly balanced tree, which is not the case
  930. very often -> generates really bad code (JM)
  931. if labels>16 then
  932. gentreejmp(nodes)
  933. else
  934. }
  935. genlinearlist(nodes);
  936. end;
  937. end;
  938. end;
  939. end
  940. else
  941. { it's always not bad }
  942. genlinearlist(nodes);
  943. end;
  944. rg.ungetregisterint(exprasmlist,hregister);
  945. { now generate the instructions }
  946. hp:=tstatementnode(right);
  947. while assigned(hp) do
  948. begin
  949. {$ifndef newra}
  950. rg.cleartempgen;
  951. {$endif}
  952. { relabel when inlining }
  953. if inlining_procedure then
  954. begin
  955. if hp.left.nodetype<>labeln then
  956. internalerror(200211261);
  957. Relabel(tlabelnode(hp.left).labelnr);
  958. end;
  959. secondpass(hp.left);
  960. { don't come back to case line }
  961. aktfilepos:=exprasmList.getlasttaifilepos^;
  962. load_all_regvars(exprasmlist);
  963. cg.a_jmp_always(exprasmlist,endlabel);
  964. hp:=tstatementnode(hp.right);
  965. end;
  966. cg.a_label(exprasmlist,elselabel);
  967. { ...and the else block }
  968. if assigned(elseblock) then
  969. begin
  970. {$ifndef newra}
  971. rg.cleartempgen;
  972. {$endif}
  973. secondpass(elseblock);
  974. load_all_regvars(exprasmlist);
  975. end;
  976. cg.a_label(exprasmlist,endlabel);
  977. { Remove relabels for inlining }
  978. if inlining_procedure and
  979. assigned(nodes) then
  980. begin
  981. { restore used symbols }
  982. objectlibrary.UsedAsmSymbolListResetAltSym;
  983. objectlibrary.DestroyUsedAsmSymbolList;
  984. end;
  985. end;
  986. begin
  987. csetelementnode:=tcgsetelementnode;
  988. cinnode:=tcginnode;
  989. ccasenode:=tcgcasenode;
  990. end.
  991. {
  992. $Log$
  993. Revision 1.47 2003-08-20 20:29:06 daniel
  994. * Some more R_NO changes
  995. * Preventive code to loadref added
  996. Revision 1.46 2003/07/23 11:02:53 jonas
  997. * final (?) fix to in-code
  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. }