cpupara.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. {
  2. Copyright (c) 2003 by Florian Klaempfl
  3. ARM specific calling conventions
  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. { ARM specific calling conventions are handled by this unit
  18. }
  19. unit cpupara;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. globtype,globals,
  24. aasmtai,aasmdata,
  25. cpuinfo,cpubase,cgbase,cgutils,
  26. symconst,symbase,symtype,symdef,parabase,paramgr;
  27. type
  28. tarmparamanager = class(tparamanager)
  29. function get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;override;
  30. function get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;override;
  31. function get_volatile_registers_mm(calloption : tproccalloption):tcpuregisterset;override;
  32. function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
  33. function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;override;
  34. procedure getintparaloc(calloption : tproccalloption; nr : longint;var cgpara:TCGPara);override;
  35. function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
  36. function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;override;
  37. function get_funcretloc(p : tabstractprocdef; side: tcallercallee; def: tdef): tcgpara;override;
  38. private
  39. procedure init_values(var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword);
  40. function create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist;
  41. var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword):longint;
  42. procedure create_funcretloc_info(p : tabstractprocdef; side: tcallercallee);
  43. end;
  44. implementation
  45. uses
  46. verbose,systems,cutils,
  47. rgobj,
  48. defutil,symsym,symtable;
  49. function tarmparamanager.get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;
  50. begin
  51. if (target_info.system<>system_arm_darwin) then
  52. result:=VOLATILE_INTREGISTERS
  53. else
  54. result:=VOLATILE_INTREGISTERS_DARWIN;
  55. end;
  56. function tarmparamanager.get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;
  57. begin
  58. result:=VOLATILE_FPUREGISTERS;
  59. end;
  60. function tarmparamanager.get_volatile_registers_mm(calloption: tproccalloption): tcpuregisterset;
  61. begin
  62. result:=VOLATILE_MMREGISTERS;
  63. end;
  64. procedure tarmparamanager.getintparaloc(calloption : tproccalloption; nr : longint;var cgpara:TCGPara);
  65. var
  66. paraloc : pcgparalocation;
  67. begin
  68. if nr<1 then
  69. internalerror(2002070801);
  70. cgpara.reset;
  71. cgpara.size:=OS_ADDR;
  72. cgpara.intsize:=sizeof(pint);
  73. cgpara.alignment:=std_param_align;
  74. paraloc:=cgpara.add_location;
  75. with paraloc^ do
  76. begin
  77. size:=OS_INT;
  78. { the four first parameters are passed into registers }
  79. if nr<=4 then
  80. begin
  81. loc:=LOC_REGISTER;
  82. register:=newreg(R_INTREGISTER,RS_R0+nr-1,R_SUBWHOLE);
  83. end
  84. else
  85. begin
  86. { the other parameters are passed on the stack }
  87. loc:=LOC_REFERENCE;
  88. reference.index:=NR_STACK_POINTER_REG;
  89. reference.offset:=(nr-5)*4;
  90. end;
  91. end;
  92. end;
  93. function getparaloc(calloption : tproccalloption; p : tdef) : tcgloc;
  94. begin
  95. { Later, the LOC_REFERENCE is in most cases changed into LOC_REGISTER
  96. if push_addr_param for the def is true
  97. }
  98. case p.typ of
  99. orddef:
  100. getparaloc:=LOC_REGISTER;
  101. floatdef:
  102. if (calloption in [pocall_cdecl,pocall_cppdecl,pocall_softfloat]) or
  103. (cs_fp_emulation in current_settings.moduleswitches) or
  104. (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3]) then
  105. { the ARM eabi also allows passing VFP values via VFP registers,
  106. but at least neither Mac OS X nor Linux seems to do that }
  107. getparaloc:=LOC_REGISTER
  108. else
  109. getparaloc:=LOC_FPUREGISTER;
  110. enumdef:
  111. getparaloc:=LOC_REGISTER;
  112. pointerdef:
  113. getparaloc:=LOC_REGISTER;
  114. formaldef:
  115. getparaloc:=LOC_REGISTER;
  116. classrefdef:
  117. getparaloc:=LOC_REGISTER;
  118. recorddef:
  119. getparaloc:=LOC_REGISTER;
  120. objectdef:
  121. getparaloc:=LOC_REGISTER;
  122. stringdef:
  123. if is_shortstring(p) or is_longstring(p) then
  124. getparaloc:=LOC_REFERENCE
  125. else
  126. getparaloc:=LOC_REGISTER;
  127. procvardef:
  128. getparaloc:=LOC_REGISTER;
  129. filedef:
  130. getparaloc:=LOC_REGISTER;
  131. arraydef:
  132. getparaloc:=LOC_REFERENCE;
  133. setdef:
  134. if is_smallset(p) then
  135. getparaloc:=LOC_REGISTER
  136. else
  137. getparaloc:=LOC_REFERENCE;
  138. variantdef:
  139. getparaloc:=LOC_REGISTER;
  140. { avoid problems with errornous definitions }
  141. errordef:
  142. getparaloc:=LOC_REGISTER;
  143. else
  144. internalerror(2002071001);
  145. end;
  146. end;
  147. function tarmparamanager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
  148. begin
  149. result:=false;
  150. if varspez in [vs_var,vs_out,vs_constref] then
  151. begin
  152. result:=true;
  153. exit;
  154. end;
  155. case def.typ of
  156. objectdef:
  157. result:=is_object(def) and ((varspez=vs_const) or (def.size=0));
  158. recorddef:
  159. { note: should this ever be changed, make sure that const records
  160. are always passed by reference for calloption=pocall_mwpascal }
  161. result:=(varspez=vs_const) or (def.size=0);
  162. variantdef,
  163. formaldef:
  164. result:=true;
  165. arraydef:
  166. result:=(tarraydef(def).highrange>=tarraydef(def).lowrange) or
  167. is_open_array(def) or
  168. is_array_of_const(def) or
  169. is_array_constructor(def);
  170. setdef :
  171. result:=not is_smallset(def);
  172. stringdef :
  173. result:=tstringdef(def).stringtype in [st_shortstring,st_longstring];
  174. end;
  175. end;
  176. function tarmparamanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
  177. var
  178. i: longint;
  179. sym: tsym;
  180. fpufield: boolean;
  181. begin
  182. case def.typ of
  183. recorddef:
  184. begin
  185. result:=def.size>4;
  186. if not result and
  187. (target_info.abi in [abi_default,abi_armeb]) then
  188. begin
  189. { in case of the old ARM abi (APCS), a struct is returned in
  190. a register only if it is simple. And what is a (non-)simple
  191. struct:
  192. "A non-simple type is any non-floating-point type of size
  193. greater than one word (including structures containing only
  194. floating-point fields), and certain single-word structured
  195. types."
  196. (-- ARM APCS documentation)
  197. So only floating point types or more than one word ->
  198. definitely non-simple (more than one word is already
  199. checked above). This includes unions/variant records with
  200. overlaid floating point and integer fields.
  201. Smaller than one word struct types are simple if they are
  202. "integer-like", and:
  203. "A structure is termed integer-like if its size is less than
  204. or equal to one word, and the offset of each of its
  205. addressable subfields is zero."
  206. (-- ARM APCS documentation)
  207. An "addressable subfield" is a field of which you can take
  208. the address, which in practive means any non-bitfield.
  209. In Pascal, there is no way to express the difference that
  210. you can have in C between "char" and "int :8". In this
  211. context, we use the fake distinction that a type defined
  212. inside the record itself (such as "a: 0..255;") indicates
  213. a bitpacked field while a field using a different type
  214. (such as "a: byte;") is not.
  215. }
  216. for i:=0 to trecorddef(def).symtable.SymList.count-1 do
  217. begin
  218. sym:=tsym(trecorddef(def).symtable.SymList[i]);
  219. if sym.typ<>fieldvarsym then
  220. continue;
  221. { bitfield -> ignore }
  222. if (trecordsymtable(trecorddef(def).symtable).usefieldalignment=bit_alignment) and
  223. (tfieldvarsym(sym).vardef.typ in [orddef,enumdef]) and
  224. (tfieldvarsym(sym).vardef.owner.defowner=def) then
  225. continue;
  226. { all other fields must be at offset zero }
  227. if tfieldvarsym(sym).fieldoffset<>0 then
  228. begin
  229. result:=true;
  230. exit;
  231. end;
  232. { floating point field -> also by reference }
  233. if tfieldvarsym(sym).vardef.typ=floatdef then
  234. begin
  235. result:=true;
  236. exit;
  237. end;
  238. end;
  239. end;
  240. end;
  241. procvardef:
  242. if not tprocvardef(def).is_addressonly then
  243. result:=true
  244. else
  245. result:=false
  246. else
  247. result:=inherited ret_in_param(def,calloption);
  248. end;
  249. end;
  250. procedure tarmparamanager.init_values(var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword);
  251. begin
  252. curintreg:=RS_R0;
  253. curfloatreg:=RS_F0;
  254. curmmreg:=RS_D0;
  255. cur_stack_offset:=0;
  256. end;
  257. function tarmparamanager.create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist;
  258. var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword):longint;
  259. var
  260. nextintreg,nextfloatreg,nextmmreg : tsuperregister;
  261. paradef : tdef;
  262. paraloc : pcgparalocation;
  263. stack_offset : aword;
  264. hp : tparavarsym;
  265. loc : tcgloc;
  266. paracgsize : tcgsize;
  267. paralen : longint;
  268. i : integer;
  269. firstparaloc: boolean;
  270. procedure assignintreg;
  271. begin
  272. { In case of po_delphi_nested_cc, the parent frame pointer
  273. is always passed on the stack. }
  274. if (nextintreg<=RS_R3) and
  275. (not(vo_is_parentfp in hp.varoptions) or
  276. not(po_delphi_nested_cc in p.procoptions)) then
  277. begin
  278. paraloc^.loc:=LOC_REGISTER;
  279. paraloc^.register:=newreg(R_INTREGISTER,nextintreg,R_SUBWHOLE);
  280. inc(nextintreg);
  281. end
  282. else
  283. begin
  284. paraloc^.loc:=LOC_REFERENCE;
  285. paraloc^.reference.index:=NR_STACK_POINTER_REG;
  286. paraloc^.reference.offset:=stack_offset;
  287. inc(stack_offset,4);
  288. end;
  289. end;
  290. begin
  291. result:=0;
  292. nextintreg:=curintreg;
  293. nextfloatreg:=curfloatreg;
  294. nextmmreg:=curmmreg;
  295. stack_offset:=cur_stack_offset;
  296. for i:=0 to paras.count-1 do
  297. begin
  298. hp:=tparavarsym(paras[i]);
  299. paradef:=hp.vardef;
  300. hp.paraloc[side].reset;
  301. { currently only support C-style array of const,
  302. there should be no location assigned to the vararg array itself }
  303. if (p.proccalloption in [pocall_cdecl,pocall_cppdecl]) and
  304. is_array_of_const(paradef) then
  305. begin
  306. paraloc:=hp.paraloc[side].add_location;
  307. { hack: the paraloc must be valid, but is not actually used }
  308. paraloc^.loc:=LOC_REGISTER;
  309. paraloc^.register:=NR_R0;
  310. paraloc^.size:=OS_ADDR;
  311. break;
  312. end;
  313. if (hp.varspez in [vs_var,vs_out]) or
  314. push_addr_param(hp.varspez,paradef,p.proccalloption) or
  315. is_open_array(paradef) or
  316. is_array_of_const(paradef) then
  317. begin
  318. paradef:=voidpointertype;
  319. loc:=LOC_REGISTER;
  320. paracgsize := OS_ADDR;
  321. paralen := tcgsize2size[OS_ADDR];
  322. end
  323. else
  324. begin
  325. if not is_special_array(paradef) then
  326. paralen := paradef.size
  327. else
  328. paralen := tcgsize2size[def_cgsize(paradef)];
  329. loc := getparaloc(p.proccalloption,paradef);
  330. if (paradef.typ in [objectdef,arraydef,recorddef]) and
  331. not is_special_array(paradef) and
  332. (hp.varspez in [vs_value,vs_const]) then
  333. paracgsize := int_cgsize(paralen)
  334. else
  335. begin
  336. paracgsize:=def_cgsize(paradef);
  337. { for things like formaldef }
  338. if (paracgsize=OS_NO) then
  339. begin
  340. paracgsize:=OS_ADDR;
  341. paralen := tcgsize2size[OS_ADDR];
  342. end;
  343. end
  344. end;
  345. hp.paraloc[side].size:=paracgsize;
  346. hp.paraloc[side].Alignment:=std_param_align;
  347. hp.paraloc[side].intsize:=paralen;
  348. firstparaloc:=true;
  349. {$ifdef EXTDEBUG}
  350. if paralen=0 then
  351. internalerror(200410311);
  352. {$endif EXTDEBUG}
  353. while paralen>0 do
  354. begin
  355. paraloc:=hp.paraloc[side].add_location;
  356. if (loc=LOC_REGISTER) and (paracgsize in [OS_F32,OS_F64,OS_F80]) then
  357. case paracgsize of
  358. OS_F32:
  359. paraloc^.size:=OS_32;
  360. OS_F64:
  361. paraloc^.size:=OS_32;
  362. else
  363. internalerror(2005082901);
  364. end
  365. else if (paracgsize in [OS_NO,OS_64,OS_S64]) then
  366. paraloc^.size := OS_32
  367. else
  368. paraloc^.size:=paracgsize;
  369. case loc of
  370. LOC_REGISTER:
  371. begin
  372. { align registers for eabi }
  373. if (target_info.abi=abi_eabi) and
  374. firstparaloc and
  375. (paradef.alignment=8) then
  376. begin
  377. if (nextintreg in [RS_R1,RS_R3]) then
  378. inc(nextintreg)
  379. else if nextintreg>RS_R3 then
  380. stack_offset:=align(stack_offset,8);
  381. end;
  382. { this is not abi compliant
  383. why? (FK) }
  384. if nextintreg<=RS_R3 then
  385. begin
  386. paraloc^.loc:=LOC_REGISTER;
  387. paraloc^.register:=newreg(R_INTREGISTER,nextintreg,R_SUBWHOLE);
  388. inc(nextintreg);
  389. end
  390. else
  391. begin
  392. { LOC_REFERENCE always contains everything that's left }
  393. paraloc^.loc:=LOC_REFERENCE;
  394. paraloc^.size:=int_cgsize(paralen);
  395. if (side=callerside) then
  396. paraloc^.reference.index:=NR_STACK_POINTER_REG;
  397. paraloc^.reference.offset:=stack_offset;
  398. inc(stack_offset,align(paralen,4));
  399. paralen:=0;
  400. end;
  401. end;
  402. LOC_FPUREGISTER:
  403. begin
  404. if nextfloatreg<=RS_F3 then
  405. begin
  406. paraloc^.loc:=LOC_FPUREGISTER;
  407. paraloc^.register:=newreg(R_FPUREGISTER,nextfloatreg,R_SUBWHOLE);
  408. inc(nextfloatreg);
  409. end
  410. else
  411. begin
  412. paraloc^.loc:=LOC_REFERENCE;
  413. paraloc^.reference.index:=NR_STACK_POINTER_REG;
  414. paraloc^.reference.offset:=stack_offset;
  415. case paraloc^.size of
  416. OS_F32:
  417. inc(stack_offset,4);
  418. OS_F64:
  419. inc(stack_offset,8);
  420. OS_F80:
  421. inc(stack_offset,10);
  422. OS_F128:
  423. inc(stack_offset,16);
  424. else
  425. internalerror(200403201);
  426. end;
  427. end;
  428. end;
  429. LOC_REFERENCE:
  430. begin
  431. if push_addr_param(hp.varspez,paradef,p.proccalloption) then
  432. begin
  433. paraloc^.size:=OS_ADDR;
  434. assignintreg
  435. end
  436. else
  437. begin
  438. { align stack for eabi }
  439. if (target_info.abi=abi_eabi) and
  440. firstparaloc and
  441. (paradef.alignment=8) then
  442. stack_offset:=align(stack_offset,8);
  443. paraloc^.size:=paracgsize;
  444. paraloc^.loc:=LOC_REFERENCE;
  445. paraloc^.reference.index:=NR_STACK_POINTER_REG;
  446. paraloc^.reference.offset:=stack_offset;
  447. inc(stack_offset,align(paralen,4));
  448. paralen:=0
  449. end;
  450. end;
  451. else
  452. internalerror(2002071002);
  453. end;
  454. if side=calleeside then
  455. begin
  456. if paraloc^.loc=LOC_REFERENCE then
  457. begin
  458. paraloc^.reference.index:=NR_FRAME_POINTER_REG;
  459. inc(paraloc^.reference.offset,4);
  460. end;
  461. end;
  462. dec(paralen,tcgsize2size[paraloc^.size]);
  463. firstparaloc:=false
  464. end;
  465. end;
  466. curintreg:=nextintreg;
  467. curfloatreg:=nextfloatreg;
  468. curmmreg:=nextmmreg;
  469. cur_stack_offset:=stack_offset;
  470. result:=cur_stack_offset;
  471. end;
  472. procedure tarmparamanager.create_funcretloc_info(p : tabstractprocdef; side: tcallercallee);
  473. begin
  474. p.funcretloc[side]:=get_funcretloc(p,side,p.returndef);
  475. end;
  476. function tarmparamanager.get_funcretloc(p : tabstractprocdef; side: tcallercallee; def: tdef): tcgpara;
  477. var
  478. paraloc : pcgparalocation;
  479. retcgsize : tcgsize;
  480. begin
  481. result.init;
  482. result.alignment:=get_para_align(p.proccalloption);
  483. { void has no location }
  484. if is_void(def) then
  485. begin
  486. paraloc:=result.add_location;
  487. result.size:=OS_NO;
  488. result.intsize:=0;
  489. paraloc^.size:=OS_NO;
  490. paraloc^.loc:=LOC_VOID;
  491. exit;
  492. end;
  493. { Constructors return self instead of a boolean }
  494. if (p.proctypeoption=potype_constructor) then
  495. begin
  496. retcgsize:=OS_ADDR;
  497. result.intsize:=sizeof(pint);
  498. end
  499. else
  500. begin
  501. retcgsize:=def_cgsize(def);
  502. result.intsize:=def.size;
  503. end;
  504. result.size:=retcgsize;
  505. { Return is passed as var parameter }
  506. if ret_in_param(def,p.proccalloption) then
  507. begin
  508. paraloc:=result.add_location;
  509. paraloc^.loc:=LOC_REFERENCE;
  510. paraloc^.size:=retcgsize;
  511. exit;
  512. end;
  513. paraloc:=result.add_location;
  514. { Return in FPU register? }
  515. if def.typ=floatdef then
  516. begin
  517. if (p.proccalloption in [pocall_softfloat]) or
  518. (cs_fp_emulation in current_settings.moduleswitches) or
  519. (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3]) then
  520. begin
  521. case retcgsize of
  522. OS_64,
  523. OS_F64:
  524. begin
  525. paraloc^.loc:=LOC_REGISTER;
  526. paraloc^.register:=NR_FUNCTION_RESULT64_LOW_REG;
  527. paraloc^.size:=OS_32;
  528. paraloc:=result.add_location;
  529. paraloc^.loc:=LOC_REGISTER;
  530. paraloc^.register:=NR_FUNCTION_RESULT64_HIGH_REG;
  531. paraloc^.size:=OS_32;
  532. end;
  533. OS_32,
  534. OS_F32:
  535. begin
  536. paraloc^.loc:=LOC_REGISTER;
  537. paraloc^.register:=NR_FUNCTION_RETURN_REG;
  538. paraloc^.size:=OS_32;
  539. end;
  540. else
  541. internalerror(2005082603);
  542. end;
  543. end
  544. else
  545. begin
  546. paraloc^.loc:=LOC_FPUREGISTER;
  547. paraloc^.register:=NR_FPU_RESULT_REG;
  548. paraloc^.size:=retcgsize;
  549. end;
  550. end
  551. { Return in register }
  552. else
  553. begin
  554. if retcgsize in [OS_64,OS_S64] then
  555. begin
  556. paraloc^.loc:=LOC_REGISTER;
  557. paraloc^.register:=NR_FUNCTION_RESULT64_LOW_REG;
  558. paraloc^.size:=OS_32;
  559. paraloc:=result.add_location;
  560. paraloc^.loc:=LOC_REGISTER;
  561. paraloc^.register:=NR_FUNCTION_RESULT64_HIGH_REG;
  562. paraloc^.size:=OS_32;
  563. end
  564. else
  565. begin
  566. paraloc^.loc:=LOC_REGISTER;
  567. paraloc^.register:=NR_FUNCTION_RETURN_REG;
  568. if (result.intsize<>3) then
  569. paraloc^.size:=retcgsize
  570. else
  571. paraloc^.size:=OS_32;
  572. end;
  573. end;
  574. end;
  575. function tarmparamanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
  576. var
  577. cur_stack_offset: aword;
  578. curintreg, curfloatreg, curmmreg: tsuperregister;
  579. begin
  580. init_values(curintreg,curfloatreg,curmmreg,cur_stack_offset);
  581. result:=create_paraloc_info_intern(p,side,p.paras,curintreg,curfloatreg,curmmreg,cur_stack_offset);
  582. create_funcretloc_info(p,side);
  583. end;
  584. function tarmparamanager.create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;
  585. var
  586. cur_stack_offset: aword;
  587. curintreg, curfloatreg, curmmreg: tsuperregister;
  588. begin
  589. init_values(curintreg,curfloatreg,curmmreg,cur_stack_offset);
  590. result:=create_paraloc_info_intern(p,callerside,p.paras,curintreg,curfloatreg,curmmreg,cur_stack_offset);
  591. if (p.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
  592. { just continue loading the parameters in the registers }
  593. result:=create_paraloc_info_intern(p,callerside,varargspara,curintreg,curfloatreg,curmmreg,cur_stack_offset)
  594. else
  595. internalerror(200410231);
  596. end;
  597. begin
  598. paramanager:=tarmparamanager.create;
  599. end.