paramgr.pas 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829
  1. {
  2. $Id$
  3. Copyright (c) 2002 by Florian Klaempfl
  4. Generic calling convention handling
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. {# Parameter passing manager. Used to manage how
  19. parameters are passed to routines.
  20. }
  21. unit paramgr;
  22. {$i fpcdefs.inc}
  23. interface
  24. uses
  25. cclasses,globtype,
  26. cpubase,cgbase,
  27. aasmtai,
  28. symconst,symtype,symdef;
  29. type
  30. tvarargsinfo = (
  31. va_uses_float_reg
  32. );
  33. tvarargspara = class(tlinkedlist)
  34. varargsinfo : set of tvarargsinfo;
  35. end;
  36. {# This class defines some methods to take care of routine
  37. parameters. It should be overriden for each new processor
  38. }
  39. tparamanager = class
  40. {# Returns true if the return value is actually a parameter
  41. pointer.
  42. }
  43. function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;virtual;
  44. function push_high_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
  45. { Returns true if a parameter is too large to copy and only
  46. the address is pushed
  47. }
  48. function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
  49. { return the size of a push }
  50. function push_size(varspez:tvarspez;def : tdef;calloption : tproccalloption) : longint;
  51. { Returns true if a parameter needs to be copied on the stack, this
  52. is required for cdecl procedures
  53. }
  54. function copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
  55. {# Returns a structure giving the information on
  56. the storage of the parameter (which must be
  57. an integer parameter). This is only used when calling
  58. internal routines directly, where all parameters must
  59. be 4-byte values.
  60. In case the location is a register, this register is allocated.
  61. Call freeintparaloc() after the call to free the locations again.
  62. Default implementation: don't do anything at all (in case you don't
  63. use register parameter passing)
  64. @param(list Current assembler list)
  65. @param(nr Parameter number of routine, starting from 1)
  66. }
  67. function get_para_align(calloption : tproccalloption):byte;virtual;
  68. function get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;virtual;
  69. function get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;virtual;
  70. function get_volatile_registers_flags(calloption : tproccalloption):tcpuregisterset;virtual;
  71. function get_volatile_registers_mm(calloption : tproccalloption):tcpuregisterset;virtual;
  72. function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;virtual;abstract;
  73. {# allocate a parameter location created with create_paraloc_info
  74. @param(list Current assembler list)
  75. @param(loc Parameter location)
  76. }
  77. procedure allocparaloc(list: taasmoutput; const loc: tparalocation); virtual;
  78. {# free a parameter location allocated with allocparaloc
  79. @param(list Current assembler list)
  80. @param(loc Parameter location)
  81. }
  82. procedure freeparaloc(list: taasmoutput; const loc: tparalocation); virtual;
  83. { This is used to populate the location information on all parameters
  84. for the routine as seen in either the caller or the callee. It returns
  85. the size allocated on the stack
  86. }
  87. function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;virtual;abstract;
  88. { This is used to populate the location information on all parameters
  89. for the routine when it is being inlined. It returns
  90. the size allocated on the stack
  91. }
  92. function create_inline_paraloc_info(p : tabstractprocdef):longint;virtual;
  93. { This is used to populate the location information on all parameters
  94. for the routine that are passed as varargs. It returns
  95. the size allocated on the stack (including the normal parameters)
  96. }
  97. function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargspara):longint;virtual;abstract;
  98. { Return the location of the low and high part of a 64bit parameter }
  99. procedure splitparaloc64(const locpara:tparalocation;var loclopara,lochipara:tparalocation);virtual;
  100. procedure alloctempregs(list: taasmoutput;var locpara:tparalocation);virtual;
  101. procedure alloctempparaloc(list: taasmoutput;calloption : tproccalloption;paraitem : tparaitem;var locpara:tparalocation);virtual;
  102. end;
  103. var
  104. paramanager : tparamanager;
  105. implementation
  106. uses
  107. cpuinfo,systems,
  108. cgobj,tgobj,
  109. defutil,verbose;
  110. { true if uses a parameter as return value }
  111. function tparamanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
  112. begin
  113. ret_in_param:=(def.deftype in [arraydef,recorddef]) or
  114. ((def.deftype=stringdef) and (tstringdef(def).string_typ in [st_shortstring,st_longstring])) or
  115. ((def.deftype=procvardef) and (po_methodpointer in tprocvardef(def).procoptions)) or
  116. ((def.deftype=objectdef) and is_object(def)) or
  117. (def.deftype=variantdef) or
  118. ((def.deftype=setdef) and (tsetdef(def).settype<>smallset));
  119. end;
  120. function tparamanager.push_high_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
  121. begin
  122. push_high_param:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and
  123. (
  124. is_open_array(def) or
  125. is_open_string(def) or
  126. is_array_of_const(def)
  127. );
  128. end;
  129. { true if a parameter is too large to copy and only the address is pushed }
  130. function tparamanager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
  131. begin
  132. result:=false;
  133. { var,out always require address }
  134. if varspez in [vs_var,vs_out] then
  135. begin
  136. result:=true;
  137. exit;
  138. end;
  139. { Only vs_const, vs_value here }
  140. case def.deftype of
  141. variantdef,
  142. formaldef :
  143. result:=true;
  144. recorddef :
  145. result:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (def.size>pointer_size);
  146. arraydef :
  147. begin
  148. if (calloption in [pocall_cdecl,pocall_cppdecl]) then
  149. begin
  150. { array of const values are pushed on the stack }
  151. result:=not is_array_of_const(def);
  152. end
  153. else
  154. begin
  155. result:=(
  156. (tarraydef(def).highrange>=tarraydef(def).lowrange) and
  157. (def.size>pointer_size)
  158. ) or
  159. is_open_array(def) or
  160. is_array_of_const(def) or
  161. is_array_constructor(def);
  162. end;
  163. end;
  164. objectdef :
  165. result:=is_object(def);
  166. stringdef :
  167. result:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (tstringdef(def).string_typ in [st_shortstring,st_longstring]);
  168. procvardef :
  169. result:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (po_methodpointer in tprocvardef(def).procoptions);
  170. setdef :
  171. result:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (tsetdef(def).settype<>smallset);
  172. end;
  173. end;
  174. { true if a parameter is too large to push and needs a concatcopy to get the value on the stack }
  175. function tparamanager.copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
  176. begin
  177. copy_value_on_stack:=false;
  178. { this is only for cdecl procedures with vs_const,vs_value }
  179. if not(
  180. (calloption in [pocall_cdecl,pocall_cppdecl]) and
  181. (varspez in [vs_value,vs_const])
  182. ) then
  183. exit;
  184. case def.deftype of
  185. variantdef,
  186. formaldef :
  187. copy_value_on_stack:=true;
  188. recorddef :
  189. copy_value_on_stack:=(def.size>pointer_size);
  190. arraydef :
  191. copy_value_on_stack:=(tarraydef(def).highrange>=tarraydef(def).lowrange) and
  192. (def.size>pointer_size);
  193. objectdef :
  194. copy_value_on_stack:=is_object(def);
  195. stringdef :
  196. copy_value_on_stack:=tstringdef(def).string_typ in [st_shortstring,st_longstring];
  197. procvardef :
  198. copy_value_on_stack:=(po_methodpointer in tprocvardef(def).procoptions);
  199. setdef :
  200. copy_value_on_stack:=(tsetdef(def).settype<>smallset);
  201. end;
  202. end;
  203. { return the size of a push }
  204. function tparamanager.push_size(varspez:tvarspez;def : tdef;calloption : tproccalloption) : longint;
  205. begin
  206. push_size:=-1;
  207. case varspez of
  208. vs_out,
  209. vs_var :
  210. push_size:=pointer_size;
  211. vs_value,
  212. vs_const :
  213. begin
  214. if push_addr_param(varspez,def,calloption) then
  215. push_size:=pointer_size
  216. else
  217. begin
  218. { special array are normally pushed by addr, only for
  219. cdecl array of const it comes here and the pushsize
  220. is unknown }
  221. if is_array_of_const(def) then
  222. push_size:=0
  223. else
  224. push_size:=def.size;
  225. end;
  226. end;
  227. end;
  228. end;
  229. function tparamanager.get_para_align(calloption : tproccalloption):byte;
  230. begin
  231. result:=std_param_align;
  232. end;
  233. function tparamanager.get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;
  234. begin
  235. result:=[];
  236. end;
  237. function tparamanager.get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;
  238. begin
  239. result:=[];
  240. end;
  241. function tparamanager.get_volatile_registers_flags(calloption : tproccalloption):tcpuregisterset;
  242. begin
  243. result:=[];
  244. end;
  245. function tparamanager.get_volatile_registers_mm(calloption : tproccalloption):tcpuregisterset;
  246. begin
  247. result:=[];
  248. end;
  249. procedure tparamanager.allocparaloc(list: taasmoutput; const loc: tparalocation);
  250. begin
  251. case loc.loc of
  252. LOC_REGISTER,
  253. LOC_CREGISTER,
  254. LOC_FPUREGISTER,
  255. LOC_CFPUREGISTER,
  256. LOC_MMREGISTER,
  257. LOC_CMMREGISTER :
  258. begin
  259. { NR_NO means we don't need to allocate the parameter.
  260. This is used for inlining parameters which allocates
  261. the parameters in gen_alloc_parast (PFV) }
  262. if loc.register<>NR_NO then
  263. cg.getexplicitregister(list,loc.register);
  264. end;
  265. LOC_REFERENCE,
  266. LOC_CREFERENCE :
  267. { do nothing by default, most of the time it's the framepointer }
  268. else
  269. internalerror(200306091);
  270. end;
  271. case loc.lochigh of
  272. LOC_INVALID :
  273. ;
  274. LOC_REGISTER,
  275. LOC_CREGISTER,
  276. LOC_FPUREGISTER,
  277. LOC_CFPUREGISTER,
  278. LOC_MMREGISTER,
  279. LOC_CMMREGISTER :
  280. begin
  281. { NR_NO means we don't need to allocate the parameter.
  282. This is used for inlining parameters which allocates
  283. the parameters in gen_alloc_parast (PFV) }
  284. if loc.registerhigh<>NR_NO then
  285. cg.getexplicitregister(list,loc.registerhigh);
  286. end;
  287. else
  288. internalerror(200306091);
  289. end;
  290. end;
  291. procedure tparamanager.freeparaloc(list: taasmoutput; const loc: tparalocation);
  292. var
  293. href : treference;
  294. begin
  295. case loc.loc of
  296. LOC_REGISTER, LOC_CREGISTER:
  297. begin
  298. {$ifndef cpu64bit}
  299. if (loc.size in [OS_64,OS_S64,OS_F64]) then
  300. begin
  301. cg.ungetregister(list,loc.registerhigh);
  302. cg.ungetregister(list,loc.registerlow);
  303. end
  304. else
  305. {$endif cpu64bit}
  306. cg.ungetregister(list,loc.register);
  307. end;
  308. LOC_MMREGISTER, LOC_CMMREGISTER,
  309. LOC_FPUREGISTER, LOC_CFPUREGISTER:
  310. cg.ungetregister(list,loc.register);
  311. LOC_REFERENCE,LOC_CREFERENCE:
  312. begin
  313. {$ifdef cputargethasfixedstack}
  314. reference_reset_base(href,loc.reference.index,loc.reference.offset);
  315. tg.ungettemp(list,href);
  316. {$endif cputargethasfixedstack}
  317. end;
  318. else
  319. internalerror(200306091);
  320. end;
  321. case loc.lochigh of
  322. LOC_INVALID :
  323. ;
  324. LOC_REGISTER,
  325. LOC_CREGISTER,
  326. LOC_FPUREGISTER,
  327. LOC_CFPUREGISTER,
  328. LOC_MMREGISTER,
  329. LOC_CMMREGISTER :
  330. cg.ungetregister(list,loc.register);
  331. else
  332. internalerror(200306091);
  333. end;
  334. end;
  335. procedure tparamanager.splitparaloc64(const locpara:tparalocation;var loclopara,lochipara:tparalocation);
  336. begin
  337. lochipara:=locpara;
  338. loclopara:=locpara;
  339. case locpara.size of
  340. OS_S128 :
  341. begin
  342. lochipara.size:=OS_S64;
  343. loclopara.size:=OS_64;
  344. end;
  345. OS_128 :
  346. begin
  347. lochipara.size:=OS_64;
  348. loclopara.size:=OS_64;
  349. end;
  350. OS_S64 :
  351. begin
  352. lochipara.size:=OS_S32;
  353. loclopara.size:=OS_32;
  354. end;
  355. OS_64 :
  356. begin
  357. lochipara.size:=OS_32;
  358. loclopara.size:=OS_32;
  359. end;
  360. else
  361. internalerror(200307023);
  362. end;
  363. loclopara.lochigh:=LOC_INVALID;
  364. lochipara.lochigh:=LOC_INVALID;
  365. case locpara.loc of
  366. LOC_REGISTER,
  367. LOC_CREGISTER,
  368. LOC_FPUREGISTER,
  369. LOC_CFPUREGISTER,
  370. LOC_MMREGISTER,
  371. LOC_CMMREGISTER :
  372. begin
  373. if locpara.lochigh=LOC_INVALID then
  374. internalerror(200402061);
  375. loclopara.register:=locpara.registerlow;
  376. lochipara.register:=locpara.registerhigh;
  377. end;
  378. LOC_REFERENCE:
  379. begin
  380. if target_info.endian=endian_big then
  381. inc(loclopara.reference.offset,tcgsize2size[loclopara.size])
  382. else
  383. inc(lochipara.reference.offset,tcgsize2size[loclopara.size]);
  384. end;
  385. else
  386. internalerror(200307024);
  387. end;
  388. end;
  389. procedure tparamanager.alloctempregs(list: taasmoutput;var locpara:tparalocation);
  390. var
  391. cgsize : tcgsize;
  392. begin
  393. if locpara.lochigh<>LOC_INVALID then
  394. cgsize:=OS_INT
  395. else
  396. cgsize:=locpara.size;
  397. case locpara.loc of
  398. LOC_REGISTER:
  399. locpara.register:=cg.getintregister(list,cgsize);
  400. LOC_FPUREGISTER:
  401. locpara.register:=cg.getfpuregister(list,cgsize);
  402. LOC_MMREGISTER:
  403. locpara.register:=cg.getmmregister(list,cgsize);
  404. else
  405. internalerror(200308123);
  406. end;
  407. case locpara.lochigh of
  408. LOC_INVALID:
  409. ;
  410. LOC_REGISTER:
  411. locpara.registerhigh:=cg.getintregister(list,cgsize);
  412. LOC_FPUREGISTER:
  413. locpara.registerhigh:=cg.getfpuregister(list,cgsize);
  414. LOC_MMREGISTER:
  415. locpara.registerhigh:=cg.getmmregister(list,cgsize);
  416. else
  417. internalerror(200308123);
  418. end;
  419. end;
  420. procedure tparamanager.alloctempparaloc(list: taasmoutput;calloption : tproccalloption;paraitem : tparaitem;var locpara:tparalocation);
  421. var
  422. href : treference;
  423. begin
  424. tg.gettemp(list,paraitem.paratype.def.size,tt_persistent,href);
  425. locpara.loc:=LOC_REFERENCE;
  426. locpara.lochigh:=LOC_INVALID;
  427. locpara.reference.index:=href.base;
  428. locpara.reference.offset:=href.offset;
  429. end;
  430. function tparamanager.create_inline_paraloc_info(p : tabstractprocdef):longint;
  431. var
  432. hp : tparaitem;
  433. paraloc : tparalocation;
  434. parasize : longint;
  435. begin
  436. parasize:=0;
  437. hp:=tparaitem(p.para.first);
  438. while assigned(hp) do
  439. begin
  440. if push_addr_param(hp.paratyp,hp.paratype.def,p.proccalloption) then
  441. paraloc.size:=OS_ADDR
  442. else
  443. paraloc.size:=def_cgsize(hp.paratype.def);
  444. if paraloc.size=OS_NO then
  445. internalerror(200309301);
  446. { Indicate parameter is loaded in register, the register
  447. will be allocated when the allocpara is called }
  448. paraloc.loc:=LOC_REGISTER;
  449. paraloc.register:=NR_NO;
  450. (*
  451. paraloc.loc:=LOC_REFERENCE;
  452. paraloc.reference.index:=NR_FRAME_POINTER_REG;
  453. l:=push_size(hp.paratyp,hp.paratype.def,p.proccalloption);
  454. varalign:=size_2_align(l);
  455. paraloc.reference.offset:=parasize+target_info.first_parm_offset;
  456. varalign:=used_align(varalign,p.paraalign,p.paraalign);
  457. parasize:=align(parasize+l,varalign);
  458. *)
  459. hp.paraloc[callerside]:=paraloc;
  460. hp.paraloc[calleeside]:=paraloc;
  461. hp:=tparaitem(hp.next);
  462. end;
  463. { We need to return the size allocated }
  464. result:=parasize;
  465. end;
  466. initialization
  467. ;
  468. finalization
  469. paramanager.free;
  470. end.
  471. {
  472. $Log$
  473. Revision 1.71 2004-02-17 19:14:09 florian
  474. * temp. fix for lochigh para
  475. Revision 1.70 2004/02/09 22:48:45 florian
  476. * several fixes to parameter handling on arm
  477. Revision 1.69 2004/02/09 22:14:17 peter
  478. * more x86_64 parameter fixes
  479. * tparalocation.lochigh is now used to indicate if registerhigh
  480. is used and what the type is
  481. Revision 1.68 2003/12/28 22:09:12 florian
  482. + setting of bit 6 of cr for c var args on ppc implemented
  483. Revision 1.67 2003/12/06 01:15:22 florian
  484. * reverted Peter's alloctemp patch; hopefully properly
  485. Revision 1.66 2003/12/03 23:13:20 peter
  486. * delayed paraloc allocation, a_param_*() gets extra parameter
  487. if it needs to allocate temp or real paralocation
  488. * optimized/simplified int-real loading
  489. Revision 1.65 2003/10/29 21:24:14 jonas
  490. + support for fpu temp parameters
  491. + saving/restoring of fpu register before/after a procedure call
  492. Revision 1.64 2003/10/17 14:38:32 peter
  493. * 64k registers supported
  494. * fixed some memory leaks
  495. Revision 1.63 2003/10/11 16:06:42 florian
  496. * fixed some MMX<->SSE
  497. * started to fix ppc, needs an overhaul
  498. + stabs info improve for spilling, not sure if it works correctly/completly
  499. - MMX_SUPPORT removed from Makefile.fpc
  500. Revision 1.62 2003/10/10 17:48:13 peter
  501. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  502. * tregisteralloctor renamed to trgobj
  503. * removed rgobj from a lot of units
  504. * moved location_* and reference_* to cgobj
  505. * first things for mmx register allocation
  506. Revision 1.61 2003/10/09 21:31:37 daniel
  507. * Register allocator splitted, ans abstract now
  508. Revision 1.60 2003/10/05 21:21:52 peter
  509. * c style array of const generates callparanodes
  510. * varargs paraloc fixes
  511. Revision 1.59 2003/10/03 22:00:33 peter
  512. * parameter alignment fixes
  513. Revision 1.58 2003/10/01 20:34:49 peter
  514. * procinfo unit contains tprocinfo
  515. * cginfo renamed to cgbase
  516. * moved cgmessage to verbose
  517. * fixed ppc and sparc compiles
  518. Revision 1.57 2003/09/30 21:02:37 peter
  519. * updates for inlining
  520. Revision 1.56 2003/09/23 17:56:05 peter
  521. * locals and paras are allocated in the code generation
  522. * tvarsym.localloc contains the location of para/local when
  523. generating code for the current procedure
  524. Revision 1.55 2003/09/16 16:17:01 peter
  525. * varspez in calls to push_addr_param
  526. Revision 1.54 2003/09/10 08:31:47 marco
  527. * Patch from Peter for paraloc
  528. Revision 1.53 2003/09/07 22:09:35 peter
  529. * preparations for different default calling conventions
  530. * various RA fixes
  531. Revision 1.52 2003/09/04 15:39:58 peter
  532. * released useparatemp
  533. Revision 1.51 2003/09/03 15:55:01 peter
  534. * NEWRA branch merged
  535. Revision 1.50.2.1 2003/08/29 17:28:59 peter
  536. * next batch of updates
  537. Revision 1.50 2003/08/11 21:18:20 peter
  538. * start of sparc support for newra
  539. Revision 1.49 2003/07/08 21:24:59 peter
  540. * sparc fixes
  541. Revision 1.48 2003/07/05 20:11:41 jonas
  542. * create_paraloc_info() is now called separately for the caller and
  543. callee info
  544. * fixed ppc cycle
  545. Revision 1.47 2003/07/02 22:18:04 peter
  546. * paraloc splitted in callerparaloc,calleeparaloc
  547. * sparc calling convention updates
  548. Revision 1.46 2003/06/17 16:32:03 peter
  549. * allocpara/freepara 64bit support
  550. Revision 1.45 2003/06/13 21:19:30 peter
  551. * current_procdef removed, use current_procinfo.procdef instead
  552. Revision 1.44 2003/06/12 21:11:10 peter
  553. * ungetregisterfpu gets size parameter
  554. Revision 1.43 2003/06/09 14:54:26 jonas
  555. * (de)allocation of registers for parameters is now performed properly
  556. (and checked on the ppc)
  557. - removed obsolete allocation of all parameter registers at the start
  558. of a procedure (and deallocation at the end)
  559. Revision 1.42 2003/06/08 10:54:41 jonas
  560. - disabled changing of LOC_*REGISTER to LOC_C*REGISTER in setparalocs,
  561. this is not necessary anymore (doesn't do anything anymore actually,
  562. except making sure the interface crc changes)
  563. Revision 1.41 2003/06/07 18:57:04 jonas
  564. + added freeintparaloc
  565. * ppc get/freeintparaloc now check whether the parameter regs are
  566. properly allocated/deallocated (and get an extra list para)
  567. * ppc a_call_* now internalerrors if pi_do_call is not yet set
  568. * fixed lot of missing pi_do_call's
  569. Revision 1.40 2003/05/31 15:05:28 peter
  570. * FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
  571. Revision 1.39 2003/05/30 23:57:08 peter
  572. * more sparc cleanup
  573. * accumulator removed, splitted in function_return_reg (called) and
  574. function_result_reg (caller)
  575. Revision 1.38 2003/05/13 15:16:13 peter
  576. * removed ret_in_acc, it's the reverse of ret_in_param
  577. * fixed ret_in_param for win32 cdecl array
  578. Revision 1.37 2003/04/30 22:15:59 florian
  579. * some 64 bit adaptions in ncgadd
  580. * x86-64 now uses ncgadd
  581. * tparamanager.ret_in_acc doesn't return true anymore for a void-def
  582. Revision 1.36 2003/04/27 11:21:33 peter
  583. * aktprocdef renamed to current_procinfo.procdef
  584. * procinfo renamed to current_procinfo
  585. * procinfo will now be stored in current_module so it can be
  586. cleaned up properly
  587. * gen_main_procsym changed to create_main_proc and release_main_proc
  588. to also generate a tprocinfo structure
  589. * fixed unit implicit initfinal
  590. Revision 1.35 2003/04/27 07:29:50 peter
  591. * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
  592. a new procdef declaration
  593. * aktprocsym removed
  594. * lexlevel removed, use symtable.symtablelevel instead
  595. * implicit init/final code uses the normal genentry/genexit
  596. * funcret state checking updated for new funcret handling
  597. Revision 1.34 2003/04/23 13:15:04 peter
  598. * fix push_high_param for cdecl
  599. Revision 1.33 2003/04/23 10:14:30 peter
  600. * cdecl array of const has no addr push
  601. Revision 1.32 2003/04/22 13:47:08 peter
  602. * fixed C style array of const
  603. * fixed C array passing
  604. * fixed left to right with high parameters
  605. Revision 1.31 2003/02/02 19:25:54 carl
  606. * Several bugfixes for m68k target (register alloc., opcode emission)
  607. + VIS target
  608. + Generic add more complete (still not verified)
  609. Revision 1.30 2003/01/08 18:43:56 daniel
  610. * Tregister changed into a record
  611. Revision 1.29 2002/12/23 20:58:03 peter
  612. * remove unused global var
  613. Revision 1.28 2002/12/17 22:19:33 peter
  614. * fixed pushing of records>8 bytes with stdcall
  615. * simplified hightree loading
  616. Revision 1.27 2002/12/06 16:56:58 peter
  617. * only compile cs_fp_emulation support when cpufpuemu is defined
  618. * define cpufpuemu for m68k only
  619. Revision 1.26 2002/11/27 20:04:09 peter
  620. * tvarsym.get_push_size replaced by paramanager.push_size
  621. Revision 1.25 2002/11/27 02:33:19 peter
  622. * copy_value_on_stack method added for cdecl record passing
  623. Revision 1.24 2002/11/25 17:43:21 peter
  624. * splitted defbase in defutil,symutil,defcmp
  625. * merged isconvertable and is_equal into compare_defs(_ext)
  626. * made operator search faster by walking the list only once
  627. Revision 1.23 2002/11/18 17:31:58 peter
  628. * pass proccalloption to ret_in_xxx and push_xxx functions
  629. Revision 1.22 2002/11/16 18:00:04 peter
  630. * only push small arrays on the stack for win32
  631. Revision 1.21 2002/10/05 12:43:25 carl
  632. * fixes for Delphi 6 compilation
  633. (warning : Some features do not work under Delphi)
  634. Revision 1.20 2002/09/30 07:07:25 florian
  635. * fixes to common code to get the alpha compiler compiled applied
  636. Revision 1.19 2002/09/30 07:00:47 florian
  637. * fixes to common code to get the alpha compiler compiled applied
  638. Revision 1.18 2002/09/09 09:10:51 florian
  639. + added generic tparamanager.getframepointerloc
  640. Revision 1.17 2002/09/07 19:40:39 florian
  641. * tvarsym.paraitem is set now
  642. Revision 1.16 2002/09/01 21:04:48 florian
  643. * several powerpc related stuff fixed
  644. Revision 1.15 2002/08/25 19:25:19 peter
  645. * sym.insert_in_data removed
  646. * symtable.insertvardata/insertconstdata added
  647. * removed insert_in_data call from symtable.insert, it needs to be
  648. called separatly. This allows to deref the address calculation
  649. * procedures now calculate the parast addresses after the procedure
  650. directives are parsed. This fixes the cdecl parast problem
  651. * push_addr_param has an extra argument that specifies if cdecl is used
  652. or not
  653. Revision 1.14 2002/08/17 22:09:47 florian
  654. * result type handling in tcgcal.pass_2 overhauled
  655. * better tnode.dowrite
  656. * some ppc stuff fixed
  657. Revision 1.13 2002/08/17 09:23:38 florian
  658. * first part of procinfo rewrite
  659. Revision 1.12 2002/08/16 14:24:58 carl
  660. * issameref() to test if two references are the same (then emit no opcodes)
  661. + ret_in_reg to replace ret_in_acc
  662. (fix some register allocation bugs at the same time)
  663. + save_std_register now has an extra parameter which is the
  664. usedinproc registers
  665. Revision 1.11 2002/08/12 15:08:40 carl
  666. + stab register indexes for powerpc (moved from gdb to cpubase)
  667. + tprocessor enumeration moved to cpuinfo
  668. + linker in target_info is now a class
  669. * many many updates for m68k (will soon start to compile)
  670. - removed some ifdef or correct them for correct cpu
  671. Revision 1.10 2002/08/10 17:15:20 jonas
  672. * register parameters are now LOC_CREGISTER instead of LOC_REGISTER
  673. Revision 1.9 2002/08/09 07:33:02 florian
  674. * a couple of interface related fixes
  675. Revision 1.8 2002/08/06 20:55:21 florian
  676. * first part of ppc calling conventions fix
  677. Revision 1.7 2002/08/05 18:27:48 carl
  678. + more more more documentation
  679. + first version include/exclude (can't test though, not enough scratch for i386 :()...
  680. Revision 1.6 2002/07/30 20:50:43 florian
  681. * the code generator knows now if parameters are in registers
  682. Revision 1.5 2002/07/26 21:15:39 florian
  683. * rewrote the system handling
  684. Revision 1.4 2002/07/20 11:57:55 florian
  685. * types.pas renamed to defbase.pas because D6 contains a types
  686. unit so this would conflicts if D6 programms are compiled
  687. + Willamette/SSE2 instructions to assembler added
  688. Revision 1.3 2002/07/13 19:38:43 florian
  689. * some more generic calling stuff fixed
  690. Revision 1.2 2002/07/13 07:17:15 jonas
  691. * fixed memory leak reported by Sergey Korshunoff
  692. Revision 1.1 2002/07/11 14:41:28 florian
  693. * start of the new generic parameter handling
  694. }