ncgcal.pas 70 KB

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