ncgcal.pas 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. Generate assembler for call 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 ncgcal;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. cpubase,
  22. globtype,
  23. parabase,cgutils,
  24. symdef,node,ncal;
  25. type
  26. tcgcallparanode = class(tcallparanode)
  27. private
  28. tempcgpara : tcgpara;
  29. procedure push_addr_para;
  30. procedure push_value_para;
  31. public
  32. constructor create(expr,next : tnode);override;
  33. destructor destroy;override;
  34. procedure secondcallparan;override;
  35. end;
  36. tcgcallnode = class(tcallnode)
  37. private
  38. procedure handle_return_value;
  39. procedure release_unused_return_value;
  40. procedure release_para_temps;
  41. procedure pushparas;
  42. procedure freeparas;
  43. protected
  44. framepointer_paraloc : tcgpara;
  45. {# This routine is used to push the current frame pointer
  46. on the stack. This is used in nested routines where the
  47. value of the frame pointer is always pushed as an extra
  48. parameter.
  49. The default handling is the standard handling used on
  50. most stack based machines, where the frame pointer is
  51. the first invisible parameter.
  52. }
  53. procedure pop_parasize(pop_size:longint);virtual;
  54. procedure extra_interrupt_code;virtual;
  55. procedure extra_call_code;virtual;
  56. procedure extra_post_call_code;virtual;
  57. procedure do_syscall;virtual;abstract;
  58. public
  59. procedure pass_generate_code;override;
  60. end;
  61. implementation
  62. uses
  63. systems,
  64. cutils,verbose,globals,
  65. cpuinfo,
  66. symconst,symtable,defutil,paramgr,
  67. cgbase,pass_2,
  68. aasmbase,aasmtai,aasmdata,
  69. nbas,nmem,nld,ncnv,nutils,
  70. {$ifdef x86}
  71. cga,cgx86,aasmcpu,
  72. {$endif x86}
  73. ncgutil,
  74. cgobj,tgobj,
  75. procinfo;
  76. {*****************************************************************************
  77. TCGCALLPARANODE
  78. *****************************************************************************}
  79. constructor tcgcallparanode.create(expr,next : tnode);
  80. begin
  81. inherited create(expr,next);
  82. tempcgpara.init;
  83. end;
  84. destructor tcgcallparanode.destroy;
  85. begin
  86. tempcgpara.done;
  87. inherited destroy;
  88. end;
  89. procedure tcgcallparanode.push_addr_para;
  90. begin
  91. if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
  92. internalerror(200304235);
  93. cg.a_paramaddr_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara);
  94. end;
  95. procedure tcgcallparanode.push_value_para;
  96. {$ifdef i386}
  97. var
  98. href : treference;
  99. size : longint;
  100. {$endif i386}
  101. begin
  102. { we've nothing to push when the size of the parameter is 0 }
  103. if left.resultdef.size=0 then
  104. exit;
  105. { Move flags and jump in register to make it less complex }
  106. if left.location.loc in [LOC_FLAGS,LOC_JUMP,LOC_SUBSETREG,LOC_CSUBSETREG,LOC_SUBSETREF,LOC_CSUBSETREF] then
  107. location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),false);
  108. { Handle Floating point types differently
  109. This doesn't depend on emulator settings, emulator settings should
  110. be handled by cpupara }
  111. if left.resultdef.typ=floatdef then
  112. begin
  113. {$ifdef i386}
  114. if tempcgpara.location^.loc<>LOC_REFERENCE then
  115. internalerror(200309291);
  116. case left.location.loc of
  117. LOC_FPUREGISTER,
  118. LOC_CFPUREGISTER:
  119. begin
  120. size:=align(TCGSize2Size[left.location.size],tempcgpara.alignment);
  121. if tempcgpara.location^.reference.index=NR_STACK_POINTER_REG then
  122. begin
  123. cg.g_stackpointer_alloc(current_asmdata.CurrAsmList,size);
  124. reference_reset_base(href,NR_STACK_POINTER_REG,0);
  125. end
  126. else
  127. reference_reset_base(href,tempcgpara.location^.reference.index,tempcgpara.location^.reference.offset);
  128. cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,left.location.size,left.location.size,left.location.register,href);
  129. end;
  130. LOC_MMREGISTER,
  131. LOC_CMMREGISTER:
  132. begin
  133. size:=align(tfloatdef(left.resultdef).size,tempcgpara.alignment);
  134. if tempcgpara.location^.reference.index=NR_STACK_POINTER_REG then
  135. begin
  136. cg.g_stackpointer_alloc(current_asmdata.CurrAsmList,size);
  137. reference_reset_base(href,NR_STACK_POINTER_REG,0);
  138. end
  139. else
  140. reference_reset_base(href,tempcgpara.location^.reference.index,tempcgpara.location^.reference.offset);
  141. cg.a_loadmm_reg_ref(current_asmdata.CurrAsmList,left.location.size,left.location.size,left.location.register,href,mms_movescalar);
  142. end;
  143. LOC_REFERENCE,
  144. LOC_CREFERENCE :
  145. begin
  146. size:=align(left.resultdef.size,tempcgpara.alignment);
  147. if (not use_fixed_stack) and
  148. (tempcgpara.location^.reference.index=NR_STACK_POINTER_REG) then
  149. cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara)
  150. else
  151. begin
  152. reference_reset_base(href,tempcgpara.location^.reference.index,tempcgpara.location^.reference.offset);
  153. cg.g_concatcopy(current_asmdata.CurrAsmList,left.location.reference,href,size);
  154. end;
  155. end;
  156. else
  157. internalerror(2002042430);
  158. end;
  159. {$else i386}
  160. case left.location.loc of
  161. LOC_MMREGISTER,
  162. LOC_CMMREGISTER:
  163. case tempcgpara.location^.loc of
  164. LOC_REFERENCE,
  165. LOC_CREFERENCE,
  166. LOC_MMREGISTER,
  167. LOC_CMMREGISTER:
  168. cg.a_parammm_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara,mms_movescalar);
  169. {$ifdef x86_64}
  170. LOC_REGISTER,
  171. LOC_CREGISTER :
  172. begin
  173. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_MOVD,S_NO,left.location.register,tempcgpara.location^.register));
  174. end;
  175. {$endif x86_64}
  176. LOC_FPUREGISTER,
  177. LOC_CFPUREGISTER:
  178. begin
  179. location_force_fpureg(current_asmdata.CurrAsmList,left.location,false);
  180. cg.a_paramfpu_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara);
  181. end;
  182. else
  183. internalerror(200204249);
  184. end;
  185. LOC_FPUREGISTER,
  186. LOC_CFPUREGISTER:
  187. case tempcgpara.location^.loc of
  188. LOC_MMREGISTER,
  189. LOC_CMMREGISTER:
  190. begin
  191. location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,false);
  192. cg.a_parammm_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara,mms_movescalar);
  193. end;
  194. {$ifdef cpu64bit}
  195. LOC_REGISTER,
  196. LOC_CREGISTER :
  197. begin
  198. location_force_mem(current_asmdata.CurrAsmList,left.location);
  199. { force integer size }
  200. left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
  201. cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara);
  202. end;
  203. {$endif cpu64bit}
  204. {$ifdef powerpc}
  205. LOC_REGISTER,
  206. LOC_CREGISTER :
  207. begin
  208. { aix abi passes floats of varargs in both fpu and }
  209. { integer registers }
  210. location_force_mem(current_asmdata.CurrAsmList,left.location);
  211. { force integer size }
  212. left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
  213. if (left.location.size in [OS_32,OS_S32]) then
  214. cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara)
  215. else
  216. cg64.a_param64_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara);
  217. end;
  218. {$endif powerpc}
  219. {$if defined(sparc) or defined(arm) or defined(m68k)}
  220. { sparc and arm pass floats in normal registers }
  221. LOC_REGISTER,
  222. LOC_CREGISTER,
  223. {$endif sparc}
  224. LOC_REFERENCE,
  225. LOC_CREFERENCE,
  226. LOC_FPUREGISTER,
  227. LOC_CFPUREGISTER:
  228. cg.a_paramfpu_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara);
  229. else
  230. internalerror(2002042433);
  231. end;
  232. LOC_REFERENCE,
  233. LOC_CREFERENCE:
  234. case tempcgpara.location^.loc of
  235. LOC_MMREGISTER,
  236. LOC_CMMREGISTER:
  237. cg.a_parammm_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara,mms_movescalar);
  238. {$ifdef cpu64bit}
  239. LOC_REGISTER,
  240. LOC_CREGISTER :
  241. begin
  242. { force integer size }
  243. left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
  244. cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara);
  245. end;
  246. {$endif cpu64bit}
  247. {$ifdef powerpc}
  248. { x86_64 pushes s64comp in normal register }
  249. LOC_REGISTER,
  250. LOC_CREGISTER :
  251. begin
  252. { force integer size }
  253. left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
  254. if (left.location.size in [OS_32,OS_S32]) then
  255. cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara)
  256. else
  257. cg64.a_param64_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara);
  258. end;
  259. {$endif powerpc}
  260. {$if defined(sparc) or defined(arm) or defined(m68k)}
  261. { sparc and arm pass floats in normal registers }
  262. LOC_REGISTER,
  263. LOC_CREGISTER,
  264. {$endif}
  265. LOC_REFERENCE,
  266. LOC_CREFERENCE,
  267. LOC_FPUREGISTER,
  268. LOC_CFPUREGISTER:
  269. cg.a_paramfpu_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara);
  270. else
  271. internalerror(2002042431);
  272. end;
  273. LOC_REGISTER,
  274. LOC_CREGISTER :
  275. begin
  276. {$ifndef cpu64bit}
  277. { use cg64 only for int64, not for 8 byte records }
  278. if is_64bit(left.resultdef) then
  279. cg64.a_param64_loc(current_asmdata.CurrAsmList,left.location,tempcgpara)
  280. else
  281. {$endif cpu64bit}
  282. begin
  283. {$ifndef cpu64bit}
  284. { Only a_param_ref supports multiple locations, when the
  285. value is still a const or in a register then write it
  286. to a reference first. This situation can be triggered
  287. by typecasting an int64 constant to a record of 8 bytes }
  288. if left.location.size in [OS_64,OS_S64] then
  289. location_force_mem(current_asmdata.CurrAsmList,left.location);
  290. {$endif cpu64bit}
  291. cg.a_param_loc(current_asmdata.CurrAsmList,left.location,tempcgpara);
  292. end;
  293. end;
  294. else
  295. internalerror(2002042432);
  296. end;
  297. {$endif i386}
  298. end
  299. else
  300. begin
  301. case left.location.loc of
  302. LOC_CONSTANT,
  303. LOC_REGISTER,
  304. LOC_CREGISTER,
  305. LOC_REFERENCE,
  306. LOC_CREFERENCE :
  307. begin
  308. {$ifndef cpu64bit}
  309. { use cg64 only for int64, not for 8 byte records }
  310. if is_64bit(left.resultdef) then
  311. cg64.a_param64_loc(current_asmdata.CurrAsmList,left.location,tempcgpara)
  312. else
  313. {$endif cpu64bit}
  314. begin
  315. {$ifndef cpu64bit}
  316. { Only a_param_ref supports multiple locations, when the
  317. value is still a const or in a register then write it
  318. to a reference first. This situation can be triggered
  319. by typecasting an int64 constant to a record of 8 bytes }
  320. if left.location.size in [OS_64,OS_S64] then
  321. location_force_mem(current_asmdata.CurrAsmList,left.location);
  322. {$endif cpu64bit}
  323. cg.a_param_loc(current_asmdata.CurrAsmList,left.location,tempcgpara);
  324. end;
  325. end;
  326. {$ifdef SUPPORT_MMX}
  327. LOC_MMXREGISTER,
  328. LOC_CMMXREGISTER:
  329. cg.a_parammm_reg(current_asmdata.CurrAsmList,OS_M64,left.location.register,tempcgpara,nil);
  330. {$endif SUPPORT_MMX}
  331. else
  332. internalerror(200204241);
  333. end;
  334. end;
  335. end;
  336. procedure tcgcallparanode.secondcallparan;
  337. var
  338. href : treference;
  339. otlabel,
  340. oflabel : tasmlabel;
  341. begin
  342. if not(assigned(parasym)) then
  343. internalerror(200304242);
  344. { Skip nothingn nodes which are used after disabling
  345. a parameter }
  346. if (left.nodetype<>nothingn) then
  347. begin
  348. otlabel:=current_procinfo.CurrTrueLabel;
  349. oflabel:=current_procinfo.CurrFalseLabel;
  350. current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel);
  351. current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel);
  352. secondpass(left);
  353. maybechangeloadnodereg(current_asmdata.CurrAsmList,left,true);
  354. { release memory for refcnt out parameters }
  355. if (parasym.varspez=vs_out) and
  356. (left.resultdef.needs_inittable) then
  357. begin
  358. location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false);
  359. cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
  360. end;
  361. paramanager.createtempparaloc(current_asmdata.CurrAsmList,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara);
  362. { handle varargs first, because parasym is not valid }
  363. if (cpf_varargs_para in callparaflags) then
  364. begin
  365. if paramanager.push_addr_param(vs_value,left.resultdef,
  366. aktcallnode.procdefinition.proccalloption) then
  367. push_addr_para
  368. else
  369. push_value_para;
  370. end
  371. { hidden parameters }
  372. else if (vo_is_hidden_para in parasym.varoptions) then
  373. begin
  374. { don't push a node that already generated a pointer type
  375. by address for implicit hidden parameters }
  376. if (vo_is_funcret in parasym.varoptions) or
  377. { pass "this" in C++ classes explicitly as pointer
  378. because push_addr_param might not be true for them }
  379. (is_cppclass(parasym.vardef) and (vo_is_self in parasym.varoptions)) or
  380. (not(left.resultdef.typ in [pointerdef,classrefdef]) and
  381. paramanager.push_addr_param(parasym.varspez,parasym.vardef,
  382. aktcallnode.procdefinition.proccalloption)) then
  383. push_addr_para
  384. else
  385. push_value_para;
  386. end
  387. { formal def }
  388. else if (parasym.vardef.typ=formaldef) then
  389. begin
  390. { allow passing of a constant to a const formaldef }
  391. if (parasym.varspez=vs_const) and
  392. (left.location.loc in [LOC_CONSTANT,LOC_REGISTER]) then
  393. location_force_mem(current_asmdata.CurrAsmList,left.location);
  394. push_addr_para;
  395. end
  396. { Normal parameter }
  397. else
  398. begin
  399. { don't push a node that already generated a pointer type
  400. by address for implicit hidden parameters }
  401. if (not(
  402. (vo_is_hidden_para in parasym.varoptions) and
  403. (left.resultdef.typ in [pointerdef,classrefdef])
  404. ) and
  405. paramanager.push_addr_param(parasym.varspez,parasym.vardef,
  406. aktcallnode.procdefinition.proccalloption)) and
  407. { dyn. arrays passed to an array of const must be passed by value, see tests/webtbs/tw4219.pp }
  408. not(
  409. is_array_of_const(parasym.vardef) and
  410. is_dynamic_array(left.resultdef)
  411. ) then
  412. begin
  413. { Passing a var parameter to a var parameter, we can
  414. just push the address transparently }
  415. if (left.nodetype=loadn) and
  416. (tloadnode(left).is_addr_param_load) then
  417. begin
  418. if (left.location.reference.index<>NR_NO) or
  419. (left.location.reference.offset<>0) then
  420. internalerror(200410107);
  421. cg.a_param_reg(current_asmdata.CurrAsmList,OS_ADDR,left.location.reference.base,tempcgpara)
  422. end
  423. else
  424. begin
  425. { Force to be in memory }
  426. if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
  427. location_force_mem(current_asmdata.CurrAsmList,left.location);
  428. push_addr_para;
  429. end;
  430. end
  431. else
  432. push_value_para;
  433. end;
  434. current_procinfo.CurrTrueLabel:=otlabel;
  435. current_procinfo.CurrFalseLabel:=oflabel;
  436. { update return location in callnode when this is the function
  437. result }
  438. if assigned(parasym) and
  439. (vo_is_funcret in parasym.varoptions) then
  440. location_copy(aktcallnode.location,left.location);
  441. end;
  442. { next parameter }
  443. if assigned(right) then
  444. tcallparanode(right).secondcallparan;
  445. end;
  446. {*****************************************************************************
  447. TCGCALLNODE
  448. *****************************************************************************}
  449. procedure tcgcallnode.extra_interrupt_code;
  450. begin
  451. end;
  452. procedure tcgcallnode.extra_call_code;
  453. begin
  454. end;
  455. procedure tcgcallnode.extra_post_call_code;
  456. begin
  457. end;
  458. procedure tcgcallnode.pop_parasize(pop_size:longint);
  459. begin
  460. end;
  461. procedure tcgcallnode.handle_return_value;
  462. var
  463. cgsize : tcgsize;
  464. retloc : tlocation;
  465. begin
  466. { Check that the return location is set when the result is passed in
  467. a parameter }
  468. if (procdefinition.proctypeoption<>potype_constructor) and
  469. paramanager.ret_in_param(resultdef,procdefinition.proccalloption) then
  470. begin
  471. if location.loc<>LOC_REFERENCE then
  472. internalerror(200304241);
  473. exit;
  474. end;
  475. { Load normal (ordinal,float,pointer) result value from accumulator }
  476. cgsize:=procdefinition.funcretloc[callerside].size;
  477. case procdefinition.funcretloc[callerside].loc of
  478. LOC_FPUREGISTER:
  479. begin
  480. location_reset(location,LOC_FPUREGISTER,cgsize);
  481. location.register:=procdefinition.funcretloc[callerside].register;
  482. {$ifdef x86}
  483. tcgx86(cg).inc_fpu_stack;
  484. {$else x86}
  485. if getsupreg(procdefinition.funcretloc[callerside].register)<first_fpu_imreg then
  486. cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
  487. hregister:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
  488. cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,location.size,location.size,location.register,hregister);
  489. location.register:=hregister;
  490. {$endif x86}
  491. end;
  492. LOC_REGISTER:
  493. begin
  494. if cgsize<>OS_NO then
  495. begin
  496. location_reset(location,LOC_REGISTER,cgsize);
  497. {$ifndef cpu64bit}
  498. if cgsize in [OS_64,OS_S64] then
  499. begin
  500. retloc:=procdefinition.funcretloc[callerside];
  501. if retloc.loc<>LOC_REGISTER then
  502. internalerror(200409141);
  503. { the function result registers are already allocated }
  504. if getsupreg(retloc.register64.reglo)<first_int_imreg then
  505. cg.ungetcpuregister(current_asmdata.CurrAsmList,retloc.register64.reglo);
  506. location.register64.reglo:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  507. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,retloc.register64.reglo,location.register64.reglo);
  508. if getsupreg(retloc.register64.reghi)<first_int_imreg then
  509. cg.ungetcpuregister(current_asmdata.CurrAsmList,retloc.register64.reghi);
  510. location.register64.reghi:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  511. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,retloc.register64.reghi,location.register64.reghi);
  512. end
  513. else
  514. {$endif cpu64bit}
  515. begin
  516. { change register size after the unget because the
  517. getregister was done for the full register
  518. def_cgsize(resultdef) is used here because
  519. it could be a constructor call }
  520. if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then
  521. cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
  522. location.register:=cg.getintregister(current_asmdata.CurrAsmList,def_cgsize(resultdef));
  523. cg.a_load_reg_reg(current_asmdata.CurrAsmList,cgsize,def_cgsize(resultdef),procdefinition.funcretloc[callerside].register,location.register);
  524. end;
  525. {$ifdef arm}
  526. if (resultdef.typ=floatdef) and (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then
  527. begin
  528. location_force_mem(current_asmdata.CurrAsmList,location);
  529. end;
  530. {$endif arm}
  531. end
  532. else
  533. begin
  534. if resultdef.size>0 then
  535. internalerror(200305131);
  536. end;
  537. end;
  538. LOC_MMREGISTER:
  539. begin
  540. location_reset(location,LOC_MMREGISTER,cgsize);
  541. if getsupreg(procdefinition.funcretloc[callerside].register)<first_mm_imreg then
  542. cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
  543. location.register:=cg.getmmregister(current_asmdata.CurrAsmList,cgsize);
  544. cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,cgsize,cgsize,procdefinition.funcretloc[callerside].register,location.register,mms_movescalar);
  545. end;
  546. else
  547. internalerror(200405023);
  548. end;
  549. { copy value to the final location if this was already provided to the
  550. callnode. This must be done after the call node, because the location can
  551. also be used as parameter and may not be finalized yet }
  552. if assigned(funcretnode) then
  553. begin
  554. funcretnode.pass_generate_code;
  555. { Decrease refcount for refcounted types, this can be skipped when
  556. we have used a temp, because then it is already done from tempcreatenode.
  557. Also no finalize is needed, because there is no risk of exceptions from the
  558. function since this is code is only executed after the function call has returned }
  559. if funcretnode.resultdef.needs_inittable and
  560. (funcretnode.nodetype<>temprefn) then
  561. cg.g_decrrefcount(current_asmdata.CurrAsmList,funcretnode.resultdef,funcretnode.location.reference);
  562. case location.loc of
  563. LOC_REGISTER :
  564. {$ifndef cpu64bit}
  565. if cgsize in [OS_64,OS_S64] then
  566. cg64.a_load64_reg_loc(current_asmdata.CurrAsmList,location.register64,funcretnode.location)
  567. else
  568. {$endif}
  569. cg.a_load_reg_loc(current_asmdata.CurrAsmList,cgsize,location.register,funcretnode.location);
  570. else
  571. internalerror(200709085);
  572. end;
  573. location := funcretnode.location;
  574. end;
  575. end;
  576. procedure tcgcallnode.release_unused_return_value;
  577. begin
  578. { When the result is not used we need to finalize the result and
  579. can release the temp. This need to be after the callcleanupblock
  580. tree is generated, because that converts the temp from persistent to normal }
  581. if not(cnf_return_value_used in callnodeflags) then
  582. begin
  583. case location.loc of
  584. LOC_REFERENCE :
  585. begin
  586. if resultdef.needs_inittable then
  587. cg.g_finalize(current_asmdata.CurrAsmList,resultdef,location.reference);
  588. tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference);
  589. end;
  590. {$ifdef x86}
  591. LOC_FPUREGISTER :
  592. begin
  593. { release FPU stack }
  594. emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
  595. tcgx86(cg).dec_fpu_stack;
  596. end;
  597. {$endif x86}
  598. end;
  599. if procdefinition.funcretloc[callerside].size<>OS_NO then
  600. location_free(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside]);
  601. location_reset(location,LOC_VOID,OS_NO);
  602. end;
  603. end;
  604. procedure tcgcallnode.release_para_temps;
  605. var
  606. hp,
  607. hp2 : tnode;
  608. ppn : tcallparanode;
  609. begin
  610. { Release temps from parameters }
  611. ppn:=tcallparanode(left);
  612. while assigned(ppn) do
  613. begin
  614. if assigned(ppn.left) then
  615. begin
  616. { don't release the funcret temp }
  617. if not(assigned(ppn.parasym)) or
  618. not(vo_is_funcret in ppn.parasym.varoptions) then
  619. location_freetemp(current_asmdata.CurrAsmList,ppn.left.location);
  620. { process also all nodes of an array of const }
  621. hp:=ppn.left;
  622. while (hp.nodetype=typeconvn) do
  623. hp:=ttypeconvnode(hp).left;
  624. if (hp.nodetype=arrayconstructorn) and
  625. assigned(tarrayconstructornode(hp).left) then
  626. begin
  627. while assigned(hp) do
  628. begin
  629. hp2:=tarrayconstructornode(hp).left;
  630. { ignore typeconvs and addrn inserted by arrayconstructn for
  631. passing a shortstring }
  632. if (hp2.nodetype=typeconvn) and
  633. (tunarynode(hp2).left.nodetype=addrn) then
  634. hp2:=tunarynode(tunarynode(hp2).left).left;
  635. location_freetemp(current_asmdata.CurrAsmList,hp2.location);
  636. hp:=tarrayconstructornode(hp).right;
  637. end;
  638. end;
  639. end;
  640. ppn:=tcallparanode(ppn.right);
  641. end;
  642. end;
  643. procedure tcgcallnode.pushparas;
  644. var
  645. ppn : tcgcallparanode;
  646. callerparaloc,
  647. tmpparaloc : pcgparalocation;
  648. sizeleft: aint;
  649. htempref,
  650. href : treference;
  651. begin
  652. { copy all resources to the allocated registers }
  653. ppn:=tcgcallparanode(left);
  654. while assigned(ppn) do
  655. begin
  656. if (ppn.left.nodetype<>nothingn) then
  657. begin
  658. { better check for the real location of the parameter here, when stack passed parameters
  659. are saved temporary in registers, checking for the tmpparaloc.loc is wrong
  660. }
  661. paramanager.freeparaloc(current_asmdata.CurrAsmList,ppn.tempcgpara);
  662. tmpparaloc:=ppn.tempcgpara.location;
  663. sizeleft:=ppn.tempcgpara.intsize;
  664. callerparaloc:=ppn.parasym.paraloc[callerside].location;
  665. while assigned(callerparaloc) do
  666. begin
  667. { Every paraloc must have a matching tmpparaloc }
  668. if not assigned(tmpparaloc) then
  669. internalerror(200408224);
  670. if callerparaloc^.size<>tmpparaloc^.size then
  671. internalerror(200408225);
  672. case callerparaloc^.loc of
  673. LOC_REGISTER:
  674. begin
  675. if tmpparaloc^.loc<>LOC_REGISTER then
  676. internalerror(200408221);
  677. if getsupreg(callerparaloc^.register)<first_int_imreg then
  678. cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register);
  679. cg.a_load_reg_reg(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,
  680. tmpparaloc^.register,callerparaloc^.register);
  681. end;
  682. LOC_FPUREGISTER:
  683. begin
  684. if tmpparaloc^.loc<>LOC_FPUREGISTER then
  685. internalerror(200408222);
  686. if getsupreg(callerparaloc^.register)<first_fpu_imreg then
  687. cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register);
  688. cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,tmpparaloc^.size,ppn.tempcgpara.size,tmpparaloc^.register,callerparaloc^.register);
  689. end;
  690. LOC_MMREGISTER:
  691. begin
  692. if tmpparaloc^.loc<>LOC_MMREGISTER then
  693. internalerror(200408223);
  694. if getsupreg(callerparaloc^.register)<first_mm_imreg then
  695. cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register);
  696. cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,
  697. tmpparaloc^.register,callerparaloc^.register,mms_movescalar);
  698. end;
  699. LOC_REFERENCE:
  700. begin
  701. if use_fixed_stack then
  702. begin
  703. { Can't have a data copied to the stack, every location
  704. must contain a valid size field }
  705. if (ppn.tempcgpara.size=OS_NO) and
  706. ((tmpparaloc^.loc<>LOC_REFERENCE) or
  707. assigned(tmpparaloc^.next)) then
  708. internalerror(200501281);
  709. reference_reset_base(href,callerparaloc^.reference.index,callerparaloc^.reference.offset);
  710. { copy parameters in case they were moved to a temp. location because we've a fixed stack }
  711. case tmpparaloc^.loc of
  712. LOC_REFERENCE:
  713. begin
  714. reference_reset_base(htempref,tmpparaloc^.reference.index,tmpparaloc^.reference.offset);
  715. { use concatcopy, because it can also be a float which fails when
  716. load_ref_ref is used }
  717. if (ppn.tempcgpara.size <> OS_NO) then
  718. cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,tcgsize2size[tmpparaloc^.size])
  719. else
  720. cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,sizeleft)
  721. end;
  722. LOC_REGISTER:
  723. cg.a_load_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href);
  724. LOC_FPUREGISTER:
  725. cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href);
  726. LOC_MMREGISTER:
  727. cg.a_loadmm_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href,mms_movescalar);
  728. else
  729. internalerror(200402081);
  730. end;
  731. end;
  732. end;
  733. end;
  734. dec(sizeleft,tcgsize2size[tmpparaloc^.size]);
  735. callerparaloc:=callerparaloc^.next;
  736. tmpparaloc:=tmpparaloc^.next;
  737. end;
  738. end;
  739. ppn:=tcgcallparanode(ppn.right);
  740. end;
  741. end;
  742. procedure tcgcallnode.freeparas;
  743. var
  744. ppn : tcgcallparanode;
  745. begin
  746. { free the resources allocated for the parameters }
  747. ppn:=tcgcallparanode(left);
  748. while assigned(ppn) do
  749. begin
  750. if (ppn.left.nodetype<>nothingn) then
  751. begin
  752. if (ppn.parasym.paraloc[callerside].location^.loc <> LOC_REFERENCE) then
  753. paramanager.freeparaloc(current_asmdata.CurrAsmList,ppn.parasym.paraloc[callerside]);
  754. end;
  755. ppn:=tcgcallparanode(ppn.right);
  756. end;
  757. end;
  758. procedure tcgcallnode.pass_generate_code;
  759. var
  760. regs_to_save_int,
  761. regs_to_save_fpu,
  762. regs_to_save_mm : Tcpuregisterset;
  763. href : treference;
  764. pop_size : longint;
  765. vmtoffset : aint;
  766. pvreg,
  767. vmtreg : tregister;
  768. oldaktcallnode : tcallnode;
  769. {$ifdef vtentry}
  770. sym : tasmsymbol;
  771. {$endif vtentry}
  772. begin
  773. if not assigned(procdefinition) or
  774. not procdefinition.has_paraloc_info then
  775. internalerror(200305264);
  776. if assigned(callinitblock) then
  777. secondpass(callinitblock);
  778. regs_to_save_int:=paramanager.get_volatile_registers_int(procdefinition.proccalloption);
  779. regs_to_save_fpu:=paramanager.get_volatile_registers_fpu(procdefinition.proccalloption);
  780. regs_to_save_mm:=paramanager.get_volatile_registers_mm(procdefinition.proccalloption);
  781. { Include Function result registers }
  782. if (not is_void(resultdef)) then
  783. begin
  784. case procdefinition.funcretloc[callerside].loc of
  785. LOC_REGISTER,
  786. LOC_CREGISTER:
  787. include(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register));
  788. LOC_FPUREGISTER,
  789. LOC_CFPUREGISTER:
  790. include(regs_to_save_fpu,getsupreg(procdefinition.funcretloc[callerside].register));
  791. LOC_MMREGISTER,
  792. LOC_CMMREGISTER:
  793. include(regs_to_save_mm,getsupreg(procdefinition.funcretloc[callerside].register));
  794. LOC_REFERENCE,
  795. LOC_VOID:
  796. ;
  797. else
  798. internalerror(2004110213);
  799. end;
  800. end;
  801. { Process parameters, register parameters will be loaded
  802. in imaginary registers. The actual load to the correct
  803. register is done just before the call }
  804. oldaktcallnode:=aktcallnode;
  805. aktcallnode:=self;
  806. if assigned(left) then
  807. tcallparanode(left).secondcallparan;
  808. aktcallnode:=oldaktcallnode;
  809. { procedure variable or normal function call ? }
  810. if (right=nil) then
  811. begin
  812. { When methodpointer is typen we don't need (and can't) load
  813. a pointer. We can directly call the correct procdef (PFV) }
  814. if (po_virtualmethod in procdefinition.procoptions) and
  815. assigned(methodpointer) and
  816. (methodpointer.nodetype<>typen) then
  817. begin
  818. { virtual methods require an index }
  819. if tprocdef(procdefinition).extnumber=$ffff then
  820. internalerror(200304021);
  821. secondpass(methodpointer);
  822. { Load VMT from self }
  823. if methodpointer.resultdef.typ=objectdef then
  824. gen_load_vmt_register(current_asmdata.CurrAsmList,tobjectdef(methodpointer.resultdef),methodpointer.location,vmtreg)
  825. else
  826. begin
  827. { Load VMT value in register }
  828. location_force_reg(current_asmdata.CurrAsmList,methodpointer.location,OS_ADDR,false);
  829. vmtreg:=methodpointer.location.register;
  830. end;
  831. { test validity of VMT }
  832. if not(is_interface(tprocdef(procdefinition)._class)) and
  833. not(is_cppclass(tprocdef(procdefinition)._class)) then
  834. cg.g_maybe_testvmt(current_asmdata.CurrAsmList,vmtreg,tprocdef(procdefinition)._class);
  835. { Call through VMT, generate a VTREF symbol to notify the linker }
  836. vmtoffset:=tprocdef(procdefinition)._class.vmtmethodoffset(tprocdef(procdefinition).extnumber);
  837. {$ifdef vtentry}
  838. if not is_interface(tprocdef(procdefinition)._class) then
  839. begin
  840. inc(current_asmdata.NextVTEntryNr);
  841. current_asmdata.CurrAsmList.Concat(tai_symbol.CreateName('VTREF'+tostr(current_asmdata.NextVTEntryNr)+'_'+tprocdef(procdefinition)._class.vmt_mangledname+'$$'+tostr(vmtoffset div sizeof(aint)),AT_FUNCTION,0));
  842. end;
  843. {$endif vtentry}
  844. {$ifndef x86}
  845. pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR);
  846. {$endif not x86}
  847. reference_reset_base(href,vmtreg,vmtoffset);
  848. {$ifndef x86}
  849. cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,pvreg);
  850. {$endif not x86}
  851. { Load parameters that are in temporary registers in the
  852. correct parameter register }
  853. if assigned(left) then
  854. begin
  855. pushparas;
  856. { free the resources allocated for the parameters }
  857. freeparas;
  858. end;
  859. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  860. if cg.uses_registers(R_FPUREGISTER) then
  861. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  862. if cg.uses_registers(R_MMREGISTER) then
  863. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  864. { call method }
  865. extra_call_code;
  866. {$ifdef x86}
  867. cg.a_call_ref(current_asmdata.CurrAsmList,href);
  868. {$else x86}
  869. cg.a_call_reg(current_asmdata.CurrAsmList,pvreg);
  870. {$endif x86}
  871. extra_post_call_code;
  872. end
  873. else
  874. begin
  875. { Load parameters that are in temporary registers in the
  876. correct parameter register }
  877. if assigned(left) then
  878. begin
  879. pushparas;
  880. { free the resources allocated for the parameters }
  881. freeparas;
  882. end;
  883. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  884. if cg.uses_registers(R_FPUREGISTER) then
  885. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  886. if cg.uses_registers(R_MMREGISTER) then
  887. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  888. if procdefinition.proccalloption=pocall_syscall then
  889. do_syscall
  890. else
  891. begin
  892. { Calling interrupt from the same code requires some
  893. extra code }
  894. if (po_interrupt in procdefinition.procoptions) then
  895. extra_interrupt_code;
  896. extra_call_code;
  897. cg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition).mangledname);
  898. extra_post_call_code;
  899. end;
  900. end;
  901. end
  902. else
  903. { now procedure variable case }
  904. begin
  905. secondpass(right);
  906. pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR);
  907. { Only load OS_ADDR from the reference }
  908. if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
  909. cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,right.location.reference,pvreg)
  910. else
  911. cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_ADDR,right.location,pvreg);
  912. location_freetemp(current_asmdata.CurrAsmList,right.location);
  913. { Load parameters that are in temporary registers in the
  914. correct parameter register }
  915. if assigned(left) then
  916. begin
  917. pushparas;
  918. { free the resources allocated for the parameters }
  919. freeparas;
  920. end;
  921. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  922. if cg.uses_registers(R_FPUREGISTER) then
  923. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  924. if cg.uses_registers(R_MMREGISTER) then
  925. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  926. { Calling interrupt from the same code requires some
  927. extra code }
  928. if (po_interrupt in procdefinition.procoptions) then
  929. extra_interrupt_code;
  930. extra_call_code;
  931. cg.a_call_reg(current_asmdata.CurrAsmList,pvreg);
  932. extra_post_call_code;
  933. end;
  934. { Need to remove the parameters from the stack? }
  935. if (procdefinition.proccalloption in clearstack_pocalls) then
  936. begin
  937. pop_size:=pushedparasize;
  938. { for Cdecl functions we don't need to pop the funcret when it
  939. was pushed by para }
  940. if paramanager.ret_in_param(procdefinition.returndef,procdefinition.proccalloption) then
  941. dec(pop_size,sizeof(aint));
  942. { Remove parameters/alignment from the stack }
  943. pop_parasize(pop_size);
  944. end;
  945. { Release registers, but not the registers that contain the
  946. function result }
  947. if (not is_void(resultdef)) then
  948. begin
  949. case procdefinition.funcretloc[callerside].loc of
  950. LOC_REGISTER,
  951. LOC_CREGISTER:
  952. begin
  953. {$ifndef cpu64bit}
  954. if procdefinition.funcretloc[callerside].size in [OS_64,OS_S64] then
  955. begin
  956. exclude(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register64.reghi));
  957. exclude(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register64.reglo));
  958. end
  959. else
  960. {$endif cpu64bit}
  961. exclude(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register));
  962. end;
  963. LOC_FPUREGISTER,
  964. LOC_CFPUREGISTER:
  965. exclude(regs_to_save_fpu,getsupreg(procdefinition.funcretloc[callerside].register));
  966. LOC_MMREGISTER,
  967. LOC_CMMREGISTER:
  968. exclude(regs_to_save_mm,getsupreg(procdefinition.funcretloc[callerside].register));
  969. LOC_REFERENCE,
  970. LOC_VOID:
  971. ;
  972. else
  973. internalerror(2004110214);
  974. end;
  975. end;
  976. {$if defined(x86) or defined(arm)}
  977. if procdefinition.proccalloption=pocall_safecall then
  978. begin
  979. {$ifdef x86_64}
  980. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,NR_RAX,NR_RCX);
  981. {$endif x86_64}
  982. cg.allocallcpuregisters(current_asmdata.CurrAsmList);
  983. cg.a_call_name(current_asmdata.CurrAsmList,'FPC_SAFECALLCHECK');
  984. cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
  985. end;
  986. {$endif}
  987. if cg.uses_registers(R_MMREGISTER) then
  988. cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  989. if cg.uses_registers(R_FPUREGISTER) then
  990. cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  991. cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  992. { handle function results }
  993. if (not is_void(resultdef)) then
  994. handle_return_value
  995. else
  996. location_reset(location,LOC_VOID,OS_NO);
  997. { convert persistent temps for parameters and function result to normal temps }
  998. if assigned(callcleanupblock) then
  999. secondpass(callcleanupblock);
  1000. { release temps and finalize unused return values, must be
  1001. after the callcleanupblock because that converts temps
  1002. from persistent to normal }
  1003. release_unused_return_value;
  1004. { release temps of paras }
  1005. release_para_temps;
  1006. { perhaps i/o check ? }
  1007. if (cs_check_io in current_settings.localswitches) and
  1008. (po_iocheck in procdefinition.procoptions) and
  1009. not(po_iocheck in current_procinfo.procdef.procoptions) and
  1010. { no IO check for methods and procedure variables }
  1011. (right=nil) and
  1012. not(po_virtualmethod in procdefinition.procoptions) then
  1013. begin
  1014. cg.allocallcpuregisters(current_asmdata.CurrAsmList);
  1015. cg.a_call_name(current_asmdata.CurrAsmList,'FPC_IOCHECK');
  1016. cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
  1017. end;
  1018. end;
  1019. begin
  1020. ccallparanode:=tcgcallparanode;
  1021. ccallnode:=tcgcallnode;
  1022. end.