ncgcal.pas 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722
  1. {
  2. Id: ncgcal.pas,v 1.10 2002/08/17 09:23:35 florian Exp $
  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. protected
  33. funcretref : treference;
  34. refcountedtemp : treference;
  35. procedure handle_return_value(inlined,extended_new:boolean);
  36. procedure load_framepointer;virtual;abstract;
  37. procedure extra_interrupt_code;virtual;
  38. public
  39. procedure pass_2;override;
  40. end;
  41. tcgprocinlinenode = class(tprocinlinenode)
  42. procedure pass_2;override;
  43. end;
  44. implementation
  45. uses
  46. systems,
  47. cutils,verbose,globals,
  48. symconst,symbase,symsym,symtable,defutil,paramgr,
  49. {$ifdef GDB}
  50. {$ifdef delphi}
  51. sysutils,
  52. {$else}
  53. strings,
  54. {$endif}
  55. gdb,
  56. {$endif GDB}
  57. cginfo,cgbase,pass_2,
  58. cpuinfo,cpupi,aasmbase,aasmtai,aasmcpu,
  59. nmem,nld,ncnv,
  60. {$ifdef i386}
  61. cga,
  62. {$endif i386}
  63. cg64f32,ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cgcpu;
  64. {*****************************************************************************
  65. TCGCALLPARANODE
  66. *****************************************************************************}
  67. procedure tcgcallparanode.secondcallparan(push_from_left_to_right:boolean;calloption:tproccalloption;para_alignment,para_offset : longint);
  68. {$ifndef VS_HIDDEN}
  69. { goes to pass 1 }
  70. procedure maybe_push_high;
  71. begin
  72. { open array ? }
  73. { defcoll.data can be nil for read/write }
  74. if assigned(paraitem.paratype.def) and
  75. assigned(hightree) then
  76. begin
  77. secondpass(hightree);
  78. { this is a longint anyway ! }
  79. push_value_para(hightree,calloption,para_offset,4,paraitem.paraloc);
  80. end;
  81. end;
  82. {$endif VS_HIDDEN}
  83. var
  84. otlabel,oflabel : tasmlabel;
  85. { temporary variables: }
  86. tempdeftype : tdeftype;
  87. tmpreg : tregister;
  88. href : treference;
  89. begin
  90. { push from left to right if specified }
  91. if push_from_left_to_right and assigned(right) then
  92. begin
  93. if (nf_varargs_para in flags) then
  94. tcallparanode(right).secondcallparan(push_from_left_to_right,
  95. calloption,para_alignment,para_offset)
  96. else
  97. tcallparanode(right).secondcallparan(push_from_left_to_right,
  98. calloption,para_alignment,para_offset);
  99. end;
  100. otlabel:=truelabel;
  101. oflabel:=falselabel;
  102. objectlibrary.getlabel(truelabel);
  103. objectlibrary.getlabel(falselabel);
  104. secondpass(left);
  105. { handle varargs first, because defcoll is not valid }
  106. if (nf_varargs_para in flags) then
  107. begin
  108. if paramanager.push_addr_param(left.resulttype.def,calloption) then
  109. begin
  110. inc(pushedparasize,4);
  111. cg.a_paramaddr_ref(exprasmlist,left.location.reference,paraitem.paraloc);
  112. location_release(exprasmlist,left.location);
  113. end
  114. else
  115. push_value_para(left,calloption,para_offset,para_alignment,paraitem.paraloc);
  116. end
  117. { filter array constructor with c styled args }
  118. else if is_array_constructor(left.resulttype.def) and (nf_cargs in left.flags) then
  119. begin
  120. { nothing, everything is already pushed }
  121. end
  122. { in codegen.handleread.. paraitem.data is set to nil }
  123. else if assigned(paraitem.paratype.def) and
  124. (paraitem.paratype.def.deftype=formaldef) then
  125. begin
  126. { allow passing of a constant to a const formaldef }
  127. if (paraitem.paratyp=vs_const) and
  128. (left.location.loc=LOC_CONSTANT) then
  129. location_force_mem(exprasmlist,left.location);
  130. { allow @var }
  131. inc(pushedparasize,4);
  132. if (left.nodetype=addrn) and
  133. (not(nf_procvarload in left.flags)) then
  134. begin
  135. if calloption=pocall_inline then
  136. begin
  137. reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
  138. cg.a_load_loc_ref(exprasmlist,left.location,href);
  139. end
  140. else
  141. cg.a_param_loc(exprasmlist,left.location,paraitem.paraloc);
  142. location_release(exprasmlist,left.location);
  143. end
  144. else
  145. begin
  146. if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
  147. begin
  148. CGMessage(type_e_mismatch)
  149. end
  150. else
  151. begin
  152. if calloption=pocall_inline then
  153. begin
  154. tmpreg:=cg.get_scratch_reg_address(exprasmlist);
  155. cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
  156. reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
  157. cg.a_load_reg_ref(exprasmlist,OS_ADDR,tmpreg,href);
  158. cg.free_scratch_reg(exprasmlist,tmpreg);
  159. end
  160. else
  161. cg.a_paramaddr_ref(exprasmlist,left.location.reference,paraitem.paraloc);
  162. location_release(exprasmlist,left.location);
  163. end;
  164. end;
  165. end
  166. { handle call by reference parameter }
  167. else if (paraitem.paratyp in [vs_var,vs_out]) then
  168. begin
  169. if (left.location.loc<>LOC_REFERENCE) then
  170. begin
  171. { passing self to a var parameter is allowed in
  172. TP and delphi }
  173. if not((left.location.loc=LOC_CREFERENCE) and
  174. (left.nodetype=selfn)) then
  175. internalerror(200106041);
  176. end;
  177. {$ifdef unused}
  178. if not push_from_left_to_right then
  179. {$endif unused}
  180. {$ifndef VS_HIDDEN}
  181. maybe_push_high;
  182. {$endif VS_HIDDEN}
  183. if (paraitem.paratyp=vs_out) and
  184. assigned(paraitem.paratype.def) and
  185. not is_class(paraitem.paratype.def) and
  186. paraitem.paratype.def.needs_inittable then
  187. cg.g_finalize(exprasmlist,paraitem.paratype.def,left.location.reference,false);
  188. inc(pushedparasize,4);
  189. if calloption=pocall_inline then
  190. begin
  191. tmpreg:=cg.get_scratch_reg_address(exprasmlist);
  192. cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
  193. reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
  194. cg.a_load_reg_ref(exprasmlist,OS_ADDR,tmpreg,href);
  195. cg.free_scratch_reg(exprasmlist,tmpreg);
  196. end
  197. else
  198. cg.a_paramaddr_ref(exprasmlist,left.location.reference,paraitem.paraloc);
  199. location_release(exprasmlist,left.location);
  200. {$ifdef unused}
  201. if push_from_left_to_right then
  202. maybe_push_high;
  203. {$endif unused}
  204. end
  205. else
  206. begin
  207. tempdeftype:=resulttype.def.deftype;
  208. if tempdeftype=filedef then
  209. CGMessage(cg_e_file_must_call_by_reference);
  210. { open array must always push the address, this is needed to
  211. also push addr of small open arrays and with cdecl functions (PFV) }
  212. if (
  213. assigned(paraitem.paratype.def) and
  214. (is_open_array(paraitem.paratype.def) or
  215. is_array_of_const(paraitem.paratype.def))
  216. ) or
  217. (
  218. paramanager.push_addr_param(resulttype.def,calloption)
  219. ) then
  220. begin
  221. if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
  222. begin
  223. { allow passing nil to a procvardef (methodpointer) }
  224. (* if (left.nodetype=typeconvn) and
  225. (left.resulttype.def.deftype=procvardef) and
  226. (ttypeconvnode(left).left.nodetype=niln) then
  227. *)
  228. if (left.location.size <> OS_NO) then
  229. begin
  230. tg.GetTemp(exprasmlist,tcgsize2size[left.location.size],tt_normal,href);
  231. if not (left.location.size in [OS_64,OS_S64]) then
  232. cg.a_load_loc_ref(exprasmlist,left.location,href)
  233. else
  234. cg64.a_load64_loc_ref(exprasmlist,left.location,href);
  235. location_reset(left.location,LOC_REFERENCE,left.location.size);
  236. left.location.reference:=href;
  237. end
  238. else
  239. internalerror(200204011);
  240. end;
  241. {$ifdef unused}
  242. if not push_from_left_to_right then
  243. {$endif unused}
  244. {$ifndef VS_HIDDEN}
  245. maybe_push_high;
  246. {$endif VS_HIDDEN}
  247. inc(pushedparasize,4);
  248. if calloption=pocall_inline then
  249. begin
  250. tmpreg:=cg.get_scratch_reg_address(exprasmlist);
  251. cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
  252. reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
  253. cg.a_load_reg_ref(exprasmlist,OS_ADDR,tmpreg,href);
  254. cg.free_scratch_reg(exprasmlist,tmpreg);
  255. end
  256. else
  257. cg.a_paramaddr_ref(exprasmlist,left.location.reference,paraitem.paraloc);
  258. location_release(exprasmlist,left.location);
  259. {$ifdef unused}
  260. if push_from_left_to_right then
  261. maybe_push_high;
  262. {$endif unused}
  263. end
  264. else
  265. begin
  266. push_value_para(left,calloption,
  267. para_offset,para_alignment,paraitem.paraloc);
  268. end;
  269. end;
  270. truelabel:=otlabel;
  271. falselabel:=oflabel;
  272. { push from right to left }
  273. if not push_from_left_to_right and assigned(right) then
  274. begin
  275. if (nf_varargs_para in flags) then
  276. tcallparanode(right).secondcallparan(push_from_left_to_right,
  277. calloption,para_alignment,para_offset)
  278. else
  279. tcallparanode(right).secondcallparan(push_from_left_to_right,
  280. calloption,para_alignment,para_offset);
  281. end;
  282. end;
  283. {*****************************************************************************
  284. TCGCALLNODE
  285. *****************************************************************************}
  286. procedure tcgcallnode.extra_interrupt_code;
  287. var r:Tregister;
  288. begin
  289. {$ifdef i386}
  290. { if the i386 ever uses tcgcal, we've to move this into an overriden method }
  291. emit_none(A_PUSHF,S_L);
  292. r.enum:=R_CS;
  293. emit_reg(A_PUSH,S_L,r);
  294. {$endif i386}
  295. end;
  296. procedure tcgcallnode.handle_return_value(inlined,extended_new:boolean);
  297. var
  298. cgsize : tcgsize;
  299. r,hregister : tregister;
  300. begin
  301. { structured results are easy to handle.... }
  302. { needed also when result_no_used !! }
  303. if paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
  304. begin
  305. location_reset(location,LOC_CREFERENCE,def_cgsize(resulttype.def));
  306. location.reference.symbol:=nil;
  307. location.reference:=funcretref;
  308. end
  309. else
  310. { ansi/widestrings must be registered, so we can dispose them }
  311. if is_ansistring(resulttype.def) or
  312. is_widestring(resulttype.def) then
  313. begin
  314. location_reset(location,LOC_CREFERENCE,OS_ADDR);
  315. location.reference:=refcountedtemp;
  316. r.enum:=accumulator;
  317. cg.a_reg_alloc(exprasmlist,r);
  318. cg.a_load_reg_ref(exprasmlist,OS_ADDR,r,location.reference);
  319. cg.a_reg_dealloc(exprasmlist,r);
  320. end
  321. else
  322. { we have only to handle the result if it is used }
  323. if (nf_return_value_used in flags) then
  324. begin
  325. case resulttype.def.deftype of
  326. enumdef,
  327. orddef :
  328. begin
  329. cgsize:=def_cgsize(resulttype.def);
  330. { an object constructor is a function with boolean result }
  331. if (inlined or (right=nil)) and
  332. (procdefinition.proctypeoption=potype_constructor) then
  333. begin
  334. {$ifdef x86}
  335. if extended_new then
  336. cgsize:=OS_INT
  337. else
  338. begin
  339. cgsize:=OS_NO;
  340. { this fails if popsize > 0 PM }
  341. location_reset(location,LOC_FLAGS,OS_NO);
  342. location.resflags:=F_NE;
  343. end;
  344. {$else x86}
  345. cgsize:=OS_INT
  346. {$endif x86}
  347. end;
  348. if cgsize<>OS_NO then
  349. begin
  350. location_reset(location,LOC_REGISTER,cgsize);
  351. r.enum:=accumulator;
  352. hregister.enum:=accumulatorhigh;
  353. cg.a_reg_alloc(exprasmlist,r);
  354. {$ifndef cpu64bit}
  355. if cgsize in [OS_64,OS_S64] then
  356. begin
  357. cg.a_reg_alloc(exprasmlist,hregister);
  358. location.registerhigh:=rg.getexplicitregisterint(exprasmlist,hregister.enum);
  359. location.registerlow:=rg.getexplicitregisterint(exprasmlist,r.enum);
  360. cg64.a_load64_reg_reg(exprasmlist,joinreg64(r,hregister),
  361. location.register64);
  362. end
  363. else
  364. {$endif cpu64bit}
  365. begin
  366. location.register:=rg.getexplicitregisterint(exprasmlist,r.enum);
  367. hregister:=rg.makeregsize(r,cgsize);
  368. location.register:=rg.makeregsize(location.register,cgsize);
  369. cg.a_load_reg_reg(exprasmlist,cgsize,cgsize,hregister,location.register);
  370. end;
  371. end;
  372. end;
  373. floatdef :
  374. begin
  375. location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
  376. location.register.enum:=fpu_result_reg;
  377. {$ifdef x86}
  378. inc(trgcpu(rg).fpuvaroffset);
  379. {$endif x86}
  380. end;
  381. {$ifdef TEST_WIN32_RECORDS}
  382. recorddef :
  383. begin
  384. if (target_info.system=system_i386_win32) then
  385. begin
  386. location_reset(location,LOC_REFERENCE,def_cgsize(resulttype.def));
  387. tg.GetTemp(exprasmlist,resulttype.size,tt_normal,location);
  388. {$ifndef cpu64bit}
  389. if cgsize in [OS_64,OS_S64] then
  390. cg64.a_load64_reg_loc(exprasmlist,joinreg64(accumulator,accumulatorhigh),location)
  391. else
  392. {$endif cpu64bit}
  393. cg.a_load_reg_loc(exprasmlist,accumulator,location);
  394. end
  395. else
  396. internalerror(200211141);
  397. end;
  398. {$endif TEST_WIN32_RECORDS}
  399. else
  400. begin
  401. location_reset(location,LOC_REGISTER,OS_INT);
  402. location.register:=rg.getexplicitregisterint(exprasmlist,accumulator);
  403. r.enum:=accumulator;
  404. cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,r,location.register);
  405. end;
  406. end;
  407. end;
  408. end;
  409. procedure tcgcallnode.pass_2;
  410. var
  411. regs_to_push : tregisterset;
  412. unusedstate: pointer;
  413. pushed : tpushedsaved;
  414. tmpreg : tregister;
  415. hregister : tregister;
  416. hregister64 : tregister64;
  417. oldpushedparasize : longint;
  418. { true if ESI must be loaded again after the subroutine }
  419. loadesi : boolean;
  420. { true if a virtual method must be called directly }
  421. no_virtual_call : boolean;
  422. { true if we produce a con- or destrutor in a call }
  423. is_con_or_destructor : boolean;
  424. { true if a constructor is called again }
  425. extended_new : boolean;
  426. { adress returned from an I/O-error }
  427. iolabel : tasmlabel;
  428. { lexlevel count }
  429. i : longint;
  430. { help reference pointer }
  431. href : treference;
  432. hrefvmt : treference;
  433. hp : tnode;
  434. pp : tbinarynode;
  435. params : tnode;
  436. inlined : boolean;
  437. inlinecode : tprocinlinenode;
  438. store_parast_fixup,
  439. para_alignment,
  440. para_offset : longint;
  441. cgsize : tcgsize;
  442. { instruction for alignement correction }
  443. { corr : paicpu;}
  444. { we must pop this size also after !! }
  445. { must_pop : boolean; }
  446. pop_size : longint;
  447. {$ifdef OPTALIGN}
  448. pop_esp : boolean;
  449. push_size : longint;
  450. {$endif OPTALIGN}
  451. pop_allowed : boolean;
  452. release_tmpreg : boolean;
  453. constructorfailed : tasmlabel;
  454. resultloc : tparalocation;
  455. returnref,
  456. pararef : treference;
  457. r,r2:Tregister;
  458. label
  459. dont_call;
  460. begin
  461. extended_new:=false;
  462. iolabel:=nil;
  463. inlinecode:=nil;
  464. inlined:=false;
  465. loadesi:=true;
  466. no_virtual_call:=false;
  467. rg.saveunusedstate(unusedstate);
  468. { if we allocate the temp. location for ansi- or widestrings }
  469. { already here, we avoid later a push/pop }
  470. if is_widestring(resulttype.def) then
  471. begin
  472. tg.GetTemp(exprasmlist,pointer_size,tt_widestring,refcountedtemp);
  473. cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp);
  474. end
  475. else if is_ansistring(resulttype.def) then
  476. begin
  477. tg.GetTemp(exprasmlist,pointer_size,tt_ansistring,refcountedtemp);
  478. cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp);
  479. end;
  480. if (procdefinition.proccalloption in [pocall_cdecl,pocall_cppdecl,pocall_stdcall]) then
  481. para_alignment:=4
  482. else
  483. para_alignment:=aktalignment.paraalign;
  484. if not assigned(procdefinition) then
  485. exit;
  486. { Deciding whether we may still need the parameters happens next (JM) }
  487. if assigned(left) then
  488. params:=left.getcopy
  489. else
  490. params := nil;
  491. if (procdefinition.proccalloption=pocall_inline) then
  492. begin
  493. inlined:=true;
  494. inlinecode:=tprocinlinenode(right);
  495. right:=nil;
  496. { set it to the same lexical level as the local symtable, becuase
  497. the para's are stored there }
  498. tprocdef(procdefinition).parast.symtablelevel:=aktprocdef.localst.symtablelevel;
  499. if assigned(params) then
  500. begin
  501. inlinecode.para_size:=tprocdef(procdefinition).para_size(para_alignment);
  502. tg.GetTemp(exprasmlist,inlinecode.para_size,tt_persistant,pararef);
  503. inlinecode.para_offset:=pararef.offset;
  504. end;
  505. store_parast_fixup:=tprocdef(procdefinition).parast.address_fixup;
  506. tprocdef(procdefinition).parast.address_fixup:=inlinecode.para_offset;
  507. {$ifdef extdebug}
  508. Comment(V_debug,
  509. 'inlined parasymtable is at offset '
  510. +tostr(tprocdef(procdefinition).parast.address_fixup));
  511. exprasmList.concat(tai_comment.Create(
  512. strpnew('inlined parasymtable is at offset '
  513. +tostr(tprocdef(procdefinition).parast.address_fixup))));
  514. {$endif extdebug}
  515. end;
  516. { only if no proc var }
  517. if inlined or
  518. not(assigned(right)) then
  519. is_con_or_destructor:=(procdefinition.proctypeoption in [potype_constructor,potype_destructor]);
  520. { proc variables destroy all registers }
  521. if (inlined or
  522. (right=nil)) and
  523. { virtual methods too }
  524. not(po_virtualmethod in procdefinition.procoptions) then
  525. begin
  526. if (cs_check_io in aktlocalswitches) and
  527. (po_iocheck in procdefinition.procoptions) and
  528. not(po_iocheck in aktprocdef.procoptions) then
  529. begin
  530. objectlibrary.getaddrlabel(iolabel);
  531. cg.a_label(exprasmlist,iolabel);
  532. end
  533. else
  534. iolabel:=nil;
  535. { save all used registers and possible registers
  536. used for the return value }
  537. regs_to_push := tprocdef(procdefinition).usedregisters;
  538. if (not is_void(resulttype.def)) and
  539. (not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
  540. begin
  541. include(regs_to_push,accumulator);
  542. {$ifndef cpu64bit}
  543. if resulttype.def.size>sizeof(aword) then
  544. include(regs_to_push,accumulatorhigh);
  545. {$endif cpu64bit}
  546. end;
  547. rg.saveusedregisters(exprasmlist,pushed,regs_to_push);
  548. { give used registers through }
  549. rg.usedinproc:=rg.usedinproc + tprocdef(procdefinition).usedregisters;
  550. end
  551. else
  552. begin
  553. regs_to_push := all_registers;
  554. rg.saveusedregisters(exprasmlist,pushed,regs_to_push);
  555. rg.usedinproc:=all_registers;
  556. { no IO check for methods and procedure variables }
  557. iolabel:=nil;
  558. end;
  559. { generate the code for the parameter and push them }
  560. oldpushedparasize:=pushedparasize;
  561. pushedparasize:=0;
  562. pop_size:=0;
  563. {$ifdef dummy}
  564. { no inc esp for inlined procedure
  565. and for objects constructors PM }
  566. if inlined or
  567. ((procdefinition.proctypeoption=potype_constructor) and
  568. { quick'n'dirty check if it is a class or an object }
  569. (resulttype.def.deftype=orddef)) then
  570. pop_allowed:=false
  571. else
  572. pop_allowed:=true;
  573. if pop_allowed then
  574. begin
  575. { Old pushedsize aligned on 4 ? }
  576. i:=oldpushedparasize and 3;
  577. if i>0 then
  578. inc(pop_size,4-i);
  579. { This parasize aligned on 4 ? }
  580. i:=procdefinition.para_size(para_alignment) and 3;
  581. if i>0 then
  582. inc(pop_size,4-i);
  583. { insert the opcode and update pushedparasize }
  584. { never push 4 or more !! }
  585. pop_size:=pop_size mod 4;
  586. if pop_size>0 then
  587. begin
  588. inc(pushedparasize,pop_size);
  589. cg.a_const_reg(A_SUB,S_L,pop_size,R_ESP);
  590. {$ifdef GDB}
  591. if (cs_debuginfo in aktmoduleswitches) and
  592. (exprasmList.first=exprasmList.last) then
  593. exprasmList.concat(Tai_force_line.Create);
  594. {$endif GDB}
  595. end;
  596. end;
  597. {$endif dummy}
  598. {$ifdef OPTALIGN}
  599. if pop_allowed and (cs_align in aktglobalswitches) then
  600. begin
  601. pop_esp:=true;
  602. push_size:=procdefinition.para_size(para_alignment);
  603. { !!!! here we have to take care of return type, self
  604. and nested procedures
  605. }
  606. inc(push_size,12);
  607. r.enum:=R_ESP:
  608. r2.enum:=R_EDI;
  609. emit_reg_reg(A_MOV,S_L,r,r2);
  610. if (push_size mod 8)=0 then
  611. emit_const_reg(A_AND,S_L,$fffffff8,r)
  612. else
  613. begin
  614. emit_const_reg(A_SUB,S_L,push_size,r);
  615. emit_const_reg(A_AND,S_L,$fffffff8,r);
  616. emit_const_reg(A_SUB,S_L,push_size,r);
  617. end;
  618. emit_reg(A_PUSH,S_L,r2);
  619. end
  620. else
  621. pop_esp:=false;
  622. {$endif OPTALIGN}
  623. { Push parameters }
  624. if assigned(params) then
  625. begin
  626. { be found elsewhere }
  627. if inlined then
  628. para_offset:=tprocdef(procdefinition).parast.address_fixup+
  629. tprocdef(procdefinition).parast.datasize
  630. else
  631. para_offset:=0;
  632. if not(inlined) and
  633. assigned(right) then
  634. tcallparanode(params).secondcallparan(
  635. { TParaItem(tabstractprocdef(right.resulttype.def).Para.first), }
  636. (po_leftright in procdefinition.procoptions),procdefinition.proccalloption,
  637. para_alignment,para_offset)
  638. else
  639. tcallparanode(params).secondcallparan(
  640. { TParaItem(procdefinition.Para.first), }
  641. (po_leftright in procdefinition.procoptions),procdefinition.proccalloption,
  642. para_alignment,para_offset);
  643. end;
  644. { Allocate return value for inlined routines }
  645. if inlined and
  646. (resulttype.def.size>0) then
  647. begin
  648. tg.GetTemp(exprasmlist,Align(resulttype.def.size,aktalignment.paraalign),tt_persistant,returnref);
  649. inlinecode.retoffset:=returnref.offset;
  650. end;
  651. { Allocate return value when returned in argument }
  652. if paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
  653. begin
  654. if assigned(funcretrefnode) then
  655. begin
  656. secondpass(funcretrefnode);
  657. if codegenerror then
  658. exit;
  659. if (funcretrefnode.location.loc<>LOC_REFERENCE) then
  660. internalerror(200204246);
  661. funcretref:=funcretrefnode.location.reference;
  662. end
  663. else
  664. begin
  665. if inlined then
  666. begin
  667. tg.GetTemp(exprasmlist,resulttype.def.size,tt_persistant,funcretref);
  668. {$ifdef extdebug}
  669. Comment(V_debug,'function return value is at offset '
  670. +tostr(funcretref.offset));
  671. exprasmlist.concat(tai_comment.create(
  672. strpnew('function return value is at offset '
  673. +tostr(funcretref.offset))));
  674. {$endif extdebug}
  675. end
  676. else
  677. tg.GetTemp(exprasmlist,resulttype.def.size,tt_normal,funcretref);
  678. end;
  679. { This must not be counted for C code
  680. complex return address is removed from stack
  681. by function itself ! }
  682. {$ifdef OLD_C_STACK}
  683. inc(pushedparasize,4); { lets try without it PM }
  684. {$endif not OLD_C_STACK}
  685. if inlined then
  686. begin
  687. hregister:=cg.get_scratch_reg_address(exprasmlist);
  688. cg.a_loadaddr_ref_reg(exprasmlist,funcretref,hregister);
  689. reference_reset_base(href,procinfo.framepointer,inlinecode.retoffset);
  690. cg.a_load_reg_ref(exprasmlist,OS_ADDR,hregister,href);
  691. cg.free_scratch_reg(exprasmlist,hregister);
  692. end
  693. else
  694. cg.a_paramaddr_ref(exprasmlist,funcretref,
  695. paramanager.getfuncretparaloc(procdefinition));
  696. end;
  697. { procedure variable or normal function call ? }
  698. if inlined or
  699. (right=nil) then
  700. begin
  701. { Normal function call }
  702. {$ifdef dummy}
  703. { overloaded operator has no symtable }
  704. { push self }
  705. if assigned(symtableproc) and
  706. (symtableproc.symtabletype=withsymtable) then
  707. begin
  708. { dirty trick to avoid the secondcall below }
  709. methodpointer:=ccallparanode.create(nil,nil);
  710. location_reset(methodpointer.location,LOC_REGISTER,OS_ADDR);
  711. rg.getexplicitregisterint(exprasmlist,R_ESI);
  712. methodpointer.location.register:=R_ESI;
  713. { ARGHHH this is wrong !!!
  714. if we can init from base class for a child
  715. class that the wrong VMT will be
  716. transfered to constructor !! }
  717. methodpointer.resulttype:=
  718. twithnode(twithsymtable(symtableproc).withnode).left.resulttype;
  719. { make a reference }
  720. href:=twithnode(twithsymtable(symtableproc).withnode).withreference;
  721. if ((not(nf_islocal in twithnode(twithsymtable(symtableproc).withnode).flags)) and
  722. (not twithsymtable(symtableproc).direct_with)) or
  723. is_class_or_interface(methodpointer.resulttype.def) then
  724. cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,self_pointer_reg)
  725. else
  726. cg.a_loadaddr_ref_reg(exprasmlist,href,self_pointer_reg);
  727. end;
  728. { push self }
  729. if assigned(symtableproc) and
  730. ((symtableproc.symtabletype=objectsymtable) or
  731. (symtableproc.symtabletype=withsymtable)) then
  732. begin
  733. if assigned(methodpointer) then
  734. begin
  735. {
  736. if methodpointer^.resulttype.def=classrefdef then
  737. begin
  738. two possibilities:
  739. 1. constructor
  740. 2. class method
  741. end
  742. else }
  743. begin
  744. case methodpointer.nodetype of
  745. typen:
  746. begin
  747. { direct call to inherited method }
  748. if (po_abstractmethod in procdefinition.procoptions) then
  749. begin
  750. CGMessage(cg_e_cant_call_abstract_method);
  751. goto dont_call;
  752. end;
  753. { generate no virtual call }
  754. no_virtual_call:=true;
  755. if (sp_static in symtableprocentry.symoptions) then
  756. begin
  757. { well lets put the VMT address directly into ESI }
  758. { it is kind of dirty but that is the simplest }
  759. { way to accept virtual static functions (PM) }
  760. loadesi:=true;
  761. { if no VMT just use $0 bug0214 PM }
  762. rg.getexplicitregisterint(exprasmlist,R_ESI);
  763. if not(oo_has_vmt in tobjectdef(methodpointer.resulttype.def).objectoptions) then
  764. cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg)
  765. else
  766. begin
  767. reference_reset_symbol(href,objectlibrary.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
  768. cg.a_loadaddr_ref_reg(exprasmlist,href,self_pointer_reg);
  769. end;
  770. { emit_reg(A_PUSH,S_L,R_ESI);
  771. this is done below !! }
  772. end
  773. else
  774. { this is a member call, so ESI isn't modfied }
  775. loadesi:=false;
  776. { a class destructor needs a flag }
  777. if is_class(tobjectdef(methodpointer.resulttype.def)) and
  778. (procdefinition.proctypeoption=potype_destructor) then
  779. begin
  780. cg.a_param_const(exprasmlist,OS_ADDR,0,2);
  781. cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,1);
  782. end;
  783. if not(is_con_or_destructor and
  784. is_class(methodpointer.resulttype.def) and
  785. (procdefinition.proctypeoption in [potype_constructor,potype_destructor])
  786. ) then
  787. cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,1);
  788. { if an inherited con- or destructor should be }
  789. { called in a con- or destructor then a warning }
  790. { will be made }
  791. { con- and destructors need a pointer to the vmt }
  792. if is_con_or_destructor and
  793. is_object(methodpointer.resulttype.def) and
  794. assigned(aktprocdef) then
  795. begin
  796. if not(aktprocdef.proctypeoption in
  797. [potype_constructor,potype_destructor]) then
  798. CGMessage(cg_w_member_cd_call_from_method);
  799. end;
  800. { class destructors get there flag above }
  801. { constructor flags ? }
  802. if is_con_or_destructor and
  803. not(
  804. is_class(methodpointer.resulttype.def) and
  805. assigned(aktprocdef) and
  806. (aktprocdef.proctypeoption=potype_destructor)) then
  807. begin
  808. { a constructor needs also a flag }
  809. if is_class(methodpointer.resulttype.def) then
  810. cg.a_param_const(exprasmlist,OS_ADDR,0,2);
  811. cg.a_param_const(exprasmlist,OS_ADDR,0,1);
  812. end;
  813. end;
  814. hnewn:
  815. begin
  816. { extended syntax of new }
  817. { ESI must be zero }
  818. rg.getexplicitregisterint(exprasmlist,R_ESI);
  819. cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg);
  820. cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,2);
  821. { insert the vmt }
  822. reference_reset_symbol(href,objectlibrary.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
  823. cg.a_paramaddr_ref(exprasmlist,href,1);
  824. extended_new:=true;
  825. end;
  826. hdisposen:
  827. begin
  828. secondpass(methodpointer);
  829. { destructor with extended syntax called from dispose }
  830. { hdisposen always deliver LOC_REFERENCE }
  831. rg.getexplicitregisterint(exprasmlist,R_ESI);
  832. emit_ref_reg(A_LEA,S_L,methodpointer.location.reference,R_ESI);
  833. reference_release(exprasmlist,methodpointer.location.reference);
  834. cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,2);
  835. reference_reset_symbol(href,objectlibrary.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
  836. cg.a_paramaddr_ref(exprasmlist,href,1);
  837. end;
  838. else
  839. begin
  840. { call to an instance member }
  841. if (symtableproc.symtabletype<>withsymtable) then
  842. begin
  843. secondpass(methodpointer);
  844. rg.getexplicitregisterint(exprasmlist,R_ESI);
  845. case methodpointer.location.loc of
  846. LOC_CREGISTER,
  847. LOC_REGISTER:
  848. begin
  849. cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,methodpointer.location.register,R_ESI);
  850. rg.ungetregisterint(exprasmlist,methodpointer.location.register);
  851. end;
  852. else
  853. begin
  854. if (methodpointer.resulttype.def.deftype=classrefdef) or
  855. is_class_or_interface(methodpointer.resulttype.def) then
  856. cg.a_load_ref_reg(exprasmlist,OS_ADDR,methodpointer.location.reference,R_ESI)
  857. else
  858. cg.a_loadaddr_ref_reg(exprasmlist,methodpointer.location.reference,R_ESI);
  859. reference_release(exprasmlist,methodpointer.location.reference);
  860. end;
  861. end;
  862. end;
  863. { when calling a class method, we have to load ESI with the VMT !
  864. But, not for a class method via self }
  865. if not(po_containsself in procdefinition.procoptions) then
  866. begin
  867. if (po_classmethod in procdefinition.procoptions) and
  868. not(methodpointer.resulttype.def.deftype=classrefdef) then
  869. begin
  870. { class method needs current VMT }
  871. rg.getexplicitregisterint(exprasmlist,R_ESI);
  872. reference_reset_base(href,R_ESI,tprocdef(procdefinition)._class.vmt_offset);
  873. cg.a_maybe_testself(exprasmlist);
  874. cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,self_pointer_reg);
  875. end;
  876. { direct call to destructor: remove data }
  877. if (procdefinition.proctypeoption=potype_destructor) and
  878. is_class(methodpointer.resulttype.def) then
  879. cg.a_param_const(exprasmlist,OS_INT,1,1);
  880. { direct call to class constructor, don't allocate memory }
  881. if (procdefinition.proctypeoption=potype_constructor) and
  882. is_class(methodpointer.resulttype.def) then
  883. begin
  884. cg.a_param_const(exprasmlist,OS_INT,0,2);
  885. cg.a_param_const(exprasmlist,OS_INT,0,1);
  886. end
  887. else
  888. begin
  889. { constructor call via classreference => allocate memory }
  890. if (procdefinition.proctypeoption=potype_constructor) and
  891. (methodpointer.resulttype.def.deftype=classrefdef) and
  892. is_class(tclassrefdef(methodpointer.resulttype.def).pointertype.def) then
  893. cg.a_param_const(exprasmlist,OS_INT,1,1);
  894. cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,1);
  895. end;
  896. end;
  897. if is_con_or_destructor then
  898. begin
  899. { classes don't get a VMT pointer pushed }
  900. if is_object(methodpointer.resulttype.def) then
  901. begin
  902. if (procdefinition.proctypeoption=potype_constructor) then
  903. begin
  904. { it's no bad idea, to insert the VMT }
  905. reference_reset_symbol(href,objectlibrary.newasmsymbol(
  906. tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
  907. cg.a_paramaddr_ref(exprasmlist,href,1);
  908. end
  909. { destructors haven't to dispose the instance, if this is }
  910. { a direct call }
  911. else
  912. cg.a_param_const(exprasmlist,OS_INT,0,1);
  913. end;
  914. end;
  915. end;
  916. end;
  917. end;
  918. end
  919. else
  920. begin
  921. if (po_classmethod in procdefinition.procoptions) and
  922. not(
  923. assigned(aktprocdef) and
  924. (po_classmethod in aktprocdef.procoptions)
  925. ) then
  926. begin
  927. { class method needs current VMT }
  928. rg.getexplicitregisterint(exprasmlist,R_ESI);
  929. reference_reset_base(href,R_ESI,tprocdef(procdefinition)._class.vmt_offset);
  930. cg.a_maybe_testself(exprasmlist);
  931. cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,R_ESI);
  932. end
  933. else
  934. begin
  935. { member call, ESI isn't modified }
  936. loadesi:=false;
  937. end;
  938. { direct call to destructor: don't remove data! }
  939. if is_class(procinfo._class) then
  940. begin
  941. if (procdefinition.proctypeoption=potype_destructor) then
  942. begin
  943. cg.a_param_const(exprasmlist,OS_INT,0,2);
  944. cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,1);
  945. end
  946. else if (procdefinition.proctypeoption=potype_constructor) then
  947. begin
  948. cg.a_param_const(exprasmlist,OS_INT,0,2);
  949. cg.a_param_const(exprasmlist,OS_INT,0,1);
  950. end
  951. else
  952. cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,1);
  953. end
  954. else if is_object(procinfo._class) then
  955. begin
  956. cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,1);
  957. if is_con_or_destructor then
  958. begin
  959. if (procdefinition.proctypeoption=potype_constructor) then
  960. begin
  961. { it's no bad idea, to insert the VMT }
  962. reference_reset_symbol(href,objectlibrary.newasmsymbol(procinfo._class.vmt_mangledname),0);
  963. cg.a_paramaddr_ref(exprasmlist,href,1);
  964. end
  965. { destructors haven't to dispose the instance, if this is }
  966. { a direct call }
  967. else
  968. cg.a_param_const(exprasmlist,OS_INT,0,1);
  969. end;
  970. end
  971. else
  972. Internalerror(200006165);
  973. end;
  974. end;
  975. {$endif dummy}
  976. { call to BeforeDestruction? }
  977. if (procdefinition.proctypeoption=potype_destructor) and
  978. assigned(methodpointer) and
  979. (methodpointer.nodetype<>typen) and
  980. is_class(tobjectdef(methodpointer.resulttype.def)) and
  981. (inlined or
  982. (right=nil)) then
  983. begin
  984. r.enum:=self_pointer_reg;
  985. cg.a_param_reg(exprasmlist,OS_ADDR,r,paramanager.getintparaloc(1));
  986. reference_reset_base(href,r,0);
  987. tmpreg:=cg.get_scratch_reg_address(exprasmlist);
  988. cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,tmpreg);
  989. reference_reset_base(href,tmpreg,72);
  990. cg.a_call_ref(exprasmlist,href);
  991. cg.free_scratch_reg(exprasmlist,tmpreg);
  992. end;
  993. {$ifndef SPARC}{We don't need that on SPARC arch!}
  994. { push base pointer ?}
  995. { never when inlining, since if necessary, the base pointer }
  996. { can/will be gottten from the current procedure's symtable }
  997. { (JM)}
  998. if not inlined then
  999. if (lexlevel>=normal_function_level) and assigned(tprocdef(procdefinition).parast) and
  1000. ((tprocdef(procdefinition).parast.symtablelevel)>normal_function_level) then
  1001. load_framepointer;
  1002. {$endif SPARC}
  1003. rg.saveregvars(exprasmlist,regs_to_push);
  1004. {$ifdef dummy}
  1005. if (po_virtualmethod in procdefinition.procoptions) and
  1006. not(no_virtual_call) then
  1007. begin
  1008. { static functions contain the vmt_address in ESI }
  1009. { also class methods }
  1010. { Here it is quite tricky because it also depends }
  1011. { on the methodpointer PM }
  1012. release_tmpreg:=false;
  1013. rg.getexplicitregisterint(exprasmlist,R_ESI);
  1014. if assigned(aktprocdef) then
  1015. begin
  1016. if (((sp_static in aktprocdef.procsym.symoptions) or
  1017. (po_classmethod in aktprocdef.procoptions)) and
  1018. ((methodpointer=nil) or (methodpointer.nodetype=typen)))
  1019. or
  1020. (po_staticmethod in procdefinition.procoptions) or
  1021. ((procdefinition.proctypeoption=potype_constructor) and
  1022. { esi contains the vmt if we call a constructor via a class ref }
  1023. assigned(methodpointer) and
  1024. (methodpointer.resulttype.def.deftype=classrefdef)
  1025. ) or
  1026. { is_interface(tprocdef(procdefinition)._class) or }
  1027. { ESI is loaded earlier }
  1028. (po_classmethod in procdefinition.procoptions) then
  1029. begin
  1030. reference_reset_base(href,R_ESI,0);
  1031. end
  1032. else
  1033. begin
  1034. { this is one point where we need vmt_offset (PM) }
  1035. reference_reset_base(href,R_ESI,tprocdef(procdefinition)._class.vmt_offset);
  1036. cg.a_maybe_testself(exprasmlist);
  1037. tmpreg:=cg.get_scratch_reg_address(exprasmlist);
  1038. cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,tmpreg);
  1039. reference_reset_base(href,tmpreg,0);
  1040. release_tmpreg:=true;
  1041. end;
  1042. end
  1043. else
  1044. { aktprocdef should be assigned, also in main program }
  1045. internalerror(12345);
  1046. if tprocdef(procdefinition).extnumber=-1 then
  1047. internalerror(44584);
  1048. href.offset:=tprocdef(procdefinition)._class.vmtmethodoffset(tprocdef(procdefinition).extnumber);
  1049. if not(is_interface(tprocdef(procdefinition)._class)) and
  1050. not(is_cppclass(tprocdef(procdefinition)._class)) then
  1051. begin
  1052. if (cs_check_object in aktlocalswitches) then
  1053. begin
  1054. reference_reset_symbol(hrefvmt,objectlibrary.newasmsymbol(tprocdef(procdefinition)._class.vmt_mangledname),0);
  1055. cg.a_paramaddr_ref(exprasmlist,hrefvmt,2);
  1056. cg.a_param_reg(exprasmlist,OS_ADDR,href.base,1);
  1057. cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT_EXT');
  1058. end
  1059. else if (cs_check_range in aktlocalswitches) then
  1060. begin
  1061. cg.a_param_reg(exprasmlist,OS_ADDR,href.base,1);
  1062. cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT');
  1063. end;
  1064. end;
  1065. cg.a_call_ref(exprasmlist,href);
  1066. if release_tmpreg then
  1067. cg.free_scratch_reg(exprasmlist,tmpreg);
  1068. end
  1069. else
  1070. {$endif dummy}
  1071. if not inlined then
  1072. begin
  1073. { We can call interrupts from within the smae code
  1074. by just pushing the flags and CS PM }
  1075. if (po_interrupt in procdefinition.procoptions) then
  1076. extra_interrupt_code;
  1077. cg.a_call_name(exprasmlist,tprocdef(procdefinition).mangledname);
  1078. end
  1079. else { inlined proc }
  1080. { inlined code is in inlinecode }
  1081. begin
  1082. { process the inlinecode }
  1083. secondpass(tnode(inlinecode));
  1084. { free the args }
  1085. if tprocdef(procdefinition).parast.datasize>0 then
  1086. tg.UnGetTemp(exprasmlist,pararef);
  1087. end;
  1088. end
  1089. else
  1090. { now procedure variable case }
  1091. begin
  1092. secondpass(right);
  1093. if (po_interrupt in procdefinition.procoptions) then
  1094. extra_interrupt_code;
  1095. { procedure of object? }
  1096. if (po_methodpointer in procdefinition.procoptions) then
  1097. begin
  1098. {$ifdef dummy}
  1099. { method pointer can't be in a register }
  1100. hregister:=R_NO;
  1101. { do some hacking if we call a method pointer }
  1102. { which is a class member }
  1103. { else ESI is overwritten ! }
  1104. if (right.location.reference.base=R_ESI) or
  1105. (right.location.reference.index=R_ESI) then
  1106. begin
  1107. reference_release(exprasmlist,right.location.reference);
  1108. hregister:=cg.get_scratch_reg_address(exprasmlist);
  1109. cg.a_load_ref_reg(exprasmlist,OS_ADDR,right.location.reference,hregister);
  1110. end;
  1111. { load self, but not if it's already explicitly pushed }
  1112. if not(po_containsself in procdefinition.procoptions) then
  1113. begin
  1114. { load ESI }
  1115. href:=right.location.reference;
  1116. inc(href.offset,4);
  1117. rg.getexplicitregisterint(exprasmlist,R_ESI);
  1118. cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,self_pointer_reg);
  1119. { push self pointer }
  1120. cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,-1);
  1121. end;
  1122. rg.saveregvars(exprasmlist,ALL_REGISTERS);
  1123. if hregister<>R_NO then
  1124. cg.a_call_reg(exprasmlist,hregister)
  1125. else
  1126. cg.a_call_ref(exprasmlist,right.location.reference);
  1127. if hregister<>R_NO then
  1128. cg.free_scratch_reg(exprasmlist,hregister);
  1129. reference_release(exprasmlist,right.location.reference);
  1130. tg.Ungetiftemp(exprasmlist,right.location.reference);
  1131. {$endif dummy}
  1132. end
  1133. else
  1134. begin
  1135. rg.saveregvars(exprasmlist,ALL_REGISTERS);
  1136. cg.a_call_loc(exprasmlist,right.location);
  1137. location_release(exprasmlist,right.location);
  1138. location_freetemp(exprasmlist,right.location);
  1139. end;
  1140. end;
  1141. {$ifdef dummy}
  1142. { this was only for normal functions
  1143. displaced here so we also get
  1144. it to work for procvars PM }
  1145. if (not inlined) and (po_clearstack in procdefinition.procoptions) then
  1146. begin
  1147. { we also add the pop_size which is included in pushedparasize }
  1148. pop_size:=0;
  1149. { better than an add on all processors }
  1150. if pushedparasize=4 then
  1151. begin
  1152. rg.getexplicitregisterint(exprasmlist,R_EDI);
  1153. emit_reg(A_POP,S_L,R_EDI);
  1154. rg.ungetregisterint(exprasmlist,R_EDI);
  1155. end
  1156. { the pentium has two pipes and pop reg is pairable }
  1157. { but the registers must be different! }
  1158. else if (pushedparasize=8) and
  1159. not(cs_littlesize in aktglobalswitches) and
  1160. {$ifdef i386}
  1161. (aktoptprocessor=ClassP5) and
  1162. {$endif}
  1163. (procinfo._class=nil) then
  1164. begin
  1165. rg.getexplicitregisterint(exprasmlist,R_EDI);
  1166. emit_reg(A_POP,S_L,R_EDI);
  1167. rg.ungetregisterint(exprasmlist,R_EDI);
  1168. exprasmList.concat(tai_regalloc.Alloc(R_ESI));
  1169. emit_reg(A_POP,S_L,R_ESI);
  1170. exprasmList.concat(tai_regalloc.DeAlloc(R_ESI));
  1171. end
  1172. else if pushedparasize<>0 then
  1173. emit_const_reg(A_ADD,S_L,pushedparasize,R_ESP);
  1174. end;
  1175. {$endif dummy}
  1176. {$ifdef powerpc}
  1177. { this calculation must be done in pass_1 anyway, so don't worry }
  1178. if tppcprocinfo(procinfo).maxpushedparasize<pushedparasize then
  1179. tppcprocinfo(procinfo).maxpushedparasize:=pushedparasize;
  1180. {$endif powerpc}
  1181. {$ifdef OPTALIGN}
  1182. r.enum:=R_ESP;
  1183. if pop_esp then
  1184. emit_reg(A_POP,S_L,r);
  1185. {$endif OPTALIGN}
  1186. dont_call:
  1187. pushedparasize:=oldpushedparasize;
  1188. rg.restoreunusedstate(unusedstate);
  1189. {$ifdef TEMPREGDEBUG}
  1190. testregisters32;
  1191. {$endif TEMPREGDEBUG}
  1192. { a constructor could be a function with boolean result }
  1193. { if calling constructor called fail we
  1194. must jump directly to quickexitlabel PM
  1195. but only if it is a call of an inherited constructor }
  1196. if (inlined or
  1197. (right=nil)) and
  1198. (procdefinition.proctypeoption=potype_constructor) and
  1199. assigned(methodpointer) and
  1200. (methodpointer.nodetype=typen) and
  1201. (aktprocdef.proctypeoption=potype_constructor) then
  1202. begin
  1203. r.enum:=accumulator;
  1204. cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,r,faillabel);
  1205. end;
  1206. { call to AfterConstruction? }
  1207. if is_class(resulttype.def) and
  1208. (inlined or
  1209. (right=nil)) and
  1210. (procdefinition.proctypeoption=potype_constructor) and
  1211. assigned(methodpointer) and
  1212. (methodpointer.nodetype<>typen) then
  1213. begin
  1214. objectlibrary.getlabel(constructorfailed);
  1215. r.enum:=self_pointer_reg;
  1216. r2.enum:=accumulator;
  1217. cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,r,constructorfailed);
  1218. cg.a_param_reg(exprasmlist,OS_ADDR,r2,paramanager.getintparaloc(1));
  1219. reference_reset_base(href,r,0);
  1220. tmpreg:=cg.get_scratch_reg_address(exprasmlist);
  1221. cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,tmpreg);
  1222. reference_reset_base(href,tmpreg,17*pointer_size);
  1223. cg.a_call_ref(exprasmlist,href);
  1224. cg.free_scratch_reg(exprasmlist,tmpreg);
  1225. exprasmList.concat(tai_regalloc.Alloc(r2));
  1226. cg.a_label(exprasmlist,constructorfailed);
  1227. cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,r,r2);
  1228. end;
  1229. { handle function results }
  1230. if (not is_void(resulttype.def)) then
  1231. handle_return_value(inlined,extended_new);
  1232. { perhaps i/o check ? }
  1233. if iolabel<>nil then
  1234. begin
  1235. reference_reset_symbol(href,iolabel,0);
  1236. cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
  1237. cg.a_call_name(exprasmlist,'FPC_IOCHECK');
  1238. end;
  1239. {$ifdef i386}
  1240. r.enum:=R_ESP;
  1241. if pop_size>0 then
  1242. emit_const_reg(A_ADD,S_L,pop_size,r);
  1243. {$endif i386}
  1244. { restore registers }
  1245. rg.restoreusedregisters(exprasmlist,pushed);
  1246. { at last, restore instance pointer (SELF) }
  1247. if loadesi then
  1248. cg.g_maybe_loadself(exprasmlist);
  1249. pp:=tbinarynode(params);
  1250. while assigned(pp) do
  1251. begin
  1252. if assigned(pp.left) then
  1253. begin
  1254. location_freetemp(exprasmlist,pp.left.location);
  1255. { process also all nodes of an array of const }
  1256. if pp.left.nodetype=arrayconstructorn then
  1257. begin
  1258. if assigned(tarrayconstructornode(pp.left).left) then
  1259. begin
  1260. hp:=pp.left;
  1261. while assigned(hp) do
  1262. begin
  1263. location_freetemp(exprasmlist,tarrayconstructornode(hp).left.location);
  1264. hp:=tarrayconstructornode(hp).right;
  1265. end;
  1266. end;
  1267. end;
  1268. end;
  1269. pp:=tbinarynode(pp.right);
  1270. end;
  1271. if inlined then
  1272. begin
  1273. if (resulttype.def.size>0) then
  1274. tg.UnGetTemp(exprasmlist,returnref);
  1275. tprocdef(procdefinition).parast.address_fixup:=store_parast_fixup;
  1276. right:=inlinecode;
  1277. end;
  1278. if assigned(params) then
  1279. params.free;
  1280. { from now on the result can be freed normally }
  1281. if inlined and paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
  1282. tg.ChangeTempType(exprasmlist,funcretref,tt_normal);
  1283. { if return value is not used }
  1284. if (not(nf_return_value_used in flags)) and (not is_void(resulttype.def)) then
  1285. begin
  1286. if location.loc in [LOC_CREFERENCE,LOC_REFERENCE] then
  1287. begin
  1288. { data which must be finalized ? }
  1289. if (resulttype.def.needs_inittable) then
  1290. cg.g_finalize(exprasmlist,resulttype.def,location.reference,false);
  1291. { release unused temp }
  1292. tg.ungetiftemp(exprasmlist,location.reference)
  1293. end
  1294. else if location.loc=LOC_FPUREGISTER then
  1295. begin
  1296. {$ifdef i386}
  1297. { release FPU stack }
  1298. r.enum:=R_ST;
  1299. emit_reg(A_FSTP,S_NO,r);
  1300. {
  1301. dec(trgcpu(rg).fpuvaroffset);
  1302. do NOT decrement as the increment before
  1303. is not called for unused results PM }
  1304. {$endif i386}
  1305. end;
  1306. end;
  1307. end;
  1308. {*****************************************************************************
  1309. TCGPROCINLINENODE
  1310. *****************************************************************************}
  1311. procedure tcgprocinlinenode.pass_2;
  1312. var st : tsymtable;
  1313. oldprocdef : tprocdef;
  1314. ps, i : longint;
  1315. tmpreg: tregister;
  1316. oldprocinfo : tprocinfo;
  1317. oldinlining_procedure,
  1318. nostackframe,make_global : boolean;
  1319. inlineentrycode,inlineexitcode : TAAsmoutput;
  1320. oldexitlabel,oldexit2label,oldquickexitlabel:tasmlabel;
  1321. oldregstate: pointer;
  1322. localsref : treference;
  1323. {$ifdef GDB}
  1324. startlabel,endlabel : tasmlabel;
  1325. pp : pchar;
  1326. mangled_length : longint;
  1327. {$endif GDB}
  1328. begin
  1329. { deallocate the registers used for the current procedure's regvars }
  1330. if assigned(aktprocdef.regvarinfo) then
  1331. begin
  1332. with pregvarinfo(aktprocdef.regvarinfo)^ do
  1333. for i := 1 to maxvarregs do
  1334. if assigned(regvars[i]) then
  1335. store_regvar(exprasmlist,regvars[i].reg);
  1336. rg.saveStateForInline(oldregstate);
  1337. { make sure the register allocator knows what the regvars in the }
  1338. { inlined code block are (JM) }
  1339. rg.resetusableregisters;
  1340. rg.clearregistercount;
  1341. rg.cleartempgen;
  1342. if assigned(inlineprocdef.regvarinfo) then
  1343. with pregvarinfo(inlineprocdef.regvarinfo)^ do
  1344. for i := 1 to maxvarregs do
  1345. if assigned(regvars[i]) then
  1346. begin
  1347. tmpreg:=rg.makeregsize(regvars[i].reg,OS_INT);
  1348. rg.makeregvar(tmpreg);
  1349. end;
  1350. end;
  1351. oldinlining_procedure:=inlining_procedure;
  1352. oldexitlabel:=aktexitlabel;
  1353. oldexit2label:=aktexit2label;
  1354. oldquickexitlabel:=quickexitlabel;
  1355. oldprocdef:=aktprocdef;
  1356. oldprocinfo:=procinfo;
  1357. objectlibrary.getlabel(aktexitlabel);
  1358. objectlibrary.getlabel(aktexit2label);
  1359. { we're inlining a procedure }
  1360. inlining_procedure:=true;
  1361. aktprocdef:=inlineprocdef;
  1362. { clone procinfo, but not the asmlists }
  1363. procinfo:=tprocinfo(cprocinfo.newinstance);
  1364. move(pointer(oldprocinfo)^,pointer(procinfo)^,cprocinfo.InstanceSize);
  1365. procinfo.aktentrycode:=nil;
  1366. procinfo.aktexitcode:=nil;
  1367. procinfo.aktproccode:=nil;
  1368. procinfo.aktlocaldata:=nil;
  1369. { set new procinfo }
  1370. procinfo.return_offset:=retoffset;
  1371. procinfo.para_offset:=para_offset;
  1372. procinfo.no_fast_exit:=false;
  1373. { arg space has been filled by the parent secondcall }
  1374. st:=aktprocdef.localst;
  1375. { set it to the same lexical level }
  1376. st.symtablelevel:=oldprocdef.localst.symtablelevel;
  1377. if st.datasize>0 then
  1378. begin
  1379. tg.GetTemp(exprasmlist,st.datasize,tt_persistant,localsref);
  1380. st.address_fixup:=localsref.offset+st.datasize;
  1381. {$ifdef extdebug}
  1382. Comment(V_debug,'local symtable is at offset '+tostr(st.address_fixup));
  1383. exprasmList.concat(tai_comment.Create(strpnew(
  1384. 'local symtable is at offset '+tostr(st.address_fixup))));
  1385. {$endif extdebug}
  1386. end;
  1387. exprasmList.concat(Tai_Marker.Create(InlineStart));
  1388. {$ifdef extdebug}
  1389. exprasmList.concat(tai_comment.Create(strpnew('Start of inlined proc')));
  1390. {$endif extdebug}
  1391. {$ifdef GDB}
  1392. if (cs_debuginfo in aktmoduleswitches) then
  1393. begin
  1394. objectlibrary.getaddrlabel(startlabel);
  1395. objectlibrary.getaddrlabel(endlabel);
  1396. cg.a_label(exprasmlist,startlabel);
  1397. inlineprocdef.localst.symtabletype:=inlinelocalsymtable;
  1398. inlineprocdef.parast.symtabletype:=inlineparasymtable;
  1399. { Here we must include the para and local symtable info }
  1400. inlineprocdef.concatstabto(withdebuglist);
  1401. { set it back for safety }
  1402. inlineprocdef.localst.symtabletype:=localsymtable;
  1403. inlineprocdef.parast.symtabletype:=parasymtable;
  1404. mangled_length:=length(oldprocdef.mangledname);
  1405. getmem(pp,mangled_length+50);
  1406. strpcopy(pp,'192,0,0,'+startlabel.name);
  1407. if (target_info.use_function_relative_addresses) then
  1408. begin
  1409. strpcopy(strend(pp),'-');
  1410. strpcopy(strend(pp),oldprocdef.mangledname);
  1411. end;
  1412. withdebugList.concat(Tai_stabn.Create(strnew(pp)));
  1413. end;
  1414. {$endif GDB}
  1415. { takes care of local data initialization }
  1416. inlineentrycode:=TAAsmoutput.Create;
  1417. inlineexitcode:=TAAsmoutput.Create;
  1418. ps:=para_size;
  1419. make_global:=false; { to avoid warning }
  1420. genentrycode(inlineentrycode,make_global,0,ps,nostackframe,true);
  1421. if po_assembler in aktprocdef.procoptions then
  1422. inlineentrycode.insert(Tai_marker.Create(asmblockstart));
  1423. exprasmList.concatlist(inlineentrycode);
  1424. secondpass(inlinetree);
  1425. genexitcode(inlineexitcode,0,false,true);
  1426. if po_assembler in aktprocdef.procoptions then
  1427. inlineexitcode.concat(Tai_marker.Create(asmblockend));
  1428. exprasmList.concatlist(inlineexitcode);
  1429. inlineentrycode.free;
  1430. inlineexitcode.free;
  1431. {$ifdef extdebug}
  1432. exprasmList.concat(tai_comment.Create(strpnew('End of inlined proc')));
  1433. {$endif extdebug}
  1434. exprasmList.concat(Tai_Marker.Create(InlineEnd));
  1435. {we can free the local data now, reset also the fixup address }
  1436. if st.datasize>0 then
  1437. begin
  1438. tg.UnGetTemp(exprasmlist,localsref);
  1439. st.address_fixup:=0;
  1440. end;
  1441. { restore procinfo }
  1442. procinfo.free;
  1443. procinfo:=oldprocinfo;
  1444. {$ifdef GDB}
  1445. if (cs_debuginfo in aktmoduleswitches) then
  1446. begin
  1447. cg.a_label(exprasmlist,endlabel);
  1448. strpcopy(pp,'224,0,0,'+endlabel.name);
  1449. if (target_info.use_function_relative_addresses) then
  1450. begin
  1451. strpcopy(strend(pp),'-');
  1452. strpcopy(strend(pp),oldprocdef.mangledname);
  1453. end;
  1454. withdebugList.concat(Tai_stabn.Create(strnew(pp)));
  1455. freemem(pp,mangled_length+50);
  1456. end;
  1457. {$endif GDB}
  1458. { restore }
  1459. aktprocdef:=oldprocdef;
  1460. aktexitlabel:=oldexitlabel;
  1461. aktexit2label:=oldexit2label;
  1462. quickexitlabel:=oldquickexitlabel;
  1463. inlining_procedure:=oldinlining_procedure;
  1464. { reallocate the registers used for the current procedure's regvars, }
  1465. { since they may have been used and then deallocated in the inlined }
  1466. { procedure (JM) }
  1467. if assigned(aktprocdef.regvarinfo) then
  1468. begin
  1469. rg.restoreStateAfterInline(oldregstate);
  1470. end;
  1471. end;
  1472. begin
  1473. ccallparanode:=tcgcallparanode;
  1474. ccallnode:=tcgcallnode;
  1475. cprocinlinenode:=tcgprocinlinenode;
  1476. end.
  1477. {
  1478. $Log$
  1479. Revision 1.35 2003-01-22 20:45:15 mazen
  1480. * making math code in RTL compiling.
  1481. *NB : This does NOT mean necessary that it will generate correct code!
  1482. Revision 1.34 2003/01/17 12:03:45 daniel
  1483. * Optalign conditional code adapted to record Tregister
  1484. Revision 1.33 2003/01/08 18:43:56 daniel
  1485. * Tregister changed into a record
  1486. Revision 1.32 2002/12/15 22:50:00 florian
  1487. + some stuff for the new hidden parameter handling added
  1488. Revision 1.31 2002/12/15 21:30:12 florian
  1489. * tcallnode.paraitem introduced, all references to defcoll removed
  1490. Revision 1.30 2002/11/27 20:04:39 peter
  1491. * cdecl array of const fixes
  1492. Revision 1.29 2002/11/25 17:43:17 peter
  1493. * splitted defbase in defutil,symutil,defcmp
  1494. * merged isconvertable and is_equal into compare_defs(_ext)
  1495. * made operator search faster by walking the list only once
  1496. Revision 1.28 2002/11/18 17:31:54 peter
  1497. * pass proccalloption to ret_in_xxx and push_xxx functions
  1498. Revision 1.27 2002/11/16 15:34:30 florian
  1499. * generic location for float results
  1500. Revision 1.26 2002/11/15 01:58:51 peter
  1501. * merged changes from 1.0.7 up to 04-11
  1502. - -V option for generating bug report tracing
  1503. - more tracing for option parsing
  1504. - errors for cdecl and high()
  1505. - win32 import stabs
  1506. - win32 records<=8 are returned in eax:edx (turned off by default)
  1507. - heaptrc update
  1508. - more info for temp management in .s file with EXTDEBUG
  1509. Revision 1.25 2002/10/05 12:43:25 carl
  1510. * fixes for Delphi 6 compilation
  1511. (warning : Some features do not work under Delphi)
  1512. Revision 1.24 2002/09/30 07:00:45 florian
  1513. * fixes to common code to get the alpha compiler compiled applied
  1514. Revision 1.23 2002/09/17 18:54:02 jonas
  1515. * a_load_reg_reg() now has two size parameters: source and dest. This
  1516. allows some optimizations on architectures that don't encode the
  1517. register size in the register name.
  1518. Revision 1.22 2002/09/07 15:25:02 peter
  1519. * old logs removed and tabs fixed
  1520. Revision 1.21 2002/09/07 11:50:02 jonas
  1521. * fixed small regalloction info bug
  1522. Revision 1.20 2002/09/02 11:25:20 florian
  1523. * fixed generic procedure variable calling
  1524. Revision 1.19 2002/09/01 21:04:48 florian
  1525. * several powerpc related stuff fixed
  1526. Revision 1.18 2002/09/01 18:43:27 peter
  1527. * include accumulator in regs_to_push list
  1528. Revision 1.17 2002/09/01 12:13:00 peter
  1529. * use a_call_reg
  1530. * ungetiftemp for procvar of object temp
  1531. Revision 1.16 2002/08/25 19:25:18 peter
  1532. * sym.insert_in_data removed
  1533. * symtable.insertvardata/insertconstdata added
  1534. * removed insert_in_data call from symtable.insert, it needs to be
  1535. called separatly. This allows to deref the address calculation
  1536. * procedures now calculate the parast addresses after the procedure
  1537. directives are parsed. This fixes the cdecl parast problem
  1538. * push_addr_param has an extra argument that specifies if cdecl is used
  1539. or not
  1540. Revision 1.15 2002/08/23 16:14:48 peter
  1541. * tempgen cleanup
  1542. * tt_noreuse temp type added that will be used in genentrycode
  1543. Revision 1.14 2002/08/20 16:55:38 peter
  1544. * don't write (stabs)line info when inlining a procedure
  1545. Revision 1.13 2002/08/19 19:36:42 peter
  1546. * More fixes for cross unit inlining, all tnodes are now implemented
  1547. * Moved pocall_internconst to po_internconst because it is not a
  1548. calling type at all and it conflicted when inlining of these small
  1549. functions was requested
  1550. Revision 1.12 2002/08/18 20:06:23 peter
  1551. * inlining is now also allowed in interface
  1552. * renamed write/load to ppuwrite/ppuload
  1553. * tnode storing in ppu
  1554. * nld,ncon,nbas are already updated for storing in ppu
  1555. Revision 1.11 2002/08/17 22:09:44 florian
  1556. * result type handling in tcgcal.pass_2 overhauled
  1557. * better tnode.dowrite
  1558. * some ppc stuff fixed
  1559. Revision 1.10 2002/08/17 09:23:35 florian
  1560. * first part of procinfo rewrite
  1561. Revision 1.9 2002/08/13 21:40:55 florian
  1562. * more fixes for ppc calling conventions
  1563. Revision 1.8 2002/08/13 18:01:51 carl
  1564. * rename swatoperands to swapoperands
  1565. + m68k first compilable version (still needs a lot of testing):
  1566. assembler generator, system information , inline
  1567. assembler reader.
  1568. Revision 1.7 2002/08/12 15:08:39 carl
  1569. + stab register indexes for powerpc (moved from gdb to cpubase)
  1570. + tprocessor enumeration moved to cpuinfo
  1571. + linker in target_info is now a class
  1572. * many many updates for m68k (will soon start to compile)
  1573. - removed some ifdef or correct them for correct cpu
  1574. Revision 1.6 2002/08/11 14:32:26 peter
  1575. * renamed current_library to objectlibrary
  1576. Revision 1.5 2002/08/11 13:24:11 peter
  1577. * saving of asmsymbols in ppu supported
  1578. * asmsymbollist global is removed and moved into a new class
  1579. tasmlibrarydata that will hold the info of a .a file which
  1580. corresponds with a single module. Added librarydata to tmodule
  1581. to keep the library info stored for the module. In the future the
  1582. objectfiles will also be stored to the tasmlibrarydata class
  1583. * all getlabel/newasmsymbol and friends are moved to the new class
  1584. Revision 1.4 2002/08/06 20:55:20 florian
  1585. * first part of ppc calling conventions fix
  1586. Revision 1.3 2002/07/20 11:57:53 florian
  1587. * types.pas renamed to defbase.pas because D6 contains a types
  1588. unit so this would conflicts if D6 programms are compiled
  1589. + Willamette/SSE2 instructions to assembler added
  1590. Revision 1.2 2002/07/13 19:38:43 florian
  1591. * some more generic calling stuff fixed
  1592. }