ncgcal.pas 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Generate assembler for call nodes
  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. unit ncgcal;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. cpubase,
  23. globtype,
  24. symdef,node,ncal;
  25. type
  26. tcgcallparanode = class(tcallparanode)
  27. private
  28. tempparaloc : tparalocation;
  29. procedure allocate_tempparaloc;
  30. procedure push_addr_para;
  31. procedure push_value_para;
  32. public
  33. procedure secondcallparan;override;
  34. end;
  35. tcgcallnode = class(tcallnode)
  36. private
  37. procedure release_para_temps;
  38. procedure normal_pass_2;
  39. procedure inlined_pass_2;
  40. protected
  41. { save the size of pushed parameter, needed po_clearstack
  42. and alignment }
  43. pushedparasize : longint;
  44. framepointer_paraloc : tparalocation;
  45. refcountedtemp : treference;
  46. procedure handle_return_value;
  47. {# This routine is used to push the current frame pointer
  48. on the stack. This is used in nested routines where the
  49. value of the frame pointer is always pushed as an extra
  50. parameter.
  51. The default handling is the standard handling used on
  52. most stack based machines, where the frame pointer is
  53. the first invisible parameter.
  54. }
  55. function align_parasize:longint;virtual;
  56. procedure pop_parasize(pop_size:longint);virtual;
  57. procedure extra_interrupt_code;virtual;
  58. procedure extra_call_code;virtual;
  59. public
  60. procedure pass_2;override;
  61. end;
  62. implementation
  63. uses
  64. systems,
  65. cutils,verbose,globals,
  66. symconst,symsym,symtable,defutil,paramgr,
  67. {$ifdef GDB}
  68. {$ifdef delphi}
  69. sysutils,
  70. {$else}
  71. strings,
  72. {$endif}
  73. gdb,
  74. {$endif GDB}
  75. cgbase,pass_2,
  76. cpuinfo,aasmbase,aasmtai,
  77. nbas,nmem,nld,ncnv,
  78. {$ifdef x86}
  79. cga,cgx86,
  80. {$endif x86}
  81. ncgutil,cgobj,tgobj,
  82. procinfo;
  83. {*****************************************************************************
  84. TCGCALLPARANODE
  85. *****************************************************************************}
  86. procedure tcgcallparanode.allocate_tempparaloc;
  87. begin
  88. { Allocate (temporary) paralocation }
  89. tempparaloc:=paraitem.paraloc[callerside];
  90. if (tempparaloc.loc in [LOC_REGISTER,LOC_FPUREGISTER,LOC_MMREGISTER]) then
  91. paramanager.alloctempregs(exprasmlist,tempparaloc)
  92. end;
  93. procedure tcgcallparanode.push_addr_para;
  94. begin
  95. if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
  96. internalerror(200304235);
  97. location_release(exprasmlist,left.location);
  98. cg.a_paramaddr_ref(exprasmlist,left.location.reference,tempparaloc);
  99. inc(tcgcallnode(aktcallnode).pushedparasize,POINTER_SIZE);
  100. end;
  101. procedure tcgcallparanode.push_value_para;
  102. var
  103. href : treference;
  104. size : longint;
  105. cgsize : tcgsize;
  106. begin
  107. { we've nothing to push when the size of the parameter is 0 }
  108. if left.resulttype.def.size=0 then
  109. exit;
  110. { Move flags and jump in register to make it less complex }
  111. if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
  112. location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),false);
  113. { Handle Floating point types differently }
  114. if left.resulttype.def.deftype=floatdef then
  115. begin
  116. location_release(exprasmlist,left.location);
  117. {$ifdef x86}
  118. if tempparaloc.loc<>LOC_REFERENCE then
  119. internalerror(200309291);
  120. case left.location.loc of
  121. LOC_FPUREGISTER,
  122. LOC_CFPUREGISTER:
  123. begin
  124. size:=align(TCGSize2Size[left.location.size],tempparaloc.alignment);
  125. inc(tcgcallnode(aktcallnode).pushedparasize,size);
  126. if tempparaloc.reference.index=NR_STACK_POINTER_REG then
  127. begin
  128. cg.g_stackpointer_alloc(exprasmlist,size);
  129. reference_reset_base(href,NR_STACK_POINTER_REG,0);
  130. end
  131. else
  132. reference_reset_base(href,tempparaloc.reference.index,tempparaloc.reference.offset);
  133. cg.a_loadfpu_reg_ref(exprasmlist,def_cgsize(left.resulttype.def),left.location.register,href);
  134. end;
  135. LOC_MMREGISTER,
  136. LOC_CMMREGISTER:
  137. begin
  138. size:=align(tfloatdef(left.resulttype.def).size,tempparaloc.alignment);
  139. inc(tcgcallnode(aktcallnode).pushedparasize,size);
  140. if tempparaloc.reference.index=NR_STACK_POINTER_REG then
  141. begin
  142. cg.g_stackpointer_alloc(exprasmlist,size);
  143. reference_reset_base(href,NR_STACK_POINTER_REG,0);
  144. end
  145. else
  146. reference_reset_base(href,tempparaloc.reference.index,tempparaloc.reference.offset);
  147. cg.a_loadmm_reg_ref(exprasmlist,def_cgsize(left.resulttype.def),def_cgsize(left.resulttype.def),left.location.register,href,mms_movescalar);
  148. end;
  149. LOC_REFERENCE,
  150. LOC_CREFERENCE :
  151. begin
  152. size:=align(left.resulttype.def.size,tempparaloc.alignment);
  153. if tempparaloc.reference.index=NR_STACK_POINTER_REG then
  154. begin
  155. href:=left.location.reference;
  156. inc(href.offset,size);
  157. while (size>0) do
  158. begin
  159. if (size>=4) or (tempparaloc.alignment>=4) then
  160. begin
  161. cgsize:=OS_32;
  162. inc(tcgcallnode(aktcallnode).pushedparasize,4);
  163. dec(href.offset,4);
  164. dec(size,4);
  165. end
  166. else
  167. begin
  168. cgsize:=OS_16;
  169. inc(tcgcallnode(aktcallnode).pushedparasize,2);
  170. dec(href.offset,2);
  171. dec(size,2);
  172. end;
  173. cg.a_param_ref(exprasmlist,cgsize,href,tempparaloc);
  174. end;
  175. end
  176. else
  177. begin
  178. reference_reset_base(href,tempparaloc.reference.index,tempparaloc.reference.offset);
  179. cg.g_concatcopy(exprasmlist,left.location.reference,href,size,false,false);
  180. inc(tcgcallnode(aktcallnode).pushedparasize,size);
  181. end;
  182. end;
  183. else
  184. internalerror(200204243);
  185. end;
  186. {$else x86}
  187. case left.location.loc of
  188. LOC_FPUREGISTER,
  189. LOC_CFPUREGISTER:
  190. cg.a_paramfpu_reg(exprasmlist,def_cgsize(left.resulttype.def),left.location.register,tempparaloc);
  191. LOC_REFERENCE,
  192. LOC_CREFERENCE :
  193. cg.a_paramfpu_ref(exprasmlist,def_cgsize(left.resulttype.def),left.location.reference,tempparaloc);
  194. else
  195. internalerror(200204243);
  196. end;
  197. {$endif i386}
  198. end
  199. else
  200. begin
  201. { copy the value on the stack or use normal parameter push?
  202. Check for varargs first because that has no paraitem }
  203. if not(nf_varargs_para in flags) and
  204. paramanager.copy_value_on_stack(paraitem.paratyp,left.resulttype.def,
  205. aktcallnode.procdefinition.proccalloption) then
  206. begin
  207. location_release(exprasmlist,left.location);
  208. {$ifdef x86}
  209. if tempparaloc.loc<>LOC_REFERENCE then
  210. internalerror(200309292);
  211. if not (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
  212. internalerror(200204241);
  213. { push on stack }
  214. size:=align(left.resulttype.def.size,tempparaloc.alignment);
  215. inc(tcgcallnode(aktcallnode).pushedparasize,size);
  216. if tempparaloc.reference.index=NR_STACK_POINTER_REG then
  217. begin
  218. cg.g_stackpointer_alloc(exprasmlist,size);
  219. reference_reset_base(href,NR_STACK_POINTER_REG,0);
  220. end
  221. else
  222. reference_reset_base(href,tempparaloc.reference.index,tempparaloc.reference.offset);
  223. cg.g_concatcopy(exprasmlist,left.location.reference,href,size,false,false);
  224. {$else x86}
  225. cg.a_param_copy_ref(exprasmlist,left.resulttype.def.size,left.location.reference,tempparaloc);
  226. {$endif x86}
  227. end
  228. else
  229. begin
  230. case left.location.loc of
  231. LOC_CONSTANT,
  232. LOC_REGISTER,
  233. LOC_CREGISTER,
  234. LOC_REFERENCE,
  235. LOC_CREFERENCE :
  236. begin
  237. cgsize:=def_cgsize(left.resulttype.def);
  238. if cgsize in [OS_64,OS_S64] then
  239. begin
  240. inc(tcgcallnode(aktcallnode).pushedparasize,8);
  241. cg64.a_param64_loc(exprasmlist,left.location,tempparaloc);
  242. location_release(exprasmlist,left.location);
  243. end
  244. else
  245. begin
  246. location_release(exprasmlist,left.location);
  247. inc(tcgcallnode(aktcallnode).pushedparasize,align(tcgsize2size[tempparaloc.size],tempparaloc.alignment));
  248. cg.a_param_loc(exprasmlist,left.location,tempparaloc);
  249. end;
  250. end;
  251. {$ifdef SUPPORT_MMX}
  252. LOC_MMXREGISTER,
  253. LOC_CMMXREGISTER:
  254. begin
  255. location_release(exprasmlist,left.location);
  256. inc(tcgcallnode(aktcallnode).pushedparasize,8);
  257. cg.a_parammm_reg(exprasmlist,left.location.register);
  258. end;
  259. {$endif SUPPORT_MMX}
  260. else
  261. internalerror(200204241);
  262. end;
  263. end;
  264. end;
  265. end;
  266. procedure tcgcallparanode.secondcallparan;
  267. var
  268. otlabel,
  269. oflabel : tasmlabel;
  270. begin
  271. if not(assigned(paraitem)) or
  272. not(assigned(paraitem.paratype.def)) or
  273. not(assigned(paraitem.parasym) or
  274. (nf_varargs_para in flags)) then
  275. internalerror(200304242);
  276. { Skip nothingn nodes which are used after disabling
  277. a parameter }
  278. if (left.nodetype<>nothingn) then
  279. begin
  280. otlabel:=truelabel;
  281. oflabel:=falselabel;
  282. objectlibrary.getlabel(truelabel);
  283. objectlibrary.getlabel(falselabel);
  284. secondpass(left);
  285. allocate_tempparaloc;
  286. { handle varargs first, because paraitem.parasym is not valid }
  287. if (nf_varargs_para in flags) then
  288. begin
  289. if paramanager.push_addr_param(vs_value,left.resulttype.def,
  290. aktcallnode.procdefinition.proccalloption) then
  291. push_addr_para
  292. else
  293. push_value_para;
  294. end
  295. { hidden parameters }
  296. else if paraitem.is_hidden then
  297. begin
  298. { don't push a node that already generated a pointer type
  299. by address for implicit hidden parameters }
  300. if (vo_is_funcret in tvarsym(paraitem.parasym).varoptions) or
  301. (not(left.resulttype.def.deftype in [pointerdef,classrefdef]) and
  302. paramanager.push_addr_param(paraitem.paratyp,paraitem.paratype.def,
  303. aktcallnode.procdefinition.proccalloption)) then
  304. push_addr_para
  305. else
  306. push_value_para;
  307. end
  308. { formal def }
  309. else if (paraitem.paratype.def.deftype=formaldef) then
  310. begin
  311. { allow passing of a constant to a const formaldef }
  312. if (tvarsym(paraitem.parasym).varspez=vs_const) and
  313. (left.location.loc=LOC_CONSTANT) then
  314. location_force_mem(exprasmlist,left.location);
  315. { allow @var }
  316. if (left.nodetype=addrn) and
  317. (not(nf_procvarload in left.flags)) then
  318. begin
  319. inc(tcgcallnode(aktcallnode).pushedparasize,POINTER_SIZE);
  320. location_release(exprasmlist,left.location);
  321. cg.a_param_loc(exprasmlist,left.location,tempparaloc);
  322. end
  323. else
  324. push_addr_para;
  325. end
  326. { Normal parameter }
  327. else
  328. begin
  329. { don't push a node that already generated a pointer type
  330. by address for implicit hidden parameters }
  331. if (not(
  332. paraitem.is_hidden and
  333. (left.resulttype.def.deftype in [pointerdef,classrefdef])
  334. ) and
  335. paramanager.push_addr_param(paraitem.paratyp,paraitem.paratype.def,
  336. aktcallnode.procdefinition.proccalloption)) then
  337. begin
  338. { Check for passing a constant to var,out parameter }
  339. if (paraitem.paratyp in [vs_var,vs_out]) and
  340. (left.location.loc<>LOC_REFERENCE) then
  341. begin
  342. { passing self to a var parameter is allowed in
  343. TP and delphi }
  344. if not((left.location.loc=LOC_CREFERENCE) and
  345. is_self_node(left)) then
  346. internalerror(200106041);
  347. end;
  348. { Force to be in memory }
  349. if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
  350. location_force_mem(exprasmlist,left.location);
  351. push_addr_para;
  352. end
  353. else
  354. push_value_para;
  355. end;
  356. truelabel:=otlabel;
  357. falselabel:=oflabel;
  358. { update return location in callnode when this is the function
  359. result }
  360. if assigned(paraitem.parasym) and
  361. (vo_is_funcret in tvarsym(paraitem.parasym).varoptions) then
  362. location_copy(aktcallnode.location,left.location);
  363. end;
  364. { next parameter }
  365. if assigned(right) then
  366. tcallparanode(right).secondcallparan;
  367. end;
  368. {*****************************************************************************
  369. TCGCALLNODE
  370. *****************************************************************************}
  371. procedure tcgcallnode.extra_interrupt_code;
  372. begin
  373. end;
  374. procedure tcgcallnode.extra_call_code;
  375. begin
  376. end;
  377. function tcgcallnode.align_parasize:longint;
  378. begin
  379. result:=0;
  380. end;
  381. procedure tcgcallnode.pop_parasize(pop_size:longint);
  382. begin
  383. end;
  384. procedure tcgcallnode.handle_return_value;
  385. var
  386. cgsize : tcgsize;
  387. hregister : tregister;
  388. tempnode: tnode;
  389. begin
  390. { structured results are easy to handle.... }
  391. { needed also when result_no_used !! }
  392. if paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
  393. begin
  394. { Location should be setup by the funcret para }
  395. if location.loc<>LOC_REFERENCE then
  396. internalerror(200304241);
  397. end
  398. else
  399. { ansi/widestrings must be registered, so we can dispose them }
  400. if resulttype.def.needs_inittable then
  401. begin
  402. { the FUNCTION_RESULT_REG is already allocated }
  403. if not assigned(funcretnode) then
  404. begin
  405. location_reset(location,LOC_CREFERENCE,OS_ADDR);
  406. location.reference:=refcountedtemp;
  407. { a_load_reg_ref may allocate registers! }
  408. cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,location.reference);
  409. cg.ungetregister(exprasmlist,NR_FUNCTION_RESULT_REG);
  410. end
  411. else
  412. begin
  413. cg.ungetregister(exprasmlist,NR_FUNCTION_RESULT_REG);
  414. hregister := cg.getaddressregister(exprasmlist);
  415. cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,hregister);
  416. { in case of a regular funcretnode with ret_in_param, the }
  417. { original funcretnode isn't touched -> make sure it's }
  418. { the same here (not sure if it's necessary) }
  419. tempnode := funcretnode.getcopy;
  420. tempnode.pass_2;
  421. location := tempnode.location;
  422. tempnode.free;
  423. cg.g_decrrefcount(exprasmlist,resulttype.def,location.reference, false);
  424. cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference);
  425. cg.ungetregister(exprasmlist,hregister);
  426. end;
  427. end
  428. else
  429. { we have only to handle the result if it is used }
  430. if (nf_return_value_used in flags) then
  431. begin
  432. if (resulttype.def.deftype=floatdef) then
  433. begin
  434. location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
  435. {$ifdef cpufpemu}
  436. if cs_fp_emulation in aktmoduleswitches then
  437. location.register:=NR_FUNCTION_RESULT_REG
  438. else
  439. {$endif cpufpemu}
  440. begin
  441. location.register:=NR_FPU_RESULT_REG;
  442. {$ifdef sparc}
  443. { Double are returned in F0:F1 }
  444. if location.size=OS_F64 then
  445. setsubreg(location.register,R_SUBFD);
  446. {$endif sparc}
  447. end;
  448. {$ifdef x86}
  449. tcgx86(cg).inc_fpu_stack;
  450. {$else x86}
  451. cg.ungetregister(exprasmlist,location.register);
  452. hregister := cg.getfpuregister(exprasmlist,location.size);
  453. cg.a_loadfpu_reg_reg(exprasmlist,location.size,location.register,hregister);
  454. location.register := hregister;
  455. {$endif x86}
  456. end
  457. else
  458. begin
  459. cgsize:=def_cgsize(resulttype.def);
  460. if cgsize<>OS_NO then
  461. begin
  462. location_reset(location,LOC_REGISTER,cgsize);
  463. {$ifndef cpu64bit}
  464. if cgsize in [OS_64,OS_S64] then
  465. begin
  466. { Move the function result to free registers, preferably the
  467. FUNCTION_RESULT_REG/FUNCTION_RESULTHIGH_REG, so no move is necessary.}
  468. { the FUNCTION_RESULT_LOW_REG/FUNCTION_RESULT_HIGH_REG
  469. are already allocated }
  470. cg.ungetregister(exprasmlist,NR_FUNCTION_RESULT64_LOW_REG);
  471. location.registerlow:=cg.getintregister(exprasmlist,OS_INT);
  472. cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,NR_FUNCTION_RESULT64_LOW_REG,location.registerlow);
  473. cg.ungetregister(exprasmlist,NR_FUNCTION_RESULT64_HIGH_REG);
  474. location.registerhigh:=cg.getintregister(exprasmlist,OS_INT);
  475. cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,NR_FUNCTION_RESULT64_HIGH_REG,location.registerhigh);
  476. end
  477. else
  478. {$endif cpu64bit}
  479. begin
  480. {Move the function result to a free register, preferably the
  481. FUNCTION_RESULT_REG, so no move is necessary.}
  482. { the FUNCTION_RESULT_REG is already allocated }
  483. cg.ungetregister(exprasmlist,NR_FUNCTION_RESULT_REG);
  484. { change register size after the unget because the
  485. getregister was done for the full register }
  486. location.register:=cg.getintregister(exprasmlist,cgsize);
  487. cg.a_load_reg_reg(exprasmlist,cgsize,cgsize,cg.makeregsize(NR_FUNCTION_RESULT_REG,cgsize),location.register);
  488. end;
  489. end
  490. else
  491. begin
  492. if resulttype.def.size>0 then
  493. internalerror(200305131);
  494. end;
  495. end;
  496. end
  497. else
  498. begin
  499. cgsize:=def_cgsize(resulttype.def);
  500. { an object constructor is a function with pointer result }
  501. if (procdefinition.proctypeoption=potype_constructor) then
  502. cgsize:=OS_ADDR;
  503. if cgsize<>OS_NO then
  504. {$ifndef cpu64bit}
  505. if cgsize in [OS_64,OS_S64] then
  506. begin
  507. cg.ungetregister(exprasmlist,NR_FUNCTION_RESULT64_LOW_REG);
  508. cg.ungetregister(exprasmlist,NR_FUNCTION_RESULT64_HIGH_REG);
  509. end
  510. else
  511. {$endif cpu64bit}
  512. cg.ungetregister(exprasmlist,NR_FUNCTION_RESULT_REG);
  513. location_reset(location,LOC_VOID,OS_NO);
  514. end;
  515. end;
  516. procedure tcgcallnode.release_para_temps;
  517. var
  518. hp : tnode;
  519. ppn : tcallparanode;
  520. begin
  521. { Release temps from parameters }
  522. ppn:=tcallparanode(left);
  523. while assigned(ppn) do
  524. begin
  525. if assigned(ppn.left) then
  526. begin
  527. { don't release the funcret temp }
  528. if not(assigned(ppn.paraitem.parasym)) or
  529. not(vo_is_funcret in tvarsym(ppn.paraitem.parasym).varoptions) then
  530. location_freetemp(exprasmlist,ppn.left.location);
  531. { process also all nodes of an array of const }
  532. if ppn.left.nodetype=arrayconstructorn then
  533. begin
  534. if assigned(tarrayconstructornode(ppn.left).left) then
  535. begin
  536. hp:=ppn.left;
  537. while assigned(hp) do
  538. begin
  539. location_freetemp(exprasmlist,tarrayconstructornode(hp).left.location);
  540. hp:=tarrayconstructornode(hp).right;
  541. end;
  542. end;
  543. end;
  544. end;
  545. ppn:=tcallparanode(ppn.right);
  546. end;
  547. end;
  548. procedure tcgcallnode.normal_pass_2;
  549. var
  550. regs_to_push_fpu,
  551. regs_to_alloc,
  552. regs_to_free : Tcpuregisterset;
  553. oldpushedparasize : longint;
  554. { adress returned from an I/O-error }
  555. { help reference pointer }
  556. href : treference;
  557. pop_size : longint;
  558. pvreg,
  559. vmtreg : tregister;
  560. oldaktcallnode : tcallnode;
  561. procedure pushparas;
  562. var
  563. ppn : tcgcallparanode;
  564. begin
  565. { copy all resources to the allocated registers }
  566. ppn:=tcgcallparanode(left);
  567. while assigned(ppn) do
  568. begin
  569. case ppn.tempparaloc.loc of
  570. LOC_REGISTER:
  571. begin
  572. paramanager.freeparaloc(exprasmlist,ppn.tempparaloc);
  573. paramanager.allocparaloc(exprasmlist,ppn.paraitem.paraloc[callerside]);
  574. {$ifdef sparc}
  575. case ppn.tempparaloc.size of
  576. OS_F32 :
  577. ppn.tempparaloc.size:=OS_32;
  578. OS_F64 :
  579. ppn.tempparaloc.size:=OS_64;
  580. end;
  581. {$endif sparc}
  582. {$ifndef cpu64bit}
  583. if ppn.tempparaloc.size in [OS_64,OS_S64] then
  584. begin
  585. cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,ppn.tempparaloc.registerlow,
  586. ppn.paraitem.paraloc[callerside].registerlow);
  587. cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,ppn.tempparaloc.registerhigh,
  588. ppn.paraitem.paraloc[callerside].registerhigh);
  589. end
  590. else
  591. {$endif cpu64bit}
  592. cg.a_load_reg_reg(exprasmlist,ppn.tempparaloc.size,ppn.tempparaloc.size,
  593. ppn.tempparaloc.register,ppn.paraitem.paraloc[callerside].register);
  594. end;
  595. LOC_FPUREGISTER:
  596. begin
  597. paramanager.freeparaloc(exprasmlist,ppn.tempparaloc);
  598. paramanager.allocparaloc(exprasmlist,ppn.paraitem.paraloc[callerside]);
  599. cg.a_loadfpu_reg_reg(exprasmlist,ppn.tempparaloc.size,
  600. ppn.tempparaloc.register,ppn.paraitem.paraloc[callerside].register);
  601. end;
  602. LOC_MMREGISTER:
  603. begin
  604. {
  605. paramanager.freeparaloc(exprasmlist,ppn.tempparaloc);
  606. paramanager.allocparaloc(exprasmlist,ppn.paraitem.paraloc[callerside]);
  607. paramanager.freeparaloc(exprasmlist,ppn.tempparaloc);
  608. paramanager.allocparaloc(exprasmlist,ppn.paraitem.paraloc[callerside]);
  609. cg.a_loadmm_reg_reg(exprasmlist,ppn.tempparaloc.size,
  610. ppn.tempparaloc.size,ppn.tempparaloc.register,ppn.paraitem.paraloc[callerside].register, shuffle???);
  611. }
  612. internalerror(2003102910);
  613. end;
  614. end;
  615. ppn:=tcgcallparanode(ppn.right);
  616. end;
  617. end;
  618. procedure freeparas;
  619. var
  620. ppn : tcgcallparanode;
  621. begin
  622. { free the resources allocated for the parameters }
  623. ppn:=tcgcallparanode(left);
  624. while assigned(ppn) do
  625. begin
  626. paramanager.freeparaloc(exprasmlist,ppn.paraitem.paraloc[callerside]);
  627. ppn:=tcgcallparanode(ppn.right);
  628. end;
  629. end;
  630. begin
  631. if not assigned(procdefinition) or
  632. not procdefinition.has_paraloc_info then
  633. internalerror(200305264);
  634. if resulttype.def.needs_inittable and
  635. not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) and
  636. not assigned(funcretnode) then
  637. begin
  638. tg.gettemptyped(exprasmlist,resulttype.def,tt_normal,refcountedtemp);
  639. cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp,false);
  640. end;
  641. regs_to_alloc:=paramanager.get_volatile_registers_int(procdefinition.proccalloption);
  642. regs_to_push_fpu:=paramanager.get_volatile_registers_fpu(procdefinition.proccalloption);
  643. { Include Function result registers }
  644. if (not is_void(resulttype.def)) then
  645. begin
  646. case procdefinition.funcret_paraloc[callerside].loc of
  647. LOC_REGISTER,LOC_CREGISTER:
  648. begin
  649. {$ifndef cpu64bit}
  650. if procdefinition.funcret_paraloc[callerside].size in [OS_S64,OS_64] then
  651. begin
  652. include(regs_to_alloc,getsupreg(procdefinition.funcret_paraloc[callerside].registerlow));
  653. include(regs_to_alloc,getsupreg(procdefinition.funcret_paraloc[callerside].registerhigh));
  654. end
  655. else
  656. {$endif cpu64bit}
  657. include(regs_to_alloc,getsupreg(procdefinition.funcret_paraloc[callerside].register));
  658. end;
  659. LOC_FPUREGISTER,LOC_CFPUREGISTER:
  660. begin
  661. include(regs_to_push_fpu,getsupreg(procdefinition.funcret_paraloc[callerside].register));
  662. end;
  663. LOC_MMREGISTER,LOC_CMMREGISTER:
  664. begin
  665. internalerror(2003102911);
  666. end;
  667. end;
  668. end;
  669. { Initialize for pushing the parameters }
  670. oldpushedparasize:=pushedparasize;
  671. pushedparasize:=0;
  672. { Process parameters, register parameters will be loaded
  673. in imaginary registers. The actual load to the correct
  674. register is done just before the call }
  675. oldaktcallnode:=aktcallnode;
  676. aktcallnode:=self;
  677. if assigned(left) then
  678. tcallparanode(left).secondcallparan;
  679. aktcallnode:=oldaktcallnode;
  680. { Align stack if required }
  681. pop_size:=align_parasize;
  682. { procedure variable or normal function call ? }
  683. if (right=nil) then
  684. begin
  685. if (po_virtualmethod in procdefinition.procoptions) and
  686. assigned(methodpointer) then
  687. begin
  688. secondpass(methodpointer);
  689. location_force_reg(exprasmlist,methodpointer.location,OS_ADDR,false);
  690. { virtual methods require an index }
  691. if tprocdef(procdefinition).extnumber=-1 then
  692. internalerror(200304021);
  693. { VMT should already be loaded in a register }
  694. if methodpointer.location.register=NR_NO then
  695. internalerror(200304022);
  696. { test validity of VMT }
  697. if not(is_interface(tprocdef(procdefinition)._class)) and
  698. not(is_cppclass(tprocdef(procdefinition)._class)) then
  699. cg.g_maybe_testvmt(exprasmlist,methodpointer.location.register,tprocdef(procdefinition)._class);
  700. end;
  701. {$warning fixme regvars}
  702. { rg.saveotherregvars(exprasmlist,regs_to_push_other);}
  703. if (po_virtualmethod in procdefinition.procoptions) and
  704. assigned(methodpointer) then
  705. begin
  706. vmtreg:=methodpointer.location.register;
  707. { release self }
  708. cg.ungetregister(exprasmlist,vmtreg);
  709. pvreg:=cg.getintregister(exprasmlist,OS_ADDR);
  710. reference_reset_base(href,vmtreg,
  711. tprocdef(procdefinition)._class.vmtmethodoffset(tprocdef(procdefinition).extnumber));
  712. cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,pvreg);
  713. { Load parameters that are in temporary registers in the
  714. correct parameter register }
  715. if assigned(left) then
  716. pushparas;
  717. { free the resources allocated for the parameters }
  718. freeparas;
  719. { Release register containing procvar }
  720. cg.ungetregister(exprasmlist,pvreg);
  721. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,regs_to_alloc);
  722. if cg.uses_registers(R_FPUREGISTER) then
  723. cg.allocexplicitregisters(exprasmlist,R_FPUREGISTER,regs_to_push_fpu);
  724. if cg.uses_registers(R_MMREGISTER) then
  725. cg.allocexplicitregisters(exprasmlist,R_MMREGISTER,paramanager.get_volatile_registers_mm(procdefinition.proccalloption));
  726. { call method }
  727. extra_call_code;
  728. cg.a_call_reg(exprasmlist,pvreg);
  729. end
  730. else
  731. begin
  732. { Load parameters that are in temporary registers in the
  733. correct parameter register }
  734. if assigned(left) then
  735. pushparas;
  736. { free the resources allocated for the parameters }
  737. freeparas;
  738. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,regs_to_alloc);
  739. if cg.uses_registers(R_FPUREGISTER) then
  740. cg.allocexplicitregisters(exprasmlist,R_FPUREGISTER,regs_to_push_fpu);
  741. if cg.uses_registers(R_MMREGISTER) then
  742. cg.allocexplicitregisters(exprasmlist,R_MMREGISTER,paramanager.get_volatile_registers_mm(procdefinition.proccalloption));
  743. { Calling interrupt from the same code requires some
  744. extra code }
  745. if (po_interrupt in procdefinition.procoptions) then
  746. extra_interrupt_code;
  747. extra_call_code;
  748. cg.a_call_name(exprasmlist,tprocdef(procdefinition).mangledname);
  749. end;
  750. end
  751. else
  752. { now procedure variable case }
  753. begin
  754. secondpass(right);
  755. location_release(exprasmlist,right.location);
  756. pvreg:=cg.getintregister(exprasmlist,OS_ADDR);
  757. { Only load OS_ADDR from the reference }
  758. if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
  759. cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,right.location.reference,pvreg)
  760. else
  761. cg.a_load_loc_reg(exprasmlist,OS_ADDR,right.location,pvreg);
  762. location_freetemp(exprasmlist,right.location);
  763. { Load parameters that are in temporary registers in the
  764. correct parameter register }
  765. if assigned(left) then
  766. pushparas;
  767. { free the resources allocated for the parameters }
  768. freeparas;
  769. { Release register containing procvar }
  770. cg.ungetregister(exprasmlist,pvreg);
  771. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,regs_to_alloc);
  772. if cg.uses_registers(R_FPUREGISTER) then
  773. cg.allocexplicitregisters(exprasmlist,R_FPUREGISTER,regs_to_push_fpu);
  774. if cg.uses_registers(R_MMREGISTER) then
  775. cg.allocexplicitregisters(exprasmlist,R_MMREGISTER,paramanager.get_volatile_registers_mm(procdefinition.proccalloption));
  776. { Calling interrupt from the same code requires some
  777. extra code }
  778. if (po_interrupt in procdefinition.procoptions) then
  779. extra_interrupt_code;
  780. {$warning fixme regvars.}
  781. { rg.saveotherregvars(exprasmlist,ALL_OTHERREGISTERS);}
  782. extra_call_code;
  783. cg.a_call_reg(exprasmlist,pvreg);
  784. end;
  785. { Need to remove the parameters from the stack? }
  786. if (procdefinition.proccalloption in clearstack_pocalls) then
  787. begin
  788. { the old pop_size was already included in pushedparasize }
  789. pop_size:=pushedparasize;
  790. { for Cdecl functions we don't need to pop the funcret when it
  791. was pushed by para }
  792. if paramanager.ret_in_param(procdefinition.rettype.def,procdefinition.proccalloption) then
  793. dec(pop_size,POINTER_SIZE);
  794. end;
  795. { Remove parameters/alignment from the stack }
  796. if pop_size>0 then
  797. pop_parasize(pop_size);
  798. { Reserve space for storing parameters that will be pushed }
  799. current_procinfo.allocate_push_parasize(pushedparasize);
  800. { Restore }
  801. pushedparasize:=oldpushedparasize;
  802. { Release registers, but not the registers that contain the
  803. function result }
  804. regs_to_free:=regs_to_alloc;
  805. if (not is_void(resulttype.def)) then
  806. begin
  807. case procdefinition.funcret_paraloc[callerside].loc of
  808. LOC_REGISTER,LOC_CREGISTER:
  809. begin
  810. {$ifndef cpu64bit}
  811. if procdefinition.funcret_paraloc[callerside].size in [OS_S64,OS_64] then
  812. begin
  813. exclude(regs_to_free,getsupreg(procdefinition.funcret_paraloc[callerside].registerlow));
  814. exclude(regs_to_free,getsupreg(procdefinition.funcret_paraloc[callerside].registerhigh));
  815. end
  816. else
  817. {$endif cpu64bit}
  818. exclude(regs_to_free,getsupreg(procdefinition.funcret_paraloc[callerside].register));
  819. end;
  820. LOC_FPUREGISTER,LOC_CFPUREGISTER:
  821. begin
  822. exclude(regs_to_push_fpu,getsupreg(procdefinition.funcret_paraloc[callerside].register));
  823. end;
  824. end;
  825. end;
  826. if cg.uses_registers(R_MMREGISTER) then
  827. cg.deallocexplicitregisters(exprasmlist,R_MMREGISTER,paramanager.get_volatile_registers_mm(procdefinition.proccalloption));
  828. if cg.uses_registers(R_FPUREGISTER) then
  829. cg.deallocexplicitregisters(exprasmlist,R_FPUREGISTER,regs_to_push_fpu);
  830. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,regs_to_free);
  831. { handle function results }
  832. if (not is_void(resulttype.def)) then
  833. handle_return_value
  834. else
  835. location_reset(location,LOC_VOID,OS_NO);
  836. { perhaps i/o check ? }
  837. if (cs_check_io in aktlocalswitches) and
  838. (po_iocheck in procdefinition.procoptions) and
  839. not(po_iocheck in current_procinfo.procdef.procoptions) and
  840. { no IO check for methods and procedure variables }
  841. (right=nil) and
  842. not(po_virtualmethod in procdefinition.procoptions) then
  843. begin
  844. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  845. cg.a_call_name(exprasmlist,'FPC_IOCHECK');
  846. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  847. end;
  848. { release temps of paras }
  849. release_para_temps;
  850. { if return value is not used }
  851. if (not(nf_return_value_used in flags)) and (not is_void(resulttype.def)) then
  852. begin
  853. if location.loc in [LOC_CREFERENCE,LOC_REFERENCE] then
  854. begin
  855. { data which must be finalized ? }
  856. if (resulttype.def.needs_inittable) then
  857. cg.g_finalize(exprasmlist,resulttype.def,location.reference,false);
  858. { release unused temp }
  859. tg.ungetiftemp(exprasmlist,location.reference)
  860. end
  861. else if location.loc=LOC_FPUREGISTER then
  862. begin
  863. {$ifdef x86}
  864. { release FPU stack }
  865. emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
  866. {$endif x86}
  867. end;
  868. end;
  869. end;
  870. procedure tcgcallnode.inlined_pass_2;
  871. var
  872. oldaktcallnode : tcallnode;
  873. oldprocinfo : tprocinfo;
  874. oldinlining_procedure : boolean;
  875. inlineentrycode,inlineexitcode : TAAsmoutput;
  876. usesacc,usesacchi,usesfpu : boolean;
  877. {$ifdef GDB}
  878. startlabel,endlabel : tasmlabel;
  879. pp : pchar;
  880. mangled_length : longint;
  881. {$endif GDB}
  882. begin
  883. if not(assigned(procdefinition) and (procdefinition.deftype=procdef)) then
  884. internalerror(200305262);
  885. oldinlining_procedure:=inlining_procedure;
  886. oldprocinfo:=current_procinfo;
  887. { we're inlining a procedure }
  888. inlining_procedure:=true;
  889. { Add inling start }
  890. exprasmlist.concat(Tai_force_line.Create);
  891. exprasmList.concat(Tai_Marker.Create(InlineStart));
  892. {$ifdef extdebug}
  893. exprasmList.concat(tai_comment.Create(strpnew('Start of inlined proc '+tprocdef(procdefinition).procsym.name)));
  894. {$endif extdebug}
  895. { calculate registers to pass the parameters }
  896. paramanager.create_inline_paraloc_info(procdefinition);
  897. { Allocate parameters and locals }
  898. gen_alloc_inline_parast(exprasmlist,tparasymtable(procdefinition.parast));
  899. if tprocdef(procdefinition).localst.symtabletype=localsymtable then
  900. gen_alloc_localst(exprasmlist,tlocalsymtable(tprocdef(procdefinition).localst));
  901. { if we allocate the temp. location for ansi- or widestrings }
  902. { already here, we avoid later a push/pop }
  903. if resulttype.def.needs_inittable and
  904. not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
  905. begin
  906. tg.gettemptyped(exprasmlist,resulttype.def,tt_normal,refcountedtemp);
  907. cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp,false);
  908. end;
  909. { Push parameters, still use the old current_procinfo. This
  910. is required that have the correct information available like
  911. _class and nested procedure }
  912. oldaktcallnode:=aktcallnode;
  913. aktcallnode:=self;
  914. if assigned(left) then
  915. tcallparanode(left).secondcallparan;
  916. aktcallnode:=oldaktcallnode;
  917. { create temp procinfo that will be used for the inlinecode tree }
  918. current_procinfo:=cprocinfo.create(nil);
  919. current_procinfo.procdef:=tprocdef(procdefinition);
  920. current_procinfo.flags:=oldprocinfo.flags;
  921. current_procinfo.aktlocaldata:=oldprocinfo.aktlocaldata;
  922. { when the oldprocinfo is also being inlined reuse the
  923. inlining_procinfo }
  924. if assigned(oldprocinfo.inlining_procinfo) then
  925. current_procinfo.inlining_procinfo:=oldprocinfo.inlining_procinfo
  926. else
  927. current_procinfo.inlining_procinfo:=oldprocinfo;
  928. { takes care of local data initialization }
  929. inlineentrycode:=TAAsmoutput.Create;
  930. inlineexitcode:=TAAsmoutput.Create;
  931. {$ifdef GDB}
  932. if (cs_debuginfo in aktmoduleswitches) then
  933. begin
  934. objectlibrary.getaddrlabel(startlabel);
  935. objectlibrary.getaddrlabel(endlabel);
  936. cg.a_label(exprasmlist,startlabel);
  937. { Here we must include the para and local symtable info }
  938. procdefinition.concatstabto(withdebuglist);
  939. mangled_length:=length(current_procinfo.inlining_procinfo.procdef.mangledname);
  940. getmem(pp,mangled_length+50);
  941. strpcopy(pp,'192,0,0,'+startlabel.name);
  942. if (target_info.use_function_relative_addresses) then
  943. begin
  944. strpcopy(strend(pp),'-');
  945. strpcopy(strend(pp),current_procinfo.inlining_procinfo.procdef.mangledname);
  946. end;
  947. withdebugList.concat(Tai_stabn.Create(strnew(pp)));
  948. end;
  949. {$endif GDB}
  950. gen_load_para_value(inlineentrycode);
  951. gen_initialize_code(inlineentrycode,true);
  952. if po_assembler in current_procinfo.procdef.procoptions then
  953. inlineentrycode.insert(Tai_marker.Create(asmblockstart));
  954. exprasmList.concatlist(inlineentrycode);
  955. { process the inline code }
  956. secondpass(inlinecode);
  957. cg.a_label(exprasmlist,current_procinfo.aktexitlabel);
  958. gen_finalize_code(inlineexitcode,true);
  959. gen_load_return_value(inlineexitcode,usesacc,usesacchi,usesfpu);
  960. if po_assembler in current_procinfo.procdef.procoptions then
  961. inlineexitcode.concat(Tai_marker.Create(asmblockend));
  962. exprasmlist.concatlist(inlineexitcode);
  963. inlineentrycode.free;
  964. inlineexitcode.free;
  965. {$ifdef extdebug}
  966. exprasmList.concat(tai_comment.Create(strpnew('End of inlined proc')));
  967. {$endif extdebug}
  968. exprasmList.concat(Tai_Marker.Create(InlineEnd));
  969. { handle function results }
  970. if (not is_void(resulttype.def)) then
  971. handle_return_value
  972. else
  973. location_reset(location,LOC_VOID,OS_NO);
  974. { perhaps i/o check ? }
  975. if (cs_check_io in aktlocalswitches) and
  976. (po_iocheck in procdefinition.procoptions) and
  977. not(po_iocheck in current_procinfo.procdef.procoptions) and
  978. { no IO check for methods and procedure variables }
  979. (right=nil) and
  980. not(po_virtualmethod in procdefinition.procoptions) then
  981. begin
  982. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  983. cg.a_call_name(exprasmlist,'FPC_IOCHECK');
  984. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  985. end;
  986. { release temps of paras }
  987. release_para_temps;
  988. { if return value is not used }
  989. if (not is_void(resulttype.def)) and
  990. (not(nf_return_value_used in flags)) then
  991. begin
  992. if location.loc in [LOC_CREFERENCE,LOC_REFERENCE] then
  993. begin
  994. { data which must be finalized ? }
  995. if (resulttype.def.needs_inittable) then
  996. cg.g_finalize(exprasmlist,resulttype.def,location.reference,false);
  997. { release unused temp }
  998. tg.ungetiftemp(exprasmlist,location.reference)
  999. end
  1000. else if location.loc=LOC_FPUREGISTER then
  1001. begin
  1002. {$ifdef x86}
  1003. { release FPU stack }
  1004. emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
  1005. {$endif x86}
  1006. end;
  1007. end;
  1008. { Release parameters and locals }
  1009. gen_free_parast(exprasmlist,tparasymtable(current_procinfo.procdef.parast));
  1010. if current_procinfo.procdef.localst.symtabletype=localsymtable then
  1011. gen_free_localst(exprasmlist,tlocalsymtable(current_procinfo.procdef.localst));
  1012. {$ifdef GDB}
  1013. if (cs_debuginfo in aktmoduleswitches) then
  1014. begin
  1015. cg.a_label(exprasmlist,endlabel);
  1016. strpcopy(pp,'224,0,0,'+endlabel.name);
  1017. if (target_info.use_function_relative_addresses) then
  1018. begin
  1019. strpcopy(strend(pp),'-');
  1020. strpcopy(strend(pp),current_procinfo.inlining_procinfo.procdef.mangledname);
  1021. end;
  1022. withdebugList.concat(Tai_stabn.Create(strnew(pp)));
  1023. freemem(pp,mangled_length+50);
  1024. end;
  1025. {$endif GDB}
  1026. { restore }
  1027. current_procinfo.aktlocaldata:=nil;
  1028. current_procinfo.free;
  1029. current_procinfo:=oldprocinfo;
  1030. inlining_procedure:=oldinlining_procedure;
  1031. end;
  1032. procedure tcgcallnode.pass_2;
  1033. begin
  1034. if assigned(inlinecode) then
  1035. inlined_pass_2
  1036. else
  1037. normal_pass_2;
  1038. end;
  1039. begin
  1040. ccallparanode:=tcgcallparanode;
  1041. ccallnode:=tcgcallnode;
  1042. end.
  1043. {
  1044. $Log$
  1045. Revision 1.152 2004-01-31 17:45:17 peter
  1046. * Change several $ifdef i386 to x86
  1047. * Change several OS_32 to OS_INT/OS_ADDR
  1048. Revision 1.151 2004/01/26 17:34:14 florian
  1049. * set aktlocaldata for inlined procedures correctly
  1050. Revision 1.150 2004/01/12 16:39:40 peter
  1051. * sparc updates, mostly float related
  1052. Revision 1.149 2003/12/28 22:09:12 florian
  1053. + setting of bit 6 of cr for c var args on ppc implemented
  1054. Revision 1.148 2003/12/26 13:19:16 florian
  1055. * rtl and compiler compile with -Cfsse2
  1056. Revision 1.147 2003/12/21 19:42:42 florian
  1057. * fixed ppc inlining stuff
  1058. * fixed wrong unit writing
  1059. + added some sse stuff
  1060. Revision 1.146 2003/12/15 21:25:48 peter
  1061. * reg allocations for imaginary register are now inserted just
  1062. before reg allocation
  1063. * tregister changed to enum to allow compile time check
  1064. * fixed several tregister-tsuperregister errors
  1065. Revision 1.145 2003/12/07 12:41:32 jonas
  1066. * fixed ansistring/widestring results: deallocate result reg only after
  1067. it has been stored to memory, as the storing itself may require extra
  1068. results (e.g. on ppc)
  1069. Revision 1.144 2003/12/06 01:15:22 florian
  1070. * reverted Peter's alloctemp patch; hopefully properly
  1071. Revision 1.143 2003/12/03 23:13:20 peter
  1072. * delayed paraloc allocation, a_param_*() gets extra parameter
  1073. if it needs to allocate temp or real paralocation
  1074. * optimized/simplified int-real loading
  1075. Revision 1.142 2003/12/02 21:23:34 peter
  1076. * exitlabel for inline procs
  1077. Revision 1.141 2003/11/23 17:39:33 peter
  1078. * removed obsolete nf_cargs flag
  1079. Revision 1.140 2003/11/23 17:05:15 peter
  1080. * register calling is left-right
  1081. * parameter ordering
  1082. * left-right calling inserts result parameter last
  1083. Revision 1.139 2003/11/10 22:02:52 peter
  1084. * cross unit inlining fixed
  1085. Revision 1.138 2003/11/07 15:58:32 florian
  1086. * Florian's culmutative nr. 1; contains:
  1087. - invalid calling conventions for a certain cpu are rejected
  1088. - arm softfloat calling conventions
  1089. - -Sp for cpu dependend code generation
  1090. - several arm fixes
  1091. - remaining code for value open array paras on heap
  1092. Revision 1.137 2003/11/04 19:03:54 peter
  1093. * fixes for temp type patch
  1094. Revision 1.136 2003/11/04 15:35:13 peter
  1095. * fix for referencecounted temps
  1096. Revision 1.135 2003/10/30 17:12:49 peter
  1097. * fixed rangecheck error
  1098. Revision 1.134 2003/10/29 21:24:14 jonas
  1099. + support for fpu temp parameters
  1100. + saving/restoring of fpu register before/after a procedure call
  1101. Revision 1.133 2003/10/20 19:28:17 peter
  1102. * fixed inlining float parameters for i386
  1103. Revision 1.132 2003/10/17 14:38:32 peter
  1104. * 64k registers supported
  1105. * fixed some memory leaks
  1106. Revision 1.131 2003/10/17 01:22:08 florian
  1107. * compilation of the powerpc compiler fixed
  1108. Revision 1.130 2003/10/11 16:06:42 florian
  1109. * fixed some MMX<->SSE
  1110. * started to fix ppc, needs an overhaul
  1111. + stabs info improve for spilling, not sure if it works correctly/completly
  1112. - MMX_SUPPORT removed from Makefile.fpc
  1113. Revision 1.129 2003/10/10 17:48:13 peter
  1114. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  1115. * tregisteralloctor renamed to trgobj
  1116. * removed rgobj from a lot of units
  1117. * moved location_* and reference_* to cgobj
  1118. * first things for mmx register allocation
  1119. Revision 1.128 2003/10/10 09:21:53 marco
  1120. * typo fix from Wiktor
  1121. Revision 1.127 2003/10/09 21:31:37 daniel
  1122. * Register allocator splitted, ans abstract now
  1123. Revision 1.126 2003/10/07 15:17:07 peter
  1124. * inline supported again, LOC_REFERENCEs are used to pass the
  1125. parameters
  1126. * inlineparasymtable,inlinelocalsymtable removed
  1127. * exitlabel inserting fixed
  1128. Revision 1.125 2003/10/05 21:21:52 peter
  1129. * c style array of const generates callparanodes
  1130. * varargs paraloc fixes
  1131. Revision 1.124 2003/10/03 22:00:33 peter
  1132. * parameter alignment fixes
  1133. Revision 1.123 2003/10/01 20:34:48 peter
  1134. * procinfo unit contains tprocinfo
  1135. * cginfo renamed to cgbase
  1136. * moved cgmessage to verbose
  1137. * fixed ppc and sparc compiles
  1138. Revision 1.122 2003/09/30 21:02:37 peter
  1139. * updates for inlining
  1140. Revision 1.121 2003/09/30 19:55:19 peter
  1141. * remove abt reg for vmtreg
  1142. Revision 1.120 2003/09/29 20:58:55 peter
  1143. * optimized releasing of registers
  1144. Revision 1.119 2003/09/28 17:55:03 peter
  1145. * parent framepointer changed to hidden parameter
  1146. * tloadparentfpnode added
  1147. Revision 1.118 2003/09/28 13:54:43 peter
  1148. * removed a_call_ref
  1149. Revision 1.117 2003/09/25 21:28:00 peter
  1150. * parameter fixes
  1151. Revision 1.116 2003/09/23 17:56:05 peter
  1152. * locals and paras are allocated in the code generation
  1153. * tvarsym.localloc contains the location of para/local when
  1154. generating code for the current procedure
  1155. Revision 1.115 2003/09/16 16:17:01 peter
  1156. * varspez in calls to push_addr_param
  1157. Revision 1.114 2003/09/14 19:17:39 peter
  1158. * don't use a_call_ref because it can use a parameter register
  1159. as temp
  1160. Revision 1.113 2003/09/11 11:54:59 florian
  1161. * improved arm code generation
  1162. * move some protected and private field around
  1163. * the temp. register for register parameters/arguments are now released
  1164. before the move to the parameter register is done. This improves
  1165. the code in a lot of cases.
  1166. Revision 1.112 2003/09/10 08:31:47 marco
  1167. * Patch from Peter for paraloc
  1168. Revision 1.111 2003/09/07 22:09:35 peter
  1169. * preparations for different default calling conventions
  1170. * various RA fixes
  1171. Revision 1.110 2003/09/04 15:39:58 peter
  1172. * released useparatemp
  1173. Revision 1.109 2003/09/03 15:55:00 peter
  1174. * NEWRA branch merged
  1175. Revision 1.108.2.4 2003/09/01 21:02:55 peter
  1176. * sparc updates for new tregister
  1177. Revision 1.108.2.3 2003/08/31 21:07:44 daniel
  1178. * callparatemp ripped
  1179. Revision 1.108.2.2 2003/08/29 17:28:59 peter
  1180. * next batch of updates
  1181. Revision 1.108.2.1 2003/08/27 20:23:55 peter
  1182. * remove old ra code
  1183. Revision 1.108 2003/08/21 22:14:16 olle
  1184. - removed parameter from fpc_iocheck
  1185. Revision 1.107 2003/08/17 16:59:20 jonas
  1186. * fixed regvars so they work with newra (at least for ppc)
  1187. * fixed some volatile register bugs
  1188. + -dnotranslation option for -dnewra, which causes the registers not to
  1189. be translated from virtual to normal registers. Requires support in
  1190. the assembler writer as well, which is only implemented in aggas/
  1191. agppcgas currently
  1192. Revision 1.106 2003/08/16 18:56:40 marco
  1193. * fix from Jonas.
  1194. Revision 1.105 2003/08/11 21:18:20 peter
  1195. * start of sparc support for newra
  1196. Revision 1.104 2003/08/11 14:22:06 mazen
  1197. - dupplicated code removed
  1198. Revision 1.103 2003/07/23 11:01:14 jonas
  1199. * several rg.allocexplicitregistersint/rg.deallocexplicitregistersint
  1200. pairs round calls to helpers
  1201. Revision 1.102 2003/07/21 13:51:50 jonas
  1202. * fixed 64bit int results with -dnewra (you can't free both registers and
  1203. then allocate two new ones, because then the registers could be reversed
  1204. afterwards -> you get something like "movl %eax, %edx; movl %edx,%eax")
  1205. Revision 1.101 2003/07/08 21:24:59 peter
  1206. * sparc fixes
  1207. Revision 1.100 2003/07/06 21:50:33 jonas
  1208. * fixed ppc compilation problems and changed VOLATILE_REGISTERS for x86
  1209. so that it doesn't include ebp and esp anymore
  1210. Revision 1.99 2003/07/06 17:58:22 peter
  1211. * framepointer fixes for sparc
  1212. * parent framepointer code more generic
  1213. Revision 1.98 2003/07/06 15:31:20 daniel
  1214. * Fixed register allocator. *Lots* of fixes.
  1215. Revision 1.97 2003/07/05 20:21:26 jonas
  1216. * create_paraloc_info() is now called separately for the caller and
  1217. callee info
  1218. * fixed ppc cycle
  1219. Revision 1.96 2003/07/02 22:18:04 peter
  1220. * paraloc splitted in paraloc[callerside],calleeparaloc
  1221. * sparc calling convention updates
  1222. Revision 1.95 2003/06/17 16:34:44 jonas
  1223. * lots of newra fixes (need getfuncretparaloc implementation for i386)!
  1224. * renamed all_intregisters to paramanager.get_volatile_registers_int(pocall_default) and made it
  1225. processor dependent
  1226. Revision 1.94 2003/06/15 16:52:02 jonas
  1227. * release function result registers if the functino result isn't used
  1228. * don't allocate function result register with -dnewra if there is none
  1229. * some optimizations for non-x86 processor (don't save any registers
  1230. before a call)
  1231. Revision 1.93 2003/06/13 21:19:30 peter
  1232. * current_procdef removed, use current_procinfo.procdef instead
  1233. Revision 1.92 2003/06/12 21:10:50 peter
  1234. * newra fixes
  1235. Revision 1.91 2003/06/12 18:38:45 jonas
  1236. * deallocate parameter registers in time for newra
  1237. * for non-i386, procvars and methodpointers always have to be processed
  1238. in advance, whether or not newra is defined
  1239. Revision 1.90 2003/06/09 14:54:26 jonas
  1240. * (de)allocation of registers for parameters is now performed properly
  1241. (and checked on the ppc)
  1242. - removed obsolete allocation of all parameter registers at the start
  1243. of a procedure (and deallocation at the end)
  1244. Revision 1.89 2003/06/09 12:23:29 peter
  1245. * init/final of procedure data splitted from genentrycode
  1246. * use asmnode getposition to insert final at the correct position
  1247. als for the implicit try...finally
  1248. Revision 1.88 2003/06/08 20:01:53 jonas
  1249. * optimized assignments with on the right side a function that returns
  1250. an ansi- or widestring
  1251. Revision 1.87 2003/06/08 18:21:47 jonas
  1252. * fixed weird error in the copyleft statement :)
  1253. Revision 1.86 2003/06/07 18:57:04 jonas
  1254. + added freeintparaloc
  1255. * ppc get/freeintparaloc now check whether the parameter regs are
  1256. properly allocated/deallocated (and get an extra list para)
  1257. * ppc a_call_* now internalerrors if pi_do_call is not yet set
  1258. * fixed lot of missing pi_do_call's
  1259. Revision 1.85 2003/06/04 06:43:36 jonas
  1260. * fixed double secondpassing of procvar loads
  1261. Revision 1.84 2003/06/03 21:11:09 peter
  1262. * cg.a_load_* get a from and to size specifier
  1263. * makeregsize only accepts newregister
  1264. * i386 uses generic tcgnotnode,tcgunaryminus
  1265. Revision 1.83 2003/06/03 20:27:02 daniel
  1266. * Restored original methodpointer code for non newra case
  1267. Revision 1.82 2003/06/03 13:01:59 daniel
  1268. * Register allocator finished
  1269. Revision 1.81 2003/06/01 21:38:06 peter
  1270. * getregisterfpu size parameter added
  1271. * op_const_reg size parameter added
  1272. * sparc updates
  1273. Revision 1.80 2003/05/31 15:05:28 peter
  1274. * FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
  1275. Revision 1.79 2003/05/31 00:59:44 peter
  1276. * typo in FUNCTION_RESULT_REG
  1277. Revision 1.78 2003/05/30 23:57:08 peter
  1278. * more sparc cleanup
  1279. * accumulator removed, splitted in function_return_reg (called) and
  1280. function_result_reg (caller)
  1281. Revision 1.77 2003/05/29 10:05:40 jonas
  1282. * free callparatemps created for call-by-reference parameters
  1283. Revision 1.76 2003/05/28 23:58:18 jonas
  1284. * added missing initialization of rg.usedintin,byproc
  1285. * ppc now also saves/restores used fpu registers
  1286. * ncgcal doesn't add used registers to usedby/inproc anymore, except for
  1287. i386
  1288. Revision 1.75 2003/05/26 21:17:17 peter
  1289. * procinlinenode removed
  1290. * aktexit2label removed, fast exit removed
  1291. + tcallnode.inlined_pass_2 added
  1292. Revision 1.74 2003/05/25 11:34:17 peter
  1293. * methodpointer self pushing fixed
  1294. Revision 1.73 2003/05/25 08:59:16 peter
  1295. * inline fixes
  1296. Revision 1.72 2003/05/24 13:36:54 jonas
  1297. * save fpu results in a normal fpu register on non-x86 processors
  1298. Revision 1.71 2003/05/23 19:35:50 jonas
  1299. - undid previous commit, it was wrong
  1300. Revision 1.70 2003/05/23 19:11:58 jonas
  1301. * fixed tests for whether a certain int register is unused
  1302. Revision 1.69 2003/05/23 18:01:56 jonas
  1303. * fixed ppc compiler
  1304. Revision 1.68 2003/05/23 14:27:35 peter
  1305. * remove some unit dependencies
  1306. * current_procinfo changes to store more info
  1307. Revision 1.67 2003/05/17 13:30:08 jonas
  1308. * changed tt_persistant to tt_persistent :)
  1309. * tempcreatenode now doesn't accept a boolean anymore for persistent
  1310. temps, but a ttemptype, so you can also create ansistring temps etc
  1311. Revision 1.66 2003/05/16 14:33:31 peter
  1312. * regvar fixes
  1313. Revision 1.65 2003/05/15 18:58:53 peter
  1314. * removed selfpointer_offset, vmtpointer_offset
  1315. * tvarsym.adjusted_address
  1316. * address in localsymtable is now in the real direction
  1317. * removed some obsolete globals
  1318. Revision 1.64 2003/05/14 19:36:54 jonas
  1319. * patch from Peter for int64 function results
  1320. Revision 1.63 2003/05/13 19:14:41 peter
  1321. * failn removed
  1322. * inherited result code check moven to pexpr
  1323. Revision 1.62 2003/05/13 15:18:18 peter
  1324. * generate code for procvar first before pushing parameters. Made
  1325. the already existing code for powerpc available for all platforms
  1326. Revision 1.61 2003/05/12 18:17:55 jonas
  1327. * moved fpc_check_object call earlier for the ppc, so it can't destroy
  1328. already-loaded parameter registers
  1329. Revision 1.60 2003/05/11 21:48:38 jonas
  1330. * fixed procvar bug on the ppc (load procvar before loading para's,
  1331. because the procvar may otherwise destroy the already loaded paras)
  1332. Revision 1.59 2003/05/09 17:47:02 peter
  1333. * self moved to hidden parameter
  1334. * removed hdisposen,hnewn,selfn
  1335. Revision 1.58 2003/05/05 14:53:16 peter
  1336. * vs_hidden replaced by is_hidden boolean
  1337. Revision 1.57 2003/04/30 20:53:32 florian
  1338. * error when address of an abstract method is taken
  1339. * fixed some x86-64 problems
  1340. * merged some more x86-64 and i386 code
  1341. Revision 1.56 2003/04/29 07:28:52 michael
  1342. + Patch from peter to fix wrong pushing of ansistring function results in open array
  1343. Revision 1.55 2003/04/27 11:21:33 peter
  1344. * aktprocdef renamed to current_procinfo.procdef
  1345. * procinfo renamed to current_procinfo
  1346. * procinfo will now be stored in current_module so it can be
  1347. cleaned up properly
  1348. * gen_main_procsym changed to create_main_proc and release_main_proc
  1349. to also generate a tprocinfo structure
  1350. * fixed unit implicit initfinal
  1351. Revision 1.54 2003/04/27 07:29:50 peter
  1352. * current_procinfo.procdef cleanup, current_procinfo.procdef is now always nil when parsing
  1353. a new procdef declaration
  1354. * aktprocsym removed
  1355. * lexlevel removed, use symtable.symtablelevel instead
  1356. * implicit init/final code uses the normal genentry/genexit
  1357. * funcret state checking updated for new funcret handling
  1358. Revision 1.53 2003/04/25 20:59:33 peter
  1359. * removed funcretn,funcretsym, function result is now in varsym
  1360. and aliases for result and function name are added using absolutesym
  1361. * vs_hidden parameter for funcret passed in parameter
  1362. * vs_hidden fixes
  1363. * writenode changed to printnode and released from extdebug
  1364. * -vp option added to generate a tree.log with the nodetree
  1365. * nicer printnode for statements, callnode
  1366. Revision 1.52 2003/04/25 08:25:26 daniel
  1367. * Ifdefs around a lot of calls to cleartempgen
  1368. * Fixed registers that are allocated but not freed in several nodes
  1369. * Tweak to register allocator to cause less spills
  1370. * 8-bit registers now interfere with esi,edi and ebp
  1371. Compiler can now compile rtl successfully when using new register
  1372. allocator
  1373. Revision 1.51 2003/04/22 23:50:22 peter
  1374. * firstpass uses expectloc
  1375. * checks if there are differences between the expectloc and
  1376. location.loc from secondpass in EXTDEBUG
  1377. Revision 1.50 2003/04/22 14:33:38 peter
  1378. * removed some notes/hints
  1379. Revision 1.49 2003/04/22 13:47:08 peter
  1380. * fixed C style array of const
  1381. * fixed C array passing
  1382. * fixed left to right with high parameters
  1383. Revision 1.48 2003/04/22 10:09:34 daniel
  1384. + Implemented the actual register allocator
  1385. + Scratch registers unavailable when new register allocator used
  1386. + maybe_save/maybe_restore unavailable when new register allocator used
  1387. Revision 1.47 2003/04/22 09:49:44 peter
  1388. * do not load self when calling a non-inherited class constructor
  1389. Revision 1.46 2003/04/21 20:03:32 peter
  1390. * forgot to copy vmtrefaddr to selfrefaddr when self=vmt
  1391. Revision 1.45 2003/04/21 13:53:16 jonas
  1392. - removed copying of all paras when secondpassing a callnode (this used
  1393. to be necessary for inlinign support, but currently the whole inlined
  1394. procedure is already copied in advance). Note that the compiler crashes
  1395. when compiling ucomplex with -dTEST_INLINE (also after fixing the
  1396. syntax errors), but that was also the case before this change.
  1397. Revision 1.44 2003/04/10 17:57:52 peter
  1398. * vs_hidden released
  1399. Revision 1.43 2003/04/06 21:11:23 olle
  1400. * changed newasmsymbol to newasmsymboldata for data symbols
  1401. Revision 1.42 2003/04/04 15:38:56 peter
  1402. * moved generic code from n386cal to ncgcal, i386 now also
  1403. uses the generic ncgcal
  1404. Revision 1.41 2003/03/28 19:16:56 peter
  1405. * generic constructor working for i386
  1406. * remove fixed self register
  1407. * esi added as address register for i386
  1408. Revision 1.40 2003/03/06 11:35:50 daniel
  1409. * Fixed internalerror 7843 issue
  1410. Revision 1.39 2003/02/19 22:00:14 daniel
  1411. * Code generator converted to new register notation
  1412. - Horribily outdated todo.txt removed
  1413. Revision 1.38 2003/02/15 22:17:38 carl
  1414. * bugfix of FPU emulation code
  1415. Revision 1.37 2003/02/12 22:10:07 carl
  1416. * load_frame_pointer is now generic
  1417. * change fpu emulation routine names
  1418. Revision 1.36 2003/01/30 21:46:57 peter
  1419. * self fixes for static methods (merged)
  1420. Revision 1.35 2003/01/22 20:45:15 mazen
  1421. * making math code in RTL compiling.
  1422. *NB : This does NOT mean necessary that it will generate correct code!
  1423. Revision 1.34 2003/01/17 12:03:45 daniel
  1424. * Optalign conditional code adapted to record Tregister
  1425. Revision 1.33 2003/01/08 18:43:56 daniel
  1426. * Tregister changed into a record
  1427. Revision 1.32 2002/12/15 22:50:00 florian
  1428. + some stuff for the new hidden parameter handling added
  1429. Revision 1.31 2002/12/15 21:30:12 florian
  1430. * tcallnode.paraitem introduced, all references to defcoll removed
  1431. Revision 1.30 2002/11/27 20:04:39 peter
  1432. * cdecl array of const fixes
  1433. Revision 1.29 2002/11/25 17:43:17 peter
  1434. * splitted defbase in defutil,symutil,defcmp
  1435. * merged isconvertable and is_equal into compare_defs(_ext)
  1436. * made operator search faster by walking the list only once
  1437. Revision 1.28 2002/11/18 17:31:54 peter
  1438. * pass proccalloption to ret_in_xxx and push_xxx functions
  1439. Revision 1.27 2002/11/16 15:34:30 florian
  1440. * generic location for float results
  1441. Revision 1.26 2002/11/15 01:58:51 peter
  1442. * merged changes from 1.0.7 up to 04-11
  1443. - -V option for generating bug report tracing
  1444. - more tracing for option parsing
  1445. - errors for cdecl and high()
  1446. - win32 import stabs
  1447. - win32 records<=8 are returned in eax:edx (turned off by default)
  1448. - heaptrc update
  1449. - more info for temp management in .s file with EXTDEBUG
  1450. Revision 1.25 2002/10/05 12:43:25 carl
  1451. * fixes for Delphi 6 compilation
  1452. (warning : Some features do not work under Delphi)
  1453. Revision 1.24 2002/09/30 07:00:45 florian
  1454. * fixes to common code to get the alpha compiler compiled applied
  1455. Revision 1.23 2002/09/17 18:54:02 jonas
  1456. * a_load_reg_reg() now has two size parameters: source and dest. This
  1457. allows some optimizations on architectures that don't encode the
  1458. register size in the register name.
  1459. Revision 1.22 2002/09/07 15:25:02 peter
  1460. * old logs removed and tabs fixed
  1461. Revision 1.21 2002/09/07 11:50:02 jonas
  1462. * fixed small regalloction info bug
  1463. Revision 1.20 2002/09/02 11:25:20 florian
  1464. * fixed generic procedure variable calling
  1465. Revision 1.19 2002/09/01 21:04:48 florian
  1466. * several powerpc related stuff fixed
  1467. Revision 1.18 2002/09/01 18:43:27 peter
  1468. * include FUNCTION_RETURN_REG in regs_to_push list
  1469. Revision 1.17 2002/09/01 12:13:00 peter
  1470. * use a_call_reg
  1471. * ungetiftemp for procvar of object temp
  1472. Revision 1.16 2002/08/25 19:25:18 peter
  1473. * sym.insert_in_data removed
  1474. * symtable.insertvardata/insertconstdata added
  1475. * removed insert_in_data call from symtable.insert, it needs to be
  1476. called separatly. This allows to deref the address calculation
  1477. * procedures now calculate the parast addresses after the procedure
  1478. directives are parsed. This fixes the cdecl parast problem
  1479. * push_addr_param has an extra argument that specifies if cdecl is used
  1480. or not
  1481. Revision 1.15 2002/08/23 16:14:48 peter
  1482. * tempgen cleanup
  1483. * tt_noreuse temp type added that will be used in genentrycode
  1484. Revision 1.14 2002/08/20 16:55:38 peter
  1485. * don't write (stabs)line info when inlining a procedure
  1486. Revision 1.13 2002/08/19 19:36:42 peter
  1487. * More fixes for cross unit inlining, all tnodes are now implemented
  1488. * Moved pocall_internconst to po_internconst because it is not a
  1489. calling type at all and it conflicted when inlining of these small
  1490. functions was requested
  1491. Revision 1.12 2002/08/18 20:06:23 peter
  1492. * inlining is now also allowed in interface
  1493. * renamed write/load to ppuwrite/ppuload
  1494. * tnode storing in ppu
  1495. * nld,ncon,nbas are already updated for storing in ppu
  1496. Revision 1.11 2002/08/17 22:09:44 florian
  1497. * result type handling in tcgcal.pass_2 overhauled
  1498. * better tnode.dowrite
  1499. * some ppc stuff fixed
  1500. Revision 1.10 2002/08/17 09:23:35 florian
  1501. * first part of procinfo rewrite
  1502. Revision 1.9 2002/08/13 21:40:55 florian
  1503. * more fixes for ppc calling conventions
  1504. Revision 1.8 2002/08/13 18:01:51 carl
  1505. * rename swatoperands to swapoperands
  1506. + m68k first compilable version (still needs a lot of testing):
  1507. assembler generator, system information , inline
  1508. assembler reader.
  1509. Revision 1.7 2002/08/12 15:08:39 carl
  1510. + stab register indexes for powerpc (moved from gdb to cpubase)
  1511. + tprocessor enumeration moved to cpuinfo
  1512. + linker in target_info is now a class
  1513. * many many updates for m68k (will soon start to compile)
  1514. - removed some ifdef or correct them for correct cpu
  1515. Revision 1.6 2002/08/11 14:32:26 peter
  1516. * renamed current_library to objectlibrary
  1517. Revision 1.5 2002/08/11 13:24:11 peter
  1518. * saving of asmsymbols in ppu supported
  1519. * asmsymbollist global is removed and moved into a new class
  1520. tasmlibrarydata that will hold the info of a .a file which
  1521. corresponds with a single module. Added librarydata to tmodule
  1522. to keep the library info stored for the module. In the future the
  1523. objectfiles will also be stored to the tasmlibrarydata class
  1524. * all getlabel/newasmsymbol and friends are moved to the new class
  1525. Revision 1.4 2002/08/06 20:55:20 florian
  1526. * first part of ppc calling conventions fix
  1527. Revision 1.3 2002/07/20 11:57:53 florian
  1528. * types.pas renamed to defbase.pas because D6 contains a types
  1529. unit so this would conflicts if D6 programms are compiled
  1530. + Willamette/SSE2 instructions to assembler added
  1531. Revision 1.2 2002/07/13 19:38:43 florian
  1532. * some more generic calling stuff fixed
  1533. }