ncgcal.pas 66 KB

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