ncgcal.pas 68 KB

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