ncgmat.pas 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. Generate generic mathematical nodes
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit ncgmat;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. symtype,
  22. node,nmat,cpubase,cgbase;
  23. type
  24. tcgunaryminusnode = class(tunaryminusnode)
  25. protected
  26. { This routine is called to change the sign of the
  27. floating point value in the floating point
  28. register r.
  29. This routine should be overridden, since
  30. the generic version is not optimal at all. The
  31. generic version assumes that floating
  32. point values are stored in the register
  33. in IEEE-754 format.
  34. }
  35. procedure emit_float_sign_change(r: tregister; _size : tdef);virtual;
  36. {$ifdef SUPPORT_MMX}
  37. procedure second_mmx;virtual;abstract;
  38. {$endif SUPPORT_MMX}
  39. {$ifndef cpu64bitalu}
  40. procedure second_64bit;virtual;
  41. {$endif not cpu64bitalu}
  42. procedure second_integer;virtual;
  43. procedure second_float;virtual;
  44. public
  45. procedure pass_generate_code;override;
  46. end;
  47. tcgmoddivnode = class(tmoddivnode)
  48. procedure pass_generate_code;override;
  49. protected
  50. { This routine must do an actual 32-bit division, be it
  51. signed or unsigned. The result must set into the the
  52. @var(num) register.
  53. @param(signed Indicates if the division must be signed)
  54. @param(denum Register containing the denominator
  55. @param(num Register containing the numerator, will also receive result)
  56. The actual optimizations regarding shifts have already
  57. been done and emitted, so this should really a do a divide.
  58. }
  59. procedure emit_div_reg_reg(signed: boolean;denum,num : tregister);virtual;abstract;
  60. { This routine must do an actual 32-bit modulo, be it
  61. signed or unsigned. The result must set into the the
  62. @var(num) register.
  63. @param(signed Indicates if the modulo must be signed)
  64. @param(denum Register containing the denominator
  65. @param(num Register containing the numerator, will also receive result)
  66. The actual optimizations regarding shifts have already
  67. been done and emitted, so this should really a do a modulo.
  68. }
  69. procedure emit_mod_reg_reg(signed: boolean;denum,num : tregister);virtual;abstract;
  70. {$ifndef cpu64bitalu}
  71. { This routine must do an actual 64-bit division, be it
  72. signed or unsigned. The result must set into the the
  73. @var(num) register.
  74. @param(signed Indicates if the division must be signed)
  75. @param(denum Register containing the denominator
  76. @param(num Register containing the numerator, will also receive result)
  77. The actual optimizations regarding shifts have already
  78. been done and emitted, so this should really a do a divide.
  79. Currently, this routine should only be implemented on
  80. 64-bit systems, otherwise a helper is called in 1st pass.
  81. }
  82. procedure emit64_div_reg_reg(signed: boolean;denum,num : tregister64);virtual;
  83. {$endif not cpu64bitalu}
  84. end;
  85. tcgshlshrnode = class(tshlshrnode)
  86. {$ifndef cpu64bitalu}
  87. procedure second_64bit;virtual;
  88. {$endif not cpu64bitalu}
  89. procedure second_integer;virtual;
  90. procedure pass_generate_code;override;
  91. end;
  92. tcgnotnode = class(tnotnode)
  93. protected
  94. function handle_locjump: boolean;
  95. procedure second_boolean;virtual;abstract;
  96. {$ifdef SUPPORT_MMX}
  97. procedure second_mmx;virtual;abstract;
  98. {$endif SUPPORT_MMX}
  99. {$ifndef cpu64bitalu}
  100. procedure second_64bit;virtual;
  101. {$endif not cpu64bitalu}
  102. procedure second_integer;virtual;
  103. public
  104. procedure pass_generate_code;override;
  105. end;
  106. implementation
  107. uses
  108. globtype,systems,
  109. cutils,verbose,globals,
  110. symtable,symconst,symdef,aasmbase,aasmtai,aasmdata,aasmcpu,defutil,
  111. parabase,
  112. pass_2,
  113. ncon,
  114. tgobj,ncgutil,cgobj,cgutils,paramgr,hlcgobj,procinfo
  115. {$ifndef cpu64bitalu}
  116. ,cg64f32
  117. {$endif not cpu64bitalu}
  118. ;
  119. {*****************************************************************************
  120. TCGUNARYMINUSNODE
  121. *****************************************************************************}
  122. procedure tcgunaryminusnode.emit_float_sign_change(r: tregister; _size : tdef);
  123. var
  124. href,
  125. href2 : treference;
  126. begin
  127. { get a temporary memory reference to store the floating
  128. point value
  129. }
  130. tg.gethltemp(current_asmdata.CurrAsmList,_size,_size.size,tt_normal,href);
  131. { store the floating point value in the temporary memory area }
  132. hlcg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,_size,_size,r,href);
  133. { only single and double ieee are supported, for little endian
  134. the signed bit is in the second dword }
  135. href2:=href;
  136. if _size.typ<>floatdef then
  137. internalerror(2014012211);
  138. case tfloatdef(_size).floattype of
  139. s64real,
  140. s64comp,
  141. s64currency:
  142. if target_info.endian = endian_little then
  143. inc(href2.offset,4);
  144. s32real :
  145. ;
  146. else
  147. internalerror(200406021);
  148. end;
  149. { flip sign-bit (bit 31/63) of single/double }
  150. hlcg.a_op_const_ref(current_asmdata.CurrAsmList,OP_XOR,u32inttype,aint($80000000),href2);
  151. hlcg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,_size,_size,href,r);
  152. tg.ungetiftemp(current_asmdata.CurrAsmList,href);
  153. end;
  154. {$ifndef cpu64bitalu}
  155. procedure tcgunaryminusnode.second_64bit;
  156. var
  157. tr: tregister;
  158. hl: tasmlabel;
  159. begin
  160. secondpass(left);
  161. location_reset(location,LOC_REGISTER,left.location.size);
  162. location.register64.reglo:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  163. location.register64.reghi:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  164. cg64.a_op64_loc_reg(current_asmdata.CurrAsmList,OP_NEG,OS_S64,
  165. left.location,joinreg64(location.register64.reglo,location.register64.reghi));
  166. { there's only overflow in case left was low(int64) -> -left = left }
  167. if (cs_check_overflow in current_settings.localswitches) then
  168. begin
  169. tr:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  170. cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_XOR,OS_32,
  171. aint($80000000),location.register64.reghi,tr);
  172. cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,
  173. location.register64.reglo,tr);
  174. current_asmdata.getjumplabel(hl);
  175. cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_32,OC_NE,0,tr,hl);
  176. cg.a_call_name(current_asmdata.CurrAsmList,'FPC_OVERFLOW',false);
  177. cg.a_label(current_asmdata.CurrAsmList,hl);
  178. end;
  179. end;
  180. {$endif not cpu64bitalu}
  181. procedure tcgunaryminusnode.second_float;
  182. begin
  183. secondpass(left);
  184. location_reset(location,LOC_FPUREGISTER,def_cgsize(resultdef));
  185. case left.location.loc of
  186. LOC_REFERENCE,
  187. LOC_CREFERENCE :
  188. begin
  189. location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
  190. hlcg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,
  191. left.resultdef,resultdef,
  192. left.location.reference,location.register);
  193. emit_float_sign_change(location.register,left.resultdef);
  194. end;
  195. LOC_FPUREGISTER:
  196. begin
  197. location.register:=left.location.register;
  198. emit_float_sign_change(location.register,left.resultdef);
  199. end;
  200. LOC_CFPUREGISTER:
  201. begin
  202. location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
  203. hlcg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,left.location.register,location.register);
  204. emit_float_sign_change(location.register,left.resultdef);
  205. end;
  206. else
  207. internalerror(200306021);
  208. end;
  209. end;
  210. procedure tcgunaryminusnode.second_integer;
  211. var
  212. hl: tasmlabel;
  213. opsize: tdef;
  214. begin
  215. secondpass(left);
  216. {$ifdef cpunodefaultint}
  217. opsize:=left.resultdef;
  218. {$else cpunodefaultint}
  219. { in case of a 32 bit system that can natively execute 64 bit operations }
  220. if (left.resultdef.size<=sinttype.size) then
  221. opsize:=sinttype
  222. else
  223. opsize:={$ifdef cpu16bitalu}s32inttype{$else}s64inttype{$endif};
  224. {$endif cpunodefaultint}
  225. if not(left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
  226. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,opsize,false);
  227. location_reset(location,LOC_REGISTER,def_cgsize(opsize));
  228. location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
  229. hlcg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,opsize,left.location.register,location.register);
  230. if (cs_check_overflow in current_settings.localswitches) then
  231. begin
  232. current_asmdata.getjumplabel(hl);
  233. hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_NE,torddef(opsize).low.svalue,location.register,hl);
  234. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_overflow',[],nil);
  235. hlcg.a_label(current_asmdata.CurrAsmList,hl);
  236. end;
  237. end;
  238. procedure tcgunaryminusnode.pass_generate_code;
  239. begin
  240. {$ifndef cpu64bitalu}
  241. if is_64bit(left.resultdef) then
  242. second_64bit
  243. else
  244. {$endif not cpu64bitalu}
  245. {$ifdef SUPPORT_MMX}
  246. if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then
  247. second_mmx
  248. else
  249. {$endif SUPPORT_MMX}
  250. if (left.resultdef.typ=floatdef) then
  251. second_float
  252. else
  253. second_integer;
  254. end;
  255. {*****************************************************************************
  256. TCGMODDIVNODE
  257. *****************************************************************************}
  258. {$ifndef cpu64bitalu}
  259. procedure tcgmoddivnode.emit64_div_reg_reg(signed: boolean; denum,num:tregister64);
  260. begin
  261. { handled in pass_1 already, unless pass_1 is
  262. overridden
  263. }
  264. { should be handled in pass_1 (JM) }
  265. internalerror(200109052);
  266. end;
  267. {$endif not cpu64bitalu}
  268. procedure tcgmoddivnode.pass_generate_code;
  269. var
  270. hreg1 : tregister;
  271. hdenom : tregister;
  272. power : longint;
  273. hl : tasmlabel;
  274. paraloc1 : tcgpara;
  275. opsize : tcgsize;
  276. opdef : tdef;
  277. pd: tprocdef;
  278. begin
  279. secondpass(left);
  280. if codegenerror then
  281. exit;
  282. secondpass(right);
  283. if codegenerror then
  284. exit;
  285. location_copy(location,left.location);
  286. {$ifndef cpu64bitalu}
  287. if is_64bit(resultdef) then
  288. begin
  289. if is_signed(left.resultdef) then
  290. opdef:=s64inttype
  291. else
  292. opdef:=u64inttype;
  293. { this code valid for 64-bit cpu's only ,
  294. otherwise helpers are called in pass_1
  295. }
  296. hlcg.location_force_reg(current_asmdata.CurrAsmList,location,left.resultdef,opdef,false);
  297. location_copy(location,left.location);
  298. hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,opdef,false);
  299. emit64_div_reg_reg(is_signed(left.resultdef),
  300. joinreg64(right.location.register64.reglo,right.location.register64.reghi),
  301. joinreg64(location.register64.reglo,location.register64.reghi));
  302. end
  303. else
  304. {$endif not cpu64bitalu}
  305. begin
  306. if is_signed(left.resultdef) then
  307. begin
  308. opsize:=OS_SINT;
  309. opdef:=ossinttype;
  310. end
  311. else
  312. begin
  313. opsize:=OS_INT;
  314. opdef:=osuinttype;
  315. end;
  316. { put numerator in register }
  317. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,opdef,false);
  318. hreg1:=left.location.register;
  319. if (nodetype=divn) and
  320. (right.nodetype=ordconstn) and
  321. ispowerof2(tordconstnode(right).value.svalue,power) then
  322. Begin
  323. { for signed numbers, the numerator must be adjusted before the
  324. shift instruction, but not wih unsigned numbers! Otherwise,
  325. "Cardinal($ffffffff) div 16" overflows! (JM) }
  326. If is_signed(left.resultdef) Then
  327. Begin
  328. current_asmdata.getjumplabel(hl);
  329. cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_GT,0,hreg1,hl);
  330. if power=1 then
  331. cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,OS_INT,1,hreg1)
  332. else
  333. cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,OS_INT,Tordconstnode(right).value.svalue-1,hreg1);
  334. cg.a_label(current_asmdata.CurrAsmList,hl);
  335. cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SAR,OS_INT,power,hreg1);
  336. End
  337. Else { not signed }
  338. cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHR,OS_INT,power,hreg1);
  339. End
  340. else
  341. begin
  342. { bring denominator to hdenom }
  343. { hdenom is always free, it's }
  344. { only used for temporary }
  345. { purposes }
  346. hdenom := cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
  347. hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,right.resultdef,osuinttype,right.location,hdenom);
  348. { verify if the divisor is zero, if so return an error
  349. immediately
  350. }
  351. current_asmdata.getjumplabel(hl);
  352. cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_NE,0,hdenom,hl);
  353. paraloc1.init;
  354. pd:=search_system_proc('fpc_handleerror');
  355. paramanager.getintparaloc(pd,1,paraloc1);
  356. cg.a_load_const_cgpara(current_asmdata.CurrAsmList,OS_S32,aint(200),paraloc1);
  357. paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
  358. cg.a_call_name(current_asmdata.CurrAsmList,'FPC_HANDLEERROR',false);
  359. paraloc1.done;
  360. cg.a_label(current_asmdata.CurrAsmList,hl);
  361. if nodetype = modn then
  362. emit_mod_reg_reg(is_signed(left.resultdef),hdenom,hreg1)
  363. else
  364. emit_div_reg_reg(is_signed(left.resultdef),hdenom,hreg1);
  365. end;
  366. location_reset(location,LOC_REGISTER,opsize);
  367. location.register:=hreg1;
  368. end;
  369. cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resultdef);
  370. end;
  371. {*****************************************************************************
  372. TCGSHLRSHRNODE
  373. *****************************************************************************}
  374. {$ifndef cpu64bitalu}
  375. procedure tcgshlshrnode.second_64bit;
  376. begin
  377. { already hanled in 1st pass }
  378. internalerror(2002081501);
  379. end;
  380. {$endif not cpu64bitalu}
  381. procedure tcgshlshrnode.second_integer;
  382. var
  383. op : topcg;
  384. opdef,right_opdef : tdef;
  385. hcountreg : tregister;
  386. opsize,right_opsize : tcgsize;
  387. shiftval : longint;
  388. begin
  389. { determine operator }
  390. case nodetype of
  391. shln: op:=OP_SHL;
  392. shrn: op:=OP_SHR;
  393. else
  394. internalerror(2013120102);
  395. end;
  396. {$ifdef cpunodefaultint}
  397. opsize:=left.location.size;
  398. opdef:=left.resultdef;
  399. right_opsize:=opsize;
  400. right_opdef:=opdef;
  401. {$else cpunodefaultint}
  402. { load left operators in a register }
  403. if is_signed(left.resultdef) then
  404. begin
  405. right_opsize:=OS_SINT;
  406. right_opdef:=ossinttype;
  407. {$ifdef cpu16bitalu}
  408. if left.resultdef.size > 2 then
  409. begin
  410. opsize:=OS_S32;
  411. opdef:=s32inttype;
  412. end
  413. else
  414. {$endif cpu16bitalu}
  415. begin
  416. opsize:=OS_SINT;
  417. opdef:=ossinttype
  418. end;
  419. end
  420. else
  421. begin
  422. right_opsize:=OS_INT;
  423. right_opdef:=osuinttype;
  424. {$ifdef cpu16bitalu}
  425. if left.resultdef.size > 2 then
  426. begin
  427. opsize:=OS_32;
  428. opdef:=u32inttype;
  429. end
  430. else
  431. {$endif cpu16bitalu}
  432. begin
  433. opsize:=OS_INT;
  434. opdef:=osuinttype;
  435. end;
  436. end;
  437. {$endif cpunodefaultint}
  438. if not(left.location.loc in [LOC_CREGISTER,LOC_REGISTER]) or
  439. { location_force_reg can be also used to change the size of a register }
  440. (left.location.size<>opsize) then
  441. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,opdef,true);
  442. location_reset(location,LOC_REGISTER,opsize);
  443. location.register:=hlcg.getintregister(current_asmdata.CurrAsmList,resultdef);
  444. { shifting by a constant directly coded: }
  445. if (right.nodetype=ordconstn) then
  446. begin
  447. { shl/shr must "wrap around", so use ... and 31 }
  448. { In TP, "byte/word shl 16 = 0", so no "and 15" in case of
  449. a 16 bit ALU }
  450. if tcgsize2size[opsize]<=4 then
  451. shiftval:=tordconstnode(right).value.uvalue and 31
  452. else
  453. shiftval:=tordconstnode(right).value.uvalue and 63;
  454. hlcg.a_op_const_reg_reg(current_asmdata.CurrAsmList,op,opdef,
  455. shiftval,left.location.register,location.register);
  456. end
  457. else
  458. begin
  459. { load right operators in a register - this
  460. is done since most target cpu which will use this
  461. node do not support a shift count in a mem. location (cec)
  462. }
  463. if not(right.location.loc in [LOC_CREGISTER,LOC_REGISTER]) then
  464. begin
  465. hcountreg:=hlcg.getintregister(current_asmdata.CurrAsmList,right_opdef);
  466. hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,right.resultdef,right_opdef,right.location,hcountreg);
  467. end
  468. else
  469. hcountreg:=right.location.register;
  470. hlcg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,op,opdef,hcountreg,left.location.register,location.register);
  471. end;
  472. { shl/shr nodes return the same type as left, which can be different
  473. from opdef }
  474. if opdef<>resultdef then
  475. begin
  476. hcountreg:=hlcg.getintregister(current_asmdata.CurrAsmList,resultdef);
  477. hlcg.a_load_reg_reg(current_asmdata.CurrAsmList,opdef,resultdef,location.register,hcountreg);
  478. location.register:=hcountreg;
  479. end;
  480. end;
  481. procedure tcgshlshrnode.pass_generate_code;
  482. begin
  483. secondpass(left);
  484. secondpass(right);
  485. {$ifndef cpu64bitalu}
  486. if is_64bit(left.resultdef) then
  487. second_64bit
  488. else
  489. {$endif not cpu64bitalu}
  490. second_integer;
  491. end;
  492. {*****************************************************************************
  493. TCGNOTNODE
  494. *****************************************************************************}
  495. {$ifndef cpu64bitalu}
  496. procedure tcgnotnode.second_64bit;
  497. begin
  498. secondpass(left);
  499. if not(left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
  500. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
  501. location_reset(location,LOC_REGISTER,left.location.size);
  502. location.register64.reglo:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  503. location.register64.reghi:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  504. { perform the NOT operation }
  505. cg64.a_op64_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,left.location.register64,location.register64);
  506. end;
  507. {$endif not cpu64bitalu}
  508. procedure tcgnotnode.second_integer;
  509. begin
  510. secondpass(left);
  511. if not(left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
  512. hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
  513. location_reset(location,LOC_REGISTER,left.location.size);
  514. location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
  515. { perform the NOT operation }
  516. hlcg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,left.resultdef,left.location.register,location.register);
  517. end;
  518. function tcgnotnode.handle_locjump: boolean;
  519. var
  520. hl: tasmlabel;
  521. begin
  522. result:=(left.expectloc=LOC_JUMP);
  523. if result then
  524. begin
  525. hl:=current_procinfo.CurrTrueLabel;
  526. current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel;
  527. current_procinfo.CurrFalseLabel:=hl;
  528. secondpass(left);
  529. if is_constboolnode(left) then
  530. internalerror(2014010101);
  531. if left.location.loc<>LOC_JUMP then
  532. internalerror(2012081306);
  533. { This does nothing for LOC_JUMP }
  534. //maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars);
  535. hl:=current_procinfo.CurrTrueLabel;
  536. current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel;
  537. current_procinfo.CurrFalseLabel:=hl;
  538. location_reset(location,LOC_JUMP,OS_NO);
  539. end;
  540. end;
  541. procedure tcgnotnode.pass_generate_code;
  542. begin
  543. if is_boolean(resultdef) then
  544. second_boolean
  545. {$ifdef SUPPORT_MMX}
  546. else if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then
  547. second_mmx
  548. {$endif SUPPORT_MMX}
  549. {$ifndef cpu64bitalu}
  550. else if is_64bit(left.resultdef) then
  551. second_64bit
  552. {$endif not cpu64bitalu}
  553. else
  554. second_integer;
  555. end;
  556. begin
  557. cmoddivnode:=tcgmoddivnode;
  558. cunaryminusnode:=tcgunaryminusnode;
  559. cshlshrnode:=tcgshlshrnode;
  560. cnotnode:=tcgnotnode;
  561. end.