ncgcal.pas 75 KB

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