ncgcal.pas 75 KB

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