paramgr.pas 30 KB

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