paramgr.pas 30 KB

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