pstatmnt.pas 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Does the parsing of the statements
  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 pstatmnt;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. tokens,node;
  23. function statement_block(starttoken : ttoken) : tnode;
  24. { reads an assembler block }
  25. function assembler_block : tnode;
  26. implementation
  27. uses
  28. { common }
  29. cutils,cclasses,
  30. { global }
  31. globtype,globals,verbose,
  32. systems,cpuinfo,
  33. { aasm }
  34. cpubase,aasmbase,aasmtai,
  35. { symtable }
  36. symconst,symbase,symtype,symdef,symsym,symtable,defutil,defcmp,
  37. paramgr,symutil,
  38. { pass 1 }
  39. pass_1,htypechk,
  40. nutils,nbas,nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,
  41. { parser }
  42. scanner,
  43. pbase,pexpr,
  44. { codegen }
  45. procinfo,cgbase,
  46. { assembler reader }
  47. rabase
  48. ;
  49. function statement : tnode;forward;
  50. function if_statement : tnode;
  51. var
  52. ex,if_a,else_a : tnode;
  53. begin
  54. consume(_IF);
  55. ex:=comp_expr(true);
  56. consume(_THEN);
  57. if token<>_ELSE then
  58. if_a:=statement
  59. else
  60. if_a:=nil;
  61. if try_to_consume(_ELSE) then
  62. else_a:=statement
  63. else
  64. else_a:=nil;
  65. if_statement:=genloopnode(ifn,ex,if_a,else_a,false);
  66. end;
  67. { creates a block (list) of statements, til the next END token }
  68. function statements_til_end : tnode;
  69. var
  70. first,last : tstatementnode;
  71. begin
  72. first:=nil;
  73. while token<>_END do
  74. begin
  75. if first=nil then
  76. begin
  77. last:=cstatementnode.create(statement,nil);
  78. first:=last;
  79. end
  80. else
  81. begin
  82. last.right:=cstatementnode.create(statement,nil);
  83. last:=tstatementnode(last.right);
  84. end;
  85. if not try_to_consume(_SEMICOLON) then
  86. break;
  87. consume_emptystats;
  88. end;
  89. consume(_END);
  90. statements_til_end:=cblocknode.create(first);
  91. end;
  92. function case_statement : tnode;
  93. var
  94. { contains the label number of currently parsed case block }
  95. aktcaselabel : tasmlabel;
  96. firstlabel : boolean;
  97. root : pcaserecord;
  98. { the typ of the case expression }
  99. casedef : tdef;
  100. procedure newcaselabel(l,h : TConstExprInt;first:boolean);
  101. var
  102. hcaselabel : pcaserecord;
  103. procedure insertlabel(var p : pcaserecord);
  104. begin
  105. if p=nil then p:=hcaselabel
  106. else
  107. if (p^._low>hcaselabel^._low) and
  108. (p^._low>hcaselabel^._high) then
  109. if (hcaselabel^.statement = p^.statement) and
  110. (p^._low = hcaselabel^._high + 1) then
  111. begin
  112. p^._low := hcaselabel^._low;
  113. dispose(hcaselabel);
  114. end
  115. else
  116. insertlabel(p^.less)
  117. else
  118. if (p^._high<hcaselabel^._low) and
  119. (p^._high<hcaselabel^._high) then
  120. if (hcaselabel^.statement = p^.statement) and
  121. (p^._high+1 = hcaselabel^._low) then
  122. begin
  123. p^._high := hcaselabel^._high;
  124. dispose(hcaselabel);
  125. end
  126. else
  127. insertlabel(p^.greater)
  128. else Message(parser_e_double_caselabel);
  129. end;
  130. begin
  131. new(hcaselabel);
  132. hcaselabel^.less:=nil;
  133. hcaselabel^.greater:=nil;
  134. hcaselabel^.statement:=aktcaselabel;
  135. hcaselabel^.firstlabel:=first;
  136. objectlibrary.getlabel(hcaselabel^._at);
  137. hcaselabel^._low:=l;
  138. hcaselabel^._high:=h;
  139. insertlabel(root);
  140. end;
  141. var
  142. code,caseexpr,p,instruc,elseblock : tnode;
  143. hl1,hl2 : TConstExprInt;
  144. casedeferror : boolean;
  145. begin
  146. consume(_CASE);
  147. caseexpr:=comp_expr(true);
  148. { determines result type }
  149. do_resulttypepass(caseexpr);
  150. set_varstate(caseexpr,vs_used,true);
  151. casedeferror:=false;
  152. casedef:=caseexpr.resulttype.def;
  153. if (not assigned(casedef)) or
  154. not(is_ordinal(casedef)) then
  155. begin
  156. CGMessage(type_e_ordinal_expr_expected);
  157. { create a correct tree }
  158. caseexpr.free;
  159. caseexpr:=cordconstnode.create(0,u32inttype,false);
  160. { set error flag so no rangechecks are done }
  161. casedeferror:=true;
  162. end;
  163. consume(_OF);
  164. root:=nil;
  165. instruc:=nil;
  166. repeat
  167. objectlibrary.getlabel(aktcaselabel);
  168. firstlabel:=true;
  169. { maybe an instruction has more case labels }
  170. repeat
  171. p:=expr;
  172. if is_widechar(casedef) then
  173. begin
  174. if (p.nodetype=rangen) then
  175. begin
  176. trangenode(p).left:=ctypeconvnode.create(trangenode(p).left,cwidechartype);
  177. trangenode(p).right:=ctypeconvnode.create(trangenode(p).right,cwidechartype);
  178. do_resulttypepass(trangenode(p).left);
  179. do_resulttypepass(trangenode(p).right);
  180. end
  181. else
  182. begin
  183. p:=ctypeconvnode.create(p,cwidechartype);
  184. do_resulttypepass(p);
  185. end;
  186. end;
  187. hl1:=0;
  188. hl2:=0;
  189. if (p.nodetype=rangen) then
  190. begin
  191. { type checking for case statements }
  192. if is_subequal(casedef, trangenode(p).left.resulttype.def) and
  193. is_subequal(casedef, trangenode(p).right.resulttype.def) then
  194. begin
  195. hl1:=get_ordinal_value(trangenode(p).left);
  196. hl2:=get_ordinal_value(trangenode(p).right);
  197. if hl1>hl2 then
  198. CGMessage(parser_e_case_lower_less_than_upper_bound);
  199. if not casedeferror then
  200. begin
  201. testrange(casedef,hl1,false);
  202. testrange(casedef,hl2,false);
  203. end;
  204. end
  205. else
  206. CGMessage(parser_e_case_mismatch);
  207. newcaselabel(hl1,hl2,firstlabel);
  208. end
  209. else
  210. begin
  211. { type checking for case statements }
  212. if not is_subequal(casedef, p.resulttype.def) then
  213. CGMessage(parser_e_case_mismatch);
  214. hl1:=get_ordinal_value(p);
  215. if not casedeferror then
  216. testrange(casedef,hl1,false);
  217. newcaselabel(hl1,hl1,firstlabel);
  218. end;
  219. p.free;
  220. if token=_COMMA then
  221. consume(_COMMA)
  222. else
  223. break;
  224. firstlabel:=false;
  225. until false;
  226. consume(_COLON);
  227. { handles instruction block }
  228. p:=clabelnode.createcase(aktcaselabel,statement);
  229. { concats instruction }
  230. instruc:=cstatementnode.create(p,instruc);
  231. if not(token in [_ELSE,_OTHERWISE,_END]) then
  232. consume(_SEMICOLON);
  233. until (token in [_ELSE,_OTHERWISE,_END]);
  234. if (token in [_ELSE,_OTHERWISE]) then
  235. begin
  236. if not try_to_consume(_ELSE) then
  237. consume(_OTHERWISE);
  238. elseblock:=statements_til_end;
  239. end
  240. else
  241. begin
  242. elseblock:=nil;
  243. consume(_END);
  244. end;
  245. code:=ccasenode.create(caseexpr,instruc,root);
  246. tcasenode(code).elseblock:=elseblock;
  247. case_statement:=code;
  248. end;
  249. function repeat_statement : tnode;
  250. var
  251. first,last,p_e : tnode;
  252. begin
  253. consume(_REPEAT);
  254. first:=nil;
  255. while token<>_UNTIL do
  256. begin
  257. if first=nil then
  258. begin
  259. last:=cstatementnode.create(statement,nil);
  260. first:=last;
  261. end
  262. else
  263. begin
  264. tstatementnode(last).right:=cstatementnode.create(statement,nil);
  265. last:=tstatementnode(last).right;
  266. end;
  267. if not try_to_consume(_SEMICOLON) then
  268. break;
  269. consume_emptystats;
  270. end;
  271. consume(_UNTIL);
  272. first:=cblocknode.create(first);
  273. p_e:=comp_expr(true);
  274. repeat_statement:=genloopnode(whilerepeatn,p_e,first,nil,true);
  275. end;
  276. function while_statement : tnode;
  277. var
  278. p_e,p_a : tnode;
  279. begin
  280. consume(_WHILE);
  281. p_e:=comp_expr(true);
  282. consume(_DO);
  283. p_a:=statement;
  284. while_statement:=genloopnode(whilerepeatn,p_e,p_a,nil,false);
  285. end;
  286. function for_statement : tnode;
  287. var
  288. p_e,tovalue,p_a : tnode;
  289. backward : boolean;
  290. begin
  291. { parse loop header }
  292. consume(_FOR);
  293. p_e:=expr;
  294. if token=_DOWNTO then
  295. begin
  296. consume(_DOWNTO);
  297. backward:=true;
  298. end
  299. else
  300. begin
  301. consume(_TO);
  302. backward:=false;
  303. end;
  304. tovalue:=comp_expr(true);
  305. consume(_DO);
  306. { ... now the instruction }
  307. p_a:=statement;
  308. for_statement:=genloopnode(forn,p_e,tovalue,p_a,backward);
  309. end;
  310. function _with_statement : tnode;
  311. var
  312. right,p : tnode;
  313. i,levelcount : longint;
  314. withsymtable,symtab : tsymtable;
  315. obj : tobjectdef;
  316. hp : tnode;
  317. newblock : tblocknode;
  318. newstatement : tstatementnode;
  319. calltempp,
  320. loadp : ttempcreatenode;
  321. refp : tnode;
  322. htype : ttype;
  323. hasimplicitderef : boolean;
  324. begin
  325. p:=comp_expr(true);
  326. do_resulttypepass(p);
  327. set_varstate(p,vs_used,false);
  328. right:=nil;
  329. if (not codegenerror) and
  330. (p.resulttype.def.deftype in [objectdef,recorddef]) then
  331. begin
  332. newblock:=nil;
  333. { ignore nodes that don't add instructions in the tree }
  334. hp:=p;
  335. while { equal type conversions }
  336. (
  337. (hp.nodetype=typeconvn) and
  338. (ttypeconvnode(hp).convtype=tc_equal)
  339. ) or
  340. { constant array index }
  341. (
  342. (hp.nodetype=vecn) and
  343. (tvecnode(hp).right.nodetype=ordconstn)
  344. ) do
  345. hp:=tunarynode(hp).left;
  346. if (hp.nodetype=loadn) and
  347. (
  348. (tloadnode(hp).symtable=current_procinfo.procdef.localst) or
  349. (tloadnode(hp).symtable=current_procinfo.procdef.parast) or
  350. (tloadnode(hp).symtable.symtabletype in [staticsymtable,globalsymtable])
  351. ) then
  352. begin
  353. { simple load, we can reference direct }
  354. loadp:=nil;
  355. refp:=p;
  356. end
  357. else
  358. begin
  359. calltempp:=nil;
  360. { complex load, load in temp first }
  361. newblock:=internalstatements(newstatement);
  362. { when right is a call then load it first in a temp }
  363. if p.nodetype=calln then
  364. begin
  365. calltempp:=ctempcreatenode.create(p.resulttype,p.resulttype.def.size,tt_persistent);
  366. addstatement(newstatement,calltempp);
  367. addstatement(newstatement,cassignmentnode.create(
  368. ctemprefnode.create(calltempp),
  369. p));
  370. p:=ctemprefnode.create(calltempp);
  371. resulttypepass(p);
  372. end;
  373. { classes and interfaces have implicit dereferencing }
  374. hasimplicitderef:=is_class_or_interface(p.resulttype.def);
  375. if hasimplicitderef then
  376. htype:=p.resulttype
  377. else
  378. htype.setdef(tpointerdef.create(p.resulttype));
  379. { we can't generate debuginfo for a withnode stored in a }
  380. { register }
  381. if (cs_debuginfo in aktmoduleswitches) then
  382. loadp:=ctempcreatenode.create(htype,POINTER_SIZE,tt_persistent)
  383. else
  384. loadp:=ctempcreatenode.create_reg(htype,POINTER_SIZE,tt_persistent);
  385. resulttypepass(loadp);
  386. if hasimplicitderef then
  387. begin
  388. hp:=p;
  389. refp:=ctemprefnode.create(loadp);
  390. end
  391. else
  392. begin
  393. hp:=caddrnode.create(p);
  394. refp:=cderefnode.create(ctemprefnode.create(loadp));
  395. end;
  396. addstatement(newstatement,loadp);
  397. addstatement(newstatement,cassignmentnode.create(
  398. ctemprefnode.create(loadp),
  399. hp));
  400. resulttypepass(refp);
  401. end;
  402. case p.resulttype.def.deftype of
  403. objectdef :
  404. begin
  405. obj:=tobjectdef(p.resulttype.def);
  406. withsymtable:=twithsymtable.Create(obj,obj.symtable.symsearch,refp);
  407. { include also all parent symtables }
  408. levelcount:=1;
  409. obj:=obj.childof;
  410. symtab:=withsymtable;
  411. while assigned(obj) do
  412. begin
  413. symtab.next:=twithsymtable.create(obj,obj.symtable.symsearch,refp.getcopy);
  414. symtab:=symtab.next;
  415. obj:=obj.childof;
  416. inc(levelcount);
  417. end;
  418. symtab.next:=symtablestack;
  419. symtablestack:=withsymtable;
  420. end;
  421. recorddef :
  422. begin
  423. symtab:=trecorddef(p.resulttype.def).symtable;
  424. levelcount:=1;
  425. withsymtable:=twithsymtable.create(trecorddef(p.resulttype.def),symtab.symsearch,refp);
  426. withsymtable.next:=symtablestack;
  427. symtablestack:=withsymtable;
  428. end;
  429. end;
  430. if try_to_consume(_COMMA) then
  431. right:=_with_statement{$ifdef FPCPROCVAR}(){$endif}
  432. else
  433. begin
  434. consume(_DO);
  435. if token<>_SEMICOLON then
  436. right:=statement
  437. else
  438. right:=cerrornode.create;
  439. end;
  440. { remove symtables from the stack }
  441. for i:=1 to levelcount do
  442. symtablestack:=symtablestack.next;
  443. p:=cwithnode.create(right,twithsymtable(withsymtable),levelcount,refp);
  444. { Finalize complex withnode with destroy of temp }
  445. if assigned(newblock) then
  446. begin
  447. addstatement(newstatement,p);
  448. addstatement(newstatement,ctempdeletenode.create(loadp));
  449. if assigned(calltempp) then
  450. addstatement(newstatement,ctempdeletenode.create(calltempp));
  451. p:=newblock;
  452. end;
  453. _with_statement:=p;
  454. end
  455. else
  456. begin
  457. p.free;
  458. Message(parser_e_false_with_expr);
  459. { try to recover from error }
  460. if try_to_consume(_COMMA) then
  461. begin
  462. hp:=_with_statement{$ifdef FPCPROCVAR}(){$endif};
  463. if (hp=nil) then; { remove warning about unused }
  464. end
  465. else
  466. begin
  467. consume(_DO);
  468. { ignore all }
  469. if token<>_SEMICOLON then
  470. statement;
  471. end;
  472. _with_statement:=nil;
  473. end;
  474. end;
  475. function with_statement : tnode;
  476. begin
  477. consume(_WITH);
  478. with_statement:=_with_statement;
  479. end;
  480. function raise_statement : tnode;
  481. var
  482. p,pobj,paddr,pframe : tnode;
  483. begin
  484. pobj:=nil;
  485. paddr:=nil;
  486. pframe:=nil;
  487. consume(_RAISE);
  488. if not(token in endtokens) then
  489. begin
  490. { object }
  491. pobj:=comp_expr(true);
  492. if try_to_consume(_AT) then
  493. begin
  494. paddr:=comp_expr(true);
  495. if try_to_consume(_COMMA) then
  496. pframe:=comp_expr(true);
  497. end;
  498. end
  499. else
  500. begin
  501. if (block_type<>bt_except) then
  502. Message(parser_e_no_reraise_possible);
  503. end;
  504. p:=craisenode.create(pobj,paddr,pframe);
  505. raise_statement:=p;
  506. end;
  507. function try_statement : tnode;
  508. var
  509. p_try_block,p_finally_block,first,last,
  510. p_default,p_specific,hp : tnode;
  511. ot : ttype;
  512. sym : tvarsym;
  513. old_block_type : tblock_type;
  514. exceptsymtable : tsymtable;
  515. objname,objrealname : stringid;
  516. srsym : tsym;
  517. srsymtable : tsymtable;
  518. oldaktexceptblock: integer;
  519. begin
  520. include(current_procinfo.flags,pi_uses_exceptions);
  521. p_default:=nil;
  522. p_specific:=nil;
  523. { read statements to try }
  524. consume(_TRY);
  525. first:=nil;
  526. inc(exceptblockcounter);
  527. oldaktexceptblock := aktexceptblock;
  528. aktexceptblock := exceptblockcounter;
  529. while (token<>_FINALLY) and (token<>_EXCEPT) do
  530. begin
  531. if first=nil then
  532. begin
  533. last:=cstatementnode.create(statement,nil);
  534. first:=last;
  535. end
  536. else
  537. begin
  538. tstatementnode(last).right:=cstatementnode.create(statement,nil);
  539. last:=tstatementnode(last).right;
  540. end;
  541. if not try_to_consume(_SEMICOLON) then
  542. break;
  543. consume_emptystats;
  544. end;
  545. p_try_block:=cblocknode.create(first);
  546. if try_to_consume(_FINALLY) then
  547. begin
  548. inc(exceptblockcounter);
  549. aktexceptblock := exceptblockcounter;
  550. p_finally_block:=statements_til_end;
  551. try_statement:=ctryfinallynode.create(p_try_block,p_finally_block);
  552. end
  553. else
  554. begin
  555. consume(_EXCEPT);
  556. old_block_type:=block_type;
  557. block_type:=bt_except;
  558. inc(exceptblockcounter);
  559. aktexceptblock := exceptblockcounter;
  560. ot:=generrortype;
  561. p_specific:=nil;
  562. if (idtoken=_ON) then
  563. { catch specific exceptions }
  564. begin
  565. repeat
  566. consume(_ID);
  567. if token=_ID then
  568. begin
  569. objname:=pattern;
  570. objrealname:=orgpattern;
  571. { can't use consume_sym here, because we need already
  572. to check for the colon }
  573. searchsym(objname,srsym,srsymtable);
  574. consume(_ID);
  575. { is a explicit name for the exception given ? }
  576. if try_to_consume(_COLON) then
  577. begin
  578. consume_sym(srsym,srsymtable);
  579. if (srsym.typ=typesym) and
  580. is_class(ttypesym(srsym).restype.def) then
  581. begin
  582. ot:=ttypesym(srsym).restype;
  583. sym:=tvarsym.create(objrealname,vs_value,ot);
  584. end
  585. else
  586. begin
  587. sym:=tvarsym.create(objrealname,vs_value,generrortype);
  588. if (srsym.typ=typesym) then
  589. Message1(type_e_class_type_expected,ttypesym(srsym).restype.def.typename)
  590. else
  591. Message1(type_e_class_type_expected,ot.def.typename);
  592. end;
  593. exceptsymtable:=tstt_exceptsymtable.create;
  594. exceptsymtable.insert(sym);
  595. { insert the exception symtable stack }
  596. exceptsymtable.next:=symtablestack;
  597. symtablestack:=exceptsymtable;
  598. end
  599. else
  600. begin
  601. { check if type is valid, must be done here because
  602. with "e: Exception" the e is not necessary }
  603. if srsym=nil then
  604. begin
  605. identifier_not_found(objrealname);
  606. srsym:=generrorsym;
  607. end;
  608. { support unit.identifier }
  609. if srsym.typ=unitsym then
  610. begin
  611. consume(_POINT);
  612. srsym:=searchsymonlyin(tunitsym(srsym).unitsymtable,pattern);
  613. if srsym=nil then
  614. begin
  615. identifier_not_found(orgpattern);
  616. srsym:=generrorsym;
  617. end;
  618. consume(_ID);
  619. end;
  620. { check if type is valid, must be done here because
  621. with "e: Exception" the e is not necessary }
  622. if (srsym.typ=typesym) and
  623. is_class(ttypesym(srsym).restype.def) then
  624. ot:=ttypesym(srsym).restype
  625. else
  626. begin
  627. ot:=generrortype;
  628. if (srsym.typ=typesym) then
  629. Message1(type_e_class_type_expected,ttypesym(srsym).restype.def.typename)
  630. else
  631. Message1(type_e_class_type_expected,ot.def.typename);
  632. end;
  633. exceptsymtable:=nil;
  634. end;
  635. end
  636. else
  637. consume(_ID);
  638. consume(_DO);
  639. hp:=connode.create(nil,statement);
  640. if ot.def.deftype=errordef then
  641. begin
  642. hp.free;
  643. hp:=cerrornode.create;
  644. end;
  645. if p_specific=nil then
  646. begin
  647. last:=hp;
  648. p_specific:=last;
  649. end
  650. else
  651. begin
  652. tonnode(last).left:=hp;
  653. last:=tonnode(last).left;
  654. end;
  655. { set the informations }
  656. { only if the creation of the onnode was succesful, it's possible }
  657. { that last and hp are errornodes (JM) }
  658. if last.nodetype = onn then
  659. begin
  660. tonnode(last).excepttype:=tobjectdef(ot.def);
  661. tonnode(last).exceptsymtable:=exceptsymtable;
  662. end;
  663. { remove exception symtable }
  664. if assigned(exceptsymtable) then
  665. begin
  666. symtablestack:=symtablestack.next;
  667. if last.nodetype <> onn then
  668. exceptsymtable.free;
  669. end;
  670. if not try_to_consume(_SEMICOLON) then
  671. break;
  672. consume_emptystats;
  673. until (token in [_END,_ELSE]);
  674. if try_to_consume(_ELSE) then
  675. begin
  676. { catch the other exceptions }
  677. p_default:=statements_til_end;
  678. end
  679. else
  680. consume(_END);
  681. end
  682. else
  683. begin
  684. { catch all exceptions }
  685. p_default:=statements_til_end;
  686. end;
  687. block_type:=old_block_type;
  688. try_statement:=ctryexceptnode.create(p_try_block,p_specific,p_default);
  689. end;
  690. aktexceptblock := oldaktexceptblock;
  691. end;
  692. function _asm_statement : tnode;
  693. var
  694. asmstat : tasmnode;
  695. Marker : tai;
  696. reg : tregister;
  697. asmreader : tbaseasmreader;
  698. begin
  699. Inside_asm_statement:=true;
  700. if assigned(asmmodeinfos[aktasmmode]) then
  701. begin
  702. asmreader:=asmmodeinfos[aktasmmode]^.casmreader.create;
  703. asmstat:=casmnode.create(asmreader.assemble as taasmoutput);
  704. asmreader.free;
  705. end
  706. else
  707. Message(parser_f_assembler_reader_not_supported);
  708. { Read first the _ASM statement }
  709. consume(_ASM);
  710. { END is read, got a list of changed registers? }
  711. if try_to_consume(_LECKKLAMMER) then
  712. begin
  713. asmstat.used_regs_fpu:=[0..first_fpu_imreg-1];
  714. if token<>_RECKKLAMMER then
  715. begin
  716. repeat
  717. { it's possible to specify the modified registers }
  718. reg:=std_regnum_search(lower(pattern));
  719. if reg<>NR_NO then
  720. begin
  721. if getregtype(reg)=R_INTREGISTER then
  722. include(asmstat.used_regs_int,getsupreg(reg));
  723. end
  724. else
  725. Message(asmr_e_invalid_register);
  726. consume(_CSTRING);
  727. if not try_to_consume(_COMMA) then
  728. break;
  729. until false;
  730. end;
  731. consume(_RECKKLAMMER);
  732. end
  733. else
  734. begin
  735. asmstat.used_regs_int:=paramanager.get_volatile_registers_int(current_procinfo.procdef.proccalloption);
  736. asmstat.used_regs_fpu:=paramanager.get_volatile_registers_fpu(current_procinfo.procdef.proccalloption);
  737. end;
  738. { mark the start and the end of the assembler block
  739. this is needed for the optimizer }
  740. If Assigned(AsmStat.p_asm) Then
  741. Begin
  742. Marker := Tai_Marker.Create(AsmBlockStart);
  743. AsmStat.p_asm.Insert(Marker);
  744. Marker := Tai_Marker.Create(AsmBlockEnd);
  745. AsmStat.p_asm.Concat(Marker);
  746. End;
  747. Inside_asm_statement:=false;
  748. _asm_statement:=asmstat;
  749. end;
  750. function statement : tnode;
  751. var
  752. p : tnode;
  753. code : tnode;
  754. filepos : tfileposinfo;
  755. srsym : tsym;
  756. srsymtable : tsymtable;
  757. s : stringid;
  758. begin
  759. filepos:=akttokenpos;
  760. case token of
  761. _GOTO :
  762. begin
  763. if not(cs_support_goto in aktmoduleswitches)then
  764. Message(sym_e_goto_and_label_not_supported);
  765. consume(_GOTO);
  766. if (token<>_INTCONST) and (token<>_ID) then
  767. begin
  768. Message(sym_e_label_not_found);
  769. code:=cerrornode.create;
  770. end
  771. else
  772. begin
  773. if token=_ID then
  774. consume_sym(srsym,srsymtable)
  775. else
  776. begin
  777. searchsym(pattern,srsym,srsymtable);
  778. if srsym=nil then
  779. begin
  780. identifier_not_found(pattern);
  781. srsym:=generrorsym;
  782. srsymtable:=nil;
  783. end;
  784. consume(token);
  785. end;
  786. if srsym.typ<>labelsym then
  787. begin
  788. Message(sym_e_id_is_no_label_id);
  789. code:=cerrornode.create;
  790. end
  791. else
  792. begin
  793. code:=cgotonode.create(tlabelsym(srsym));
  794. tgotonode(code).labsym:=tlabelsym(srsym);
  795. { set flag that this label is used }
  796. tlabelsym(srsym).used:=true;
  797. end;
  798. end;
  799. end;
  800. _BEGIN :
  801. code:=statement_block(_BEGIN);
  802. _IF :
  803. code:=if_statement;
  804. _CASE :
  805. code:=case_statement;
  806. _REPEAT :
  807. code:=repeat_statement;
  808. _WHILE :
  809. code:=while_statement;
  810. _FOR :
  811. code:=for_statement;
  812. _WITH :
  813. code:=with_statement;
  814. _TRY :
  815. code:=try_statement;
  816. _RAISE :
  817. code:=raise_statement;
  818. { semicolons,else until and end are ignored }
  819. _SEMICOLON,
  820. _ELSE,
  821. _UNTIL,
  822. _END:
  823. code:=cnothingnode.create;
  824. _FAIL :
  825. begin
  826. if (current_procinfo.procdef.proctypeoption<>potype_constructor) then
  827. Message(parser_e_fail_only_in_constructor);
  828. consume(_FAIL);
  829. code:=call_fail_node;
  830. end;
  831. _ASM :
  832. code:=_asm_statement;
  833. _EOF :
  834. Message(scan_f_end_of_file);
  835. else
  836. begin
  837. p:=expr;
  838. { When a colon follows a intconst then transform it into a label }
  839. if try_to_consume(_COLON) then
  840. begin
  841. s:=tostr(tordconstnode(p).value);
  842. p.free;
  843. searchsym(s,srsym,srsymtable);
  844. if assigned(srsym) then
  845. begin
  846. if tlabelsym(srsym).defined then
  847. Message(sym_e_label_already_defined);
  848. tlabelsym(srsym).defined:=true;
  849. p:=clabelnode.create(tlabelsym(srsym),nil);
  850. end
  851. else
  852. begin
  853. Message1(sym_e_label_used_and_not_defined,s);
  854. p:=cnothingnode.create;
  855. end;
  856. end;
  857. if p.nodetype=labeln then
  858. begin
  859. { the pointer to the following instruction }
  860. { isn't a very clean way }
  861. if token in endtokens then
  862. tlabelnode(p).left:=cnothingnode.create
  863. else
  864. tlabelnode(p).left:=statement{$ifdef FPCPROCVAR}(){$endif};
  865. { be sure to have left also resulttypepass }
  866. resulttypepass(tlabelnode(p).left);
  867. end
  868. else
  869. begin
  870. { change a load of a procvar to a call. this is also
  871. supported in fpc mode }
  872. maybe_call_procvar(p,false);
  873. end;
  874. { blockn support because a read/write is changed into a blocknode }
  875. { with a separate statement for each read/write operation (JM) }
  876. { the same is true for val() if the third parameter is not 32 bit }
  877. if not(p.nodetype in [nothingn,calln,ifn,assignn,breakn,inlinen,
  878. continuen,labeln,blockn,exitn]) then
  879. Message(cg_e_illegal_expression);
  880. { Specify that we don't use the value returned by the call.
  881. This is used for :
  882. - dispose of temp stack space
  883. - dispose on FPU stack }
  884. if (p.nodetype=calln) then
  885. exclude(p.flags,nf_return_value_used);
  886. code:=p;
  887. end;
  888. end;
  889. if assigned(code) then
  890. code.set_tree_filepos(filepos);
  891. statement:=code;
  892. end;
  893. function statement_block(starttoken : ttoken) : tnode;
  894. var
  895. first,last : tnode;
  896. filepos : tfileposinfo;
  897. begin
  898. first:=nil;
  899. filepos:=akttokenpos;
  900. consume(starttoken);
  901. while not(token in [_END,_FINALIZATION]) do
  902. begin
  903. if first=nil then
  904. begin
  905. last:=cstatementnode.create(statement,nil);
  906. first:=last;
  907. end
  908. else
  909. begin
  910. tstatementnode(last).right:=cstatementnode.create(statement,nil);
  911. last:=tstatementnode(last).right;
  912. end;
  913. if (token in [_END,_FINALIZATION]) then
  914. break
  915. else
  916. begin
  917. { if no semicolon, then error and go on }
  918. if token<>_SEMICOLON then
  919. begin
  920. consume(_SEMICOLON);
  921. consume_all_until(_SEMICOLON);
  922. end;
  923. consume(_SEMICOLON);
  924. end;
  925. consume_emptystats;
  926. end;
  927. { don't consume the finalization token, it is consumed when
  928. reading the finalization block, but allow it only after
  929. an initalization ! }
  930. if (starttoken<>_INITIALIZATION) or (token<>_FINALIZATION) then
  931. consume(_END);
  932. last:=cblocknode.create(first);
  933. last.set_tree_filepos(filepos);
  934. statement_block:=last;
  935. end;
  936. function assembler_block : tnode;
  937. var
  938. p : tnode;
  939. locals : longint;
  940. begin
  941. { Rename the funcret so that recursive calls are possible }
  942. if not is_void(current_procinfo.procdef.rettype.def) then
  943. symtablestack.rename(current_procinfo.procdef.resultname,'$hiddenresult');
  944. { delphi uses register calling for assembler methods }
  945. if (m_delphi in aktmodeswitches) and
  946. (po_assembler in current_procinfo.procdef.procoptions) and
  947. not(po_hascallingconvention in current_procinfo.procdef.procoptions) then
  948. current_procinfo.procdef.proccalloption:=pocall_register;
  949. { force the asm statement }
  950. if token<>_ASM then
  951. consume(_ASM);
  952. include(current_procinfo.flags,pi_is_assembler);
  953. p:=_asm_statement;
  954. {$ifndef sparc}
  955. {$ifndef arm}
  956. if (po_assembler in current_procinfo.procdef.procoptions) then
  957. begin
  958. { set the framepointer to esp for assembler functions when the
  959. following conditions are met:
  960. - if the are no local variables and parameters (except the allocated result)
  961. - no reference to the result variable (refcount<=1)
  962. - result is not stored as parameter
  963. - target processor has optional frame pointer save
  964. (vm, i386, vm only currently)
  965. }
  966. locals:=0;
  967. current_procinfo.procdef.localst.foreach_static({$ifdef FPCPROCVAR}@{$endif}count_locals,@locals);
  968. current_procinfo.procdef.parast.foreach_static({$ifdef FPCPROCVAR}@{$endif}count_locals,@locals);
  969. if (locals=0) and
  970. (current_procinfo.procdef.owner.symtabletype<>objectsymtable) and
  971. (not assigned(current_procinfo.procdef.funcretsym) or
  972. (tvarsym(current_procinfo.procdef.funcretsym).refcount<=1)) and
  973. not(paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption)) then
  974. begin
  975. { Only need to set the framepointer, the locals will
  976. be inserted with the correct reference in tcgasmnode.pass_2 }
  977. current_procinfo.framepointer:=NR_STACK_POINTER_REG;
  978. end;
  979. end;
  980. {$endif arm}
  981. {$endif sparc}
  982. { Flag the result as assigned when it is returned in a
  983. register.
  984. }
  985. if assigned(current_procinfo.procdef.funcretsym) and
  986. (not paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption)) then
  987. tvarsym(current_procinfo.procdef.funcretsym).varstate:=vs_assigned;
  988. { because the END is already read we need to get the
  989. last_endtoken_filepos here (PFV) }
  990. last_endtoken_filepos:=akttokenpos;
  991. assembler_block:=p;
  992. end;
  993. end.
  994. {
  995. $Log$
  996. Revision 1.130 2004-02-20 21:55:59 peter
  997. * procvar cleanup
  998. Revision 1.129 2004/02/03 22:32:54 peter
  999. * renamed xNNbittype to xNNinttype
  1000. * renamed registers32 to registersint
  1001. * replace some s32bit,u32bit with torddef([su]inttype).def.typ
  1002. Revision 1.128 2004/02/03 19:47:45 jonas
  1003. * don't put the temp of a withnode in a register if debugging info is on,
  1004. because then our stabs generation internalerror's
  1005. Revision 1.127 2004/02/03 16:46:51 jonas
  1006. + support to store ttempcreate/ref/deletenodes in registers
  1007. * put temps for withnodes and some newnodes in registers
  1008. Note: this currently only works because calling ungetregister()
  1009. multiple times for the same register doesn't matter. We need again
  1010. a way to specify that a register is currently a regvar and as such
  1011. should not be freed when you call ungetregister() on it.
  1012. Revision 1.126 2004/01/22 17:24:49 peter
  1013. * except is also an end of block token
  1014. * after a label don't try to parse a statement when the next token
  1015. is an end token
  1016. Revision 1.125 2004/01/12 16:36:53 peter
  1017. * removed asmmode_direct
  1018. Revision 1.124 2003/12/07 16:40:45 jonas
  1019. * moved count_locals from pstatmnt to symutils
  1020. * use count_locals in powerpc/cpupi to check whether we should set the
  1021. first temp offset (and as such generate a stackframe)
  1022. Revision 1.123 2003/12/03 17:39:04 florian
  1023. * fixed several arm calling conventions issues
  1024. * fixed reference reading in the assembler reader
  1025. * fixed a_loadaddr_ref_reg
  1026. Revision 1.122 2003/11/12 16:05:39 florian
  1027. * assembler readers OOPed
  1028. + typed currency constants
  1029. + typed 128 bit float constants if the CPU supports it
  1030. Revision 1.121 2003/11/11 21:10:12 peter
  1031. * remove temporary stdcall hack
  1032. Revision 1.120 2003/11/10 22:02:52 peter
  1033. * cross unit inlining fixed
  1034. Revision 1.119 2003/10/29 20:34:20 peter
  1035. * move check for unused object constructor result to blocknode
  1036. Revision 1.117 2003/10/29 15:40:20 peter
  1037. * support indexing and offset retrieval for locals
  1038. Revision 1.116 2003/10/17 14:38:32 peter
  1039. * 64k registers supported
  1040. * fixed some memory leaks
  1041. Revision 1.115 2003/10/10 17:48:13 peter
  1042. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  1043. * tregisteralloctor renamed to trgobj
  1044. * removed rgobj from a lot of units
  1045. * moved location_* and reference_* to cgobj
  1046. * first things for mmx register allocation
  1047. Revision 1.114 2003/10/08 19:19:45 peter
  1048. * set_varstate cleanup
  1049. Revision 1.113 2003/10/07 20:06:37 peter
  1050. * set calling convention before assembler block is parsed
  1051. Revision 1.112 2003/10/02 21:15:59 peter
  1052. * delphi mode uses register calling by default for assembler
  1053. Revision 1.111 2003/10/01 20:34:49 peter
  1054. * procinfo unit contains tprocinfo
  1055. * cginfo renamed to cgbase
  1056. * moved cgmessage to verbose
  1057. * fixed ppc and sparc compiles
  1058. Revision 1.110 2003/09/23 17:56:05 peter
  1059. * locals and paras are allocated in the code generation
  1060. * tvarsym.localloc contains the location of para/local when
  1061. generating code for the current procedure
  1062. Revision 1.109 2003/09/16 16:17:01 peter
  1063. * varspez in calls to push_addr_param
  1064. Revision 1.108 2003/09/07 22:09:35 peter
  1065. * preparations for different default calling conventions
  1066. * various RA fixes
  1067. Revision 1.107 2003/09/03 15:55:01 peter
  1068. * NEWRA branch merged
  1069. Revision 1.106.2.3 2003/08/31 15:46:26 peter
  1070. * more updates for tregister
  1071. Revision 1.106.2.2 2003/08/29 17:28:59 peter
  1072. * next batch of updates
  1073. Revision 1.106.2.1 2003/08/28 18:35:08 peter
  1074. * tregister changed to cardinal
  1075. Revision 1.106 2003/07/08 21:24:59 peter
  1076. * sparc fixes
  1077. Revision 1.105 2003/06/17 16:34:44 jonas
  1078. * lots of newra fixes (need getfuncretparaloc implementation for i386)!
  1079. * renamed all_intregisters to paramanager.get_volatile_registers_int(pocall_default) and made it
  1080. processor dependent
  1081. Revision 1.104 2003/06/13 21:19:31 peter
  1082. * current_procdef removed, use current_procinfo.procdef instead
  1083. Revision 1.103 2003/06/09 18:27:14 peter
  1084. * load calln in temprefn in with statement
  1085. Revision 1.102 2003/05/23 22:33:48 florian
  1086. * fix some small flaws which prevent sparc linux system unit from compiling
  1087. * some reformatting done
  1088. Revision 1.101 2003/05/23 15:15:36 peter
  1089. * better error for undefined ordinal labels
  1090. Revision 1.100 2003/05/17 13:30:08 jonas
  1091. * changed tt_persistant to tt_persistent :)
  1092. * tempcreatenode now doesn't accept a boolean anymore for persistent
  1093. temps, but a ttemptype, so you can also create ansistring temps etc
  1094. Revision 1.99 2003/05/15 18:58:53 peter
  1095. * removed selfpointer_offset, vmtpointer_offset
  1096. * tvarsym.adjusted_address
  1097. * address in localsymtable is now in the real direction
  1098. * removed some obsolete globals
  1099. Revision 1.98 2003/05/13 19:14:41 peter
  1100. * failn removed
  1101. * inherited result code check moven to pexpr
  1102. Revision 1.97 2003/05/11 14:45:12 peter
  1103. * tloadnode does not support objectsymtable,withsymtable anymore
  1104. * withnode cleanup
  1105. * direct with rewritten to use temprefnode
  1106. Revision 1.96 2003/05/09 17:47:03 peter
  1107. * self moved to hidden parameter
  1108. * removed hdisposen,hnewn,selfn
  1109. Revision 1.95 2003/04/30 22:15:59 florian
  1110. * some 64 bit adaptions in ncgadd
  1111. * x86-64 now uses ncgadd
  1112. * tparamanager.ret_in_acc doesn't return true anymore for a void-def
  1113. Revision 1.94 2003/04/27 11:21:34 peter
  1114. * aktprocdef renamed to current_procinfo.procdef
  1115. * procinfo renamed to current_procinfo
  1116. * procinfo will now be stored in current_module so it can be
  1117. cleaned up properly
  1118. * gen_main_procsym changed to create_main_proc and release_main_proc
  1119. to also generate a tprocinfo structure
  1120. * fixed unit implicit initfinal
  1121. Revision 1.93 2003/04/27 07:29:50 peter
  1122. * current_procinfo.procdef cleanup, current_procinfo.procdef is now always nil when parsing
  1123. a new procdef declaration
  1124. * aktprocsym removed
  1125. * lexlevel removed, use symtable.symtablelevel instead
  1126. * implicit init/final code uses the normal genentry/genexit
  1127. * funcret state checking updated for new funcret handling
  1128. Revision 1.92 2003/04/26 11:30:59 florian
  1129. * fixed the powerpc to work with the new function result handling
  1130. Revision 1.91 2003/04/25 20:59:34 peter
  1131. * removed funcretn,funcretsym, function result is now in varsym
  1132. and aliases for result and function name are added using absolutesym
  1133. * vs_hidden parameter for funcret passed in parameter
  1134. * vs_hidden fixes
  1135. * writenode changed to printnode and released from extdebug
  1136. * -vp option added to generate a tree.log with the nodetree
  1137. * nicer printnode for statements, callnode
  1138. Revision 1.90 2002/04/25 20:15:40 florian
  1139. * block nodes within expressions shouldn't release the used registers,
  1140. fixed using a flag till the new rg is ready
  1141. Revision 1.89 2003/04/25 08:25:26 daniel
  1142. * Ifdefs around a lot of calls to cleartempgen
  1143. * Fixed registers that are allocated but not freed in several nodes
  1144. * Tweak to register allocator to cause less spills
  1145. * 8-bit registers now interfere with esi,edi and ebp
  1146. Compiler can now compile rtl successfully when using new register
  1147. allocator
  1148. Revision 1.88 2003/03/28 19:16:57 peter
  1149. * generic constructor working for i386
  1150. * remove fixed self register
  1151. * esi added as address register for i386
  1152. Revision 1.87 2003/03/17 18:55:30 peter
  1153. * allow more tokens instead of only semicolon after inherited
  1154. Revision 1.86 2003/02/19 22:00:14 daniel
  1155. * Code generator converted to new register notation
  1156. - Horribily outdated todo.txt removed
  1157. Revision 1.85 2003/01/08 18:43:56 daniel
  1158. * Tregister changed into a record
  1159. Revision 1.84 2003/01/01 21:05:24 peter
  1160. * fixed assembler methods stackpointer optimization that was
  1161. broken after the previous change
  1162. Revision 1.83 2002/12/29 18:59:34 peter
  1163. * fixed parsing of declarations before asm statement
  1164. Revision 1.82 2002/12/27 18:18:56 peter
  1165. * check for else after empty raise statement
  1166. Revision 1.81 2002/11/27 02:37:14 peter
  1167. * case statement inlining added
  1168. * fixed inlining of write()
  1169. * switched statementnode left and right parts so the statements are
  1170. processed in the correct order when getcopy is used. This is
  1171. required for tempnodes
  1172. Revision 1.80 2002/11/25 17:43:22 peter
  1173. * splitted defbase in defutil,symutil,defcmp
  1174. * merged isconvertable and is_equal into compare_defs(_ext)
  1175. * made operator search faster by walking the list only once
  1176. Revision 1.79 2002/11/18 17:31:58 peter
  1177. * pass proccalloption to ret_in_xxx and push_xxx functions
  1178. Revision 1.78 2002/09/07 19:34:08 florian
  1179. + tcg.direction is used now
  1180. Revision 1.77 2002/09/07 15:25:07 peter
  1181. * old logs removed and tabs fixed
  1182. Revision 1.76 2002/09/07 12:16:03 carl
  1183. * second part bug report 1996 fix, testrange in cordconstnode
  1184. only called if option is set (also make parsing a tiny faster)
  1185. Revision 1.75 2002/09/02 18:40:52 peter
  1186. * fixed parsing of register names with lowercase
  1187. Revision 1.74 2002/09/01 14:43:12 peter
  1188. * fixed direct assembler for i386
  1189. Revision 1.73 2002/08/25 19:25:20 peter
  1190. * sym.insert_in_data removed
  1191. * symtable.insertvardata/insertconstdata added
  1192. * removed insert_in_data call from symtable.insert, it needs to be
  1193. called separatly. This allows to deref the address calculation
  1194. * procedures now calculate the parast addresses after the procedure
  1195. directives are parsed. This fixes the cdecl parast problem
  1196. * push_addr_param has an extra argument that specifies if cdecl is used
  1197. or not
  1198. Revision 1.72 2002/08/17 09:23:40 florian
  1199. * first part of procinfo rewrite
  1200. Revision 1.71 2002/08/16 14:24:58 carl
  1201. * issameref() to test if two references are the same (then emit no opcodes)
  1202. + ret_in_reg to replace ret_in_acc
  1203. (fix some register allocation bugs at the same time)
  1204. + save_std_register now has an extra parameter which is the
  1205. usedinproc registers
  1206. Revision 1.70 2002/08/11 14:32:27 peter
  1207. * renamed current_library to objectlibrary
  1208. Revision 1.69 2002/08/11 13:24:12 peter
  1209. * saving of asmsymbols in ppu supported
  1210. * asmsymbollist global is removed and moved into a new class
  1211. tasmlibrarydata that will hold the info of a .a file which
  1212. corresponds with a single module. Added librarydata to tmodule
  1213. to keep the library info stored for the module. In the future the
  1214. objectfiles will also be stored to the tasmlibrarydata class
  1215. * all getlabel/newasmsymbol and friends are moved to the new class
  1216. Revision 1.68 2002/08/10 14:46:30 carl
  1217. + moved target_cpu_string to cpuinfo
  1218. * renamed asmmode enum.
  1219. * assembler reader has now less ifdef's
  1220. * move from nppcmem.pas -> ncgmem.pas vec. node.
  1221. Revision 1.67 2002/08/09 19:11:44 carl
  1222. + reading of used registers in assembler routines is now
  1223. cpu-independent
  1224. Revision 1.66 2002/08/06 20:55:22 florian
  1225. * first part of ppc calling conventions fix
  1226. Revision 1.65 2002/07/28 20:45:22 florian
  1227. + added direct assembler reader for PowerPC
  1228. Revision 1.64 2002/07/20 11:57:56 florian
  1229. * types.pas renamed to defbase.pas because D6 contains a types
  1230. unit so this would conflicts if D6 programms are compiled
  1231. + Willamette/SSE2 instructions to assembler added
  1232. Revision 1.63 2002/07/19 11:41:36 daniel
  1233. * State tracker work
  1234. * The whilen and repeatn are now completely unified into whilerepeatn. This
  1235. allows the state tracker to change while nodes automatically into
  1236. repeat nodes.
  1237. * Resulttypepass improvements to the notn. 'not not a' is optimized away and
  1238. 'not(a>b)' is optimized into 'a<=b'.
  1239. * Resulttypepass improvements to the whilerepeatn. 'while not a' is optimized
  1240. by removing the notn and later switchting the true and falselabels. The
  1241. same is done with 'repeat until not a'.
  1242. Revision 1.62 2002/07/16 15:34:20 florian
  1243. * exit is now a syssym instead of a keyword
  1244. Revision 1.61 2002/07/11 14:41:28 florian
  1245. * start of the new generic parameter handling
  1246. Revision 1.60 2002/07/04 20:43:01 florian
  1247. * first x86-64 patches
  1248. Revision 1.59 2002/07/01 18:46:25 peter
  1249. * internal linker
  1250. * reorganized aasm layer
  1251. Revision 1.58 2002/05/18 13:34:13 peter
  1252. * readded missing revisions
  1253. Revision 1.57 2002/05/16 19:46:44 carl
  1254. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1255. + try to fix temp allocation (still in ifdef)
  1256. + generic constructor calls
  1257. + start of tassembler / tmodulebase class cleanup
  1258. }