ncgcal.pas 68 KB

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