ncgmat.pas 24 KB

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