ncgadd.pas 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. {
  2. $Id$
  3. Copyright (c) 2000-2002 by the FPC development team
  4. Code generation for add nodes (generic version)
  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 ncgadd;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. node,nadd,cpubase;
  23. type
  24. tcgaddnode = class(taddnode)
  25. { function pass_1: tnode; override;}
  26. procedure pass_2;override;
  27. protected
  28. { call secondpass for both left and right }
  29. procedure pass_left_right;
  30. { set the register of the result location }
  31. procedure set_result_location_reg;
  32. { load left and right nodes into registers }
  33. procedure force_reg_left_right(allow_swap,allow_constant:boolean);
  34. { free used registers, except result location }
  35. procedure release_reg_left_right;
  36. procedure second_opfloat;
  37. procedure second_opboolean;
  38. procedure second_opsmallset;
  39. procedure second_op64bit;
  40. procedure second_opordinal;
  41. procedure second_addfloat;virtual;abstract;
  42. procedure second_addboolean;virtual;
  43. procedure second_addsmallset;virtual;
  44. procedure second_add64bit;virtual;
  45. procedure second_addordinal;virtual;
  46. procedure second_cmpfloat;virtual;abstract;
  47. procedure second_cmpboolean;virtual;
  48. procedure second_cmpsmallset;virtual;abstract;
  49. procedure second_cmp64bit;virtual;abstract;
  50. procedure second_cmpordinal;virtual;abstract;
  51. end;
  52. implementation
  53. uses
  54. globtype,systems,
  55. cutils,verbose,globals,
  56. symconst,symdef,paramgr,
  57. aasmbase,aasmtai,aasmcpu,defutil,htypechk,
  58. cgbase,cpuinfo,pass_1,pass_2,regvars,
  59. ncon,nset,ncgutil,tgobj,cgobj,
  60. {$ifdef cpu64bit}
  61. cg64f64
  62. {$else cpu64bit}
  63. cg64f32
  64. {$endif cpu64bit}
  65. ;
  66. {*****************************************************************************
  67. Helpers
  68. *****************************************************************************}
  69. procedure tcgaddnode.pass_left_right;
  70. var
  71. tmpreg : tregister;
  72. isjump,
  73. pushedfpu : boolean;
  74. otl,ofl : tasmlabel;
  75. begin
  76. { calculate the operator which is more difficult }
  77. firstcomplex(self);
  78. { in case of constant put it to the left }
  79. if (left.nodetype=ordconstn) then
  80. swapleftright;
  81. isjump:=(left.location.loc=LOC_JUMP);
  82. if isjump then
  83. begin
  84. otl:=truelabel;
  85. objectlibrary.getlabel(truelabel);
  86. ofl:=falselabel;
  87. objectlibrary.getlabel(falselabel);
  88. end;
  89. secondpass(left);
  90. if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
  91. location_force_reg(exprasmlist,left.location,def_cgsize(resulttype.def),false);
  92. if isjump then
  93. begin
  94. truelabel:=otl;
  95. falselabel:=ofl;
  96. end;
  97. { are too few registers free? }
  98. if left.location.loc=LOC_FPUREGISTER then
  99. pushedfpu:=maybe_pushfpu(exprasmlist,right.registersfpu,left.location)
  100. else
  101. pushedfpu:=false;
  102. isjump:=(right.location.loc=LOC_JUMP);
  103. if isjump then
  104. begin
  105. otl:=truelabel;
  106. objectlibrary.getlabel(truelabel);
  107. ofl:=falselabel;
  108. objectlibrary.getlabel(falselabel);
  109. end;
  110. secondpass(right);
  111. if right.location.loc in [LOC_FLAGS,LOC_JUMP] then
  112. location_force_reg(exprasmlist,right.location,def_cgsize(resulttype.def),false);
  113. if isjump then
  114. begin
  115. truelabel:=otl;
  116. falselabel:=ofl;
  117. end;
  118. if pushedfpu then
  119. begin
  120. tmpreg := cg.getfpuregister(exprasmlist,left.location.size);
  121. cg.a_loadfpu_loc_reg(exprasmlist,left.location,tmpreg);
  122. location_reset(left.location,LOC_FPUREGISTER,left.location.size);
  123. left.location.register := tmpreg;
  124. end;
  125. end;
  126. procedure tcgaddnode.set_result_location_reg;
  127. begin
  128. location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
  129. if left.location.loc=LOC_REGISTER then
  130. begin
  131. if TCGSize2Size[left.location.size]<>TCGSize2Size[location.size] then
  132. internalerror(200307041);
  133. {$ifndef cpu64bit}
  134. if location.size in [OS_64,OS_S64] then
  135. begin
  136. location.registerlow := left.location.registerlow;
  137. location.registerhigh := left.location.registerhigh;
  138. end
  139. else
  140. {$endif}
  141. location.register := left.location.register;
  142. end
  143. else
  144. if right.location.loc=LOC_REGISTER then
  145. begin
  146. if TCGSize2Size[right.location.size]<>TCGSize2Size[location.size] then
  147. internalerror(200307042);
  148. {$ifndef cpu64bit}
  149. if location.size in [OS_64,OS_S64] then
  150. begin
  151. location.registerlow := right.location.registerlow;
  152. location.registerhigh := right.location.registerhigh;
  153. end
  154. else
  155. {$endif}
  156. location.register := right.location.register;
  157. end
  158. else
  159. begin
  160. {$ifndef cpu64bit}
  161. if location.size in [OS_64,OS_S64] then
  162. begin
  163. location.registerlow := cg.getintregister(exprasmlist,OS_INT);
  164. location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
  165. end
  166. else
  167. {$endif}
  168. location.register := cg.getintregister(exprasmlist,location.size);
  169. end;
  170. end;
  171. procedure tcgaddnode.force_reg_left_right(allow_swap,allow_constant:boolean);
  172. begin
  173. if (left.location.loc<>LOC_REGISTER) and
  174. not(
  175. allow_constant and
  176. (left.location.loc=LOC_CONSTANT)
  177. ) then
  178. location_force_reg(exprasmlist,left.location,left.location.size,false);
  179. if (right.location.loc<>LOC_REGISTER) and
  180. not(
  181. allow_constant and
  182. (right.location.loc=LOC_CONSTANT) and
  183. (left.location.loc<>LOC_CONSTANT)
  184. ) then
  185. location_force_reg(exprasmlist,right.location,right.location.size,false);
  186. { Left is always a register, right can be register or constant }
  187. if left.location.loc<>LOC_REGISTER then
  188. begin
  189. { when it is not allowed to swap we have a constant on
  190. left, that will give problems }
  191. if not allow_swap then
  192. internalerror(200307041);
  193. swapleftright;
  194. end;
  195. end;
  196. procedure tcgaddnode.release_reg_left_right;
  197. begin
  198. if (right.location.loc in [LOC_REGISTER,LOC_FPUREGISTER]) and
  199. not(
  200. (location.loc = right.location.loc) and
  201. (location.register=right.location.register)
  202. ) then
  203. location_release(exprasmlist,right.location);
  204. if (left.location.loc in [LOC_REGISTER,LOC_FPUREGISTER]) and
  205. not(
  206. (location.loc = left.location.loc) and
  207. (location.register=left.location.register)
  208. ) then
  209. location_release(exprasmlist,left.location);
  210. end;
  211. {*****************************************************************************
  212. Smallsets
  213. *****************************************************************************}
  214. procedure tcgaddnode.second_opsmallset;
  215. begin
  216. { when a setdef is passed, it has to be a smallset }
  217. if ((left.resulttype.def.deftype=setdef) and
  218. (tsetdef(left.resulttype.def).settype<>smallset)) or
  219. ((right.resulttype.def.deftype=setdef) and
  220. (tsetdef(right.resulttype.def).settype<>smallset)) then
  221. internalerror(200203301);
  222. if nodetype in [equaln,unequaln,gtn,gten,lten,ltn] then
  223. second_cmpsmallset
  224. else
  225. second_addsmallset;
  226. end;
  227. procedure tcgaddnode.second_addsmallset;
  228. var
  229. cgop : TOpCg;
  230. tmpreg : tregister;
  231. opdone : boolean;
  232. begin
  233. opdone := false;
  234. pass_left_right;
  235. force_reg_left_right(true,true);
  236. { setelementn is a special case, it must be on right.
  237. We need an extra check if left is a register because the
  238. default case can skip the register loading when the
  239. setelementn is in a register (PFV) }
  240. if (nf_swaped in flags) and
  241. (left.nodetype=setelementn) then
  242. swapleftright;
  243. if (right.nodetype=setelementn) and
  244. (left.location.loc<>LOC_REGISTER) then
  245. location_force_reg(exprasmlist,left.location,left.location.size,false);
  246. set_result_location_reg;
  247. case nodetype of
  248. addn :
  249. begin
  250. { are we adding set elements ? }
  251. if right.nodetype=setelementn then
  252. begin
  253. { no range support for smallsets! }
  254. if assigned(tsetelementnode(right).right) then
  255. internalerror(43244);
  256. if (right.location.loc = LOC_CONSTANT) then
  257. cg.a_op_const_reg_reg(exprasmlist,OP_OR,location.size,
  258. aword(1 shl aword(right.location.value)),
  259. left.location.register,location.register)
  260. else
  261. begin
  262. tmpreg := cg.getintregister(exprasmlist,location.size);
  263. cg.a_load_const_reg(exprasmlist,location.size,1,tmpreg);
  264. cg.a_op_reg_reg(exprasmlist,OP_SHL,location.size,
  265. right.location.register,tmpreg);
  266. if left.location.loc <> LOC_CONSTANT then
  267. cg.a_op_reg_reg_reg(exprasmlist,OP_OR,location.size,tmpreg,
  268. left.location.register,location.register)
  269. else
  270. cg.a_op_const_reg_reg(exprasmlist,OP_OR,location.size,
  271. aword(left.location.value),tmpreg,location.register);
  272. cg.ungetregister(exprasmlist,tmpreg);
  273. end;
  274. opdone := true;
  275. end
  276. else
  277. cgop := OP_OR;
  278. end;
  279. symdifn :
  280. cgop:=OP_XOR;
  281. muln :
  282. cgop:=OP_AND;
  283. subn :
  284. begin
  285. cgop:=OP_AND;
  286. if (not(nf_swaped in flags)) then
  287. if (right.location.loc=LOC_CONSTANT) then
  288. right.location.value := not(right.location.value)
  289. else
  290. opdone := true
  291. else if (left.location.loc=LOC_CONSTANT) then
  292. left.location.value := not(left.location.value)
  293. else
  294. begin
  295. swapleftright;
  296. opdone := true;
  297. end;
  298. if opdone then
  299. begin
  300. if left.location.loc = LOC_CONSTANT then
  301. begin
  302. tmpreg := cg.getintregister(exprasmlist,location.size);
  303. cg.a_load_const_reg(exprasmlist,location.size,
  304. aword(left.location.value),tmpreg);
  305. cg.a_op_reg_reg(exprasmlist,OP_NOT,location.size,right.location.register,right.location.register);
  306. cg.a_op_reg_reg(exprasmlist,OP_AND,location.size,right.location.register,tmpreg);
  307. cg.a_load_reg_reg(exprasmlist,OS_INT,location.size,tmpreg,location.register);
  308. cg.ungetregister(exprasmlist,tmpreg);
  309. end
  310. else
  311. begin
  312. cg.a_op_reg_reg(exprasmlist,OP_NOT,right.location.size,right.location.register,right.location.register);
  313. cg.a_op_reg_reg(exprasmlist,OP_AND,left.location.size,right.location.register,left.location.register);
  314. cg.a_load_reg_reg(exprasmlist,left.location.size,location.size,left.location.register,location.register);
  315. end;
  316. end;
  317. end;
  318. else
  319. internalerror(2002072701);
  320. end;
  321. if not opdone then
  322. begin
  323. // these are all commutative operations
  324. if (left.location.loc = LOC_CONSTANT) then
  325. swapleftright;
  326. if (right.location.loc = LOC_CONSTANT) then
  327. cg.a_op_const_reg_reg(exprasmlist,cgop,location.size,
  328. aword(right.location.value),left.location.register,
  329. location.register)
  330. else
  331. cg.a_op_reg_reg_reg(exprasmlist,cgop,location.size,
  332. right.location.register,left.location.register,
  333. location.register);
  334. end;
  335. release_reg_left_right;
  336. end;
  337. {*****************************************************************************
  338. Boolean
  339. *****************************************************************************}
  340. procedure tcgaddnode.second_opboolean;
  341. begin
  342. if nodetype in [ltn,lten,gtn,gten,equaln,unequaln] then
  343. second_cmpboolean
  344. else
  345. second_addboolean;
  346. end;
  347. procedure tcgaddnode.second_addboolean;
  348. var
  349. cgop : TOpCg;
  350. otl,ofl : tasmlabel;
  351. begin
  352. { And,Or will only evaluate from left to right only the
  353. needed nodes unless full boolean evaluation is enabled }
  354. if (nodetype in [orn,andn]) and
  355. not(cs_full_boolean_eval in aktlocalswitches) then
  356. begin
  357. location_reset(location,LOC_JUMP,OS_NO);
  358. case nodetype of
  359. andn :
  360. begin
  361. otl:=truelabel;
  362. objectlibrary.getlabel(truelabel);
  363. secondpass(left);
  364. maketojumpbool(exprasmlist,left,lr_load_regvars);
  365. cg.a_label(exprasmlist,truelabel);
  366. truelabel:=otl;
  367. end;
  368. orn :
  369. begin
  370. ofl:=falselabel;
  371. objectlibrary.getlabel(falselabel);
  372. secondpass(left);
  373. maketojumpbool(exprasmlist,left,lr_load_regvars);
  374. cg.a_label(exprasmlist,falselabel);
  375. falselabel:=ofl;
  376. end;
  377. else
  378. internalerror(200307044);
  379. end;
  380. secondpass(right);
  381. maketojumpbool(exprasmlist,right,lr_load_regvars);
  382. end
  383. else
  384. begin
  385. pass_left_right;
  386. force_reg_left_right(false,true);
  387. set_result_location_reg;
  388. case nodetype of
  389. xorn :
  390. cgop:=OP_XOR;
  391. orn :
  392. cgop:=OP_OR;
  393. andn :
  394. cgop:=OP_AND;
  395. else
  396. internalerror(200203247);
  397. end;
  398. if right.location.loc <> LOC_CONSTANT then
  399. cg.a_op_reg_reg_reg(exprasmlist,cgop,location.size,
  400. left.location.register,right.location.register,
  401. location.register)
  402. else
  403. cg.a_op_const_reg_reg(exprasmlist,cgop,location.size,
  404. aword(right.location.value),left.location.register,
  405. location.register);
  406. end;
  407. release_reg_left_right;
  408. end;
  409. {*****************************************************************************
  410. 64-bit
  411. *****************************************************************************}
  412. procedure tcgaddnode.second_op64bit;
  413. begin
  414. if nodetype in [ltn,lten,gtn,gten,equaln,unequaln] then
  415. second_cmp64bit
  416. else
  417. second_add64bit;
  418. end;
  419. procedure tcgaddnode.second_add64bit;
  420. var
  421. op : TOpCG;
  422. checkoverflow : boolean;
  423. begin
  424. pass_left_right;
  425. force_reg_left_right(false,(cs_check_overflow in aktlocalswitches) and
  426. (nodetype in [addn,subn]));
  427. set_result_location_reg;
  428. { assume no overflow checking is required }
  429. checkoverflow := false;
  430. case nodetype of
  431. addn :
  432. begin
  433. op:=OP_ADD;
  434. checkoverflow := true;
  435. end;
  436. subn :
  437. begin
  438. op:=OP_SUB;
  439. checkoverflow := true;
  440. end;
  441. xorn:
  442. op:=OP_XOR;
  443. orn:
  444. op:=OP_OR;
  445. andn:
  446. op:=OP_AND;
  447. muln:
  448. begin
  449. { should be handled in pass_1 (JM) }
  450. internalerror(200109051);
  451. end;
  452. else
  453. internalerror(2002072705);
  454. end;
  455. case nodetype of
  456. xorn,orn,andn,addn:
  457. begin
  458. if (right.location.loc = LOC_CONSTANT) then
  459. cg64.a_op64_const_reg_reg(exprasmlist,op,right.location.valueqword,
  460. left.location.register64,location.register64)
  461. else
  462. cg64.a_op64_reg_reg_reg(exprasmlist,op,right.location.register64,
  463. left.location.register64,location.register64);
  464. end;
  465. subn:
  466. begin
  467. if (nf_swaped in flags) then
  468. swapleftright;
  469. if left.location.loc <> LOC_CONSTANT then
  470. begin
  471. if right.location.loc <> LOC_CONSTANT then
  472. // reg64 - reg64
  473. cg64.a_op64_reg_reg_reg(exprasmlist,OP_SUB,
  474. right.location.register64,left.location.register64,
  475. location.register64)
  476. else
  477. // reg64 - const64
  478. cg64.a_op64_const_reg_reg(exprasmlist,OP_SUB,
  479. right.location.valueqword,left.location.register64,
  480. location.register64)
  481. end
  482. else
  483. begin
  484. // const64 - reg64
  485. location_force_reg(exprasmlist,left.location,left.location.size,true);
  486. cg64.a_op64_reg_reg_reg(exprasmlist,OP_SUB,
  487. right.location.register64,left.location.register64,
  488. location.register64);
  489. end;
  490. end;
  491. else
  492. internalerror(2002072803);
  493. end;
  494. { emit overflow check if enabled }
  495. if checkoverflow then
  496. cg.g_overflowcheck(exprasmlist,Location,ResultType.Def);
  497. release_reg_left_right;
  498. end;
  499. {*****************************************************************************
  500. Floats
  501. *****************************************************************************}
  502. procedure tcgaddnode.second_opfloat;
  503. begin
  504. if nodetype in [ltn,lten,gtn,gten,equaln,unequaln] then
  505. second_cmpfloat
  506. else
  507. second_addfloat;
  508. end;
  509. {*****************************************************************************
  510. Ordinals
  511. *****************************************************************************}
  512. procedure tcgaddnode.second_opordinal;
  513. begin
  514. if (nodetype in [ltn,lten,gtn,gten,equaln,unequaln]) then
  515. second_cmpordinal
  516. else
  517. second_addordinal;
  518. end;
  519. procedure tcgaddnode.second_addordinal;
  520. var
  521. unsigned,
  522. checkoverflow : boolean;
  523. cgop : topcg;
  524. tmpreg : tregister;
  525. begin
  526. pass_left_right;
  527. force_reg_left_right(false,(cs_check_overflow in aktlocalswitches) and
  528. (nodetype in [addn,subn,muln]));
  529. set_result_location_reg;
  530. { determine if the comparison will be unsigned }
  531. unsigned:=not(is_signed(left.resulttype.def)) or
  532. not(is_signed(right.resulttype.def));
  533. { assume no overflow checking is require }
  534. checkoverflow := false;
  535. case nodetype of
  536. addn:
  537. begin
  538. cgop := OP_ADD;
  539. checkoverflow := true;
  540. end;
  541. xorn :
  542. begin
  543. cgop := OP_XOR;
  544. end;
  545. orn :
  546. begin
  547. cgop := OP_OR;
  548. end;
  549. andn:
  550. begin
  551. cgop := OP_AND;
  552. end;
  553. muln:
  554. begin
  555. checkoverflow := true;
  556. if unsigned then
  557. cgop := OP_MUL
  558. else
  559. cgop := OP_IMUL;
  560. end;
  561. subn :
  562. begin
  563. checkoverflow := true;
  564. cgop := OP_SUB;
  565. end;
  566. end;
  567. if nodetype <> subn then
  568. begin
  569. if (right.location.loc <> LOC_CONSTANT) then
  570. cg.a_op_reg_reg_reg(exprasmlist,cgop,location.size,
  571. left.location.register,right.location.register,
  572. location.register)
  573. else
  574. cg.a_op_const_reg_reg(exprasmlist,cgop,location.size,
  575. aword(right.location.value),left.location.register,
  576. location.register);
  577. end
  578. else { subtract is a special case since its not commutative }
  579. begin
  580. if (nf_swaped in flags) then
  581. swapleftright;
  582. if left.location.loc <> LOC_CONSTANT then
  583. begin
  584. if right.location.loc <> LOC_CONSTANT then
  585. cg.a_op_reg_reg_reg(exprasmlist,OP_SUB,location.size,
  586. right.location.register,left.location.register,
  587. location.register)
  588. else
  589. cg.a_op_const_reg_reg(exprasmlist,OP_SUB,location.size,
  590. aword(right.location.value),left.location.register,
  591. location.register);
  592. end
  593. else
  594. begin
  595. tmpreg := cg.getintregister(exprasmlist,location.size);
  596. cg.a_load_const_reg(exprasmlist,location.size,
  597. aword(left.location.value),tmpreg);
  598. cg.a_op_reg_reg_reg(exprasmlist,OP_SUB,location.size,
  599. right.location.register,tmpreg,location.register);
  600. cg.ungetregister(exprasmlist,tmpreg);
  601. end;
  602. end;
  603. { emit overflow check if required }
  604. if checkoverflow then
  605. cg.g_overflowcheck(exprasmlist,Location,ResultType.Def);
  606. release_reg_left_right;
  607. end;
  608. procedure tcgaddnode.second_cmpboolean;
  609. begin
  610. second_cmpordinal;
  611. end;
  612. {*****************************************************************************
  613. pass_2
  614. *****************************************************************************}
  615. procedure tcgaddnode.pass_2;
  616. begin
  617. case left.resulttype.def.deftype of
  618. orddef :
  619. begin
  620. { handling boolean expressions }
  621. if is_boolean(left.resulttype.def) and
  622. is_boolean(right.resulttype.def) then
  623. second_opboolean
  624. { 64bit operations }
  625. else if is_64bit(left.resulttype.def) then
  626. second_op64bit
  627. else
  628. second_opordinal;
  629. end;
  630. stringdef :
  631. begin
  632. { this should already be handled in pass1 }
  633. internalerror(2002072402);
  634. end;
  635. setdef :
  636. begin
  637. { normalsets are already handled in pass1 }
  638. if (tsetdef(left.resulttype.def).settype<>smallset) then
  639. internalerror(200109041);
  640. second_opsmallset;
  641. end;
  642. arraydef :
  643. begin
  644. {$ifdef SUPPORT_MMX}
  645. if is_mmx_able_array(left.resulttype.def) then
  646. second_opmmx;
  647. {$endif SUPPORT_MMX}
  648. { only mmx arrays are possible }
  649. internalerror(200306016);
  650. end;
  651. floatdef :
  652. second_opfloat;
  653. else
  654. second_opordinal;
  655. end;
  656. end;
  657. begin
  658. caddnode:=tcgaddnode;
  659. end.
  660. {
  661. $Log$
  662. Revision 1.22 2003-10-17 01:22:08 florian
  663. * compilation of the powerpc compiler fixed
  664. Revision 1.21 2003/10/10 17:48:13 peter
  665. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  666. * tregisteralloctor renamed to trgobj
  667. * removed rgobj from a lot of units
  668. * moved location_* and reference_* to cgobj
  669. * first things for mmx register allocation
  670. Revision 1.20 2003/10/01 20:34:48 peter
  671. * procinfo unit contains tprocinfo
  672. * cginfo renamed to cgbase
  673. * moved cgmessage to verbose
  674. * fixed ppc and sparc compiles
  675. Revision 1.19 2003/09/14 21:57:08 jonas
  676. * fixed release_reg_left_right for fpu registers
  677. Revision 1.18 2003/09/14 21:34:16 peter
  678. * fix setelementn support
  679. * fix loading of flags
  680. Revision 1.17 2003/09/03 15:55:00 peter
  681. * NEWRA branch merged
  682. Revision 1.16 2003/09/03 11:18:36 florian
  683. * fixed arm concatcopy
  684. + arm support in the common compiler sources added
  685. * moved some generic cg code around
  686. + tfputype added
  687. * ...
  688. Revision 1.15.2.2 2003/09/01 21:02:55 peter
  689. * sparc updates for new tregister
  690. Revision 1.15.2.1 2003/08/27 20:23:55 peter
  691. * remove old ra code
  692. Revision 1.15 2003/07/08 21:24:59 peter
  693. * sparc fixes
  694. Revision 1.14 2003/07/06 17:44:12 peter
  695. * cleanup and first sparc implementation
  696. Revision 1.13 2003/06/12 16:43:07 peter
  697. * newra compiles for sparc
  698. Revision 1.12 2003/06/10 20:46:17 mazen
  699. * fixing a general compile problem related to
  700. cg.g_overflowcheck declaration that has
  701. changed
  702. Revision 1.11 2003/06/01 21:38:06 peter
  703. * getregisterfpu size parameter added
  704. * op_const_reg size parameter added
  705. * sparc updates
  706. Revision 1.10 2003/05/23 14:27:35 peter
  707. * remove some unit dependencies
  708. * current_procinfo changes to store more info
  709. Revision 1.9 2003/04/30 22:15:59 florian
  710. * some 64 bit adaptions in ncgadd
  711. * x86-64 now uses ncgadd
  712. * tparamanager.ret_in_acc doesn't return true anymore for a void-def
  713. Revision 1.8 2003/04/23 20:16:04 peter
  714. + added currency support based on int64
  715. + is_64bit for use in cg units instead of is_64bitint
  716. * removed cgmessage from n386add, replace with internalerrors
  717. Revision 1.7 2003/04/22 23:50:22 peter
  718. * firstpass uses expectloc
  719. * checks if there are differences between the expectloc and
  720. location.loc from secondpass in EXTDEBUG
  721. Revision 1.6 2003/02/19 22:00:14 daniel
  722. * Code generator converted to new register notation
  723. - Horribily outdated todo.txt removed
  724. Revision 1.5 2003/02/02 19:25:54 carl
  725. * Several bugfixes for m68k target (register alloc., opcode emission)
  726. + VIS target
  727. + Generic add more complete (still not verified)
  728. Revision 1.4 2003/01/08 18:43:56 daniel
  729. * Tregister changed into a record
  730. Revision 1.3 2002/12/14 15:02:03 carl
  731. * maxoperands -> max_operands (for portability in rautils.pas)
  732. * fix some range-check errors with loadconst
  733. + add ncgadd unit to m68k
  734. * some bugfix of a_param_reg with LOC_CREFERENCE
  735. Revision 1.2 2002/12/08 15:02:17 carl
  736. + more fixes
  737. Revision 1.1 2002/12/07 19:51:35 carl
  738. + first version (uncompilable!)
  739. }