pstatmnt.pas 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407
  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,
  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,u32bittype,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. loadp:=ctempcreatenode.create(htype,POINTER_SIZE,tt_persistent);
  380. resulttypepass(loadp);
  381. if hasimplicitderef then
  382. begin
  383. hp:=p;
  384. refp:=ctemprefnode.create(loadp);
  385. end
  386. else
  387. begin
  388. hp:=caddrnode.create(p);
  389. refp:=cderefnode.create(ctemprefnode.create(loadp));
  390. end;
  391. addstatement(newstatement,loadp);
  392. addstatement(newstatement,cassignmentnode.create(
  393. ctemprefnode.create(loadp),
  394. hp));
  395. resulttypepass(refp);
  396. end;
  397. case p.resulttype.def.deftype of
  398. objectdef :
  399. begin
  400. obj:=tobjectdef(p.resulttype.def);
  401. withsymtable:=twithsymtable.Create(obj,obj.symtable.symsearch,refp);
  402. { include also all parent symtables }
  403. levelcount:=1;
  404. obj:=obj.childof;
  405. symtab:=withsymtable;
  406. while assigned(obj) do
  407. begin
  408. symtab.next:=twithsymtable.create(obj,obj.symtable.symsearch,refp.getcopy);
  409. symtab:=symtab.next;
  410. obj:=obj.childof;
  411. inc(levelcount);
  412. end;
  413. symtab.next:=symtablestack;
  414. symtablestack:=withsymtable;
  415. end;
  416. recorddef :
  417. begin
  418. symtab:=trecorddef(p.resulttype.def).symtable;
  419. levelcount:=1;
  420. withsymtable:=twithsymtable.create(trecorddef(p.resulttype.def),symtab.symsearch,refp);
  421. withsymtable.next:=symtablestack;
  422. symtablestack:=withsymtable;
  423. end;
  424. end;
  425. if try_to_consume(_COMMA) then
  426. right:=_with_statement{$ifdef FPCPROCVAR}(){$endif}
  427. else
  428. begin
  429. consume(_DO);
  430. if token<>_SEMICOLON then
  431. right:=statement
  432. else
  433. right:=cerrornode.create;
  434. end;
  435. { remove symtables from the stack }
  436. for i:=1 to levelcount do
  437. symtablestack:=symtablestack.next;
  438. p:=cwithnode.create(right,twithsymtable(withsymtable),levelcount,refp);
  439. { Finalize complex withnode with destroy of temp }
  440. if assigned(newblock) then
  441. begin
  442. addstatement(newstatement,p);
  443. addstatement(newstatement,ctempdeletenode.create(loadp));
  444. if assigned(calltempp) then
  445. addstatement(newstatement,ctempdeletenode.create(calltempp));
  446. p:=newblock;
  447. end;
  448. _with_statement:=p;
  449. end
  450. else
  451. begin
  452. p.free;
  453. Message(parser_e_false_with_expr);
  454. { try to recover from error }
  455. if try_to_consume(_COMMA) then
  456. begin
  457. hp:=_with_statement{$ifdef FPCPROCVAR}(){$endif};
  458. if (hp=nil) then; { remove warning about unused }
  459. end
  460. else
  461. begin
  462. consume(_DO);
  463. { ignore all }
  464. if token<>_SEMICOLON then
  465. statement;
  466. end;
  467. _with_statement:=nil;
  468. end;
  469. end;
  470. function with_statement : tnode;
  471. begin
  472. consume(_WITH);
  473. with_statement:=_with_statement;
  474. end;
  475. function raise_statement : tnode;
  476. var
  477. p,pobj,paddr,pframe : tnode;
  478. begin
  479. pobj:=nil;
  480. paddr:=nil;
  481. pframe:=nil;
  482. consume(_RAISE);
  483. if not(token in endtokens) then
  484. begin
  485. { object }
  486. pobj:=comp_expr(true);
  487. if try_to_consume(_AT) then
  488. begin
  489. paddr:=comp_expr(true);
  490. if try_to_consume(_COMMA) then
  491. pframe:=comp_expr(true);
  492. end;
  493. end
  494. else
  495. begin
  496. if (block_type<>bt_except) then
  497. Message(parser_e_no_reraise_possible);
  498. end;
  499. p:=craisenode.create(pobj,paddr,pframe);
  500. raise_statement:=p;
  501. end;
  502. function try_statement : tnode;
  503. var
  504. p_try_block,p_finally_block,first,last,
  505. p_default,p_specific,hp : tnode;
  506. ot : ttype;
  507. sym : tvarsym;
  508. old_block_type : tblock_type;
  509. exceptsymtable : tsymtable;
  510. objname,objrealname : stringid;
  511. srsym : tsym;
  512. srsymtable : tsymtable;
  513. oldaktexceptblock: integer;
  514. begin
  515. include(current_procinfo.flags,pi_uses_exceptions);
  516. p_default:=nil;
  517. p_specific:=nil;
  518. { read statements to try }
  519. consume(_TRY);
  520. first:=nil;
  521. inc(exceptblockcounter);
  522. oldaktexceptblock := aktexceptblock;
  523. aktexceptblock := exceptblockcounter;
  524. while (token<>_FINALLY) and (token<>_EXCEPT) do
  525. begin
  526. if first=nil then
  527. begin
  528. last:=cstatementnode.create(statement,nil);
  529. first:=last;
  530. end
  531. else
  532. begin
  533. tstatementnode(last).right:=cstatementnode.create(statement,nil);
  534. last:=tstatementnode(last).right;
  535. end;
  536. if not try_to_consume(_SEMICOLON) then
  537. break;
  538. consume_emptystats;
  539. end;
  540. p_try_block:=cblocknode.create(first);
  541. if try_to_consume(_FINALLY) then
  542. begin
  543. inc(exceptblockcounter);
  544. aktexceptblock := exceptblockcounter;
  545. p_finally_block:=statements_til_end;
  546. try_statement:=ctryfinallynode.create(p_try_block,p_finally_block);
  547. end
  548. else
  549. begin
  550. consume(_EXCEPT);
  551. old_block_type:=block_type;
  552. block_type:=bt_except;
  553. inc(exceptblockcounter);
  554. aktexceptblock := exceptblockcounter;
  555. ot:=generrortype;
  556. p_specific:=nil;
  557. if (idtoken=_ON) then
  558. { catch specific exceptions }
  559. begin
  560. repeat
  561. consume(_ID);
  562. if token=_ID then
  563. begin
  564. objname:=pattern;
  565. objrealname:=orgpattern;
  566. { can't use consume_sym here, because we need already
  567. to check for the colon }
  568. searchsym(objname,srsym,srsymtable);
  569. consume(_ID);
  570. { is a explicit name for the exception given ? }
  571. if try_to_consume(_COLON) then
  572. begin
  573. consume_sym(srsym,srsymtable);
  574. if (srsym.typ=typesym) and
  575. is_class(ttypesym(srsym).restype.def) then
  576. begin
  577. ot:=ttypesym(srsym).restype;
  578. sym:=tvarsym.create(objrealname,vs_value,ot);
  579. end
  580. else
  581. begin
  582. sym:=tvarsym.create(objrealname,vs_value,generrortype);
  583. if (srsym.typ=typesym) then
  584. Message1(type_e_class_type_expected,ttypesym(srsym).restype.def.typename)
  585. else
  586. Message1(type_e_class_type_expected,ot.def.typename);
  587. end;
  588. exceptsymtable:=tstt_exceptsymtable.create;
  589. exceptsymtable.insert(sym);
  590. { insert the exception symtable stack }
  591. exceptsymtable.next:=symtablestack;
  592. symtablestack:=exceptsymtable;
  593. end
  594. else
  595. begin
  596. { check if type is valid, must be done here because
  597. with "e: Exception" the e is not necessary }
  598. if srsym=nil then
  599. begin
  600. identifier_not_found(objrealname);
  601. srsym:=generrorsym;
  602. end;
  603. { support unit.identifier }
  604. if srsym.typ=unitsym then
  605. begin
  606. consume(_POINT);
  607. srsym:=searchsymonlyin(tunitsym(srsym).unitsymtable,pattern);
  608. if srsym=nil then
  609. begin
  610. identifier_not_found(orgpattern);
  611. srsym:=generrorsym;
  612. end;
  613. consume(_ID);
  614. end;
  615. { check if type is valid, must be done here because
  616. with "e: Exception" the e is not necessary }
  617. if (srsym.typ=typesym) and
  618. is_class(ttypesym(srsym).restype.def) then
  619. ot:=ttypesym(srsym).restype
  620. else
  621. begin
  622. ot:=generrortype;
  623. if (srsym.typ=typesym) then
  624. Message1(type_e_class_type_expected,ttypesym(srsym).restype.def.typename)
  625. else
  626. Message1(type_e_class_type_expected,ot.def.typename);
  627. end;
  628. exceptsymtable:=nil;
  629. end;
  630. end
  631. else
  632. consume(_ID);
  633. consume(_DO);
  634. hp:=connode.create(nil,statement);
  635. if ot.def.deftype=errordef then
  636. begin
  637. hp.free;
  638. hp:=cerrornode.create;
  639. end;
  640. if p_specific=nil then
  641. begin
  642. last:=hp;
  643. p_specific:=last;
  644. end
  645. else
  646. begin
  647. tonnode(last).left:=hp;
  648. last:=tonnode(last).left;
  649. end;
  650. { set the informations }
  651. { only if the creation of the onnode was succesful, it's possible }
  652. { that last and hp are errornodes (JM) }
  653. if last.nodetype = onn then
  654. begin
  655. tonnode(last).excepttype:=tobjectdef(ot.def);
  656. tonnode(last).exceptsymtable:=exceptsymtable;
  657. end;
  658. { remove exception symtable }
  659. if assigned(exceptsymtable) then
  660. begin
  661. symtablestack:=symtablestack.next;
  662. if last.nodetype <> onn then
  663. exceptsymtable.free;
  664. end;
  665. if not try_to_consume(_SEMICOLON) then
  666. break;
  667. consume_emptystats;
  668. until (token in [_END,_ELSE]);
  669. if try_to_consume(_ELSE) then
  670. begin
  671. { catch the other exceptions }
  672. p_default:=statements_til_end;
  673. end
  674. else
  675. consume(_END);
  676. end
  677. else
  678. begin
  679. { catch all exceptions }
  680. p_default:=statements_til_end;
  681. end;
  682. block_type:=old_block_type;
  683. try_statement:=ctryexceptnode.create(p_try_block,p_specific,p_default);
  684. end;
  685. aktexceptblock := oldaktexceptblock;
  686. end;
  687. function _asm_statement : tnode;
  688. var
  689. asmstat : tasmnode;
  690. Marker : tai;
  691. reg : tregister;
  692. asmreader : tbaseasmreader;
  693. begin
  694. Inside_asm_statement:=true;
  695. if aktasmmode=asmmode_direct then
  696. begin
  697. if not target_asm.allowdirect then
  698. Message(parser_f_direct_assembler_not_allowed);
  699. if (current_procinfo.procdef.proccalloption=pocall_inline) then
  700. Begin
  701. Message1(parser_w_not_supported_for_inline,'direct asm');
  702. Message(parser_w_inlining_disabled);
  703. current_procinfo.procdef.proccalloption:=pocall_default;
  704. End;
  705. end;
  706. if assigned(asmmodeinfos[aktasmmode]) then
  707. begin
  708. asmreader:=asmmodeinfos[aktasmmode]^.casmreader.create;
  709. asmstat:=casmnode.create(asmreader.assemble as taasmoutput);
  710. asmreader.free;
  711. end
  712. else
  713. Message(parser_f_assembler_reader_not_supported);
  714. { Read first the _ASM statement }
  715. consume(_ASM);
  716. { END is read, got a list of changed registers? }
  717. if try_to_consume(_LECKKLAMMER) then
  718. begin
  719. asmstat.used_regs_fpu:=[0..first_fpu_imreg-1];
  720. if token<>_RECKKLAMMER then
  721. begin
  722. repeat
  723. { it's possible to specify the modified registers }
  724. reg:=std_regnum_search(lower(pattern));
  725. if reg<>NR_NO then
  726. begin
  727. if getregtype(reg)=R_INTREGISTER then
  728. include(asmstat.used_regs_int,getsupreg(reg));
  729. end
  730. else
  731. Message(asmr_e_invalid_register);
  732. consume(_CSTRING);
  733. if not try_to_consume(_COMMA) then
  734. break;
  735. until false;
  736. end;
  737. consume(_RECKKLAMMER);
  738. end
  739. else
  740. begin
  741. asmstat.used_regs_int:=paramanager.get_volatile_registers_int(current_procinfo.procdef.proccalloption);
  742. asmstat.used_regs_fpu:=paramanager.get_volatile_registers_fpu(current_procinfo.procdef.proccalloption);
  743. end;
  744. { mark the start and the end of the assembler block
  745. this is needed for the optimizer }
  746. If Assigned(AsmStat.p_asm) Then
  747. Begin
  748. Marker := Tai_Marker.Create(AsmBlockStart);
  749. AsmStat.p_asm.Insert(Marker);
  750. Marker := Tai_Marker.Create(AsmBlockEnd);
  751. AsmStat.p_asm.Concat(Marker);
  752. End;
  753. Inside_asm_statement:=false;
  754. _asm_statement:=asmstat;
  755. end;
  756. function statement : tnode;
  757. var
  758. p : tnode;
  759. code : tnode;
  760. filepos : tfileposinfo;
  761. srsym : tsym;
  762. srsymtable : tsymtable;
  763. s : stringid;
  764. begin
  765. filepos:=akttokenpos;
  766. case token of
  767. _GOTO :
  768. begin
  769. if not(cs_support_goto in aktmoduleswitches)then
  770. Message(sym_e_goto_and_label_not_supported);
  771. consume(_GOTO);
  772. if (token<>_INTCONST) and (token<>_ID) then
  773. begin
  774. Message(sym_e_label_not_found);
  775. code:=cerrornode.create;
  776. end
  777. else
  778. begin
  779. if token=_ID then
  780. consume_sym(srsym,srsymtable)
  781. else
  782. begin
  783. searchsym(pattern,srsym,srsymtable);
  784. if srsym=nil then
  785. begin
  786. identifier_not_found(pattern);
  787. srsym:=generrorsym;
  788. srsymtable:=nil;
  789. end;
  790. consume(token);
  791. end;
  792. if srsym.typ<>labelsym then
  793. begin
  794. Message(sym_e_id_is_no_label_id);
  795. code:=cerrornode.create;
  796. end
  797. else
  798. begin
  799. code:=cgotonode.create(tlabelsym(srsym));
  800. tgotonode(code).labsym:=tlabelsym(srsym);
  801. { set flag that this label is used }
  802. tlabelsym(srsym).used:=true;
  803. end;
  804. end;
  805. end;
  806. _BEGIN :
  807. code:=statement_block(_BEGIN);
  808. _IF :
  809. code:=if_statement;
  810. _CASE :
  811. code:=case_statement;
  812. _REPEAT :
  813. code:=repeat_statement;
  814. _WHILE :
  815. code:=while_statement;
  816. _FOR :
  817. code:=for_statement;
  818. _WITH :
  819. code:=with_statement;
  820. _TRY :
  821. code:=try_statement;
  822. _RAISE :
  823. code:=raise_statement;
  824. { semicolons,else until and end are ignored }
  825. _SEMICOLON,
  826. _ELSE,
  827. _UNTIL,
  828. _END:
  829. code:=cnothingnode.create;
  830. _FAIL :
  831. begin
  832. if (current_procinfo.procdef.proctypeoption<>potype_constructor) then
  833. Message(parser_e_fail_only_in_constructor);
  834. consume(_FAIL);
  835. code:=call_fail_node;
  836. end;
  837. _ASM :
  838. code:=_asm_statement;
  839. _EOF :
  840. Message(scan_f_end_of_file);
  841. else
  842. begin
  843. p:=expr;
  844. { When a colon follows a intconst then transform it into a label }
  845. if try_to_consume(_COLON) then
  846. begin
  847. s:=tostr(tordconstnode(p).value);
  848. p.free;
  849. searchsym(s,srsym,srsymtable);
  850. if assigned(srsym) then
  851. begin
  852. if tlabelsym(srsym).defined then
  853. Message(sym_e_label_already_defined);
  854. tlabelsym(srsym).defined:=true;
  855. p:=clabelnode.create(tlabelsym(srsym),nil);
  856. end
  857. else
  858. begin
  859. Message1(sym_e_label_used_and_not_defined,s);
  860. p:=cnothingnode.create;
  861. end;
  862. end;
  863. if p.nodetype=labeln then
  864. begin
  865. { the pointer to the following instruction }
  866. { isn't a very clean way }
  867. tlabelnode(p).left:=statement{$ifdef FPCPROCVAR}(){$endif};
  868. { be sure to have left also resulttypepass }
  869. resulttypepass(tlabelnode(p).left);
  870. end;
  871. { blockn support because a read/write is changed into a blocknode }
  872. { with a separate statement for each read/write operation (JM) }
  873. { the same is true for val() if the third parameter is not 32 bit }
  874. if not(p.nodetype in [nothingn,calln,ifn,assignn,breakn,inlinen,
  875. continuen,labeln,blockn,exitn]) then
  876. Message(cg_e_illegal_expression);
  877. { Specify that we don't use the value returned by the call.
  878. This is used for :
  879. - dispose of temp stack space
  880. - dispose on FPU stack }
  881. if (p.nodetype=calln) then
  882. exclude(p.flags,nf_return_value_used);
  883. code:=p;
  884. end;
  885. end;
  886. if assigned(code) then
  887. code.set_tree_filepos(filepos);
  888. statement:=code;
  889. end;
  890. function statement_block(starttoken : ttoken) : tnode;
  891. var
  892. first,last : tnode;
  893. filepos : tfileposinfo;
  894. begin
  895. first:=nil;
  896. filepos:=akttokenpos;
  897. consume(starttoken);
  898. while not(token in [_END,_FINALIZATION]) do
  899. begin
  900. if first=nil then
  901. begin
  902. last:=cstatementnode.create(statement,nil);
  903. first:=last;
  904. end
  905. else
  906. begin
  907. tstatementnode(last).right:=cstatementnode.create(statement,nil);
  908. last:=tstatementnode(last).right;
  909. end;
  910. if (token in [_END,_FINALIZATION]) then
  911. break
  912. else
  913. begin
  914. { if no semicolon, then error and go on }
  915. if token<>_SEMICOLON then
  916. begin
  917. consume(_SEMICOLON);
  918. consume_all_until(_SEMICOLON);
  919. end;
  920. consume(_SEMICOLON);
  921. end;
  922. consume_emptystats;
  923. end;
  924. { don't consume the finalization token, it is consumed when
  925. reading the finalization block, but allow it only after
  926. an initalization ! }
  927. if (starttoken<>_INITIALIZATION) or (token<>_FINALIZATION) then
  928. consume(_END);
  929. last:=cblocknode.create(first);
  930. last.set_tree_filepos(filepos);
  931. statement_block:=last;
  932. end;
  933. procedure count_locals(p:tnamedindexitem;arg:pointer);
  934. begin
  935. { Count only varsyms, but ignore the funcretsym }
  936. if (tsym(p).typ=varsym) and
  937. (tsym(p)<>current_procinfo.procdef.funcretsym) and
  938. (not(vo_is_parentfp in tvarsym(p).varoptions) or
  939. (tvarsym(p).refs>0)) then
  940. inc(plongint(arg)^);
  941. end;
  942. function assembler_block : tnode;
  943. var
  944. p : tnode;
  945. locals : longint;
  946. begin
  947. { Rename the funcret so that recursive calls are possible }
  948. if not is_void(current_procinfo.procdef.rettype.def) then
  949. symtablestack.rename(current_procinfo.procdef.resultname,'$hiddenresult');
  950. { delphi uses register calling for assembler methods }
  951. if (m_delphi in aktmodeswitches) and
  952. (po_assembler in current_procinfo.procdef.procoptions) and
  953. not(po_hascallingconvention in current_procinfo.procdef.procoptions) then
  954. current_procinfo.procdef.proccalloption:=pocall_register;
  955. { force the asm statement }
  956. if token<>_ASM then
  957. consume(_ASM);
  958. include(current_procinfo.flags,pi_is_assembler);
  959. p:=_asm_statement;
  960. {$ifndef sparc}
  961. if (po_assembler in current_procinfo.procdef.procoptions) then
  962. begin
  963. { set the framepointer to esp for assembler functions when the
  964. following conditions are met:
  965. - if the are no local variables and parameters (except the allocated result)
  966. - no reference to the result variable (refcount<=1)
  967. - result is not stored as parameter
  968. - target processor has optional frame pointer save
  969. (vm, i386, vm only currently)
  970. }
  971. locals:=0;
  972. current_procinfo.procdef.localst.foreach_static({$ifdef FPCPROCVAR}@{$endif}count_locals,@locals);
  973. current_procinfo.procdef.parast.foreach_static({$ifdef FPCPROCVAR}@{$endif}count_locals,@locals);
  974. if (locals=0) and
  975. (current_procinfo.procdef.owner.symtabletype<>objectsymtable) and
  976. (not assigned(current_procinfo.procdef.funcretsym) or
  977. (tvarsym(current_procinfo.procdef.funcretsym).refcount<=1)) and
  978. not(paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption)) then
  979. begin
  980. { Only need to set the framepointer, the locals will
  981. be inserted with the correct reference in tcgasmnode.pass_2 }
  982. current_procinfo.framepointer:=NR_STACK_POINTER_REG;
  983. end;
  984. end;
  985. {$endif sparc}
  986. { Flag the result as assigned when it is returned in a
  987. register.
  988. }
  989. if assigned(current_procinfo.procdef.funcretsym) and
  990. (not paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption)) then
  991. tvarsym(current_procinfo.procdef.funcretsym).varstate:=vs_assigned;
  992. { because the END is already read we need to get the
  993. last_endtoken_filepos here (PFV) }
  994. last_endtoken_filepos:=akttokenpos;
  995. assembler_block:=p;
  996. end;
  997. end.
  998. {
  999. $Log$
  1000. Revision 1.122 2003-11-12 16:05:39 florian
  1001. * assembler readers OOPed
  1002. + typed currency constants
  1003. + typed 128 bit float constants if the CPU supports it
  1004. Revision 1.121 2003/11/11 21:10:12 peter
  1005. * remove temporary stdcall hack
  1006. Revision 1.120 2003/11/10 22:02:52 peter
  1007. * cross unit inlining fixed
  1008. Revision 1.119 2003/10/29 20:34:20 peter
  1009. * move check for unused object constructor result to blocknode
  1010. Revision 1.117 2003/10/29 15:40:20 peter
  1011. * support indexing and offset retrieval for locals
  1012. Revision 1.116 2003/10/17 14:38:32 peter
  1013. * 64k registers supported
  1014. * fixed some memory leaks
  1015. Revision 1.115 2003/10/10 17:48:13 peter
  1016. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  1017. * tregisteralloctor renamed to trgobj
  1018. * removed rgobj from a lot of units
  1019. * moved location_* and reference_* to cgobj
  1020. * first things for mmx register allocation
  1021. Revision 1.114 2003/10/08 19:19:45 peter
  1022. * set_varstate cleanup
  1023. Revision 1.113 2003/10/07 20:06:37 peter
  1024. * set calling convention before assembler block is parsed
  1025. Revision 1.112 2003/10/02 21:15:59 peter
  1026. * delphi mode uses register calling by default for assembler
  1027. Revision 1.111 2003/10/01 20:34:49 peter
  1028. * procinfo unit contains tprocinfo
  1029. * cginfo renamed to cgbase
  1030. * moved cgmessage to verbose
  1031. * fixed ppc and sparc compiles
  1032. Revision 1.110 2003/09/23 17:56:05 peter
  1033. * locals and paras are allocated in the code generation
  1034. * tvarsym.localloc contains the location of para/local when
  1035. generating code for the current procedure
  1036. Revision 1.109 2003/09/16 16:17:01 peter
  1037. * varspez in calls to push_addr_param
  1038. Revision 1.108 2003/09/07 22:09:35 peter
  1039. * preparations for different default calling conventions
  1040. * various RA fixes
  1041. Revision 1.107 2003/09/03 15:55:01 peter
  1042. * NEWRA branch merged
  1043. Revision 1.106.2.3 2003/08/31 15:46:26 peter
  1044. * more updates for tregister
  1045. Revision 1.106.2.2 2003/08/29 17:28:59 peter
  1046. * next batch of updates
  1047. Revision 1.106.2.1 2003/08/28 18:35:08 peter
  1048. * tregister changed to cardinal
  1049. Revision 1.106 2003/07/08 21:24:59 peter
  1050. * sparc fixes
  1051. Revision 1.105 2003/06/17 16:34:44 jonas
  1052. * lots of newra fixes (need getfuncretparaloc implementation for i386)!
  1053. * renamed all_intregisters to paramanager.get_volatile_registers_int(pocall_default) and made it
  1054. processor dependent
  1055. Revision 1.104 2003/06/13 21:19:31 peter
  1056. * current_procdef removed, use current_procinfo.procdef instead
  1057. Revision 1.103 2003/06/09 18:27:14 peter
  1058. * load calln in temprefn in with statement
  1059. Revision 1.102 2003/05/23 22:33:48 florian
  1060. * fix some small flaws which prevent sparc linux system unit from compiling
  1061. * some reformatting done
  1062. Revision 1.101 2003/05/23 15:15:36 peter
  1063. * better error for undefined ordinal labels
  1064. Revision 1.100 2003/05/17 13:30:08 jonas
  1065. * changed tt_persistant to tt_persistent :)
  1066. * tempcreatenode now doesn't accept a boolean anymore for persistent
  1067. temps, but a ttemptype, so you can also create ansistring temps etc
  1068. Revision 1.99 2003/05/15 18:58:53 peter
  1069. * removed selfpointer_offset, vmtpointer_offset
  1070. * tvarsym.adjusted_address
  1071. * address in localsymtable is now in the real direction
  1072. * removed some obsolete globals
  1073. Revision 1.98 2003/05/13 19:14:41 peter
  1074. * failn removed
  1075. * inherited result code check moven to pexpr
  1076. Revision 1.97 2003/05/11 14:45:12 peter
  1077. * tloadnode does not support objectsymtable,withsymtable anymore
  1078. * withnode cleanup
  1079. * direct with rewritten to use temprefnode
  1080. Revision 1.96 2003/05/09 17:47:03 peter
  1081. * self moved to hidden parameter
  1082. * removed hdisposen,hnewn,selfn
  1083. Revision 1.95 2003/04/30 22:15:59 florian
  1084. * some 64 bit adaptions in ncgadd
  1085. * x86-64 now uses ncgadd
  1086. * tparamanager.ret_in_acc doesn't return true anymore for a void-def
  1087. Revision 1.94 2003/04/27 11:21:34 peter
  1088. * aktprocdef renamed to current_procinfo.procdef
  1089. * procinfo renamed to current_procinfo
  1090. * procinfo will now be stored in current_module so it can be
  1091. cleaned up properly
  1092. * gen_main_procsym changed to create_main_proc and release_main_proc
  1093. to also generate a tprocinfo structure
  1094. * fixed unit implicit initfinal
  1095. Revision 1.93 2003/04/27 07:29:50 peter
  1096. * current_procinfo.procdef cleanup, current_procinfo.procdef is now always nil when parsing
  1097. a new procdef declaration
  1098. * aktprocsym removed
  1099. * lexlevel removed, use symtable.symtablelevel instead
  1100. * implicit init/final code uses the normal genentry/genexit
  1101. * funcret state checking updated for new funcret handling
  1102. Revision 1.92 2003/04/26 11:30:59 florian
  1103. * fixed the powerpc to work with the new function result handling
  1104. Revision 1.91 2003/04/25 20:59:34 peter
  1105. * removed funcretn,funcretsym, function result is now in varsym
  1106. and aliases for result and function name are added using absolutesym
  1107. * vs_hidden parameter for funcret passed in parameter
  1108. * vs_hidden fixes
  1109. * writenode changed to printnode and released from extdebug
  1110. * -vp option added to generate a tree.log with the nodetree
  1111. * nicer printnode for statements, callnode
  1112. Revision 1.90 2002/04/25 20:15:40 florian
  1113. * block nodes within expressions shouldn't release the used registers,
  1114. fixed using a flag till the new rg is ready
  1115. Revision 1.89 2003/04/25 08:25:26 daniel
  1116. * Ifdefs around a lot of calls to cleartempgen
  1117. * Fixed registers that are allocated but not freed in several nodes
  1118. * Tweak to register allocator to cause less spills
  1119. * 8-bit registers now interfere with esi,edi and ebp
  1120. Compiler can now compile rtl successfully when using new register
  1121. allocator
  1122. Revision 1.88 2003/03/28 19:16:57 peter
  1123. * generic constructor working for i386
  1124. * remove fixed self register
  1125. * esi added as address register for i386
  1126. Revision 1.87 2003/03/17 18:55:30 peter
  1127. * allow more tokens instead of only semicolon after inherited
  1128. Revision 1.86 2003/02/19 22:00:14 daniel
  1129. * Code generator converted to new register notation
  1130. - Horribily outdated todo.txt removed
  1131. Revision 1.85 2003/01/08 18:43:56 daniel
  1132. * Tregister changed into a record
  1133. Revision 1.84 2003/01/01 21:05:24 peter
  1134. * fixed assembler methods stackpointer optimization that was
  1135. broken after the previous change
  1136. Revision 1.83 2002/12/29 18:59:34 peter
  1137. * fixed parsing of declarations before asm statement
  1138. Revision 1.82 2002/12/27 18:18:56 peter
  1139. * check for else after empty raise statement
  1140. Revision 1.81 2002/11/27 02:37:14 peter
  1141. * case statement inlining added
  1142. * fixed inlining of write()
  1143. * switched statementnode left and right parts so the statements are
  1144. processed in the correct order when getcopy is used. This is
  1145. required for tempnodes
  1146. Revision 1.80 2002/11/25 17:43:22 peter
  1147. * splitted defbase in defutil,symutil,defcmp
  1148. * merged isconvertable and is_equal into compare_defs(_ext)
  1149. * made operator search faster by walking the list only once
  1150. Revision 1.79 2002/11/18 17:31:58 peter
  1151. * pass proccalloption to ret_in_xxx and push_xxx functions
  1152. Revision 1.78 2002/09/07 19:34:08 florian
  1153. + tcg.direction is used now
  1154. Revision 1.77 2002/09/07 15:25:07 peter
  1155. * old logs removed and tabs fixed
  1156. Revision 1.76 2002/09/07 12:16:03 carl
  1157. * second part bug report 1996 fix, testrange in cordconstnode
  1158. only called if option is set (also make parsing a tiny faster)
  1159. Revision 1.75 2002/09/02 18:40:52 peter
  1160. * fixed parsing of register names with lowercase
  1161. Revision 1.74 2002/09/01 14:43:12 peter
  1162. * fixed direct assembler for i386
  1163. Revision 1.73 2002/08/25 19:25:20 peter
  1164. * sym.insert_in_data removed
  1165. * symtable.insertvardata/insertconstdata added
  1166. * removed insert_in_data call from symtable.insert, it needs to be
  1167. called separatly. This allows to deref the address calculation
  1168. * procedures now calculate the parast addresses after the procedure
  1169. directives are parsed. This fixes the cdecl parast problem
  1170. * push_addr_param has an extra argument that specifies if cdecl is used
  1171. or not
  1172. Revision 1.72 2002/08/17 09:23:40 florian
  1173. * first part of procinfo rewrite
  1174. Revision 1.71 2002/08/16 14:24:58 carl
  1175. * issameref() to test if two references are the same (then emit no opcodes)
  1176. + ret_in_reg to replace ret_in_acc
  1177. (fix some register allocation bugs at the same time)
  1178. + save_std_register now has an extra parameter which is the
  1179. usedinproc registers
  1180. Revision 1.70 2002/08/11 14:32:27 peter
  1181. * renamed current_library to objectlibrary
  1182. Revision 1.69 2002/08/11 13:24:12 peter
  1183. * saving of asmsymbols in ppu supported
  1184. * asmsymbollist global is removed and moved into a new class
  1185. tasmlibrarydata that will hold the info of a .a file which
  1186. corresponds with a single module. Added librarydata to tmodule
  1187. to keep the library info stored for the module. In the future the
  1188. objectfiles will also be stored to the tasmlibrarydata class
  1189. * all getlabel/newasmsymbol and friends are moved to the new class
  1190. Revision 1.68 2002/08/10 14:46:30 carl
  1191. + moved target_cpu_string to cpuinfo
  1192. * renamed asmmode enum.
  1193. * assembler reader has now less ifdef's
  1194. * move from nppcmem.pas -> ncgmem.pas vec. node.
  1195. Revision 1.67 2002/08/09 19:11:44 carl
  1196. + reading of used registers in assembler routines is now
  1197. cpu-independent
  1198. Revision 1.66 2002/08/06 20:55:22 florian
  1199. * first part of ppc calling conventions fix
  1200. Revision 1.65 2002/07/28 20:45:22 florian
  1201. + added direct assembler reader for PowerPC
  1202. Revision 1.64 2002/07/20 11:57:56 florian
  1203. * types.pas renamed to defbase.pas because D6 contains a types
  1204. unit so this would conflicts if D6 programms are compiled
  1205. + Willamette/SSE2 instructions to assembler added
  1206. Revision 1.63 2002/07/19 11:41:36 daniel
  1207. * State tracker work
  1208. * The whilen and repeatn are now completely unified into whilerepeatn. This
  1209. allows the state tracker to change while nodes automatically into
  1210. repeat nodes.
  1211. * Resulttypepass improvements to the notn. 'not not a' is optimized away and
  1212. 'not(a>b)' is optimized into 'a<=b'.
  1213. * Resulttypepass improvements to the whilerepeatn. 'while not a' is optimized
  1214. by removing the notn and later switchting the true and falselabels. The
  1215. same is done with 'repeat until not a'.
  1216. Revision 1.62 2002/07/16 15:34:20 florian
  1217. * exit is now a syssym instead of a keyword
  1218. Revision 1.61 2002/07/11 14:41:28 florian
  1219. * start of the new generic parameter handling
  1220. Revision 1.60 2002/07/04 20:43:01 florian
  1221. * first x86-64 patches
  1222. Revision 1.59 2002/07/01 18:46:25 peter
  1223. * internal linker
  1224. * reorganized aasm layer
  1225. Revision 1.58 2002/05/18 13:34:13 peter
  1226. * readded missing revisions
  1227. Revision 1.57 2002/05/16 19:46:44 carl
  1228. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1229. + try to fix temp allocation (still in ifdef)
  1230. + generic constructor calls
  1231. + start of tassembler / tmodulebase class cleanup
  1232. }