ncgcal.pas 68 KB

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