psub.pas 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl, Daniel Mantione
  4. Does the parsing and codegeneration at subroutine level
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit psub;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. cclasses,globals,
  23. node,nbas,
  24. symdef,procinfo;
  25. type
  26. tcgprocinfo=class(tprocinfo)
  27. { code for the subroutine as tree }
  28. code : tnode;
  29. { positions in the tree for init/final }
  30. entry_asmnode,
  31. loadpara_asmnode,
  32. exitlabel_asmnode,
  33. init_asmnode,
  34. final_asmnode : tasmnode;
  35. { list to store the procinfo's of the nested procedures }
  36. nestedprocs : tlinkedlist;
  37. constructor create(aparent:tprocinfo);override;
  38. destructor destroy;override;
  39. procedure generate_code;
  40. procedure resetprocdef;
  41. procedure add_to_symtablestack;
  42. procedure remove_from_symtablestack;
  43. procedure parse_body;
  44. procedure add_entry_exit_code;
  45. end;
  46. procedure printnode_reset;
  47. { reads the declaration blocks }
  48. procedure read_declarations(islibrary : boolean);
  49. { reads declarations in the interface part of a unit }
  50. procedure read_interface_declarations;
  51. implementation
  52. uses
  53. { common }
  54. cutils,
  55. { global }
  56. globtype,tokens,verbose,comphook,
  57. systems,
  58. { aasm }
  59. cpubase,aasmtai,
  60. { symtable }
  61. symconst,symbase,symsym,symtype,symtable,defutil,
  62. paramgr,
  63. ppu,fmodule,
  64. { pass 1 }
  65. nutils,nld,ncal,ncon,nflw,nadd,ncnv,nmem,
  66. pass_1,
  67. {$ifdef state_tracking}
  68. nstate,
  69. {$endif state_tracking}
  70. { pass 2 }
  71. {$ifndef NOPASS2}
  72. pass_2,
  73. {$endif}
  74. { parser }
  75. scanner,
  76. pbase,pstatmnt,pdecl,pdecsub,pexports,
  77. { codegen }
  78. tgobj,cgobj,
  79. ncgutil,regvars
  80. {$ifdef arm}
  81. ,aasmcpu
  82. {$endif arm}
  83. {$ifndef NOOPT}
  84. {$ifdef i386}
  85. ,aopt386
  86. {$else i386}
  87. ,aoptcpu
  88. {$endif i386}
  89. {$endif}
  90. ;
  91. {****************************************************************************
  92. PROCEDURE/FUNCTION BODY PARSING
  93. ****************************************************************************}
  94. procedure initializevars(p:tnamedindexitem;arg:pointer);
  95. var
  96. b : tblocknode;
  97. begin
  98. if tsym(p).typ<>varsym then
  99. exit;
  100. with tvarsym(p) do
  101. begin
  102. if assigned(defaultconstsym) then
  103. begin
  104. b:=tblocknode(arg);
  105. b.left:=cstatementnode.create(
  106. cassignmentnode.create(
  107. cloadnode.create(tsym(p),tsym(p).owner),
  108. cloadnode.create(defaultconstsym,defaultconstsym.owner)),
  109. b.left);
  110. end;
  111. end;
  112. end;
  113. function block(islibrary : boolean) : tnode;
  114. begin
  115. { parse const,types and vars }
  116. read_declarations(islibrary);
  117. { do we have an assembler block without the po_assembler?
  118. we should allow this for Delphi compatibility (PFV) }
  119. if (token=_ASM) and (m_delphi in aktmodeswitches) then
  120. include(current_procinfo.procdef.procoptions,po_assembler);
  121. { Handle assembler block different }
  122. if (po_assembler in current_procinfo.procdef.procoptions) then
  123. begin
  124. block:=assembler_block;
  125. exit;
  126. end;
  127. {Unit initialization?.}
  128. if (
  129. assigned(current_procinfo.procdef.localst) and
  130. (current_procinfo.procdef.localst.symtablelevel=main_program_level) and
  131. (current_module.is_unit)
  132. ) or
  133. islibrary then
  134. begin
  135. if (token=_END) then
  136. begin
  137. consume(_END);
  138. { We need at least a node, else the entry/exit code is not
  139. generated and thus no PASCALMAIN symbol which we need (PFV) }
  140. if islibrary then
  141. block:=cnothingnode.create
  142. else
  143. block:=nil;
  144. end
  145. else
  146. begin
  147. if token=_INITIALIZATION then
  148. begin
  149. { The library init code is already called and does not
  150. need to be in the initfinal table (PFV) }
  151. if not islibrary then
  152. current_module.flags:=current_module.flags or uf_init;
  153. block:=statement_block(_INITIALIZATION);
  154. end
  155. else if (token=_FINALIZATION) then
  156. begin
  157. if (current_module.flags and uf_finalize)<>0 then
  158. block:=statement_block(_FINALIZATION)
  159. else
  160. begin
  161. { can we allow no INITIALIZATION for DLL ??
  162. I think it should work PM }
  163. block:=nil;
  164. exit;
  165. end;
  166. end
  167. else
  168. begin
  169. { The library init code is already called and does not
  170. need to be in the initfinal table (PFV) }
  171. if not islibrary then
  172. current_module.flags:=current_module.flags or uf_init;
  173. block:=statement_block(_BEGIN);
  174. end;
  175. end;
  176. end
  177. else
  178. begin
  179. block:=statement_block(_BEGIN);
  180. if symtablestack.symtabletype=localsymtable then
  181. symtablestack.foreach_static({$ifdef FPCPROCVAR}@{$endif}initializevars,block);
  182. end;
  183. if (current_procinfo.procdef.localst.symtablelevel=main_program_level) and
  184. (not current_module.is_unit) then
  185. begin
  186. { there's always a call to FPC_DO_EXIT in the main program }
  187. include(current_procinfo.flags,pi_do_call);
  188. end;
  189. if ([cs_check_range,cs_check_overflow] * aktlocalswitches <> []) then
  190. include(current_procinfo.flags,pi_do_call);
  191. end;
  192. {****************************************************************************
  193. PROCEDURE/FUNCTION COMPILING
  194. ****************************************************************************}
  195. procedure printnode_reset;
  196. begin
  197. assign(printnodefile,treelogfilename);
  198. {$I-}
  199. rewrite(printnodefile);
  200. {$I+}
  201. if ioresult<>0 then
  202. begin
  203. Comment(V_Error,'Error creating '+treelogfilename);
  204. exit;
  205. end;
  206. close(printnodefile);
  207. end;
  208. procedure printnode_procdef(pd:tprocdef);
  209. begin
  210. assign(printnodefile,treelogfilename);
  211. {$I-}
  212. append(printnodefile);
  213. if ioresult<>0 then
  214. rewrite(printnodefile);
  215. {$I+}
  216. if ioresult<>0 then
  217. begin
  218. Comment(V_Error,'Error creating '+treelogfilename);
  219. exit;
  220. end;
  221. writeln(printnodefile);
  222. writeln(printnodefile,'*******************************************************************************');
  223. writeln(printnodefile,current_procinfo.procdef.fullprocname(false));
  224. writeln(printnodefile,'*******************************************************************************');
  225. printnode(printnodefile,pd.inlininginfo^.code);
  226. close(printnodefile);
  227. end;
  228. function generate_bodyentry_block:tnode;
  229. var
  230. srsym : tsym;
  231. para : tcallparanode;
  232. newstatement : tstatementnode;
  233. htype : ttype;
  234. begin
  235. result:=internalstatements(newstatement);
  236. if assigned(current_procinfo.procdef._class) then
  237. begin
  238. { a constructor needs a help procedure }
  239. if (current_procinfo.procdef.proctypeoption=potype_constructor) then
  240. begin
  241. if is_class(current_procinfo.procdef._class) then
  242. begin
  243. if (cs_implicit_exceptions in aktmoduleswitches) then
  244. include(current_procinfo.flags,pi_needs_implicit_finally);
  245. srsym:=search_class_member(current_procinfo.procdef._class,'NEWINSTANCE');
  246. if assigned(srsym) and
  247. (srsym.typ=procsym) then
  248. begin
  249. { if vmt<>0 then newinstance }
  250. addstatement(newstatement,cifnode.create(
  251. caddnode.create(unequaln,
  252. load_vmt_pointer_node,
  253. cnilnode.create),
  254. cassignmentnode.create(
  255. ctypeconvnode.create_explicit(
  256. load_self_pointer_node,
  257. voidpointertype),
  258. ccallnode.create(nil,tprocsym(srsym),srsym.owner,load_vmt_pointer_node)),
  259. nil));
  260. end
  261. else
  262. internalerror(200305108);
  263. end
  264. else
  265. if is_object(current_procinfo.procdef._class) then
  266. begin
  267. htype.setdef(current_procinfo.procdef._class);
  268. htype.setdef(tpointerdef.create(htype));
  269. { parameter 3 : vmt_offset }
  270. { parameter 2 : address of pointer to vmt,
  271. this is required to allow setting the vmt to -1 to indicate
  272. that memory was allocated }
  273. { parameter 1 : self pointer }
  274. para:=ccallparanode.create(
  275. cordconstnode.create(current_procinfo.procdef._class.vmt_offset,s32bittype,false),
  276. ccallparanode.create(
  277. ctypeconvnode.create_explicit(
  278. load_vmt_pointer_node,
  279. voidpointertype),
  280. ccallparanode.create(
  281. ctypeconvnode.create_explicit(
  282. load_self_pointer_node,
  283. voidpointertype),
  284. nil)));
  285. addstatement(newstatement,cassignmentnode.create(
  286. ctypeconvnode.create_explicit(
  287. load_self_pointer_node,
  288. voidpointertype),
  289. ccallnode.createintern('fpc_help_constructor',para)));
  290. end
  291. else
  292. internalerror(200305103);
  293. { if self=nil then exit
  294. calling fail instead of exit is useless because
  295. there is nothing to dispose (PFV) }
  296. addstatement(newstatement,cifnode.create(
  297. caddnode.create(equaln,
  298. load_self_pointer_node,
  299. cnilnode.create),
  300. cexitnode.create(nil),
  301. nil));
  302. end;
  303. { maybe call BeforeDestruction for classes }
  304. if (current_procinfo.procdef.proctypeoption=potype_destructor) and
  305. is_class(current_procinfo.procdef._class) then
  306. begin
  307. srsym:=search_class_member(current_procinfo.procdef._class,'BEFOREDESTRUCTION');
  308. if assigned(srsym) and
  309. (srsym.typ=procsym) then
  310. begin
  311. { if vmt<>0 then beforedestruction }
  312. addstatement(newstatement,cifnode.create(
  313. caddnode.create(unequaln,
  314. load_vmt_pointer_node,
  315. cnilnode.create),
  316. ccallnode.create(nil,tprocsym(srsym),srsym.owner,load_self_node),
  317. nil));
  318. end
  319. else
  320. internalerror(200305104);
  321. end;
  322. end;
  323. end;
  324. function generate_bodyexit_block:tnode;
  325. var
  326. srsym : tsym;
  327. para : tcallparanode;
  328. newstatement : tstatementnode;
  329. begin
  330. result:=internalstatements(newstatement);
  331. if assigned(current_procinfo.procdef._class) then
  332. begin
  333. { maybe call AfterConstruction for classes }
  334. if (current_procinfo.procdef.proctypeoption=potype_constructor) and
  335. is_class(current_procinfo.procdef._class) then
  336. begin
  337. srsym:=search_class_member(current_procinfo.procdef._class,'AFTERCONSTRUCTION');
  338. if assigned(srsym) and
  339. (srsym.typ=procsym) then
  340. begin
  341. { Self can be nil when fail is called }
  342. { if self<>nil and vmt<>nil then afterconstruction }
  343. addstatement(newstatement,cifnode.create(
  344. caddnode.create(andn,
  345. caddnode.create(unequaln,
  346. load_self_pointer_node,
  347. cnilnode.create),
  348. caddnode.create(unequaln,
  349. load_vmt_pointer_node,
  350. cnilnode.create)),
  351. ccallnode.create(nil,tprocsym(srsym),srsym.owner,load_self_node),
  352. nil));
  353. end
  354. else
  355. internalerror(200305106);
  356. end;
  357. { a destructor needs a help procedure }
  358. if (current_procinfo.procdef.proctypeoption=potype_destructor) then
  359. begin
  360. if is_class(current_procinfo.procdef._class) then
  361. begin
  362. srsym:=search_class_member(current_procinfo.procdef._class,'FREEINSTANCE');
  363. if assigned(srsym) and
  364. (srsym.typ=procsym) then
  365. begin
  366. { if self<>0 and vmt=1 then freeinstance }
  367. addstatement(newstatement,cifnode.create(
  368. caddnode.create(andn,
  369. caddnode.create(unequaln,
  370. load_self_pointer_node,
  371. cnilnode.create),
  372. caddnode.create(equaln,
  373. ctypeconvnode.create(
  374. load_vmt_pointer_node,
  375. voidpointertype),
  376. cpointerconstnode.create(1,voidpointertype))),
  377. ccallnode.create(nil,tprocsym(srsym),srsym.owner,load_self_node),
  378. nil));
  379. end
  380. else
  381. internalerror(200305108);
  382. end
  383. else
  384. if is_object(current_procinfo.procdef._class) then
  385. begin
  386. { finalize object data }
  387. if current_procinfo.procdef._class.needs_inittable then
  388. addstatement(newstatement,finalize_data_node(load_self_node));
  389. { parameter 3 : vmt_offset }
  390. { parameter 2 : pointer to vmt }
  391. { parameter 1 : self pointer }
  392. para:=ccallparanode.create(
  393. cordconstnode.create(current_procinfo.procdef._class.vmt_offset,s32bittype,false),
  394. ccallparanode.create(
  395. ctypeconvnode.create_explicit(
  396. load_vmt_pointer_node,
  397. voidpointertype),
  398. ccallparanode.create(
  399. ctypeconvnode.create_explicit(
  400. load_self_pointer_node,
  401. voidpointertype),
  402. nil)));
  403. addstatement(newstatement,
  404. ccallnode.createintern('fpc_help_destructor',para));
  405. end
  406. else
  407. internalerror(200305105);
  408. end;
  409. end;
  410. end;
  411. function generate_except_block:tnode;
  412. var
  413. pd : tprocdef;
  414. newstatement : tstatementnode;
  415. begin
  416. generate_except_block:=internalstatements(newstatement);
  417. { a constructor needs call destructor (if available) when it
  418. is not inherited }
  419. if assigned(current_procinfo.procdef._class) and
  420. (current_procinfo.procdef.proctypeoption=potype_constructor) then
  421. begin
  422. pd:=current_procinfo.procdef._class.searchdestructor;
  423. if assigned(pd) then
  424. begin
  425. { if vmt<>0 then call destructor }
  426. addstatement(newstatement,cifnode.create(
  427. caddnode.create(unequaln,
  428. load_vmt_pointer_node,
  429. cnilnode.create),
  430. ccallnode.create(nil,tprocsym(pd.procsym),pd.procsym.owner,load_self_node),
  431. nil));
  432. end;
  433. end
  434. else
  435. begin
  436. { no constructor }
  437. { must be the return value finalized before reraising the exception? }
  438. if (not is_void(current_procinfo.procdef.rettype.def)) and
  439. (current_procinfo.procdef.rettype.def.needs_inittable) and
  440. (not is_class(current_procinfo.procdef.rettype.def)) then
  441. addstatement(newstatement,finalize_data_node(load_result_node));
  442. end;
  443. end;
  444. {****************************************************************************
  445. TCGProcInfo
  446. ****************************************************************************}
  447. constructor tcgprocinfo.create(aparent:tprocinfo);
  448. begin
  449. inherited Create(aparent);
  450. nestedprocs:=tlinkedlist.create;
  451. end;
  452. destructor tcgprocinfo.destroy;
  453. begin
  454. nestedprocs.free;
  455. if assigned(code) then
  456. code.free;
  457. inherited destroy;
  458. end;
  459. procedure tcgprocinfo.add_entry_exit_code;
  460. var
  461. finalcode,
  462. bodyentrycode,
  463. bodyexitcode,
  464. exceptcode : tnode;
  465. newblock : tblocknode;
  466. codestatement,
  467. newstatement : tstatementnode;
  468. oldfilepos : tfileposinfo;
  469. begin
  470. oldfilepos:=aktfilepos;
  471. { Generate code/locations used at start of proc }
  472. aktfilepos:=entrypos;
  473. entry_asmnode:=casmnode.create_get_position;
  474. loadpara_asmnode:=casmnode.create_get_position;
  475. init_asmnode:=casmnode.create_get_position;
  476. bodyentrycode:=generate_bodyentry_block;
  477. { Generate code/locations used at end of proc }
  478. aktfilepos:=exitpos;
  479. exitlabel_asmnode:=casmnode.create_get_position;
  480. final_asmnode:=casmnode.create_get_position;
  481. bodyexitcode:=generate_bodyexit_block;
  482. { Generate procedure by combining init+body+final,
  483. depending on the implicit finally we need to add
  484. an try...finally...end wrapper }
  485. newblock:=internalstatements(newstatement);
  486. if (pi_needs_implicit_finally in flags) and
  487. { but it's useless in init/final code of units }
  488. not(procdef.proctypeoption in [potype_unitfinalize,potype_unitinit]) then
  489. begin
  490. { Generate special exception block only needed when
  491. implicit finaly is used }
  492. aktfilepos:=exitpos;
  493. exceptcode:=generate_except_block;
  494. { Generate code that will be in the try...finally }
  495. finalcode:=internalstatements(codestatement);
  496. addstatement(codestatement,bodyexitcode);
  497. addstatement(codestatement,final_asmnode);
  498. { Initialize before try...finally...end frame }
  499. addstatement(newstatement,entry_asmnode);
  500. addstatement(newstatement,loadpara_asmnode);
  501. addstatement(newstatement,init_asmnode);
  502. addstatement(newstatement,bodyentrycode);
  503. aktfilepos:=entrypos;
  504. addstatement(newstatement,ctryfinallynode.create_implicit(
  505. code,
  506. finalcode,
  507. exceptcode));
  508. addstatement(newstatement,exitlabel_asmnode);
  509. end
  510. else
  511. begin
  512. addstatement(newstatement,entry_asmnode);
  513. addstatement(newstatement,loadpara_asmnode);
  514. addstatement(newstatement,init_asmnode);
  515. addstatement(newstatement,bodyentrycode);
  516. addstatement(newstatement,code);
  517. addstatement(newstatement,exitlabel_asmnode);
  518. addstatement(newstatement,bodyexitcode);
  519. addstatement(newstatement,final_asmnode);
  520. end;
  521. resulttypepass(newblock);
  522. code:=newblock;
  523. aktfilepos:=oldfilepos;
  524. end;
  525. procedure clearrefs(p : tnamedindexitem;arg:pointer);
  526. begin
  527. if (tsym(p).typ=varsym) then
  528. if tvarsym(p).refs>1 then
  529. tvarsym(p).refs:=1;
  530. end;
  531. procedure tcgprocinfo.generate_code;
  532. var
  533. oldprocinfo : tprocinfo;
  534. oldaktmaxfpuregisters : longint;
  535. oldfilepos : tfileposinfo;
  536. templist : Taasmoutput;
  537. headertai : tai;
  538. usesacc,
  539. usesfpu,
  540. usesacchi : boolean;
  541. begin
  542. { the initialization procedure can be empty, then we
  543. don't need to generate anything. When it was an empty
  544. procedure there would be at least a blocknode }
  545. if not assigned(code) then
  546. exit;
  547. { We need valid code }
  548. if Errorcount<>0 then
  549. exit;
  550. { The RA and Tempgen shall not be available yet }
  551. if assigned(tg) then
  552. internalerror(200309201);
  553. oldprocinfo:=current_procinfo;
  554. oldfilepos:=aktfilepos;
  555. oldaktmaxfpuregisters:=aktmaxfpuregisters;
  556. current_procinfo:=self;
  557. aktfilepos:=entrypos;
  558. { get new labels }
  559. aktbreaklabel:=nil;
  560. aktcontinuelabel:=nil;
  561. templist:=Taasmoutput.create;
  562. { add parast/localst to symtablestack }
  563. add_to_symtablestack;
  564. { when size optimization only count occurrence }
  565. if cs_littlesize in aktglobalswitches then
  566. cg.t_times:=1
  567. else
  568. { reference for repetition is 100 }
  569. cg.t_times:=100;
  570. { clear register count }
  571. symtablestack.foreach_static({$ifdef FPCPROCVAR}@{$endif}clearrefs,nil);
  572. symtablestack.next.foreach_static({$ifdef FPCPROCVAR}@{$endif}clearrefs,nil);
  573. { firstpass everything }
  574. flowcontrol:=[];
  575. do_firstpass(code);
  576. if code.registersfpu>0 then
  577. include(current_procinfo.flags,pi_uses_fpu);
  578. { only do secondpass if there are no errors }
  579. if ErrorCount=0 then
  580. begin
  581. { set the start offset to the start of the temp area in the stack }
  582. tg:=ttgobj.create;
  583. { Create register allocator }
  584. cg.init_register_allocators;
  585. set_first_temp_offset;
  586. generate_parameter_info;
  587. { Allocate space in temp/registers for parast and localst }
  588. aktfilepos:=entrypos;
  589. gen_alloc_parast(aktproccode,tparasymtable(procdef.parast));
  590. if procdef.localst.symtabletype=localsymtable then
  591. gen_alloc_localst(aktproccode,tlocalsymtable(procdef.localst));
  592. { Store temp offset for information about 'real' temps }
  593. tempstart:=tg.lasttemp;
  594. { Generate code to load register parameters in temps and insert local
  595. copies for values parameters. This must be done before the code for the
  596. body is generated because the localloc is updated.
  597. Note: The generated code will be inserted after the code generation of
  598. the body is finished, because only then the position is known }
  599. aktfilepos:=entrypos;
  600. gen_load_para_value(templist);
  601. { caller paraloc info is also necessary in the stackframe_entry
  602. code of the ppc (and possibly other processors) }
  603. if not procdef.has_paraloc_info then
  604. begin
  605. paramanager.create_paraloc_info(procdef,callerside);
  606. procdef.has_paraloc_info:=true;
  607. end;
  608. { generate code for the node tree }
  609. do_secondpass(code);
  610. aktproccode.concatlist(exprasmlist);
  611. {$ifdef i386}
  612. procdef.fpu_used:=code.registersfpu;
  613. {$endif i386}
  614. { The position of the loadpara_asmnode is now known }
  615. aktproccode.insertlistafter(loadpara_asmnode.currenttai,templist);
  616. { first generate entry and initialize code with the correct
  617. position and switches }
  618. aktfilepos:=entrypos;
  619. aktlocalswitches:=entryswitches;
  620. gen_entry_code(templist);
  621. aktproccode.insertlistafter(entry_asmnode.currenttai,templist);
  622. gen_initialize_code(templist,false);
  623. aktproccode.insertlistafter(init_asmnode.currenttai,templist);
  624. { now generate finalize and exit code with the correct position
  625. and switches }
  626. aktfilepos:=exitpos;
  627. aktlocalswitches:=exitswitches;
  628. gen_finalize_code(templist,false);
  629. { the finalcode must be concated if there was no position available,
  630. using insertlistafter will result in an insert at the start
  631. when currentai=nil }
  632. if assigned(final_asmnode.currenttai) then
  633. aktproccode.insertlistafter(final_asmnode.currenttai,templist)
  634. else
  635. aktproccode.concatlist(templist);
  636. { insert exit label at the correct position }
  637. cg.a_label(templist,aktexitlabel);
  638. if assigned(exitlabel_asmnode.currenttai) then
  639. aktproccode.insertlistafter(exitlabel_asmnode.currenttai,templist)
  640. else
  641. aktproccode.concatlist(templist);
  642. { exit code }
  643. gen_exit_code(templist);
  644. aktproccode.concatlist(templist);
  645. {$ifdef OLDREGVARS}
  646. { note: this must be done only after as much code as possible has }
  647. { been generated. The result is that when you ungetregister() a }
  648. { regvar, it will actually free the regvar (and alse free the }
  649. { the regvars at the same time). Doing this too early will }
  650. { confuse the register allocator, as the regvars will still be }
  651. { used. It should be done before loading the result regs (so }
  652. { they don't conflict with the regvars) and before }
  653. { gen_entry_code (that one has to be able to allocate the }
  654. { regvars again) (JM) }
  655. free_regvars(aktproccode);
  656. {$endif OLDREGVARS}
  657. { add code that will load the return value, this is not done
  658. for assembler routines when they didn't reference the result
  659. variable }
  660. usesacc:=false;
  661. usesfpu:=false;
  662. usesacchi:=false;
  663. gen_load_return_value(templist,usesacc,usesacchi,usesfpu);
  664. aktproccode.concatlist(templist);
  665. { generate symbol and save end of header position }
  666. aktfilepos:=entrypos;
  667. gen_proc_symbol(templist);
  668. headertai:=tai(templist.last);
  669. { insert symbol }
  670. aktproccode.insertlist(templist);
  671. { Free space in temp/registers for parast and localst, must be
  672. done after gen_entry_code }
  673. aktfilepos:=exitpos;
  674. if procdef.localst.symtabletype=localsymtable then
  675. gen_free_localst(aktproccode,tlocalsymtable(procdef.localst));
  676. gen_free_parast(aktproccode,tparasymtable(procdef.parast));
  677. { The procedure body is finished, we can now
  678. allocate the registers }
  679. cg.do_register_allocation(aktproccode,headertai);
  680. { Add save and restore of used registers }
  681. aktfilepos:=entrypos;
  682. gen_save_used_regs(templist);
  683. aktproccode.insertlistafter(headertai,templist);
  684. aktfilepos:=exitpos;
  685. gen_restore_used_regs(aktproccode,usesacc,usesacchi,usesfpu);
  686. { Add stack allocation code after header }
  687. aktfilepos:=entrypos;
  688. gen_stackalloc_code(templist);
  689. aktproccode.insertlistafter(headertai,templist);
  690. { Add exit code at the end }
  691. aktfilepos:=exitpos;
  692. gen_stackfree_code(templist,usesacc,usesacchi);
  693. aktproccode.concatlist(templist);
  694. {$ifndef NoOpt}
  695. if not(cs_no_regalloc in aktglobalswitches) then
  696. begin
  697. if (cs_optimize in aktglobalswitches) and
  698. { do not optimize pure assembler procedures }
  699. not(pi_is_assembler in flags) then
  700. optimize(aktproccode);
  701. end;
  702. {$endif NoOpt}
  703. { Add end symbol and debug info }
  704. aktfilepos:=exitpos;
  705. gen_proc_symbol_end(templist);
  706. aktproccode.concatlist(templist);
  707. {$ifdef ARM}
  708. insertpcrelativedata(aktproccode,aktlocaldata);
  709. {$endif ARM}
  710. { save local data (casetable) also in the same file }
  711. if assigned(aktlocaldata) and
  712. (not aktlocaldata.empty) then
  713. begin
  714. { because of the limited constant size of the arm, all data access is done pc relative }
  715. if target_info.cpu=cpu_arm then
  716. aktproccode.concatlist(aktlocaldata)
  717. else
  718. begin
  719. aktproccode.concat(Tai_section.Create(sec_data));
  720. aktproccode.concatlist(aktlocaldata);
  721. aktproccode.concat(Tai_section.Create(sec_code));
  722. end;
  723. end;
  724. { add the procedure to the codesegment }
  725. if (cs_create_smart in aktmoduleswitches) then
  726. codesegment.concat(Tai_cut.Create);
  727. codesegment.concatlist(aktproccode);
  728. { only now we can remove the temps }
  729. tg.resettempgen;
  730. { stop tempgen and ra }
  731. tg.free;
  732. cg.done_register_allocators;
  733. tg:=nil;
  734. end;
  735. { restore symtablestack }
  736. remove_from_symtablestack;
  737. { restore }
  738. templist.free;
  739. aktmaxfpuregisters:=oldaktmaxfpuregisters;
  740. aktfilepos:=oldfilepos;
  741. current_procinfo:=oldprocinfo;
  742. end;
  743. procedure tcgprocinfo.add_to_symtablestack;
  744. var
  745. _class,hp : tobjectdef;
  746. begin
  747. { insert symtables for the class, but only if it is no nested function }
  748. if assigned(procdef._class) and
  749. not(assigned(parent) and
  750. assigned(parent.procdef) and
  751. assigned(parent.procdef._class)) then
  752. begin
  753. { insert them in the reverse order }
  754. hp:=nil;
  755. repeat
  756. _class:=procdef._class;
  757. while _class.childof<>hp do
  758. _class:=_class.childof;
  759. hp:=_class;
  760. _class.symtable.next:=symtablestack;
  761. symtablestack:=_class.symtable;
  762. until hp=procdef._class;
  763. end;
  764. { insert parasymtable in symtablestack when parsing
  765. a function }
  766. if procdef.parast.symtablelevel>=normal_function_level then
  767. begin
  768. procdef.parast.next:=symtablestack;
  769. symtablestack:=procdef.parast;
  770. end;
  771. procdef.localst.next:=symtablestack;
  772. symtablestack:=procdef.localst;
  773. end;
  774. procedure tcgprocinfo.remove_from_symtablestack;
  775. begin
  776. { remove localst/parast }
  777. if procdef.parast.symtablelevel>=normal_function_level then
  778. symtablestack:=symtablestack.next.next
  779. else
  780. symtablestack:=symtablestack.next;
  781. { remove class member symbol tables }
  782. while symtablestack.symtabletype=objectsymtable do
  783. symtablestack:=symtablestack.next;
  784. end;
  785. procedure tcgprocinfo.resetprocdef;
  786. begin
  787. { the local symtables can be deleted, but the parast }
  788. { doesn't, (checking definitons when calling a }
  789. { function }
  790. { not for a inline procedure !! (PM) }
  791. { at lexlevel = 1 localst is the staticsymtable itself }
  792. { so no dispose here !! }
  793. if assigned(code) and
  794. not(cs_browser in aktmoduleswitches) and
  795. (procdef.proccalloption<>pocall_inline) then
  796. begin
  797. if procdef.parast.symtablelevel>=normal_function_level then
  798. procdef.localst.free;
  799. procdef.localst:=nil;
  800. end;
  801. { remove code tree, if not inline procedure }
  802. if assigned(code) then
  803. begin
  804. { the inline procedure has already got a copy of the tree
  805. stored in current_procinfo.procdef.code }
  806. code.free;
  807. code:=nil;
  808. if (procdef.proccalloption<>pocall_inline) then
  809. procdef.inlininginfo^.code:=nil;
  810. end;
  811. end;
  812. procedure tcgprocinfo.parse_body;
  813. var
  814. oldprocinfo : tprocinfo;
  815. oldblock_type : tblock_type;
  816. begin
  817. oldprocinfo:=current_procinfo;
  818. oldblock_type:=block_type;
  819. { reset break and continue labels }
  820. block_type:=bt_body;
  821. current_procinfo:=self;
  822. { calculate the lexical level }
  823. if procdef.parast.symtablelevel>maxnesting then
  824. Message(parser_e_too_much_lexlevel);
  825. { static is also important for local procedures !! }
  826. if (po_staticmethod in procdef.procoptions) then
  827. allow_only_static:=true
  828. else if (procdef.parast.symtablelevel=normal_function_level) then
  829. allow_only_static:=false;
  830. {$ifdef state_tracking}
  831. { aktstate:=Tstate_storage.create;}
  832. {$endif state_tracking}
  833. { create a local symbol table for this routine }
  834. if not assigned(procdef.localst) then
  835. procdef.insert_localst;
  836. { add parast/localst to symtablestack }
  837. add_to_symtablestack;
  838. { constant symbols are inserted in this symboltable }
  839. constsymtable:=symtablestack;
  840. { save entry info }
  841. entrypos:=aktfilepos;
  842. entryswitches:=aktlocalswitches;
  843. { parse the code ... }
  844. code:=block(current_module.islibrary);
  845. { save exit info }
  846. exitswitches:=aktlocalswitches;
  847. exitpos:=last_endtoken_filepos;
  848. if assigned(code) then
  849. begin
  850. { get a better entry point }
  851. entrypos:=code.fileinfo;
  852. { the procedure is now defined }
  853. procdef.forwarddef:=false;
  854. if (Errorcount=0) then
  855. begin
  856. { add implicit entry and exit code }
  857. add_entry_exit_code;
  858. { check if forwards are resolved }
  859. tstoredsymtable(procdef.localst).check_forwards;
  860. { check if all labels are used }
  861. tstoredsymtable(procdef.localst).checklabels;
  862. { remove cross unit overloads }
  863. tstoredsymtable(procdef.localst).unchain_overloaded;
  864. end;
  865. { check for unused symbols, but only if there is no asm block }
  866. if not(pi_uses_asm in flags) then
  867. begin
  868. { not for unit init, becuase the var can be used in finalize,
  869. it will be done in proc_unit }
  870. if not(procdef.proctypeoption in [potype_proginit,potype_unitinit,potype_unitfinalize]) then
  871. tstoredsymtable(procdef.localst).allsymbolsused;
  872. tstoredsymtable(procdef.parast).allsymbolsused;
  873. end;
  874. { Finish type checking pass }
  875. do_resulttypepass(code);
  876. { Print the node to tree.log }
  877. if paraprintnodetree=1 then
  878. printnode_procdef(procdef);
  879. end;
  880. { store a copy of the original tree for inline, for
  881. normal procedures only store a reference to the
  882. current tree }
  883. if (procdef.proccalloption=pocall_inline) then
  884. begin
  885. procdef.inlininginfo^.code:=code.getcopy;
  886. procdef.inlininginfo^.flags:=current_procinfo.flags;
  887. end
  888. else
  889. procdef.inlininginfo^.code:=code;
  890. { ... remove symbol tables }
  891. remove_from_symtablestack;
  892. {$ifdef state_tracking}
  893. { aktstate.destroy;}
  894. {$endif state_tracking}
  895. { reset to normal non static function }
  896. if (procdef.parast.symtablelevel=normal_function_level) then
  897. allow_only_static:=false;
  898. current_procinfo:=oldprocinfo;
  899. block_type:=oldblock_type;
  900. end;
  901. {****************************************************************************
  902. PROCEDURE/FUNCTION PARSING
  903. ****************************************************************************}
  904. procedure check_init_paras(p:tnamedindexitem;arg:pointer);
  905. begin
  906. if tsym(p).typ<>varsym then
  907. exit;
  908. with tvarsym(p) do
  909. if (not is_class(vartype.def) and
  910. vartype.def.needs_inittable and
  911. (varspez in [vs_value,vs_out])) then
  912. include(current_procinfo.flags,pi_do_call);
  913. end;
  914. procedure read_proc;
  915. {
  916. Parses the procedure directives, then parses the procedure body, then
  917. generates the code for it
  918. }
  919. procedure do_generate_code(pi:tcgprocinfo);
  920. var
  921. hpi : tcgprocinfo;
  922. begin
  923. { generate code for this procedure }
  924. pi.generate_code;
  925. { process nested procs }
  926. hpi:=tcgprocinfo(pi.nestedprocs.first);
  927. while assigned(hpi) do
  928. begin
  929. do_generate_code(hpi);
  930. hpi:=tcgprocinfo(hpi.next);
  931. end;
  932. pi.resetprocdef;
  933. end;
  934. var
  935. old_current_procinfo : tprocinfo;
  936. oldconstsymtable : tsymtable;
  937. oldfailtokenmode : tmodeswitch;
  938. pdflags : tpdflags;
  939. pd : tprocdef;
  940. isnestedproc : boolean;
  941. begin
  942. { save old state }
  943. oldconstsymtable:=constsymtable;
  944. old_current_procinfo:=current_procinfo;
  945. { reset current_procinfo.procdef to nil to be sure that nothing is writing
  946. to an other procdef }
  947. current_procinfo:=nil;
  948. { parse procedure declaration }
  949. if assigned(old_current_procinfo) and
  950. assigned(old_current_procinfo.procdef) then
  951. pd:=parse_proc_dec(old_current_procinfo.procdef._class)
  952. else
  953. pd:=parse_proc_dec(nil);
  954. { set the default function options }
  955. if parse_only then
  956. begin
  957. pd.forwarddef:=true;
  958. { set also the interface flag, for better error message when the
  959. implementation doesn't much this header }
  960. pd.interfacedef:=true;
  961. include(pd.procoptions,po_public);
  962. pdflags:=[pd_interface];
  963. end
  964. else
  965. begin
  966. pdflags:=[pd_body];
  967. if (not current_module.in_interface) then
  968. include(pdflags,pd_implemen);
  969. if (not current_module.is_unit) or
  970. (cs_create_smart in aktmoduleswitches) then
  971. include(pd.procoptions,po_public);
  972. pd.forwarddef:=false;
  973. end;
  974. { parse the directives that may follow }
  975. parse_proc_directives(pd,pdflags);
  976. { hint directives, these can be separated by semicolons here,
  977. that needs to be handled here with a loop (PFV) }
  978. while try_consume_hintdirective(pd.symoptions) do
  979. Consume(_SEMICOLON);
  980. { Set calling convention }
  981. handle_calling_convention(pd);
  982. { everything of the proc definition is known, we can now
  983. calculate the parameters }
  984. calc_parast(pd);
  985. { search for forward declarations }
  986. if not proc_add_definition(pd) then
  987. begin
  988. { A method must be forward defined (in the object declaration) }
  989. if assigned(pd._class) and
  990. (not assigned(old_current_procinfo.procdef._class)) then
  991. begin
  992. MessagePos1(pd.fileinfo,parser_e_header_dont_match_any_member,pd.fullprocname(false));
  993. tprocsym(pd.procsym).write_parameter_lists(pd);
  994. end
  995. else
  996. begin
  997. { Give a better error if there is a forward def in the interface and only
  998. a single implementation }
  999. if (not pd.forwarddef) and
  1000. (not pd.interfacedef) and
  1001. (tprocsym(pd.procsym).procdef_count>1) and
  1002. tprocsym(pd.procsym).first_procdef.forwarddef and
  1003. tprocsym(pd.procsym).first_procdef.interfacedef and
  1004. not(tprocsym(pd.procsym).procdef_count>2) then
  1005. begin
  1006. MessagePos1(pd.fileinfo,parser_e_header_dont_match_forward,pd.fullprocname(false));
  1007. tprocsym(pd.procsym).write_parameter_lists(pd);
  1008. end;
  1009. end;
  1010. end;
  1011. { compile procedure when a body is needed }
  1012. if (pd_body in pdflags) then
  1013. begin
  1014. Message1(parser_d_procedure_start,pd.fullprocname(false));
  1015. { create a new procedure }
  1016. current_procinfo:=cprocinfo.create(old_current_procinfo);
  1017. current_module.procinfo:=current_procinfo;
  1018. current_procinfo.procdef:=pd;
  1019. isnestedproc:=(current_procinfo.procdef.parast.symtablelevel>normal_function_level);
  1020. { Insert mangledname }
  1021. pd.aliasnames.insert(pd.mangledname);
  1022. { Insert result variables in the localst }
  1023. insert_funcret_local(pd);
  1024. { check if there are para's which require initing -> set }
  1025. { pi_do_call (if not yet set) }
  1026. if not(pi_do_call in current_procinfo.flags) then
  1027. pd.parast.foreach_static({$ifdef FPCPROCVAR}@{$endif}check_init_paras,nil);
  1028. { set _FAIL as keyword if constructor }
  1029. if (pd.proctypeoption=potype_constructor) then
  1030. begin
  1031. oldfailtokenmode:=tokeninfo^[_FAIL].keyword;
  1032. tokeninfo^[_FAIL].keyword:=m_all;
  1033. end;
  1034. tcgprocinfo(current_procinfo).parse_body;
  1035. { When it's a nested procedure then defer the code generation,
  1036. when back at normal function level then generate the code
  1037. for all defered nested procedures and the current procedure }
  1038. if isnestedproc then
  1039. tcgprocinfo(current_procinfo.parent).nestedprocs.insert(current_procinfo)
  1040. else
  1041. begin
  1042. { We can't support inlining for procedures that have nested
  1043. procedures because the nested procedures use a fixed offset
  1044. for accessing locals in the parent procedure (PFV) }
  1045. if (current_procinfo.procdef.proccalloption=pocall_inline) and
  1046. (tcgprocinfo(current_procinfo).nestedprocs.count>0) then
  1047. begin
  1048. Message1(parser_w_not_supported_for_inline,'nested procedures');
  1049. Message(parser_w_inlining_disabled);
  1050. current_procinfo.procdef.proccalloption:=pocall_default;
  1051. end;
  1052. do_generate_code(tcgprocinfo(current_procinfo));
  1053. end;
  1054. { reset _FAIL as _SELF normal }
  1055. if (pd.proctypeoption=potype_constructor) then
  1056. tokeninfo^[_FAIL].keyword:=oldfailtokenmode;
  1057. { release procinfo }
  1058. if tprocinfo(current_module.procinfo)<>current_procinfo then
  1059. internalerror(200304274);
  1060. current_module.procinfo:=current_procinfo.parent;
  1061. if not isnestedproc then
  1062. current_procinfo.free;
  1063. consume(_SEMICOLON);
  1064. end;
  1065. { Restore old state }
  1066. constsymtable:=oldconstsymtable;
  1067. current_procinfo:=old_current_procinfo;
  1068. end;
  1069. {****************************************************************************
  1070. DECLARATION PARSING
  1071. ****************************************************************************}
  1072. { search in symtablestack for not complete classes }
  1073. procedure check_forward_class(p : tnamedindexitem;arg:pointer);
  1074. begin
  1075. if (tsym(p).typ=typesym) and
  1076. (ttypesym(p).restype.def.deftype=objectdef) and
  1077. (oo_is_forward in tobjectdef(ttypesym(p).restype.def).objectoptions) then
  1078. MessagePos1(tsym(p).fileinfo,sym_e_forward_type_not_resolved,tsym(p).realname);
  1079. end;
  1080. procedure read_declarations(islibrary : boolean);
  1081. begin
  1082. repeat
  1083. if not assigned(current_procinfo) then
  1084. internalerror(200304251);
  1085. case token of
  1086. _LABEL:
  1087. label_dec;
  1088. _CONST:
  1089. const_dec;
  1090. _TYPE:
  1091. type_dec;
  1092. _VAR:
  1093. var_dec;
  1094. _THREADVAR:
  1095. threadvar_dec;
  1096. _CONSTRUCTOR,
  1097. _DESTRUCTOR,
  1098. _FUNCTION,
  1099. _PROCEDURE,
  1100. _OPERATOR,
  1101. _CLASS:
  1102. read_proc;
  1103. _EXPORTS:
  1104. begin
  1105. if not(assigned(current_procinfo.procdef.localst)) or
  1106. (current_procinfo.procdef.localst.symtablelevel>main_program_level) or
  1107. (current_module.is_unit) then
  1108. begin
  1109. Message(parser_e_syntax_error);
  1110. consume_all_until(_SEMICOLON);
  1111. end
  1112. else if islibrary or
  1113. (target_info.system in [system_i386_WIN32,system_i386_wdosx,system_i386_Netware]) then
  1114. read_exports
  1115. else
  1116. begin
  1117. Message(parser_w_unsupported_feature);
  1118. consume(_BEGIN);
  1119. end;
  1120. end
  1121. else
  1122. begin
  1123. case idtoken of
  1124. _RESOURCESTRING :
  1125. resourcestring_dec;
  1126. _PROPERTY:
  1127. begin
  1128. if (m_fpc in aktmodeswitches) then
  1129. property_dec
  1130. else
  1131. break;
  1132. end;
  1133. else
  1134. break;
  1135. end;
  1136. end;
  1137. end;
  1138. until false;
  1139. { check for incomplete class definitions, this is only required
  1140. for fpc modes }
  1141. if (m_fpc in aktmodeswitches) then
  1142. symtablestack.foreach_static({$ifdef FPCPROCVAR}@{$endif}check_forward_class,nil);
  1143. end;
  1144. procedure read_interface_declarations;
  1145. begin
  1146. repeat
  1147. case token of
  1148. _CONST :
  1149. const_dec;
  1150. _TYPE :
  1151. type_dec;
  1152. _VAR :
  1153. var_dec;
  1154. _THREADVAR :
  1155. threadvar_dec;
  1156. _FUNCTION,
  1157. _PROCEDURE,
  1158. _OPERATOR :
  1159. read_proc;
  1160. else
  1161. begin
  1162. case idtoken of
  1163. _RESOURCESTRING :
  1164. resourcestring_dec;
  1165. _PROPERTY:
  1166. begin
  1167. if (m_fpc in aktmodeswitches) then
  1168. property_dec
  1169. else
  1170. break;
  1171. end;
  1172. else
  1173. break;
  1174. end;
  1175. end;
  1176. end;
  1177. until false;
  1178. { check for incomplete class definitions, this is only required
  1179. for fpc modes }
  1180. if (m_fpc in aktmodeswitches) then
  1181. symtablestack.foreach_static({$ifdef FPCPROCVAR}@{$endif}check_forward_class,nil);
  1182. end;
  1183. end.
  1184. {
  1185. $Log$
  1186. Revision 1.182 2004-01-21 19:01:03 florian
  1187. * fixed handling of max. distance of pc relative symbols
  1188. Revision 1.181 2003/12/21 19:42:43 florian
  1189. * fixed ppc inlining stuff
  1190. * fixed wrong unit writing
  1191. + added some sse stuff
  1192. Revision 1.180 2003/12/19 22:08:44 daniel
  1193. * Some work to restore the MMX capabilities
  1194. Revision 1.179 2003/12/16 22:36:19 florian
  1195. * forgot a commit
  1196. Revision 1.178 2003/12/16 21:29:24 florian
  1197. + inlined procedures inherit procinfo flags
  1198. Revision 1.177 2003/12/15 21:25:48 peter
  1199. * reg allocations for imaginary register are now inserted just
  1200. before reg allocation
  1201. * tregister changed to enum to allow compile time check
  1202. * fixed several tregister-tsuperregister errors
  1203. Revision 1.176 2003/12/10 16:37:01 peter
  1204. * global property support for fpc modes
  1205. Revision 1.175 2003/12/03 23:13:20 peter
  1206. * delayed paraloc allocation, a_param_*() gets extra parameter
  1207. if it needs to allocate temp or real paralocation
  1208. * optimized/simplified int-real loading
  1209. Revision 1.174 2003/11/27 09:08:01 florian
  1210. * resourcestring is allowed in the interface
  1211. Revision 1.173 2003/11/23 17:05:16 peter
  1212. * register calling is left-right
  1213. * parameter ordering
  1214. * left-right calling inserts result parameter last
  1215. Revision 1.172 2003/11/22 00:40:19 jonas
  1216. * fixed optimiser so it compiles again
  1217. * fixed several bugs which were in there already for a long time, but
  1218. which only popped up now :) -O2/-O3 will now optimise less than in
  1219. the past (and correctly so), but -O2u/-O3u will optimise a bit more
  1220. * some more small improvements for -O3 are still possible
  1221. Revision 1.171 2003/11/10 22:02:52 peter
  1222. * cross unit inlining fixed
  1223. Revision 1.170 2003/11/07 15:58:32 florian
  1224. * Florian's culmutative nr. 1; contains:
  1225. - invalid calling conventions for a certain cpu are rejected
  1226. - arm softfloat calling conventions
  1227. - -Sp for cpu dependend code generation
  1228. - several arm fixes
  1229. - remaining code for value open array paras on heap
  1230. Revision 1.169 2003/10/31 15:52:18 peter
  1231. * fix crash with fail in constructor
  1232. Revision 1.168 2003/10/30 16:22:40 peter
  1233. * call firstpass before allocation and codegeneration is started
  1234. * move leftover code from pass_2.generatecode() to psub
  1235. Revision 1.167 2003/10/24 17:40:23 peter
  1236. * cleanup of the entry and exit code insertion
  1237. Revision 1.166 2003/10/21 15:14:33 peter
  1238. * fixed memleak for initfinalcode
  1239. * exit from generatecode when there are already errors
  1240. Revision 1.165 2003/10/20 19:28:51 peter
  1241. * disable inlining when nested procedures are found
  1242. Revision 1.164 2003/10/19 01:34:30 florian
  1243. * some ppc stuff fixed
  1244. * memory leak fixed
  1245. Revision 1.163 2003/10/17 14:38:32 peter
  1246. * 64k registers supported
  1247. * fixed some memory leaks
  1248. Revision 1.162 2003/10/10 17:48:13 peter
  1249. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  1250. * tregisteralloctor renamed to trgobj
  1251. * removed rgobj from a lot of units
  1252. * moved location_* and reference_* to cgobj
  1253. * first things for mmx register allocation
  1254. Revision 1.161 2003/10/09 21:31:37 daniel
  1255. * Register allocator splitted, ans abstract now
  1256. Revision 1.160 2003/10/09 15:20:56 peter
  1257. * self is not a token anymore. It is handled special when found
  1258. in a code block and when parsing an method
  1259. Revision 1.159 2003/10/07 15:17:07 peter
  1260. * inline supported again, LOC_REFERENCEs are used to pass the
  1261. parameters
  1262. * inlineparasymtable,inlinelocalsymtable removed
  1263. * exitlabel inserting fixed
  1264. Revision 1.158 2003/10/06 22:23:41 florian
  1265. + added basic olevariant support
  1266. Revision 1.157 2003/10/03 14:45:09 peter
  1267. * more proc directive for procvar fixes
  1268. Revision 1.156 2003/10/02 21:20:32 peter
  1269. * handle_calling_convention removed from parse_proc_directive to
  1270. separate call
  1271. Revision 1.155 2003/10/01 20:34:49 peter
  1272. * procinfo unit contains tprocinfo
  1273. * cginfo renamed to cgbase
  1274. * moved cgmessage to verbose
  1275. * fixed ppc and sparc compiles
  1276. Revision 1.154 2003/09/29 20:58:56 peter
  1277. * optimized releasing of registers
  1278. Revision 1.153 2003/09/28 17:55:04 peter
  1279. * parent framepointer changed to hidden parameter
  1280. * tloadparentfpnode added
  1281. Revision 1.152 2003/09/27 13:29:43 peter
  1282. * fix reported file position for not matched forwards
  1283. Revision 1.151 2003/09/25 21:25:13 peter
  1284. * remove allocate_intterupt_parameter, allocation is platform
  1285. dependent and needs to be done in create_paraloc_info
  1286. Revision 1.150 2003/09/25 16:19:32 peter
  1287. * fix filepositions
  1288. * insert spill temp allocations at the start of the proc
  1289. Revision 1.149 2003/09/23 17:56:06 peter
  1290. * locals and paras are allocated in the code generation
  1291. * tvarsym.localloc contains the location of para/local when
  1292. generating code for the current procedure
  1293. Revision 1.148 2003/09/14 19:18:10 peter
  1294. * remove obsolete code already in comments
  1295. Revision 1.147 2003/09/14 12:58:00 peter
  1296. * support mulitple overloads in implementation, this is delphi
  1297. compatible
  1298. * procsym only stores the overloads available in the interface
  1299. Revision 1.146 2003/09/12 19:07:42 daniel
  1300. * Fixed fast spilling functionality by re-adding the code that initializes
  1301. precoloured nodes to degree 255. I would like to play hangman on the one
  1302. who removed that code.
  1303. Revision 1.145 2003/09/10 19:14:31 daniel
  1304. * Failed attempt to restore broken fastspill functionality
  1305. Revision 1.144 2003/09/09 20:59:27 daniel
  1306. * Adding register allocation order
  1307. Revision 1.143 2003/09/09 15:55:44 peter
  1308. * use register with least interferences in spillregister
  1309. Revision 1.142 2003/09/07 22:09:35 peter
  1310. * preparations for different default calling conventions
  1311. * various RA fixes
  1312. Revision 1.141 2003/09/04 14:46:12 peter
  1313. * abort with IE when spilling requires > 20 loops
  1314. Revision 1.140 2003/09/03 15:55:01 peter
  1315. * NEWRA branch merged
  1316. Revision 1.139 2003/09/03 11:18:37 florian
  1317. * fixed arm concatcopy
  1318. + arm support in the common compiler sources added
  1319. * moved some generic cg code around
  1320. + tfputype added
  1321. * ...
  1322. Revision 1.138.2.1 2003/08/31 13:50:16 daniel
  1323. * Remove sorting and use pregenerated indexes
  1324. * Some work on making things compile
  1325. Revision 1.138 2003/08/20 17:48:49 peter
  1326. * fixed stackalloc to not allocate localst.datasize twice
  1327. * order of stackalloc code fixed for implicit init/final
  1328. Revision 1.137 2003/08/20 15:50:35 peter
  1329. * define NOOPT until optimizer is fixed
  1330. Revision 1.136 2003/08/20 09:07:00 daniel
  1331. * New register coding now mandatory, some more convert_registers calls
  1332. removed.
  1333. Revision 1.135 2003/08/20 07:48:03 daniel
  1334. * Made internal assembler use new register coding
  1335. Revision 1.134 2003/08/17 16:59:20 jonas
  1336. * fixed regvars so they work with newra (at least for ppc)
  1337. * fixed some volatile register bugs
  1338. + -dnotranslation option for -dnewra, which causes the registers not to
  1339. be translated from virtual to normal registers. Requires support in
  1340. the assembler writer as well, which is only implemented in aggas/
  1341. agppcgas currently
  1342. Revision 1.133 2003/07/23 11:04:15 jonas
  1343. * split en_exit_code into a part that may allocate a register and a part
  1344. that doesn't, so the former can be done before the register colouring
  1345. has been performed
  1346. Revision 1.132 2003/07/06 17:58:22 peter
  1347. * framepointer fixes for sparc
  1348. * parent framepointer code more generic
  1349. Revision 1.131 2003/07/06 15:31:21 daniel
  1350. * Fixed register allocator. *Lots* of fixes.
  1351. Revision 1.130 2003/07/05 20:15:24 jonas
  1352. * set pi_do_call if range/overflow checking is on
  1353. Revision 1.129 2003/06/17 16:34:44 jonas
  1354. * lots of newra fixes (need getfuncretparaloc implementation for i386)!
  1355. * renamed all_intregisters to paramanager.get_volatile_registers_int(pocall_default) and made it
  1356. processor dependent
  1357. Revision 1.128 2003/06/14 14:53:50 jonas
  1358. * fixed newra cycle for x86
  1359. * added constants for indicating source and destination operands of the
  1360. "move reg,reg" instruction to aasmcpu (and use those in rgobj)
  1361. Revision 1.127 2003/06/13 21:19:31 peter
  1362. * current_procdef removed, use current_procinfo.procdef instead
  1363. Revision 1.126 2003/06/12 16:43:07 peter
  1364. * newra compiles for sparc
  1365. Revision 1.125 2003/06/09 12:23:30 peter
  1366. * init/final of procedure data splitted from genentrycode
  1367. * use asmnode getposition to insert final at the correct position
  1368. als for the implicit try...finally
  1369. Revision 1.124 2003/06/07 19:37:43 jonas
  1370. * pi_do_call must always be set for the main program, since it always
  1371. ends with a call to FPC_DO_EXIT
  1372. Revision 1.123 2003/06/07 18:57:04 jonas
  1373. + added freeintparaloc
  1374. * ppc get/freeintparaloc now check whether the parameter regs are
  1375. properly allocated/deallocated (and get an extra list para)
  1376. * ppc a_call_* now internalerrors if pi_do_call is not yet set
  1377. * fixed lot of missing pi_do_call's
  1378. Revision 1.122 2003/06/03 13:01:59 daniel
  1379. * Register allocator finished
  1380. Revision 1.121 2003/05/31 20:23:39 jonas
  1381. * added pi_do_call if a procedure has a value shortstring parameter
  1382. (it's copied to the local stackframe with a helper)
  1383. Revision 1.120 2003/05/30 23:57:08 peter
  1384. * more sparc cleanup
  1385. * accumulator removed, splitted in function_return_reg (called) and
  1386. function_result_reg (caller)
  1387. Revision 1.119 2003/05/28 23:58:18 jonas
  1388. * added missing initialization of rg.usedintin,byproc
  1389. * ppc now also saves/restores used fpu registers
  1390. * ncgcal doesn't add used registers to usedby/inproc anymore, except for
  1391. i386
  1392. Revision 1.118 2003/05/26 21:17:18 peter
  1393. * procinlinenode removed
  1394. * aktexit2label removed, fast exit removed
  1395. + tcallnode.inlined_pass_2 added
  1396. Revision 1.117 2003/05/25 08:59:47 peter
  1397. * do not generate code when there was an error
  1398. Revision 1.116 2003/05/23 18:49:55 jonas
  1399. * generate code for parent procedure before that of nested procedures as
  1400. well (I only need pass_1 to be done for the ppc, but pass_1 and pass_2
  1401. are grouped and it doesn't hurt that pass_2 is done as well)
  1402. Revision 1.115 2003/05/22 21:31:35 peter
  1403. * defer codegeneration for nested procedures
  1404. Revision 1.114 2003/05/16 20:00:39 jonas
  1405. * powerpc nested procedure fixes, should work completely now if all
  1406. local variables of the parent procedure are declared before the
  1407. nested procedures are declared
  1408. Revision 1.113 2003/05/16 14:33:31 peter
  1409. * regvar fixes
  1410. Revision 1.112 2003/05/13 21:26:38 peter
  1411. * only call destructor in except block when there is a destructor
  1412. available
  1413. Revision 1.111 2003/05/13 19:14:41 peter
  1414. * failn removed
  1415. * inherited result code check moven to pexpr
  1416. Revision 1.110 2003/05/13 15:18:49 peter
  1417. * fixed various crashes
  1418. Revision 1.109 2003/05/11 21:37:03 peter
  1419. * moved implicit exception frame from ncgutil to psub
  1420. * constructor/destructor helpers moved from cobj/ncgutil to psub
  1421. Revision 1.108 2003/05/09 17:47:03 peter
  1422. * self moved to hidden parameter
  1423. * removed hdisposen,hnewn,selfn
  1424. Revision 1.107 2003/04/27 11:21:34 peter
  1425. * aktprocdef renamed to current_procinfo.procdef
  1426. * procinfo renamed to current_procinfo
  1427. * procinfo will now be stored in current_module so it can be
  1428. cleaned up properly
  1429. * gen_main_procsym changed to create_main_proc and release_main_proc
  1430. to also generate a tprocinfo structure
  1431. * fixed unit implicit initfinal
  1432. Revision 1.106 2003/04/27 07:29:50 peter
  1433. * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
  1434. a new procdef declaration
  1435. * aktprocsym removed
  1436. * lexlevel removed, use symtable.symtablelevel instead
  1437. * implicit init/final code uses the normal genentry/genexit
  1438. * funcret state checking updated for new funcret handling
  1439. Revision 1.105 2003/04/26 00:31:42 peter
  1440. * set return_offset moved to after_header
  1441. Revision 1.104 2003/04/25 20:59:34 peter
  1442. * removed funcretn,funcretsym, function result is now in varsym
  1443. and aliases for result and function name are added using absolutesym
  1444. * vs_hidden parameter for funcret passed in parameter
  1445. * vs_hidden fixes
  1446. * writenode changed to printnode and released from extdebug
  1447. * -vp option added to generate a tree.log with the nodetree
  1448. * nicer printnode for statements, callnode
  1449. Revision 1.103 2003/04/24 13:03:01 florian
  1450. * comp is now written with its bit pattern to the ppu instead as an extended
  1451. Revision 1.102 2003/04/23 12:35:34 florian
  1452. * fixed several issues with powerpc
  1453. + applied a patch from Jonas for nested function calls (PowerPC only)
  1454. * ...
  1455. Revision 1.101 2003/04/22 14:33:38 peter
  1456. * removed some notes/hints
  1457. Revision 1.100 2003/04/22 13:47:08 peter
  1458. * fixed C style array of const
  1459. * fixed C array passing
  1460. * fixed left to right with high parameters
  1461. Revision 1.99 2003/04/22 10:09:35 daniel
  1462. + Implemented the actual register allocator
  1463. + Scratch registers unavailable when new register allocator used
  1464. + maybe_save/maybe_restore unavailable when new register allocator used
  1465. Revision 1.98 2003/04/17 07:50:24 daniel
  1466. * Some work on interference graph construction
  1467. Revision 1.97 2003/04/16 09:26:55 jonas
  1468. * assembler procedures now again get a stackframe if they have local
  1469. variables. No space is reserved for a function result however.
  1470. Also, the register parameters aren't automatically saved on the stack
  1471. anymore in assembler procedures.
  1472. Revision 1.96 2003/04/05 21:09:31 jonas
  1473. * several ppc/generic result offset related fixes. The "normal" result
  1474. offset seems now to be calculated correctly and a lot of duplicate
  1475. calculations have been removed. Nested functions accessing the parent's
  1476. function result don't work at all though :(
  1477. Revision 1.95 2003/04/02 16:11:34 peter
  1478. * give error when exports is not supported
  1479. Revision 1.94 2003/03/12 22:43:38 jonas
  1480. * more powerpc and generic fixes related to the new register allocator
  1481. Revision 1.93 2003/03/08 08:59:07 daniel
  1482. + $define newra will enable new register allocator
  1483. + getregisterint will return imaginary registers with $newra
  1484. + -sr switch added, will skip register allocation so you can see
  1485. the direct output of the code generator before register allocation
  1486. Revision 1.92 2003/02/19 22:00:14 daniel
  1487. * Code generator converted to new register notation
  1488. - Horribily outdated todo.txt removed
  1489. Revision 1.91 2003/01/09 21:52:37 peter
  1490. * merged some verbosity options.
  1491. * V_LineInfo is a verbosity flag to include line info
  1492. Revision 1.90 2003/01/09 20:40:59 daniel
  1493. * Converted some code in cgx86.pas to new register numbering
  1494. Revision 1.89 2003/01/09 15:49:56 daniel
  1495. * Added register conversion
  1496. Revision 1.88 2003/01/08 18:43:56 daniel
  1497. * Tregister changed into a record
  1498. Revision 1.87 2003/01/03 20:35:08 peter
  1499. * check also interfacedef when checking for matching forwarddef
  1500. Revision 1.86 2003/01/02 11:14:02 michael
  1501. + Patch from peter to support initial values for local variables
  1502. Revision 1.85 2002/12/29 18:59:34 peter
  1503. * fixed parsing of declarations before asm statement
  1504. Revision 1.84 2002/12/29 18:25:18 peter
  1505. * parse declarations before check _ASM token
  1506. Revision 1.83 2002/12/29 14:57:50 peter
  1507. * unit loading changed to first register units and load them
  1508. afterwards. This is needed to support uses xxx in yyy correctly
  1509. * unit dependency check fixed
  1510. Revision 1.82 2002/12/25 01:26:56 peter
  1511. * duplicate procsym-unitsym fix
  1512. Revision 1.81 2002/12/15 13:37:15 peter
  1513. * don't include uf_init for library. The code is already called and
  1514. does not need to be in the initfinal table
  1515. Revision 1.80 2002/12/07 14:27:09 carl
  1516. * 3% memory optimization
  1517. * changed some types
  1518. + added type checking with different size for call node and for
  1519. parameters
  1520. Revision 1.79 2002/11/25 18:43:32 carl
  1521. - removed the invalid if <> checking (Delphi is strange on this)
  1522. + implemented abstract warning on instance creation of class with
  1523. abstract methods.
  1524. * some error message cleanups
  1525. Revision 1.78 2002/11/25 17:43:23 peter
  1526. * splitted defbase in defutil,symutil,defcmp
  1527. * merged isconvertable and is_equal into compare_defs(_ext)
  1528. * made operator search faster by walking the list only once
  1529. Revision 1.77 2002/11/23 22:50:06 carl
  1530. * some small speed optimizations
  1531. + added several new warnings/hints
  1532. Revision 1.76 2002/11/18 17:31:58 peter
  1533. * pass proccalloption to ret_in_xxx and push_xxx functions
  1534. Revision 1.75 2002/11/17 16:31:57 carl
  1535. * memory optimization (3-4%) : cleanup of tai fields,
  1536. cleanup of tdef and tsym fields.
  1537. * make it work for m68k
  1538. Revision 1.74 2002/11/15 01:58:53 peter
  1539. * merged changes from 1.0.7 up to 04-11
  1540. - -V option for generating bug report tracing
  1541. - more tracing for option parsing
  1542. - errors for cdecl and high()
  1543. - win32 import stabs
  1544. - win32 records<=8 are returned in eax:edx (turned off by default)
  1545. - heaptrc update
  1546. - more info for temp management in .s file with EXTDEBUG
  1547. Revision 1.73 2002/11/09 15:32:30 carl
  1548. * noopt for non-i386 targets
  1549. Revision 1.72 2002/09/10 20:31:48 florian
  1550. * call to current_procinfo.after_header added
  1551. Revision 1.71 2002/09/07 15:25:07 peter
  1552. * old logs removed and tabs fixed
  1553. Revision 1.70 2002/09/03 16:26:27 daniel
  1554. * Make Tprocdef.defs protected
  1555. Revision 1.69 2002/08/25 19:25:20 peter
  1556. * sym.insert_in_data removed
  1557. * symtable.insertvardata/insertconstdata added
  1558. * removed insert_in_data call from symtable.insert, it needs to be
  1559. called separatly. This allows to deref the address calculation
  1560. * procedures now calculate the parast addresses after the procedure
  1561. directives are parsed. This fixes the cdecl parast problem
  1562. * push_addr_param has an extra argument that specifies if cdecl is used
  1563. or not
  1564. Revision 1.68 2002/08/17 09:23:41 florian
  1565. * first part of procinfo rewrite
  1566. Revision 1.67 2002/08/16 14:24:59 carl
  1567. * issameref() to test if two references are the same (then emit no opcodes)
  1568. + ret_in_reg to replace ret_in_acc
  1569. (fix some register allocation bugs at the same time)
  1570. + save_std_register now has an extra parameter which is the
  1571. usedinproc registers
  1572. Revision 1.66 2002/08/11 14:32:27 peter
  1573. * renamed current_library to objectlibrary
  1574. Revision 1.65 2002/08/11 13:24:13 peter
  1575. * saving of asmsymbols in ppu supported
  1576. * asmsymbollist global is removed and moved into a new class
  1577. tasmlibrarydata that will hold the info of a .a file which
  1578. corresponds with a single module. Added librarydata to tmodule
  1579. to keep the library info stored for the module. In the future the
  1580. objectfiles will also be stored to the tasmlibrarydata class
  1581. * all getlabel/newasmsymbol and friends are moved to the new class
  1582. Revision 1.64 2002/08/09 19:14:28 carl
  1583. * fixed stackframe parameter (should only contain local size),
  1584. set to zero currently
  1585. Revision 1.63 2002/08/06 20:55:22 florian
  1586. * first part of ppc calling conventions fix
  1587. Revision 1.62 2002/07/26 21:15:41 florian
  1588. * rewrote the system handling
  1589. Revision 1.61 2002/07/20 11:57:56 florian
  1590. * types.pas renamed to defbase.pas because D6 contains a types
  1591. unit so this would conflicts if D6 programms are compiled
  1592. + Willamette/SSE2 instructions to assembler added
  1593. Revision 1.60 2002/07/19 11:41:36 daniel
  1594. * State tracker work
  1595. * The whilen and repeatn are now completely unified into whilerepeatn. This
  1596. allows the state tracker to change while nodes automatically into
  1597. repeat nodes.
  1598. * Resulttypepass improvements to the notn. 'not not a' is optimized away and
  1599. 'not(a>b)' is optimized into 'a<=b'.
  1600. * Resulttypepass improvements to the whilerepeatn. 'while not a' is optimized
  1601. by removing the notn and later switchting the true and falselabels. The
  1602. same is done with 'repeat until not a'.
  1603. Revision 1.59 2002/07/15 18:03:15 florian
  1604. * readded removed changes
  1605. Revision 1.57 2002/07/11 14:41:28 florian
  1606. * start of the new generic parameter handling
  1607. Revision 1.58 2002/07/14 18:00:44 daniel
  1608. + Added the beginning of a state tracker. This will track the values of
  1609. variables through procedures and optimize things away.
  1610. Revision 1.56 2002/07/07 09:52:32 florian
  1611. * powerpc target fixed, very simple units can be compiled
  1612. * some basic stuff for better callparanode handling, far from being finished
  1613. Revision 1.55 2002/07/04 20:43:01 florian
  1614. * first x86-64 patches
  1615. Revision 1.54 2002/07/01 18:46:25 peter
  1616. * internal linker
  1617. * reorganized aasm layer
  1618. Revision 1.53 2002/05/18 13:34:14 peter
  1619. * readded missing revisions
  1620. Revision 1.52 2002/05/16 19:46:44 carl
  1621. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1622. + try to fix temp allocation (still in ifdef)
  1623. + generic constructor calls
  1624. + start of tassembler / tmodulebase class cleanup
  1625. Revision 1.51 2002/05/14 19:34:49 peter
  1626. * removed old logs and updated copyright year
  1627. }