ncgcal.pas 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  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. {$ifndef x86}
  466. hregister : tregister;
  467. {$endif not x86}
  468. begin
  469. { Check that the return location is set when the result is passed in
  470. a parameter }
  471. if (procdefinition.proctypeoption<>potype_constructor) and
  472. paramanager.ret_in_param(resultdef,procdefinition.proccalloption) then
  473. begin
  474. if location.loc<>LOC_REFERENCE then
  475. internalerror(200304241);
  476. exit;
  477. end;
  478. { Load normal (ordinal,float,pointer) result value from accumulator }
  479. cgsize:=procdefinition.funcretloc[callerside].size;
  480. case procdefinition.funcretloc[callerside].loc of
  481. LOC_FPUREGISTER:
  482. begin
  483. location_reset(location,LOC_FPUREGISTER,cgsize);
  484. location.register:=procdefinition.funcretloc[callerside].register;
  485. {$ifdef x86}
  486. tcgx86(cg).inc_fpu_stack;
  487. {$else x86}
  488. if getsupreg(procdefinition.funcretloc[callerside].register)<first_fpu_imreg then
  489. cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
  490. hregister:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
  491. cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,location.size,location.size,location.register,hregister);
  492. location.register:=hregister;
  493. {$endif x86}
  494. end;
  495. LOC_REGISTER:
  496. begin
  497. if cgsize<>OS_NO then
  498. begin
  499. location_reset(location,LOC_REGISTER,cgsize);
  500. {$ifndef cpu64bit}
  501. if cgsize in [OS_64,OS_S64] then
  502. begin
  503. retloc:=procdefinition.funcretloc[callerside];
  504. if retloc.loc<>LOC_REGISTER then
  505. internalerror(200409141);
  506. { the function result registers are already allocated }
  507. if getsupreg(retloc.register64.reglo)<first_int_imreg then
  508. cg.ungetcpuregister(current_asmdata.CurrAsmList,retloc.register64.reglo);
  509. location.register64.reglo:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  510. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,retloc.register64.reglo,location.register64.reglo);
  511. if getsupreg(retloc.register64.reghi)<first_int_imreg then
  512. cg.ungetcpuregister(current_asmdata.CurrAsmList,retloc.register64.reghi);
  513. location.register64.reghi:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  514. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,retloc.register64.reghi,location.register64.reghi);
  515. end
  516. else
  517. {$endif cpu64bit}
  518. begin
  519. { change register size after the unget because the
  520. getregister was done for the full register
  521. def_cgsize(resultdef) is used here because
  522. it could be a constructor call }
  523. if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then
  524. cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
  525. location.register:=cg.getintregister(current_asmdata.CurrAsmList,def_cgsize(resultdef));
  526. cg.a_load_reg_reg(current_asmdata.CurrAsmList,cgsize,def_cgsize(resultdef),procdefinition.funcretloc[callerside].register,location.register);
  527. end;
  528. {$ifdef arm}
  529. if (resultdef.typ=floatdef) and (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then
  530. begin
  531. location_force_mem(current_asmdata.CurrAsmList,location);
  532. end;
  533. {$endif arm}
  534. end
  535. else
  536. begin
  537. if resultdef.size>0 then
  538. internalerror(200305131);
  539. end;
  540. end;
  541. LOC_MMREGISTER:
  542. begin
  543. location_reset(location,LOC_MMREGISTER,cgsize);
  544. if getsupreg(procdefinition.funcretloc[callerside].register)<first_mm_imreg then
  545. cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
  546. location.register:=cg.getmmregister(current_asmdata.CurrAsmList,cgsize);
  547. cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,cgsize,cgsize,procdefinition.funcretloc[callerside].register,location.register,mms_movescalar);
  548. end;
  549. else
  550. internalerror(200405023);
  551. end;
  552. { copy value to the final location if this was already provided to the
  553. callnode. This must be done after the call node, because the location can
  554. also be used as parameter and may not be finalized yet }
  555. if assigned(funcretnode) then
  556. begin
  557. funcretnode.pass_generate_code;
  558. { Decrease refcount for refcounted types, this can be skipped when
  559. we have used a temp, because then it is already done from tempcreatenode.
  560. Also no finalize is needed, because there is no risk of exceptions from the
  561. function since this is code is only executed after the function call has returned }
  562. if funcretnode.resultdef.needs_inittable and
  563. (funcretnode.nodetype<>temprefn) then
  564. cg.g_decrrefcount(current_asmdata.CurrAsmList,funcretnode.resultdef,funcretnode.location.reference);
  565. case location.loc of
  566. LOC_REGISTER :
  567. {$ifndef cpu64bit}
  568. if cgsize in [OS_64,OS_S64] then
  569. cg64.a_load64_reg_loc(current_asmdata.CurrAsmList,location.register64,funcretnode.location)
  570. else
  571. {$endif}
  572. cg.a_load_reg_loc(current_asmdata.CurrAsmList,cgsize,location.register,funcretnode.location);
  573. else
  574. internalerror(200709085);
  575. end;
  576. location := funcretnode.location;
  577. end;
  578. end;
  579. procedure tcgcallnode.release_unused_return_value;
  580. begin
  581. { When the result is not used we need to finalize the result and
  582. can release the temp. This need to be after the callcleanupblock
  583. tree is generated, because that converts the temp from persistent to normal }
  584. if not(cnf_return_value_used in callnodeflags) then
  585. begin
  586. case location.loc of
  587. LOC_REFERENCE :
  588. begin
  589. if resultdef.needs_inittable then
  590. cg.g_finalize(current_asmdata.CurrAsmList,resultdef,location.reference);
  591. tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference);
  592. end;
  593. {$ifdef x86}
  594. LOC_FPUREGISTER :
  595. begin
  596. { release FPU stack }
  597. emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
  598. tcgx86(cg).dec_fpu_stack;
  599. end;
  600. {$endif x86}
  601. end;
  602. if procdefinition.funcretloc[callerside].size<>OS_NO then
  603. location_free(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside]);
  604. location_reset(location,LOC_VOID,OS_NO);
  605. end;
  606. end;
  607. procedure tcgcallnode.release_para_temps;
  608. var
  609. hp,
  610. hp2 : tnode;
  611. ppn : tcallparanode;
  612. begin
  613. { Release temps from parameters }
  614. ppn:=tcallparanode(left);
  615. while assigned(ppn) do
  616. begin
  617. if assigned(ppn.left) then
  618. begin
  619. { don't release the funcret temp }
  620. if not(assigned(ppn.parasym)) or
  621. not(vo_is_funcret in ppn.parasym.varoptions) then
  622. location_freetemp(current_asmdata.CurrAsmList,ppn.left.location);
  623. { process also all nodes of an array of const }
  624. hp:=ppn.left;
  625. while (hp.nodetype=typeconvn) do
  626. hp:=ttypeconvnode(hp).left;
  627. if (hp.nodetype=arrayconstructorn) and
  628. assigned(tarrayconstructornode(hp).left) then
  629. begin
  630. while assigned(hp) do
  631. begin
  632. hp2:=tarrayconstructornode(hp).left;
  633. { ignore typeconvs and addrn inserted by arrayconstructn for
  634. passing a shortstring }
  635. if (hp2.nodetype=typeconvn) and
  636. (tunarynode(hp2).left.nodetype=addrn) then
  637. hp2:=tunarynode(tunarynode(hp2).left).left;
  638. location_freetemp(current_asmdata.CurrAsmList,hp2.location);
  639. hp:=tarrayconstructornode(hp).right;
  640. end;
  641. end;
  642. end;
  643. ppn:=tcallparanode(ppn.right);
  644. end;
  645. end;
  646. procedure tcgcallnode.pushparas;
  647. var
  648. ppn : tcgcallparanode;
  649. callerparaloc,
  650. tmpparaloc : pcgparalocation;
  651. sizeleft: aint;
  652. htempref,
  653. href : treference;
  654. begin
  655. { copy all resources to the allocated registers }
  656. ppn:=tcgcallparanode(left);
  657. while assigned(ppn) do
  658. begin
  659. if (ppn.left.nodetype<>nothingn) then
  660. begin
  661. { better check for the real location of the parameter here, when stack passed parameters
  662. are saved temporary in registers, checking for the tmpparaloc.loc is wrong
  663. }
  664. paramanager.freeparaloc(current_asmdata.CurrAsmList,ppn.tempcgpara);
  665. tmpparaloc:=ppn.tempcgpara.location;
  666. sizeleft:=ppn.tempcgpara.intsize;
  667. callerparaloc:=ppn.parasym.paraloc[callerside].location;
  668. while assigned(callerparaloc) do
  669. begin
  670. { Every paraloc must have a matching tmpparaloc }
  671. if not assigned(tmpparaloc) then
  672. internalerror(200408224);
  673. if callerparaloc^.size<>tmpparaloc^.size then
  674. internalerror(200408225);
  675. case callerparaloc^.loc of
  676. LOC_REGISTER:
  677. begin
  678. if tmpparaloc^.loc<>LOC_REGISTER then
  679. internalerror(200408221);
  680. if getsupreg(callerparaloc^.register)<first_int_imreg then
  681. cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register);
  682. cg.a_load_reg_reg(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,
  683. tmpparaloc^.register,callerparaloc^.register);
  684. end;
  685. LOC_FPUREGISTER:
  686. begin
  687. if tmpparaloc^.loc<>LOC_FPUREGISTER then
  688. internalerror(200408222);
  689. if getsupreg(callerparaloc^.register)<first_fpu_imreg then
  690. cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register);
  691. cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,tmpparaloc^.size,ppn.tempcgpara.size,tmpparaloc^.register,callerparaloc^.register);
  692. end;
  693. LOC_MMREGISTER:
  694. begin
  695. if tmpparaloc^.loc<>LOC_MMREGISTER then
  696. internalerror(200408223);
  697. if getsupreg(callerparaloc^.register)<first_mm_imreg then
  698. cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register);
  699. cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,
  700. tmpparaloc^.register,callerparaloc^.register,mms_movescalar);
  701. end;
  702. LOC_REFERENCE:
  703. begin
  704. if use_fixed_stack then
  705. begin
  706. { Can't have a data copied to the stack, every location
  707. must contain a valid size field }
  708. if (ppn.tempcgpara.size=OS_NO) and
  709. ((tmpparaloc^.loc<>LOC_REFERENCE) or
  710. assigned(tmpparaloc^.next)) then
  711. internalerror(200501281);
  712. reference_reset_base(href,callerparaloc^.reference.index,callerparaloc^.reference.offset);
  713. { copy parameters in case they were moved to a temp. location because we've a fixed stack }
  714. case tmpparaloc^.loc of
  715. LOC_REFERENCE:
  716. begin
  717. reference_reset_base(htempref,tmpparaloc^.reference.index,tmpparaloc^.reference.offset);
  718. { use concatcopy, because it can also be a float which fails when
  719. load_ref_ref is used }
  720. if (ppn.tempcgpara.size <> OS_NO) then
  721. cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,tcgsize2size[tmpparaloc^.size])
  722. else
  723. cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,sizeleft)
  724. end;
  725. LOC_REGISTER:
  726. cg.a_load_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href);
  727. LOC_FPUREGISTER:
  728. cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href);
  729. LOC_MMREGISTER:
  730. cg.a_loadmm_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href,mms_movescalar);
  731. else
  732. internalerror(200402081);
  733. end;
  734. end;
  735. end;
  736. end;
  737. dec(sizeleft,tcgsize2size[tmpparaloc^.size]);
  738. callerparaloc:=callerparaloc^.next;
  739. tmpparaloc:=tmpparaloc^.next;
  740. end;
  741. end;
  742. ppn:=tcgcallparanode(ppn.right);
  743. end;
  744. end;
  745. procedure tcgcallnode.freeparas;
  746. var
  747. ppn : tcgcallparanode;
  748. begin
  749. { free the resources allocated for the parameters }
  750. ppn:=tcgcallparanode(left);
  751. while assigned(ppn) do
  752. begin
  753. if (ppn.left.nodetype<>nothingn) then
  754. begin
  755. if (ppn.parasym.paraloc[callerside].location^.loc <> LOC_REFERENCE) then
  756. paramanager.freeparaloc(current_asmdata.CurrAsmList,ppn.parasym.paraloc[callerside]);
  757. end;
  758. ppn:=tcgcallparanode(ppn.right);
  759. end;
  760. end;
  761. procedure tcgcallnode.pass_generate_code;
  762. var
  763. regs_to_save_int,
  764. regs_to_save_fpu,
  765. regs_to_save_mm : Tcpuregisterset;
  766. href : treference;
  767. pop_size : longint;
  768. vmtoffset : aint;
  769. pvreg,
  770. vmtreg : tregister;
  771. oldaktcallnode : tcallnode;
  772. {$ifdef vtentry}
  773. sym : tasmsymbol;
  774. {$endif vtentry}
  775. begin
  776. if not assigned(procdefinition) or
  777. not procdefinition.has_paraloc_info then
  778. internalerror(200305264);
  779. if assigned(callinitblock) then
  780. secondpass(callinitblock);
  781. regs_to_save_int:=paramanager.get_volatile_registers_int(procdefinition.proccalloption);
  782. regs_to_save_fpu:=paramanager.get_volatile_registers_fpu(procdefinition.proccalloption);
  783. regs_to_save_mm:=paramanager.get_volatile_registers_mm(procdefinition.proccalloption);
  784. { Include Function result registers }
  785. if (not is_void(resultdef)) then
  786. begin
  787. case procdefinition.funcretloc[callerside].loc of
  788. LOC_REGISTER,
  789. LOC_CREGISTER:
  790. include(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register));
  791. LOC_FPUREGISTER,
  792. LOC_CFPUREGISTER:
  793. include(regs_to_save_fpu,getsupreg(procdefinition.funcretloc[callerside].register));
  794. LOC_MMREGISTER,
  795. LOC_CMMREGISTER:
  796. include(regs_to_save_mm,getsupreg(procdefinition.funcretloc[callerside].register));
  797. LOC_REFERENCE,
  798. LOC_VOID:
  799. ;
  800. else
  801. internalerror(2004110213);
  802. end;
  803. end;
  804. { Process parameters, register parameters will be loaded
  805. in imaginary registers. The actual load to the correct
  806. register is done just before the call }
  807. oldaktcallnode:=aktcallnode;
  808. aktcallnode:=self;
  809. if assigned(left) then
  810. tcallparanode(left).secondcallparan;
  811. aktcallnode:=oldaktcallnode;
  812. { procedure variable or normal function call ? }
  813. if (right=nil) then
  814. begin
  815. { When methodpointer is typen we don't need (and can't) load
  816. a pointer. We can directly call the correct procdef (PFV) }
  817. if (po_virtualmethod in procdefinition.procoptions) and
  818. assigned(methodpointer) and
  819. (methodpointer.nodetype<>typen) then
  820. begin
  821. { virtual methods require an index }
  822. if tprocdef(procdefinition).extnumber=$ffff then
  823. internalerror(200304021);
  824. secondpass(methodpointer);
  825. { Load VMT from self }
  826. if methodpointer.resultdef.typ=objectdef then
  827. gen_load_vmt_register(current_asmdata.CurrAsmList,tobjectdef(methodpointer.resultdef),methodpointer.location,vmtreg)
  828. else
  829. begin
  830. { Load VMT value in register }
  831. location_force_reg(current_asmdata.CurrAsmList,methodpointer.location,OS_ADDR,false);
  832. vmtreg:=methodpointer.location.register;
  833. end;
  834. { test validity of VMT }
  835. if not(is_interface(tprocdef(procdefinition)._class)) and
  836. not(is_cppclass(tprocdef(procdefinition)._class)) then
  837. cg.g_maybe_testvmt(current_asmdata.CurrAsmList,vmtreg,tprocdef(procdefinition)._class);
  838. { Call through VMT, generate a VTREF symbol to notify the linker }
  839. vmtoffset:=tprocdef(procdefinition)._class.vmtmethodoffset(tprocdef(procdefinition).extnumber);
  840. {$ifdef vtentry}
  841. if not is_interface(tprocdef(procdefinition)._class) then
  842. begin
  843. inc(current_asmdata.NextVTEntryNr);
  844. 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));
  845. end;
  846. {$endif vtentry}
  847. {$ifndef x86}
  848. pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR);
  849. {$endif not x86}
  850. reference_reset_base(href,vmtreg,vmtoffset);
  851. {$ifndef x86}
  852. cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,pvreg);
  853. {$endif not x86}
  854. { Load parameters that are in temporary registers in the
  855. correct parameter register }
  856. if assigned(left) then
  857. begin
  858. pushparas;
  859. { free the resources allocated for the parameters }
  860. freeparas;
  861. end;
  862. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  863. if cg.uses_registers(R_FPUREGISTER) then
  864. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  865. if cg.uses_registers(R_MMREGISTER) then
  866. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  867. { call method }
  868. extra_call_code;
  869. {$ifdef x86}
  870. cg.a_call_ref(current_asmdata.CurrAsmList,href);
  871. {$else x86}
  872. cg.a_call_reg(current_asmdata.CurrAsmList,pvreg);
  873. {$endif x86}
  874. extra_post_call_code;
  875. end
  876. else
  877. begin
  878. { Load parameters that are in temporary registers in the
  879. correct parameter register }
  880. if assigned(left) then
  881. begin
  882. pushparas;
  883. { free the resources allocated for the parameters }
  884. freeparas;
  885. end;
  886. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  887. if cg.uses_registers(R_FPUREGISTER) then
  888. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  889. if cg.uses_registers(R_MMREGISTER) then
  890. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  891. if procdefinition.proccalloption=pocall_syscall then
  892. do_syscall
  893. else
  894. begin
  895. { Calling interrupt from the same code requires some
  896. extra code }
  897. if (po_interrupt in procdefinition.procoptions) then
  898. extra_interrupt_code;
  899. extra_call_code;
  900. cg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition).mangledname);
  901. extra_post_call_code;
  902. end;
  903. end;
  904. end
  905. else
  906. { now procedure variable case }
  907. begin
  908. secondpass(right);
  909. pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR);
  910. { Only load OS_ADDR from the reference }
  911. if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
  912. cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,right.location.reference,pvreg)
  913. else
  914. cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_ADDR,right.location,pvreg);
  915. location_freetemp(current_asmdata.CurrAsmList,right.location);
  916. { Load parameters that are in temporary registers in the
  917. correct parameter register }
  918. if assigned(left) then
  919. begin
  920. pushparas;
  921. { free the resources allocated for the parameters }
  922. freeparas;
  923. end;
  924. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  925. if cg.uses_registers(R_FPUREGISTER) then
  926. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  927. if cg.uses_registers(R_MMREGISTER) then
  928. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  929. { Calling interrupt from the same code requires some
  930. extra code }
  931. if (po_interrupt in procdefinition.procoptions) then
  932. extra_interrupt_code;
  933. extra_call_code;
  934. cg.a_call_reg(current_asmdata.CurrAsmList,pvreg);
  935. extra_post_call_code;
  936. end;
  937. { Need to remove the parameters from the stack? }
  938. if (procdefinition.proccalloption in clearstack_pocalls) then
  939. begin
  940. pop_size:=pushedparasize;
  941. { for Cdecl functions we don't need to pop the funcret when it
  942. was pushed by para }
  943. if paramanager.ret_in_param(procdefinition.returndef,procdefinition.proccalloption) then
  944. dec(pop_size,sizeof(aint));
  945. { Remove parameters/alignment from the stack }
  946. pop_parasize(pop_size);
  947. end;
  948. { Release registers, but not the registers that contain the
  949. function result }
  950. if (not is_void(resultdef)) then
  951. begin
  952. case procdefinition.funcretloc[callerside].loc of
  953. LOC_REGISTER,
  954. LOC_CREGISTER:
  955. begin
  956. {$ifndef cpu64bit}
  957. if procdefinition.funcretloc[callerside].size in [OS_64,OS_S64] then
  958. begin
  959. exclude(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register64.reghi));
  960. exclude(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register64.reglo));
  961. end
  962. else
  963. {$endif cpu64bit}
  964. exclude(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register));
  965. end;
  966. LOC_FPUREGISTER,
  967. LOC_CFPUREGISTER:
  968. exclude(regs_to_save_fpu,getsupreg(procdefinition.funcretloc[callerside].register));
  969. LOC_MMREGISTER,
  970. LOC_CMMREGISTER:
  971. exclude(regs_to_save_mm,getsupreg(procdefinition.funcretloc[callerside].register));
  972. LOC_REFERENCE,
  973. LOC_VOID:
  974. ;
  975. else
  976. internalerror(2004110214);
  977. end;
  978. end;
  979. {$if defined(x86) or defined(arm)}
  980. if procdefinition.proccalloption=pocall_safecall then
  981. begin
  982. {$ifdef x86_64}
  983. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,NR_RAX,NR_RCX);
  984. {$endif x86_64}
  985. cg.allocallcpuregisters(current_asmdata.CurrAsmList);
  986. cg.a_call_name(current_asmdata.CurrAsmList,'FPC_SAFECALLCHECK');
  987. cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
  988. end;
  989. {$endif}
  990. if cg.uses_registers(R_MMREGISTER) then
  991. cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  992. if cg.uses_registers(R_FPUREGISTER) then
  993. cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  994. cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  995. { handle function results }
  996. if (not is_void(resultdef)) then
  997. handle_return_value
  998. else
  999. location_reset(location,LOC_VOID,OS_NO);
  1000. { convert persistent temps for parameters and function result to normal temps }
  1001. if assigned(callcleanupblock) then
  1002. secondpass(callcleanupblock);
  1003. { release temps and finalize unused return values, must be
  1004. after the callcleanupblock because that converts temps
  1005. from persistent to normal }
  1006. release_unused_return_value;
  1007. { release temps of paras }
  1008. release_para_temps;
  1009. { perhaps i/o check ? }
  1010. if (cs_check_io in current_settings.localswitches) and
  1011. (po_iocheck in procdefinition.procoptions) and
  1012. not(po_iocheck in current_procinfo.procdef.procoptions) and
  1013. { no IO check for methods and procedure variables }
  1014. (right=nil) and
  1015. not(po_virtualmethod in procdefinition.procoptions) then
  1016. begin
  1017. cg.allocallcpuregisters(current_asmdata.CurrAsmList);
  1018. cg.a_call_name(current_asmdata.CurrAsmList,'FPC_IOCHECK');
  1019. cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
  1020. end;
  1021. end;
  1022. begin
  1023. ccallparanode:=tcgcallparanode;
  1024. ccallnode:=tcgcallnode;
  1025. end.