ncgcal.pas 49 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 release_para_temps;
  39. procedure pushparas;
  40. procedure freeparas;
  41. protected
  42. framepointer_paraloc : tcgpara;
  43. refcountedtemp : treference;
  44. procedure handle_return_value;
  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,
  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.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. LOC_FPUREGISTER,
  170. LOC_CFPUREGISTER:
  171. begin
  172. location_force_fpureg(current_asmdata.CurrAsmList,left.location,false);
  173. cg.a_paramfpu_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara);
  174. end;
  175. else
  176. internalerror(200204249);
  177. end;
  178. LOC_FPUREGISTER,
  179. LOC_CFPUREGISTER:
  180. case tempcgpara.location^.loc of
  181. LOC_MMREGISTER,
  182. LOC_CMMREGISTER:
  183. begin
  184. location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,false);
  185. cg.a_parammm_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara,mms_movescalar);
  186. end;
  187. {$ifdef cpu64bit}
  188. LOC_REGISTER,
  189. LOC_CREGISTER :
  190. begin
  191. location_force_mem(current_asmdata.CurrAsmList,left.location);
  192. { force integer size }
  193. left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
  194. cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara);
  195. end;
  196. {$endif cpu64bit}
  197. {$ifdef powerpc}
  198. LOC_REGISTER,
  199. LOC_CREGISTER :
  200. begin
  201. { aix abi passes floats of varargs in both fpu and }
  202. { integer registers }
  203. location_force_mem(current_asmdata.CurrAsmList,left.location);
  204. { force integer size }
  205. left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
  206. if (left.location.size in [OS_32,OS_S32]) then
  207. cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara)
  208. else
  209. cg64.a_param64_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara);
  210. end;
  211. {$endif powerpc}
  212. {$if defined(sparc) or defined(arm) or defined(m68k)}
  213. { sparc and arm pass floats in normal registers }
  214. LOC_REGISTER,
  215. LOC_CREGISTER,
  216. {$endif sparc}
  217. LOC_REFERENCE,
  218. LOC_CREFERENCE,
  219. LOC_FPUREGISTER,
  220. LOC_CFPUREGISTER:
  221. cg.a_paramfpu_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara);
  222. else
  223. internalerror(2002042433);
  224. end;
  225. LOC_REFERENCE,
  226. LOC_CREFERENCE:
  227. case tempcgpara.location^.loc of
  228. LOC_MMREGISTER,
  229. LOC_CMMREGISTER:
  230. cg.a_parammm_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara,mms_movescalar);
  231. {$ifdef cpu64bit}
  232. LOC_REGISTER,
  233. LOC_CREGISTER :
  234. begin
  235. { force integer size }
  236. left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
  237. cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara);
  238. end;
  239. {$endif cpu64bit}
  240. {$ifdef powerpc}
  241. { x86_64 pushes s64comp in normal register }
  242. LOC_REGISTER,
  243. LOC_CREGISTER :
  244. begin
  245. { force integer size }
  246. left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
  247. if (left.location.size in [OS_32,OS_S32]) then
  248. cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara)
  249. else
  250. cg64.a_param64_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara);
  251. end;
  252. {$endif powerpc}
  253. {$if defined(sparc) or defined(arm) or defined(m68k)}
  254. { sparc and arm pass floats in normal registers }
  255. LOC_REGISTER,
  256. LOC_CREGISTER,
  257. {$endif}
  258. LOC_REFERENCE,
  259. LOC_CREFERENCE,
  260. LOC_FPUREGISTER,
  261. LOC_CFPUREGISTER:
  262. cg.a_paramfpu_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara);
  263. else
  264. internalerror(2002042431);
  265. end;
  266. LOC_REGISTER,
  267. LOC_CREGISTER :
  268. begin
  269. {$ifndef cpu64bit}
  270. { use cg64 only for int64, not for 8 byte records }
  271. if is_64bit(left.resultdef) then
  272. cg64.a_param64_loc(current_asmdata.CurrAsmList,left.location,tempcgpara)
  273. else
  274. {$endif cpu64bit}
  275. begin
  276. {$ifndef cpu64bit}
  277. { Only a_param_ref supports multiple locations, when the
  278. value is still a const or in a register then write it
  279. to a reference first. This situation can be triggered
  280. by typecasting an int64 constant to a record of 8 bytes }
  281. if left.location.size in [OS_64,OS_S64] then
  282. location_force_mem(current_asmdata.CurrAsmList,left.location);
  283. {$endif cpu64bit}
  284. cg.a_param_loc(current_asmdata.CurrAsmList,left.location,tempcgpara);
  285. end;
  286. end;
  287. else
  288. internalerror(2002042432);
  289. end;
  290. {$endif i386}
  291. end
  292. else
  293. begin
  294. case left.location.loc of
  295. LOC_CONSTANT,
  296. LOC_REGISTER,
  297. LOC_CREGISTER,
  298. LOC_REFERENCE,
  299. LOC_CREFERENCE :
  300. begin
  301. {$ifndef cpu64bit}
  302. { use cg64 only for int64, not for 8 byte records }
  303. if is_64bit(left.resultdef) then
  304. cg64.a_param64_loc(current_asmdata.CurrAsmList,left.location,tempcgpara)
  305. else
  306. {$endif cpu64bit}
  307. begin
  308. {$ifndef cpu64bit}
  309. { Only a_param_ref supports multiple locations, when the
  310. value is still a const or in a register then write it
  311. to a reference first. This situation can be triggered
  312. by typecasting an int64 constant to a record of 8 bytes }
  313. if left.location.size in [OS_64,OS_S64] then
  314. location_force_mem(current_asmdata.CurrAsmList,left.location);
  315. {$endif cpu64bit}
  316. cg.a_param_loc(current_asmdata.CurrAsmList,left.location,tempcgpara);
  317. end;
  318. end;
  319. {$ifdef SUPPORT_MMX}
  320. LOC_MMXREGISTER,
  321. LOC_CMMXREGISTER:
  322. cg.a_parammm_reg(current_asmdata.CurrAsmList,OS_M64,left.location.register,tempcgpara,nil);
  323. {$endif SUPPORT_MMX}
  324. else
  325. internalerror(200204241);
  326. end;
  327. end;
  328. end;
  329. procedure tcgcallparanode.secondcallparan;
  330. var
  331. href : treference;
  332. otlabel,
  333. oflabel : tasmlabel;
  334. begin
  335. if not(assigned(parasym)) then
  336. internalerror(200304242);
  337. { Skip nothingn nodes which are used after disabling
  338. a parameter }
  339. if (left.nodetype<>nothingn) then
  340. begin
  341. otlabel:=current_procinfo.CurrTrueLabel;
  342. oflabel:=current_procinfo.CurrFalseLabel;
  343. current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel);
  344. current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel);
  345. secondpass(left);
  346. maybechangeloadnodereg(current_asmdata.CurrAsmList,left,true);
  347. { release memory for refcnt out parameters }
  348. if (parasym.varspez=vs_out) and
  349. (left.resultdef.needs_inittable) then
  350. begin
  351. location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false);
  352. cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
  353. end;
  354. paramanager.createtempparaloc(current_asmdata.CurrAsmList,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara);
  355. { handle varargs first, because parasym is not valid }
  356. if (cpf_varargs_para in callparaflags) then
  357. begin
  358. if paramanager.push_addr_param(vs_value,left.resultdef,
  359. aktcallnode.procdefinition.proccalloption) then
  360. push_addr_para
  361. else
  362. push_value_para;
  363. end
  364. { hidden parameters }
  365. else if (vo_is_hidden_para in parasym.varoptions) then
  366. begin
  367. { don't push a node that already generated a pointer type
  368. by address for implicit hidden parameters }
  369. if (vo_is_funcret in parasym.varoptions) or
  370. (not(left.resultdef.typ in [pointerdef,classrefdef]) and
  371. paramanager.push_addr_param(parasym.varspez,parasym.vardef,
  372. aktcallnode.procdefinition.proccalloption)) then
  373. push_addr_para
  374. else
  375. push_value_para;
  376. end
  377. { formal def }
  378. else if (parasym.vardef.typ=formaldef) then
  379. begin
  380. { allow passing of a constant to a const formaldef }
  381. if (parasym.varspez=vs_const) and
  382. (left.location.loc in [LOC_CONSTANT,LOC_REGISTER]) then
  383. location_force_mem(current_asmdata.CurrAsmList,left.location);
  384. push_addr_para;
  385. end
  386. { Normal parameter }
  387. else
  388. begin
  389. { don't push a node that already generated a pointer type
  390. by address for implicit hidden parameters }
  391. if (not(
  392. (vo_is_hidden_para in parasym.varoptions) and
  393. (left.resultdef.typ in [pointerdef,classrefdef])
  394. ) and
  395. paramanager.push_addr_param(parasym.varspez,parasym.vardef,
  396. aktcallnode.procdefinition.proccalloption)) and
  397. { dyn. arrays passed to an array of const must be passed by value, see tests/webtbs/tw4219.pp }
  398. not(
  399. is_array_of_const(parasym.vardef) and
  400. is_dynamic_array(left.resultdef)
  401. ) then
  402. begin
  403. { Passing a var parameter to a var parameter, we can
  404. just push the address transparently }
  405. if (left.nodetype=loadn) and
  406. (tloadnode(left).is_addr_param_load) then
  407. begin
  408. if (left.location.reference.index<>NR_NO) or
  409. (left.location.reference.offset<>0) then
  410. internalerror(200410107);
  411. cg.a_param_reg(current_asmdata.CurrAsmList,OS_ADDR,left.location.reference.base,tempcgpara)
  412. end
  413. else
  414. begin
  415. { Force to be in memory }
  416. if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
  417. location_force_mem(current_asmdata.CurrAsmList,left.location);
  418. push_addr_para;
  419. end;
  420. end
  421. else
  422. push_value_para;
  423. end;
  424. current_procinfo.CurrTrueLabel:=otlabel;
  425. current_procinfo.CurrFalseLabel:=oflabel;
  426. { update return location in callnode when this is the function
  427. result }
  428. if assigned(parasym) and
  429. (vo_is_funcret in parasym.varoptions) then
  430. location_copy(aktcallnode.location,left.location);
  431. end;
  432. { next parameter }
  433. if assigned(right) then
  434. tcallparanode(right).secondcallparan;
  435. end;
  436. {*****************************************************************************
  437. TCGCALLNODE
  438. *****************************************************************************}
  439. procedure tcgcallnode.extra_interrupt_code;
  440. begin
  441. end;
  442. procedure tcgcallnode.extra_call_code;
  443. begin
  444. end;
  445. procedure tcgcallnode.extra_post_call_code;
  446. begin
  447. end;
  448. procedure tcgcallnode.pop_parasize(pop_size:longint);
  449. begin
  450. end;
  451. procedure tcgcallnode.handle_return_value;
  452. var
  453. cgsize : tcgsize;
  454. retloc : tlocation;
  455. hregister : tregister;
  456. tempnode : tnode;
  457. begin
  458. cgsize:=procdefinition.funcretloc[callerside].size;
  459. { structured results are easy to handle....
  460. needed also when result_no_used !! }
  461. if (procdefinition.proctypeoption<>potype_constructor) and
  462. paramanager.ret_in_param(resultdef,procdefinition.proccalloption) then
  463. begin
  464. { Location should be setup by the funcret para }
  465. if location.loc<>LOC_REFERENCE then
  466. internalerror(200304241);
  467. end
  468. else
  469. { ansi/widestrings must be registered, so we can dispose them }
  470. if resultdef.needs_inittable then
  471. begin
  472. if procdefinition.funcretloc[callerside].loc<>LOC_REGISTER then
  473. internalerror(200409261);
  474. { the FUNCTION_RESULT_REG is already allocated }
  475. if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then
  476. cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
  477. if not assigned(funcretnode) then
  478. begin
  479. { reg_ref could generate two instrcutions and allocate a register so we've to
  480. save the result first before releasing it }
  481. hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
  482. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,procdefinition.funcretloc[callerside].register,hregister);
  483. location_reset(location,LOC_REFERENCE,OS_ADDR);
  484. location.reference:=refcountedtemp;
  485. cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference);
  486. end
  487. else
  488. begin
  489. hregister := cg.getaddressregister(current_asmdata.CurrAsmList);
  490. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,procdefinition.funcretloc[callerside].register,hregister);
  491. { in case of a regular funcretnode with ret_in_param, the }
  492. { original funcretnode isn't touched -> make sure it's }
  493. { the same here (not sure if it's necessary) }
  494. tempnode := funcretnode.getcopy;
  495. tempnode.pass_generate_code;
  496. location := tempnode.location;
  497. tempnode.free;
  498. cg.g_decrrefcount(current_asmdata.CurrAsmList,resultdef,location.reference);
  499. cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference);
  500. end;
  501. end
  502. else
  503. { normal (ordinal,float,pointer) result value }
  504. begin
  505. { we have only to handle the result if it is used }
  506. if (cnf_return_value_used in callnodeflags) then
  507. begin
  508. location.loc:=procdefinition.funcretloc[callerside].loc;
  509. case procdefinition.funcretloc[callerside].loc of
  510. LOC_FPUREGISTER:
  511. begin
  512. location_reset(location,LOC_FPUREGISTER,cgsize);
  513. location.register:=procdefinition.funcretloc[callerside].register;
  514. {$ifdef x86}
  515. tcgx86(cg).inc_fpu_stack;
  516. {$else x86}
  517. if getsupreg(procdefinition.funcretloc[callerside].register)<first_fpu_imreg then
  518. cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
  519. hregister:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
  520. cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,location.size,location.register,hregister);
  521. location.register:=hregister;
  522. {$endif x86}
  523. end;
  524. LOC_REGISTER:
  525. begin
  526. if cgsize<>OS_NO then
  527. begin
  528. location_reset(location,LOC_REGISTER,cgsize);
  529. {$ifndef cpu64bit}
  530. if cgsize in [OS_64,OS_S64] then
  531. begin
  532. retloc:=procdefinition.funcretloc[callerside];
  533. if retloc.loc<>LOC_REGISTER then
  534. internalerror(200409141);
  535. { the function result registers are already allocated }
  536. if getsupreg(retloc.register64.reglo)<first_int_imreg then
  537. cg.ungetcpuregister(current_asmdata.CurrAsmList,retloc.register64.reglo);
  538. location.register64.reglo:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  539. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,retloc.register64.reglo,location.register64.reglo);
  540. if getsupreg(retloc.register64.reghi)<first_int_imreg then
  541. cg.ungetcpuregister(current_asmdata.CurrAsmList,retloc.register64.reghi);
  542. location.register64.reghi:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
  543. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,retloc.register64.reghi,location.register64.reghi);
  544. end
  545. else
  546. {$endif cpu64bit}
  547. begin
  548. { change register size after the unget because the
  549. getregister was done for the full register
  550. def_cgsize(resultdef) is used here because
  551. it could be a constructor call }
  552. if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then
  553. cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
  554. location.register:=cg.getintregister(current_asmdata.CurrAsmList,def_cgsize(resultdef));
  555. cg.a_load_reg_reg(current_asmdata.CurrAsmList,cgsize,def_cgsize(resultdef),procdefinition.funcretloc[callerside].register,location.register);
  556. end;
  557. {$ifdef arm}
  558. if (resultdef.typ=floatdef) and (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then
  559. begin
  560. location_force_mem(current_asmdata.CurrAsmList,location);
  561. end;
  562. {$endif arm}
  563. end
  564. else
  565. begin
  566. if resultdef.size>0 then
  567. internalerror(200305131);
  568. end;
  569. end;
  570. LOC_MMREGISTER:
  571. begin
  572. location_reset(location,LOC_MMREGISTER,cgsize);
  573. if getsupreg(procdefinition.funcretloc[callerside].register)<first_mm_imreg then
  574. cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register);
  575. location.register:=cg.getmmregister(current_asmdata.CurrAsmList,cgsize);
  576. cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,cgsize,cgsize,procdefinition.funcretloc[callerside].register,location.register,mms_movescalar);
  577. end;
  578. else
  579. internalerror(200405023);
  580. end;
  581. end
  582. else
  583. begin
  584. {$ifdef x86}
  585. { release FPU stack }
  586. if procdefinition.funcretloc[callerside].loc=LOC_FPUREGISTER then
  587. emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
  588. {$endif x86}
  589. if cgsize<>OS_NO then
  590. location_free(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside]);
  591. location_reset(location,LOC_VOID,OS_NO);
  592. end;
  593. end;
  594. { When the result is not used we need to finalize the result and
  595. can release the temp }
  596. if not(cnf_return_value_used in callnodeflags) then
  597. begin
  598. if location.loc=LOC_REFERENCE then
  599. begin
  600. if resultdef.needs_inittable then
  601. cg.g_finalize(current_asmdata.CurrAsmList,resultdef,location.reference);
  602. tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference)
  603. end;
  604. end;
  605. end;
  606. procedure tcgcallnode.release_para_temps;
  607. var
  608. hp : tnode;
  609. ppn : tcallparanode;
  610. begin
  611. { Release temps from parameters }
  612. ppn:=tcallparanode(left);
  613. while assigned(ppn) do
  614. begin
  615. if assigned(ppn.left) then
  616. begin
  617. { don't release the funcret temp }
  618. if not(assigned(ppn.parasym)) or
  619. not(vo_is_funcret in ppn.parasym.varoptions) then
  620. location_freetemp(current_asmdata.CurrAsmList,ppn.left.location);
  621. { process also all nodes of an array of const }
  622. hp:=ppn.left;
  623. while (hp.nodetype=typeconvn) do
  624. hp:=ttypeconvnode(hp).left;
  625. if (hp.nodetype=arrayconstructorn) and
  626. assigned(tarrayconstructornode(hp).left) then
  627. begin
  628. while assigned(hp) do
  629. begin
  630. location_freetemp(current_asmdata.CurrAsmList,tarrayconstructornode(hp).left.location);
  631. hp:=tarrayconstructornode(hp).right;
  632. end;
  633. end;
  634. end;
  635. ppn:=tcallparanode(ppn.right);
  636. end;
  637. end;
  638. procedure tcgcallnode.pushparas;
  639. var
  640. ppn : tcgcallparanode;
  641. callerparaloc,
  642. tmpparaloc : pcgparalocation;
  643. sizeleft: aint;
  644. htempref,
  645. href : treference;
  646. begin
  647. { copy all resources to the allocated registers }
  648. ppn:=tcgcallparanode(left);
  649. while assigned(ppn) do
  650. begin
  651. if (ppn.left.nodetype<>nothingn) then
  652. begin
  653. { better check for the real location of the parameter here, when stack passed parameters
  654. are saved temporary in registers, checking for the tmpparaloc.loc is wrong
  655. }
  656. paramanager.freeparaloc(current_asmdata.CurrAsmList,ppn.tempcgpara);
  657. tmpparaloc:=ppn.tempcgpara.location;
  658. sizeleft:=ppn.tempcgpara.intsize;
  659. callerparaloc:=ppn.parasym.paraloc[callerside].location;
  660. while assigned(callerparaloc) do
  661. begin
  662. { Every paraloc must have a matching tmpparaloc }
  663. if not assigned(tmpparaloc) then
  664. internalerror(200408224);
  665. if callerparaloc^.size<>tmpparaloc^.size then
  666. internalerror(200408225);
  667. case callerparaloc^.loc of
  668. LOC_REGISTER:
  669. begin
  670. if tmpparaloc^.loc<>LOC_REGISTER then
  671. internalerror(200408221);
  672. if getsupreg(callerparaloc^.register)<first_int_imreg then
  673. cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register);
  674. cg.a_load_reg_reg(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,
  675. tmpparaloc^.register,callerparaloc^.register);
  676. end;
  677. LOC_FPUREGISTER:
  678. begin
  679. if tmpparaloc^.loc<>LOC_FPUREGISTER then
  680. internalerror(200408222);
  681. if getsupreg(callerparaloc^.register)<first_fpu_imreg then
  682. cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register);
  683. cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,ppn.tempcgpara.size,tmpparaloc^.register,callerparaloc^.register);
  684. end;
  685. LOC_MMREGISTER:
  686. begin
  687. if tmpparaloc^.loc<>LOC_MMREGISTER then
  688. internalerror(200408223);
  689. if getsupreg(callerparaloc^.register)<first_mm_imreg then
  690. cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register);
  691. cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,
  692. tmpparaloc^.register,callerparaloc^.register,mms_movescalar);
  693. end;
  694. LOC_REFERENCE:
  695. begin
  696. if use_fixed_stack then
  697. begin
  698. { Can't have a data copied to the stack, every location
  699. must contain a valid size field }
  700. if (ppn.tempcgpara.size=OS_NO) and
  701. ((tmpparaloc^.loc<>LOC_REFERENCE) or
  702. assigned(tmpparaloc^.next)) then
  703. internalerror(200501281);
  704. reference_reset_base(href,callerparaloc^.reference.index,callerparaloc^.reference.offset);
  705. { copy parameters in case they were moved to a temp. location because we've a fixed stack }
  706. case tmpparaloc^.loc of
  707. LOC_REFERENCE:
  708. begin
  709. reference_reset_base(htempref,tmpparaloc^.reference.index,tmpparaloc^.reference.offset);
  710. { use concatcopy, because it can also be a float which fails when
  711. load_ref_ref is used }
  712. if (ppn.tempcgpara.size <> OS_NO) then
  713. cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,tcgsize2size[tmpparaloc^.size])
  714. else
  715. cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,sizeleft)
  716. end;
  717. LOC_REGISTER:
  718. cg.a_load_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href);
  719. LOC_FPUREGISTER:
  720. cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.register,href);
  721. LOC_MMREGISTER:
  722. cg.a_loadmm_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href,mms_movescalar);
  723. else
  724. internalerror(200402081);
  725. end;
  726. end;
  727. end;
  728. end;
  729. dec(sizeleft,tcgsize2size[tmpparaloc^.size]);
  730. callerparaloc:=callerparaloc^.next;
  731. tmpparaloc:=tmpparaloc^.next;
  732. end;
  733. end;
  734. ppn:=tcgcallparanode(ppn.right);
  735. end;
  736. end;
  737. procedure tcgcallnode.freeparas;
  738. var
  739. ppn : tcgcallparanode;
  740. begin
  741. { free the resources allocated for the parameters }
  742. ppn:=tcgcallparanode(left);
  743. while assigned(ppn) do
  744. begin
  745. if (ppn.left.nodetype<>nothingn) then
  746. begin
  747. if (ppn.parasym.paraloc[callerside].location^.loc <> LOC_REFERENCE) then
  748. paramanager.freeparaloc(current_asmdata.CurrAsmList,ppn.parasym.paraloc[callerside]);
  749. end;
  750. ppn:=tcgcallparanode(ppn.right);
  751. end;
  752. end;
  753. procedure tcgcallnode.pass_generate_code;
  754. var
  755. regs_to_save_int,
  756. regs_to_save_fpu,
  757. regs_to_save_mm : Tcpuregisterset;
  758. href : treference;
  759. pop_size : longint;
  760. vmtoffset : aint;
  761. pvreg,
  762. vmtreg : tregister;
  763. oldaktcallnode : tcallnode;
  764. {$ifdef vtentry}
  765. sym : tasmsymbol;
  766. {$endif vtentry}
  767. begin
  768. if not assigned(procdefinition) or
  769. not procdefinition.has_paraloc_info then
  770. internalerror(200305264);
  771. if assigned(methodpointerinit) then
  772. secondpass(methodpointerinit);
  773. if resultdef.needs_inittable and
  774. not paramanager.ret_in_param(resultdef,procdefinition.proccalloption) and
  775. not assigned(funcretnode) then
  776. begin
  777. tg.gettemptyped(current_asmdata.CurrAsmList,resultdef,tt_normal,refcountedtemp);
  778. { finalize instead of only decrref, because if the called }
  779. { function throws an exception this temp will be decrref'd }
  780. { again (tw7100) }
  781. cg.g_finalize(current_asmdata.CurrAsmList,resultdef,refcountedtemp);
  782. end;
  783. regs_to_save_int:=paramanager.get_volatile_registers_int(procdefinition.proccalloption);
  784. regs_to_save_fpu:=paramanager.get_volatile_registers_fpu(procdefinition.proccalloption);
  785. regs_to_save_mm:=paramanager.get_volatile_registers_mm(procdefinition.proccalloption);
  786. { Include Function result registers }
  787. if (not is_void(resultdef)) then
  788. begin
  789. case procdefinition.funcretloc[callerside].loc of
  790. LOC_REGISTER,
  791. LOC_CREGISTER:
  792. include(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register));
  793. LOC_FPUREGISTER,
  794. LOC_CFPUREGISTER:
  795. include(regs_to_save_fpu,getsupreg(procdefinition.funcretloc[callerside].register));
  796. LOC_MMREGISTER,
  797. LOC_CMMREGISTER:
  798. include(regs_to_save_mm,getsupreg(procdefinition.funcretloc[callerside].register));
  799. LOC_REFERENCE,
  800. LOC_VOID:
  801. ;
  802. else
  803. internalerror(2004110213);
  804. end;
  805. end;
  806. { Process parameters, register parameters will be loaded
  807. in imaginary registers. The actual load to the correct
  808. register is done just before the call }
  809. oldaktcallnode:=aktcallnode;
  810. aktcallnode:=self;
  811. if assigned(left) then
  812. tcallparanode(left).secondcallparan;
  813. aktcallnode:=oldaktcallnode;
  814. { procedure variable or normal function call ? }
  815. if (right=nil) then
  816. begin
  817. { When methodpointer is typen we don't need (and can't) load
  818. a pointer. We can directly call the correct procdef (PFV) }
  819. if (po_virtualmethod in procdefinition.procoptions) and
  820. assigned(methodpointer) and
  821. (methodpointer.nodetype<>typen) then
  822. begin
  823. { virtual methods require an index }
  824. if tprocdef(procdefinition).extnumber=$ffff then
  825. internalerror(200304021);
  826. secondpass(methodpointer);
  827. { Load VMT from self }
  828. if methodpointer.resultdef.typ=objectdef then
  829. gen_load_vmt_register(current_asmdata.CurrAsmList,tobjectdef(methodpointer.resultdef),methodpointer.location,vmtreg)
  830. else
  831. begin
  832. { Load VMT value in register }
  833. location_force_reg(current_asmdata.CurrAsmList,methodpointer.location,OS_ADDR,false);
  834. vmtreg:=methodpointer.location.register;
  835. end;
  836. { test validity of VMT }
  837. if not(is_interface(tprocdef(procdefinition)._class)) and
  838. not(is_cppclass(tprocdef(procdefinition)._class)) then
  839. cg.g_maybe_testvmt(current_asmdata.CurrAsmList,vmtreg,tprocdef(procdefinition)._class);
  840. { Call through VMT, generate a VTREF symbol to notify the linker }
  841. vmtoffset:=tprocdef(procdefinition)._class.vmtmethodoffset(tprocdef(procdefinition).extnumber);
  842. {$ifdef vtentry}
  843. if not is_interface(tprocdef(procdefinition)._class) then
  844. begin
  845. inc(current_asmdata.NextVTEntryNr);
  846. 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));
  847. end;
  848. {$endif vtentry}
  849. {$ifndef x86}
  850. pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR);
  851. {$endif not x86}
  852. reference_reset_base(href,vmtreg,vmtoffset);
  853. {$ifndef x86}
  854. cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,pvreg);
  855. {$endif not x86}
  856. { Load parameters that are in temporary registers in the
  857. correct parameter register }
  858. if assigned(left) then
  859. begin
  860. pushparas;
  861. { free the resources allocated for the parameters }
  862. freeparas;
  863. end;
  864. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  865. if cg.uses_registers(R_FPUREGISTER) then
  866. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  867. if cg.uses_registers(R_MMREGISTER) then
  868. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  869. { call method }
  870. extra_call_code;
  871. {$ifdef x86}
  872. cg.a_call_ref(current_asmdata.CurrAsmList,href);
  873. {$else x86}
  874. cg.a_call_reg(current_asmdata.CurrAsmList,pvreg);
  875. {$endif x86}
  876. extra_post_call_code;
  877. end
  878. else
  879. begin
  880. { Load parameters that are in temporary registers in the
  881. correct parameter register }
  882. if assigned(left) then
  883. begin
  884. pushparas;
  885. { free the resources allocated for the parameters }
  886. freeparas;
  887. end;
  888. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  889. if cg.uses_registers(R_FPUREGISTER) then
  890. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  891. if cg.uses_registers(R_MMREGISTER) then
  892. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  893. if procdefinition.proccalloption=pocall_syscall then
  894. do_syscall
  895. else
  896. begin
  897. { Calling interrupt from the same code requires some
  898. extra code }
  899. if (po_interrupt in procdefinition.procoptions) then
  900. extra_interrupt_code;
  901. extra_call_code;
  902. cg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition).mangledname);
  903. extra_post_call_code;
  904. end;
  905. end;
  906. end
  907. else
  908. { now procedure variable case }
  909. begin
  910. secondpass(right);
  911. pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR);
  912. { Only load OS_ADDR from the reference }
  913. if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
  914. cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,right.location.reference,pvreg)
  915. else
  916. cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_ADDR,right.location,pvreg);
  917. location_freetemp(current_asmdata.CurrAsmList,right.location);
  918. { Load parameters that are in temporary registers in the
  919. correct parameter register }
  920. if assigned(left) then
  921. begin
  922. pushparas;
  923. { free the resources allocated for the parameters }
  924. freeparas;
  925. end;
  926. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  927. if cg.uses_registers(R_FPUREGISTER) then
  928. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  929. if cg.uses_registers(R_MMREGISTER) then
  930. cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  931. { Calling interrupt from the same code requires some
  932. extra code }
  933. if (po_interrupt in procdefinition.procoptions) then
  934. extra_interrupt_code;
  935. extra_call_code;
  936. cg.a_call_reg(current_asmdata.CurrAsmList,pvreg);
  937. extra_post_call_code;
  938. end;
  939. { Need to remove the parameters from the stack? }
  940. if (procdefinition.proccalloption in clearstack_pocalls) then
  941. begin
  942. pop_size:=pushedparasize;
  943. { for Cdecl functions we don't need to pop the funcret when it
  944. was pushed by para }
  945. if paramanager.ret_in_param(procdefinition.returndef,procdefinition.proccalloption) then
  946. dec(pop_size,sizeof(aint));
  947. { Remove parameters/alignment from the stack }
  948. pop_parasize(pop_size);
  949. end;
  950. { Release registers, but not the registers that contain the
  951. function result }
  952. if (not is_void(resultdef)) then
  953. begin
  954. case procdefinition.funcretloc[callerside].loc of
  955. LOC_REGISTER,
  956. LOC_CREGISTER:
  957. begin
  958. {$ifndef cpu64bit}
  959. if procdefinition.funcretloc[callerside].size in [OS_64,OS_S64] then
  960. begin
  961. exclude(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register64.reghi));
  962. exclude(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register64.reglo));
  963. end
  964. else
  965. {$endif cpu64bit}
  966. exclude(regs_to_save_int,getsupreg(procdefinition.funcretloc[callerside].register));
  967. end;
  968. LOC_FPUREGISTER,
  969. LOC_CFPUREGISTER:
  970. exclude(regs_to_save_fpu,getsupreg(procdefinition.funcretloc[callerside].register));
  971. LOC_MMREGISTER,
  972. LOC_CMMREGISTER:
  973. exclude(regs_to_save_mm,getsupreg(procdefinition.funcretloc[callerside].register));
  974. LOC_REFERENCE,
  975. LOC_VOID:
  976. ;
  977. else
  978. internalerror(2004110214);
  979. end;
  980. end;
  981. {$if defined(x86) or defined(arm)}
  982. if procdefinition.proccalloption=pocall_safecall then
  983. begin
  984. {$ifdef x86_64}
  985. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,NR_RAX,NR_RCX);
  986. {$endif x86_64}
  987. cg.allocallcpuregisters(current_asmdata.CurrAsmList);
  988. cg.a_call_name(current_asmdata.CurrAsmList,'FPC_SAFECALLCHECK');
  989. cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
  990. end;
  991. {$endif}
  992. if cg.uses_registers(R_MMREGISTER) then
  993. cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm);
  994. if cg.uses_registers(R_FPUREGISTER) then
  995. cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu);
  996. cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int);
  997. { handle function results }
  998. if (not is_void(resultdef)) then
  999. handle_return_value
  1000. else
  1001. location_reset(location,LOC_VOID,OS_NO);
  1002. { perhaps i/o check ? }
  1003. if (cs_check_io in current_settings.localswitches) and
  1004. (po_iocheck in procdefinition.procoptions) and
  1005. not(po_iocheck in current_procinfo.procdef.procoptions) and
  1006. { no IO check for methods and procedure variables }
  1007. (right=nil) and
  1008. not(po_virtualmethod in procdefinition.procoptions) then
  1009. begin
  1010. cg.allocallcpuregisters(current_asmdata.CurrAsmList);
  1011. cg.a_call_name(current_asmdata.CurrAsmList,'FPC_IOCHECK');
  1012. cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
  1013. end;
  1014. { release temps of paras }
  1015. release_para_temps;
  1016. if assigned(methodpointerdone) then
  1017. secondpass(methodpointerdone);
  1018. end;
  1019. begin
  1020. ccallparanode:=tcgcallparanode;
  1021. ccallnode:=tcgcallnode;
  1022. end.