ncgflw.pas 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. Generate assembler for nodes that influence the flow which are
  4. the same for all (most?) processors
  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 ncgflw;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. aasmbase,node,nflw,ncgutil;
  23. type
  24. tcgwhilerepeatnode = class(twhilerepeatnode)
  25. usedregvars: tusedregvars;
  26. procedure pass_generate_code;override;
  27. procedure sync_regvars(checkusedregvars: boolean);
  28. end;
  29. tcgifnode = class(tifnode)
  30. procedure pass_generate_code;override;
  31. end;
  32. tcgfornode = class(tfornode)
  33. procedure pass_generate_code;override;
  34. end;
  35. tcgexitnode = class(texitnode)
  36. procedure pass_generate_code;override;
  37. end;
  38. tcgbreaknode = class(tbreaknode)
  39. procedure pass_generate_code;override;
  40. end;
  41. tcgcontinuenode = class(tcontinuenode)
  42. procedure pass_generate_code;override;
  43. end;
  44. tcggotonode = class(tgotonode)
  45. procedure pass_generate_code;override;
  46. end;
  47. tcglabelnode = class(tlabelnode)
  48. private
  49. asmlabel : tasmlabel;
  50. public
  51. function getasmlabel : tasmlabel;
  52. procedure pass_generate_code;override;
  53. end;
  54. tcgraisenode = class(traisenode)
  55. end;
  56. tcgtryexceptnode = class(ttryexceptnode)
  57. procedure pass_generate_code;override;
  58. end;
  59. tcgtryfinallynode = class(ttryfinallynode)
  60. procedure handle_safecall_exception;
  61. procedure pass_generate_code;override;
  62. end;
  63. tcgonnode = class(tonnode)
  64. procedure pass_generate_code;override;
  65. end;
  66. implementation
  67. uses
  68. verbose,globals,systems,globtype,constexp,
  69. symconst,symdef,symsym,symtable,symtype,aasmtai,aasmdata,aasmcpu,defutil,
  70. procinfo,cgbase,pass_2,parabase,
  71. fmodule,
  72. cpubase,ncon,
  73. tgobj,paramgr,
  74. cgutils,cgobj,hlcgobj,nutils
  75. ;
  76. {*****************************************************************************
  77. Second_While_RepeatN
  78. *****************************************************************************}
  79. procedure tcgwhilerepeatnode.sync_regvars(checkusedregvars: boolean);
  80. begin
  81. if (cs_opt_regvar in current_settings.optimizerswitches) and
  82. not(pi_has_label in current_procinfo.flags) then
  83. begin
  84. if checkusedregvars then
  85. begin
  86. usedregvars.intregvars.init;
  87. usedregvars.addrregvars.init;
  88. usedregvars.fpuregvars.init;
  89. usedregvars.mmregvars.init;
  90. { we have to synchronise both the regvars used in the loop }
  91. { and the ones in the while/until condition }
  92. get_used_regvars(self,usedregvars);
  93. gen_sync_regvars(current_asmdata.CurrAsmList,usedregvars);
  94. end
  95. else
  96. begin
  97. gen_sync_regvars(current_asmdata.CurrAsmList,usedregvars);
  98. usedregvars.intregvars.done;
  99. usedregvars.addrregvars.done;
  100. usedregvars.fpuregvars.done;
  101. usedregvars.mmregvars.done;
  102. end;
  103. end;
  104. end;
  105. procedure tcgwhilerepeatnode.pass_generate_code;
  106. var
  107. lcont,lbreak,lloop,
  108. oldclabel,oldblabel : tasmlabel;
  109. truelabel,falselabel : tasmlabel;
  110. oldflowcontrol : tflowcontrol;
  111. oldexecutionweight : longint;
  112. begin
  113. location_reset(location,LOC_VOID,OS_NO);
  114. current_asmdata.getjumplabel(lloop);
  115. current_asmdata.getjumplabel(lcont);
  116. current_asmdata.getjumplabel(lbreak);
  117. { arrange continue and breaklabels: }
  118. oldflowcontrol:=flowcontrol;
  119. oldclabel:=current_procinfo.CurrContinueLabel;
  120. oldblabel:=current_procinfo.CurrBreakLabel;
  121. include(flowcontrol,fc_inflowcontrol);
  122. exclude(flowcontrol,fc_unwind_loop);
  123. sync_regvars(true);
  124. {$ifdef OLDREGVARS}
  125. load_all_regvars(current_asmdata.CurrAsmList);
  126. {$endif OLDREGVARS}
  127. { handling code at the end as it is much more efficient, and makes
  128. while equal to repeat loop, only the end true/false is swapped (PFV) }
  129. if lnf_testatbegin in loopflags then
  130. hlcg.a_jmp_always(current_asmdata.CurrAsmList,lcont);
  131. if not(cs_opt_size in current_settings.optimizerswitches) then
  132. { align loop target }
  133. current_asmdata.CurrAsmList.concat(Tai_align.Create(current_settings.alignment.loopalign));
  134. hlcg.a_label(current_asmdata.CurrAsmList,lloop);
  135. current_procinfo.CurrContinueLabel:=lcont;
  136. current_procinfo.CurrBreakLabel:=lbreak;
  137. if assigned(right) then
  138. begin
  139. { calc register weight }
  140. oldexecutionweight:=cg.executionweight;
  141. cg.executionweight:=cg.executionweight*8;
  142. secondpass(right);
  143. cg.executionweight:=oldexecutionweight;
  144. end;
  145. {$ifdef OLDREGVARS}
  146. load_all_regvars(current_asmdata.CurrAsmList);
  147. {$endif OLDREGVARS}
  148. hlcg.a_label(current_asmdata.CurrAsmList,lcont);
  149. if lnf_checknegate in loopflags then
  150. begin
  151. truelabel:=lbreak;
  152. falselabel:=lloop;
  153. end
  154. else
  155. begin
  156. truelabel:=lloop;
  157. falselabel:=lbreak;
  158. end;
  159. secondpass(left);
  160. hlcg.maketojumpboollabels(current_asmdata.CurrAsmList,left,truelabel,falselabel);
  161. hlcg.a_label(current_asmdata.CurrAsmList,lbreak);
  162. sync_regvars(false);
  163. current_procinfo.CurrContinueLabel:=oldclabel;
  164. current_procinfo.CurrBreakLabel:=oldblabel;
  165. { a break/continue in a while/repeat block can't be seen outside }
  166. flowcontrol:=oldflowcontrol+(flowcontrol-[fc_break,fc_continue,fc_inflowcontrol]);
  167. end;
  168. {*****************************************************************************
  169. tcgIFNODE
  170. *****************************************************************************}
  171. procedure tcgifnode.pass_generate_code;
  172. var
  173. hl : tasmlabel;
  174. oldflowcontrol: tflowcontrol;
  175. oldexecutionweight : longint;
  176. (*
  177. org_regvar_loaded_other,
  178. then_regvar_loaded_other,
  179. else_regvar_loaded_other : regvarother_booleanarray;
  180. org_regvar_loaded_int,
  181. then_regvar_loaded_int,
  182. else_regvar_loaded_int : Tsuperregisterset;
  183. org_list,
  184. then_list,
  185. else_list : TAsmList;
  186. *)
  187. begin
  188. location_reset(location,LOC_VOID,OS_NO);
  189. hl:=nil;
  190. oldflowcontrol := flowcontrol;
  191. include(flowcontrol,fc_inflowcontrol);
  192. secondpass(left);
  193. (*
  194. { save regvars loaded in the beginning so that we can restore them }
  195. { when processing the else-block }
  196. if cs_opt_regvar in current_settings.optimizerswitches then
  197. begin
  198. org_list := current_asmdata.CurrAsmList;
  199. current_asmdata.CurrAsmList := TAsmList.create;
  200. end;
  201. *)
  202. hlcg.maketojumpbool(current_asmdata.CurrAsmList,left);
  203. (*
  204. if cs_opt_regvar in current_settings.optimizerswitches then
  205. begin
  206. org_regvar_loaded_int := rg.regvar_loaded_int;
  207. org_regvar_loaded_other := rg.regvar_loaded_other;
  208. end;
  209. *)
  210. { determines registers weigths }
  211. oldexecutionweight:=cg.executionweight;
  212. cg.executionweight:=cg.executionweight div 2;
  213. if cg.executionweight<1 then
  214. cg.executionweight:=1;
  215. if assigned(right) then
  216. begin
  217. hlcg.a_label(current_asmdata.CurrAsmList,left.location.truelabel);
  218. secondpass(right);
  219. end;
  220. { save current asmlist (previous instructions + then-block) and }
  221. { loaded regvar state and create new clean ones }
  222. {
  223. if cs_opt_regvar in current_settings.optimizerswitches then
  224. begin
  225. then_regvar_loaded_int := rg.regvar_loaded_int;
  226. then_regvar_loaded_other := rg.regvar_loaded_other;
  227. rg.regvar_loaded_int := org_regvar_loaded_int;
  228. rg.regvar_loaded_other := org_regvar_loaded_other;
  229. then_list := current_asmdata.CurrAsmList;
  230. current_asmdata.CurrAsmList := TAsmList.create;
  231. end;
  232. }
  233. if assigned(t1) then
  234. begin
  235. if assigned(right) then
  236. begin
  237. current_asmdata.getjumplabel(hl);
  238. { do go back to if line !! }
  239. (*
  240. if not(cs_opt_regvar in current_settings.optimizerswitches) then
  241. *)
  242. current_filepos:=current_asmdata.CurrAsmList.getlasttaifilepos^
  243. (*
  244. else
  245. current_filepos:=then_list.getlasttaifilepos^
  246. *)
  247. ;
  248. hlcg.a_jmp_always(current_asmdata.CurrAsmList,hl);
  249. end;
  250. hlcg.a_label(current_asmdata.CurrAsmList,left.location.falselabel);
  251. secondpass(t1);
  252. (*
  253. { save current asmlist (previous instructions + else-block) }
  254. { and loaded regvar state and create a new clean list }
  255. if cs_opt_regvar in current_settings.optimizerswitches then
  256. begin
  257. { else_regvar_loaded_int := rg.regvar_loaded_int;
  258. else_regvar_loaded_other := rg.regvar_loaded_other;}
  259. else_list := current_asmdata.CurrAsmList;
  260. current_asmdata.CurrAsmList := TAsmList.create;
  261. end;
  262. *)
  263. if assigned(right) then
  264. hlcg.a_label(current_asmdata.CurrAsmList,hl);
  265. end
  266. else
  267. begin
  268. (*
  269. if cs_opt_regvar in current_settings.optimizerswitches then
  270. begin
  271. { else_regvar_loaded_int := rg.regvar_loaded_int;
  272. else_regvar_loaded_other := rg.regvar_loaded_other;}
  273. else_list := current_asmdata.CurrAsmList;
  274. current_asmdata.CurrAsmList := TAsmList.create;
  275. end;
  276. *)
  277. hlcg.a_label(current_asmdata.CurrAsmList,left.location.falselabel);
  278. end;
  279. if not(assigned(right)) then
  280. begin
  281. hlcg.a_label(current_asmdata.CurrAsmList,left.location.truelabel);
  282. end;
  283. (*
  284. if cs_opt_regvar in current_settings.optimizerswitches then
  285. begin
  286. { add loads of regvars at the end of the then- and else-blocks }
  287. { so that at the end of both blocks the same regvars are loaded }
  288. { no else block? }
  289. if not assigned(t1) then
  290. begin
  291. sync_regvars_int(org_list,then_list,org_regvar_loaded_int,then_regvar_loaded_int);
  292. sync_regvars_other(org_list,then_list,org_regvar_loaded_other,then_regvar_loaded_other);
  293. end
  294. { no then block? }
  295. else if not assigned(right) then
  296. begin
  297. sync_regvars_int(org_list,else_list,org_regvar_loaded_int,else_regvar_loaded_int);
  298. sync_regvars_other(org_list,else_list,org_regvar_loaded_other,else_regvar_loaded_other);
  299. end
  300. { both else and then blocks }
  301. else
  302. begin
  303. sync_regvars_int(then_list,else_list,then_regvar_loaded_int,else_regvar_loaded_int);
  304. sync_regvars_other(then_list,else_list,then_regvar_loaded_other,else_regvar_loaded_other);
  305. end;
  306. { add all lists together }
  307. org_list.concatlist(then_list);
  308. then_list.free;
  309. org_list.concatlist(else_list);
  310. else_list.free;
  311. org_list.concatlist(current_asmdata.CurrAsmList);
  312. current_asmdata.CurrAsmList.free;
  313. current_asmdata.CurrAsmList := org_list;
  314. end;
  315. *)
  316. cg.executionweight:=oldexecutionweight;
  317. flowcontrol := oldflowcontrol + (flowcontrol - [fc_inflowcontrol]);
  318. end;
  319. {*****************************************************************************
  320. SecondFor
  321. *****************************************************************************}
  322. procedure tcgfornode.pass_generate_code;
  323. begin
  324. { for nodes are converted in pass_1 in a while loop }
  325. internalerror(2015082501);
  326. end;
  327. {*****************************************************************************
  328. SecondExitN
  329. *****************************************************************************}
  330. procedure tcgexitnode.pass_generate_code;
  331. begin
  332. location_reset(location,LOC_VOID,OS_NO);
  333. include(flowcontrol,fc_exit);
  334. if assigned(left) then
  335. secondpass(left);
  336. if (fc_unwind_exit in flowcontrol) then
  337. hlcg.g_local_unwind(current_asmdata.CurrAsmList,current_procinfo.CurrExitLabel)
  338. else
  339. hlcg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrExitLabel);
  340. end;
  341. {*****************************************************************************
  342. SecondBreakN
  343. *****************************************************************************}
  344. procedure tcgbreaknode.pass_generate_code;
  345. begin
  346. location_reset(location,LOC_VOID,OS_NO);
  347. include(flowcontrol,fc_break);
  348. if current_procinfo.CurrBreakLabel<>nil then
  349. begin
  350. {$ifdef OLDREGVARS}
  351. load_all_regvars(current_asmdata.CurrAsmList);
  352. {$endif OLDREGVARS}
  353. if (fc_unwind_loop in flowcontrol) then
  354. hlcg.g_local_unwind(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel)
  355. else
  356. hlcg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel)
  357. end
  358. else
  359. CGMessage(cg_e_break_not_allowed);
  360. end;
  361. {*****************************************************************************
  362. SecondContinueN
  363. *****************************************************************************}
  364. procedure tcgcontinuenode.pass_generate_code;
  365. begin
  366. location_reset(location,LOC_VOID,OS_NO);
  367. include(flowcontrol,fc_continue);
  368. if current_procinfo.CurrContinueLabel<>nil then
  369. begin
  370. {$ifdef OLDREGVARS}
  371. load_all_regvars(current_asmdata.CurrAsmList);
  372. {$endif OLDREGVARS}
  373. if (fc_unwind_loop in flowcontrol) then
  374. hlcg.g_local_unwind(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel)
  375. else
  376. hlcg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel)
  377. end
  378. else
  379. CGMessage(cg_e_continue_not_allowed);
  380. end;
  381. {*****************************************************************************
  382. SecondGoto
  383. *****************************************************************************}
  384. procedure tcggotonode.pass_generate_code;
  385. begin
  386. location_reset(location,LOC_VOID,OS_NO);
  387. include(flowcontrol,fc_gotolabel);
  388. {$ifdef OLDREGVARS}
  389. load_all_regvars(current_asmdata.CurrAsmList);
  390. {$endif OLDREGVARS}
  391. hlcg.a_jmp_always(current_asmdata.CurrAsmList,tcglabelnode(labelnode).getasmlabel)
  392. end;
  393. {*****************************************************************************
  394. SecondLabel
  395. *****************************************************************************}
  396. function tcglabelnode.getasmlabel : tasmlabel;
  397. begin
  398. if not(assigned(asmlabel)) then
  399. { labsym is not set in inlined procedures, but since assembler }
  400. { routines can't be inlined, that shouldn't matter }
  401. if assigned(labsym) and
  402. labsym.nonlocal then
  403. current_asmdata.getglobaljumplabel(asmlabel)
  404. else
  405. current_asmdata.getjumplabel(asmlabel);
  406. result:=asmlabel
  407. end;
  408. procedure tcglabelnode.pass_generate_code;
  409. begin
  410. location_reset(location,LOC_VOID,OS_NO);
  411. include(flowcontrol,fc_gotolabel);
  412. {$ifdef OLDREGVARS}
  413. load_all_regvars(current_asmdata.CurrAsmList);
  414. {$endif OLDREGVARS}
  415. hlcg.a_label(current_asmdata.CurrAsmList,getasmlabel);
  416. { Write also extra label if this label was referenced from
  417. assembler block }
  418. if assigned(labsym) and
  419. assigned(labsym.asmblocklabel) then
  420. hlcg.a_label(current_asmdata.CurrAsmList,labsym.asmblocklabel);
  421. secondpass(left);
  422. end;
  423. {*****************************************************************************
  424. SecondTryExcept
  425. *****************************************************************************}
  426. var
  427. endexceptlabel : tasmlabel;
  428. { does the necessary things to clean up the object stack }
  429. { in the except block }
  430. procedure cleanupobjectstack;
  431. begin
  432. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_doneexception',[],nil);
  433. end;
  434. { generates code to be executed when another exeception is raised while
  435. control is inside except block }
  436. procedure handle_nested_exception(list:TAsmList;const t:texceptiontemps;entrylabel:TAsmLabel);
  437. var
  438. exitlabel: tasmlabel;
  439. begin
  440. { don't generate line info for internal cleanup }
  441. list.concat(tai_marker.create(mark_NoLineInfoStart));
  442. current_asmdata.getjumplabel(exitlabel);
  443. hlcg.a_label(list,entrylabel);
  444. free_exception(list,t,0,exitlabel,false);
  445. { we don't need to save/restore registers here because reraise never }
  446. { returns }
  447. hlcg.g_call_system_proc(list,'fpc_raise_nested',[],nil);
  448. hlcg.a_label(list,exitlabel);
  449. cleanupobjectstack;
  450. end;
  451. procedure tcgtryexceptnode.pass_generate_code;
  452. var
  453. exceptlabel,doexceptlabel,oldendexceptlabel,
  454. lastonlabel,
  455. exitexceptlabel,
  456. continueexceptlabel,
  457. breakexceptlabel,
  458. exittrylabel,
  459. continuetrylabel,
  460. breaktrylabel,
  461. doobjectdestroyandreraise,
  462. oldCurrExitLabel,
  463. oldContinueLabel,
  464. oldBreakLabel : tasmlabel;
  465. oldflowcontrol,tryflowcontrol,
  466. exceptflowcontrol : tflowcontrol;
  467. destroytemps,
  468. excepttemps : texceptiontemps;
  469. label
  470. errorexit;
  471. begin
  472. location_reset(location,LOC_VOID,OS_NO);
  473. exceptflowcontrol:=[];
  474. continuetrylabel:=nil;
  475. breaktrylabel:=nil;
  476. continueexceptlabel:=nil;
  477. breakexceptlabel:=nil;
  478. oldflowcontrol:=flowcontrol;
  479. flowcontrol:=[fc_inflowcontrol];
  480. { this can be called recursivly }
  481. oldBreakLabel:=nil;
  482. oldContinueLabel:=nil;
  483. oldendexceptlabel:=endexceptlabel;
  484. { save the old labels for control flow statements }
  485. oldCurrExitLabel:=current_procinfo.CurrExitLabel;
  486. if assigned(current_procinfo.CurrBreakLabel) then
  487. begin
  488. oldContinueLabel:=current_procinfo.CurrContinueLabel;
  489. oldBreakLabel:=current_procinfo.CurrBreakLabel;
  490. end;
  491. { get new labels for the control flow statements }
  492. current_asmdata.getjumplabel(exittrylabel);
  493. current_asmdata.getjumplabel(exitexceptlabel);
  494. if assigned(current_procinfo.CurrBreakLabel) then
  495. begin
  496. current_asmdata.getjumplabel(breaktrylabel);
  497. current_asmdata.getjumplabel(continuetrylabel);
  498. current_asmdata.getjumplabel(breakexceptlabel);
  499. current_asmdata.getjumplabel(continueexceptlabel);
  500. end;
  501. current_asmdata.getjumplabel(exceptlabel);
  502. current_asmdata.getjumplabel(doexceptlabel);
  503. current_asmdata.getjumplabel(endexceptlabel);
  504. current_asmdata.getjumplabel(lastonlabel);
  505. get_exception_temps(current_asmdata.CurrAsmList,excepttemps);
  506. new_exception(current_asmdata.CurrAsmList,excepttemps,exceptlabel);
  507. { try block }
  508. { set control flow labels for the try block }
  509. current_procinfo.CurrExitLabel:=exittrylabel;
  510. if assigned(oldBreakLabel) then
  511. begin
  512. current_procinfo.CurrContinueLabel:=continuetrylabel;
  513. current_procinfo.CurrBreakLabel:=breaktrylabel;
  514. end;
  515. flowcontrol:=[fc_inflowcontrol];
  516. secondpass(left);
  517. tryflowcontrol:=flowcontrol;
  518. if codegenerror then
  519. goto errorexit;
  520. { don't generate line info for internal cleanup }
  521. current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
  522. hlcg.a_label(current_asmdata.CurrAsmList,exceptlabel);
  523. free_exception(current_asmdata.CurrAsmList, excepttemps, 0, endexceptlabel, false);
  524. hlcg.a_label(current_asmdata.CurrAsmList,doexceptlabel);
  525. { end cleanup }
  526. current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
  527. { set control flow labels for the except block }
  528. { and the on statements }
  529. current_procinfo.CurrExitLabel:=exitexceptlabel;
  530. if assigned(oldBreakLabel) then
  531. begin
  532. current_procinfo.CurrContinueLabel:=continueexceptlabel;
  533. current_procinfo.CurrBreakLabel:=breakexceptlabel;
  534. end;
  535. flowcontrol:=[fc_inflowcontrol];
  536. { on statements }
  537. if assigned(right) then
  538. secondpass(right);
  539. { don't generate line info for internal cleanup }
  540. current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
  541. hlcg.a_label(current_asmdata.CurrAsmList,lastonlabel);
  542. { default handling except handling }
  543. if assigned(t1) then
  544. begin
  545. { FPC_CATCHES with 'default handler' flag (=-1) need no longer be called,
  546. it doesn't change any state and its return value is ignored (Sergei)
  547. }
  548. { the destruction of the exception object must be also }
  549. { guarded by an exception frame, but it can be omitted }
  550. { if there's no user code in 'except' block }
  551. if not (has_no_code(t1)) then
  552. begin
  553. current_asmdata.getjumplabel(doobjectdestroyandreraise);
  554. get_exception_temps(current_asmdata.CurrAsmList,destroytemps);
  555. new_exception(current_asmdata.CurrAsmList,destroytemps,doobjectdestroyandreraise);
  556. { except block needs line info }
  557. current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
  558. { here we don't have to reset flowcontrol }
  559. { the default and on flowcontrols are handled equal }
  560. secondpass(t1);
  561. exceptflowcontrol:=flowcontrol;
  562. handle_nested_exception(current_asmdata.CurrAsmList,destroytemps,doobjectdestroyandreraise);
  563. unget_exception_temps(current_asmdata.CurrAsmList,destroytemps);
  564. hlcg.a_jmp_always(current_asmdata.CurrAsmList,endexceptlabel);
  565. end
  566. else
  567. begin
  568. exceptflowcontrol:=flowcontrol;
  569. cleanupobjectstack;
  570. hlcg.a_jmp_always(current_asmdata.CurrAsmList,endexceptlabel);
  571. end;
  572. end
  573. else
  574. begin
  575. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_reraise',[],nil);
  576. exceptflowcontrol:=flowcontrol;
  577. end;
  578. if fc_exit in exceptflowcontrol then
  579. begin
  580. { do some magic for exit in the try block }
  581. hlcg.a_label(current_asmdata.CurrAsmList,exitexceptlabel);
  582. { we must also destroy the address frame which guards }
  583. { exception object }
  584. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_popaddrstack',[],nil);
  585. hlcg.g_exception_reason_discard(current_asmdata.CurrAsmList,osuinttype,excepttemps.reasonbuf);
  586. cleanupobjectstack;
  587. hlcg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel);
  588. end;
  589. if fc_break in exceptflowcontrol then
  590. begin
  591. hlcg.a_label(current_asmdata.CurrAsmList,breakexceptlabel);
  592. { we must also destroy the address frame which guards }
  593. { exception object }
  594. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_popaddrstack',[],nil);
  595. hlcg.g_exception_reason_discard(current_asmdata.CurrAsmList,osuinttype,excepttemps.reasonbuf);
  596. cleanupobjectstack;
  597. cg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel);
  598. end;
  599. if fc_continue in exceptflowcontrol then
  600. begin
  601. hlcg.a_label(current_asmdata.CurrAsmList,continueexceptlabel);
  602. { we must also destroy the address frame which guards }
  603. { exception object }
  604. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_popaddrstack',[],nil);
  605. hlcg.g_exception_reason_discard(current_asmdata.CurrAsmList,osuinttype,excepttemps.reasonbuf);
  606. cleanupobjectstack;
  607. hlcg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel);
  608. end;
  609. if fc_exit in tryflowcontrol then
  610. begin
  611. { do some magic for exit in the try block }
  612. hlcg.a_label(current_asmdata.CurrAsmList,exittrylabel);
  613. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_popaddrstack',[],nil);
  614. hlcg.g_exception_reason_discard(current_asmdata.CurrAsmList,osuinttype,excepttemps.reasonbuf);
  615. hlcg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel);
  616. end;
  617. if fc_break in tryflowcontrol then
  618. begin
  619. hlcg.a_label(current_asmdata.CurrAsmList,breaktrylabel);
  620. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_popaddrstack',[],nil);
  621. hlcg.g_exception_reason_discard(current_asmdata.CurrAsmList,osuinttype,excepttemps.reasonbuf);
  622. cg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel);
  623. end;
  624. if fc_continue in tryflowcontrol then
  625. begin
  626. hlcg.a_label(current_asmdata.CurrAsmList,continuetrylabel);
  627. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_popaddrstack',[],nil);
  628. hlcg.g_exception_reason_discard(current_asmdata.CurrAsmList,osuinttype,excepttemps.reasonbuf);
  629. cg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel);
  630. end;
  631. unget_exception_temps(current_asmdata.CurrAsmList,excepttemps);
  632. hlcg.a_label(current_asmdata.CurrAsmList,endexceptlabel);
  633. { end cleanup }
  634. current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
  635. errorexit:
  636. { restore all saved labels }
  637. endexceptlabel:=oldendexceptlabel;
  638. { restore the control flow labels }
  639. current_procinfo.CurrExitLabel:=oldCurrExitLabel;
  640. if assigned(oldBreakLabel) then
  641. begin
  642. current_procinfo.CurrContinueLabel:=oldContinueLabel;
  643. current_procinfo.CurrBreakLabel:=oldBreakLabel;
  644. end;
  645. { return all used control flow statements }
  646. flowcontrol:=oldflowcontrol+(exceptflowcontrol +
  647. tryflowcontrol - [fc_inflowcontrol]);
  648. end;
  649. procedure tcgonnode.pass_generate_code;
  650. var
  651. nextonlabel,
  652. exitonlabel,
  653. continueonlabel,
  654. breakonlabel,
  655. oldCurrExitLabel,
  656. oldContinueLabel,
  657. doobjectdestroyandreraise,
  658. oldBreakLabel : tasmlabel;
  659. oldflowcontrol : tflowcontrol;
  660. excepttemps : texceptiontemps;
  661. href2: treference;
  662. paraloc1 : tcgpara;
  663. exceptvarsym : tlocalvarsym;
  664. pd : tprocdef;
  665. fpc_catches_res: TCGPara;
  666. fpc_catches_resloc: tlocation;
  667. otherunit,
  668. indirect : boolean;
  669. begin
  670. paraloc1.init;
  671. location_reset(location,LOC_VOID,OS_NO);
  672. oldCurrExitLabel:=nil;
  673. continueonlabel:=nil;
  674. breakonlabel:=nil;
  675. exitonlabel:=nil;
  676. oldflowcontrol:=flowcontrol;
  677. flowcontrol:=[fc_inflowcontrol];
  678. current_asmdata.getjumplabel(nextonlabel);
  679. otherunit:=findunitsymtable(excepttype.owner).moduleid<>findunitsymtable(current_procinfo.procdef.owner).moduleid;
  680. indirect:=(tf_supports_packages in target_info.flags) and
  681. (target_info.system in systems_indirect_var_imports) and
  682. (cs_imported_data in current_settings.localswitches) and
  683. otherunit;
  684. { send the vmt parameter }
  685. pd:=search_system_proc('fpc_catches');
  686. reference_reset_symbol(href2,current_asmdata.RefAsmSymbol(excepttype.vmt_mangledname,AT_DATA,indirect),0,sizeof(pint));
  687. if otherunit then
  688. current_module.add_extern_asmsym(excepttype.vmt_mangledname,AB_EXTERNAL,AT_DATA);
  689. paramanager.getintparaloc(current_asmdata.CurrAsmList,pd,1,paraloc1);
  690. hlcg.a_loadaddr_ref_cgpara(current_asmdata.CurrAsmList,excepttype.vmt_def,href2,paraloc1);
  691. paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
  692. fpc_catches_res:=hlcg.g_call_system_proc(current_asmdata.CurrAsmList,pd,[@paraloc1],nil);
  693. location_reset(fpc_catches_resloc,LOC_REGISTER,def_cgsize(fpc_catches_res.def));
  694. fpc_catches_resloc.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,fpc_catches_res.def);
  695. hlcg.gen_load_cgpara_loc(current_asmdata.CurrAsmList,fpc_catches_res.def,fpc_catches_res,fpc_catches_resloc,true);
  696. { is it this catch? No. go to next onlabel }
  697. hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,fpc_catches_res.def,OC_EQ,0,fpc_catches_resloc.register,nextonlabel);
  698. { Retrieve exception variable }
  699. if assigned(excepTSymtable) then
  700. exceptvarsym:=tlocalvarsym(excepTSymtable.SymList[0])
  701. else
  702. internalerror(2011020401);
  703. if assigned(exceptvarsym) then
  704. begin
  705. location_reset_ref(exceptvarsym.localloc,LOC_REFERENCE,def_cgsize(voidpointertype),voidpointertype.alignment);
  706. tg.GetLocal(current_asmdata.CurrAsmList,exceptvarsym.vardef.size,exceptvarsym.vardef,exceptvarsym.localloc.reference);
  707. hlcg.a_load_reg_ref(current_asmdata.CurrAsmList,fpc_catches_res.def,exceptvarsym.vardef,fpc_catches_resloc.register,exceptvarsym.localloc.reference);
  708. end;
  709. { in the case that another exception is risen
  710. we've to destroy the old one }
  711. current_asmdata.getjumplabel(doobjectdestroyandreraise);
  712. { call setjmp, and jump to finally label on non-zero result }
  713. get_exception_temps(current_asmdata.CurrAsmList,excepttemps);
  714. new_exception(current_asmdata.CurrAsmList,excepttemps,doobjectdestroyandreraise);
  715. oldBreakLabel:=nil;
  716. oldContinueLabel:=nil;
  717. if assigned(right) then
  718. begin
  719. oldCurrExitLabel:=current_procinfo.CurrExitLabel;
  720. current_asmdata.getjumplabel(exitonlabel);
  721. current_procinfo.CurrExitLabel:=exitonlabel;
  722. if assigned(current_procinfo.CurrBreakLabel) then
  723. begin
  724. oldContinueLabel:=current_procinfo.CurrContinueLabel;
  725. oldBreakLabel:=current_procinfo.CurrBreakLabel;
  726. current_asmdata.getjumplabel(breakonlabel);
  727. current_asmdata.getjumplabel(continueonlabel);
  728. current_procinfo.CurrContinueLabel:=continueonlabel;
  729. current_procinfo.CurrBreakLabel:=breakonlabel;
  730. end;
  731. secondpass(right);
  732. end;
  733. handle_nested_exception(current_asmdata.CurrAsmList,excepttemps,doobjectdestroyandreraise);
  734. { clear some stuff }
  735. if assigned(exceptvarsym) then
  736. begin
  737. tg.UngetLocal(current_asmdata.CurrAsmList,exceptvarsym.localloc.reference);
  738. exceptvarsym.localloc.loc:=LOC_INVALID;
  739. end;
  740. cg.a_jmp_always(current_asmdata.CurrAsmList,endexceptlabel);
  741. if assigned(right) then
  742. begin
  743. { special handling for control flow instructions }
  744. if fc_exit in flowcontrol then
  745. begin
  746. { the address and object pop does secondtryexcept }
  747. cg.a_label(current_asmdata.CurrAsmList,exitonlabel);
  748. cg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel);
  749. end;
  750. if fc_break in flowcontrol then
  751. begin
  752. { the address and object pop does secondtryexcept }
  753. cg.a_label(current_asmdata.CurrAsmList,breakonlabel);
  754. cg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel);
  755. end;
  756. if fc_continue in flowcontrol then
  757. begin
  758. { the address and object pop does secondtryexcept }
  759. cg.a_label(current_asmdata.CurrAsmList,continueonlabel);
  760. cg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel);
  761. end;
  762. current_procinfo.CurrExitLabel:=oldCurrExitLabel;
  763. if assigned(oldBreakLabel) then
  764. begin
  765. current_procinfo.CurrContinueLabel:=oldContinueLabel;
  766. current_procinfo.CurrBreakLabel:=oldBreakLabel;
  767. end;
  768. end;
  769. unget_exception_temps(current_asmdata.CurrAsmList,excepttemps);
  770. cg.a_label(current_asmdata.CurrAsmList,nextonlabel);
  771. flowcontrol:=oldflowcontrol+(flowcontrol-[fc_inflowcontrol]);
  772. paraloc1.done;
  773. current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
  774. { next on node }
  775. if assigned(left) then
  776. secondpass(left);
  777. end;
  778. {*****************************************************************************
  779. SecondTryFinally
  780. *****************************************************************************}
  781. procedure tcgtryfinallynode.handle_safecall_exception;
  782. var
  783. cgpara: tcgpara;
  784. selfsym: tparavarsym;
  785. pd: tprocdef;
  786. begin
  787. { call fpc_safecallhandler, passing self for methods of classes,
  788. nil otherwise. }
  789. pd:=search_system_proc('fpc_safecallhandler');
  790. cgpara.init;
  791. paramanager.getintparaloc(current_asmdata.CurrAsmList,pd,1,cgpara);
  792. if is_class(current_procinfo.procdef.struct) then
  793. begin
  794. selfsym:=tparavarsym(current_procinfo.procdef.parast.Find('self'));
  795. if (selfsym=nil) or (selfsym.typ<>paravarsym) then
  796. InternalError(2011123101);
  797. cg.a_load_loc_cgpara(current_asmdata.CurrAsmList,selfsym.localloc,cgpara);
  798. end
  799. else
  800. cg.a_load_const_cgpara(current_asmdata.CurrAsmList,OS_ADDR,0,cgpara);
  801. paramanager.freecgpara(current_asmdata.CurrAsmList,cgpara);
  802. cgpara.done;
  803. cg.g_call(current_asmdata.CurrAsmList,'FPC_SAFECALLHANDLER');
  804. cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_FUNCTION_RESULT_REG, NR_FUNCTION_RETURN_REG);
  805. end;
  806. procedure tcgtryfinallynode.pass_generate_code;
  807. var
  808. finallylabel,
  809. endfinallylabel,
  810. exitfinallylabel,
  811. continuefinallylabel,
  812. breakfinallylabel,
  813. oldCurrExitLabel,
  814. oldContinueLabel,
  815. oldBreakLabel : tasmlabel;
  816. oldflowcontrol,tryflowcontrol : tflowcontrol;
  817. excepttemps : texceptiontemps;
  818. reasonreg : tregister;
  819. begin
  820. location_reset(location,LOC_VOID,OS_NO);
  821. tryflowcontrol:=[];
  822. oldBreakLabel:=nil;
  823. oldContinueLabel:=nil;
  824. continuefinallylabel:=nil;
  825. breakfinallylabel:=nil;
  826. { check if child nodes do a break/continue/exit }
  827. oldflowcontrol:=flowcontrol;
  828. flowcontrol:=[fc_inflowcontrol];
  829. current_asmdata.getjumplabel(finallylabel);
  830. current_asmdata.getjumplabel(endfinallylabel);
  831. { the finally block must catch break, continue and exit }
  832. { statements }
  833. oldCurrExitLabel:=current_procinfo.CurrExitLabel;
  834. if implicitframe then
  835. exitfinallylabel:=finallylabel
  836. else
  837. current_asmdata.getjumplabel(exitfinallylabel);
  838. current_procinfo.CurrExitLabel:=exitfinallylabel;
  839. if assigned(current_procinfo.CurrBreakLabel) then
  840. begin
  841. oldContinueLabel:=current_procinfo.CurrContinueLabel;
  842. oldBreakLabel:=current_procinfo.CurrBreakLabel;
  843. if implicitframe then
  844. begin
  845. breakfinallylabel:=finallylabel;
  846. continuefinallylabel:=finallylabel;
  847. end
  848. else
  849. begin
  850. current_asmdata.getjumplabel(breakfinallylabel);
  851. current_asmdata.getjumplabel(continuefinallylabel);
  852. end;
  853. current_procinfo.CurrContinueLabel:=continuefinallylabel;
  854. current_procinfo.CurrBreakLabel:=breakfinallylabel;
  855. end;
  856. { call setjmp, and jump to finally label on non-zero result }
  857. get_exception_temps(current_asmdata.CurrAsmList,excepttemps);
  858. new_exception(current_asmdata.CurrAsmList,excepttemps,finallylabel);
  859. { try code }
  860. if assigned(left) then
  861. begin
  862. secondpass(left);
  863. tryflowcontrol:=flowcontrol;
  864. if codegenerror then
  865. exit;
  866. end;
  867. { don't generate line info for internal cleanup }
  868. current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
  869. hlcg.a_label(current_asmdata.CurrAsmList,finallylabel);
  870. { just free the frame information }
  871. free_exception(current_asmdata.CurrAsmList,excepttemps,1,finallylabel,true);
  872. { end cleanup }
  873. current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
  874. { finally code }
  875. flowcontrol:=[fc_inflowcontrol];
  876. secondpass(right);
  877. { goto is allowed if it stays inside the finally block,
  878. this is checked using the exception block number }
  879. if (flowcontrol-[fc_gotolabel])<>[fc_inflowcontrol] then
  880. CGMessage(cg_e_control_flow_outside_finally);
  881. if codegenerror then
  882. exit;
  883. { don't generate line info for internal cleanup }
  884. current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
  885. { the value should now be in the exception handler }
  886. reasonreg:=hlcg.getintregister(current_asmdata.CurrAsmList,osuinttype);
  887. hlcg.g_exception_reason_load(current_asmdata.CurrAsmList,osuinttype,osuinttype,excepttemps.reasonbuf,reasonreg);
  888. if implicitframe then
  889. begin
  890. hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,osuinttype,OC_EQ,0,reasonreg,endfinallylabel);
  891. { finally code only needed to be executed on exception }
  892. flowcontrol:=[fc_inflowcontrol];
  893. secondpass(t1);
  894. if flowcontrol<>[fc_inflowcontrol] then
  895. CGMessage(cg_e_control_flow_outside_finally);
  896. if codegenerror then
  897. exit;
  898. if (tf_safecall_exceptions in target_info.flags) and
  899. (current_procinfo.procdef.proccalloption=pocall_safecall) then
  900. handle_safecall_exception
  901. else
  902. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_reraise',[],nil);
  903. end
  904. else
  905. begin
  906. hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,osuinttype,OC_EQ,0,reasonreg,endfinallylabel);
  907. if fc_exit in tryflowcontrol then
  908. hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,osuinttype,OC_EQ,2,reasonreg,oldCurrExitLabel);
  909. if fc_break in tryflowcontrol then
  910. hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,osuinttype,OC_EQ,3,reasonreg,oldBreakLabel);
  911. if fc_continue in tryflowcontrol then
  912. hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,osuinttype,OC_EQ,4,reasonreg,oldContinueLabel);
  913. hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_reraise',[],nil);
  914. { do some magic for exit,break,continue in the try block }
  915. if fc_exit in tryflowcontrol then
  916. begin
  917. hlcg.a_label(current_asmdata.CurrAsmList,exitfinallylabel);
  918. hlcg.g_exception_reason_discard(current_asmdata.CurrAsmList,osuinttype,excepttemps.reasonbuf);
  919. hlcg.g_exception_reason_save_const(current_asmdata.CurrAsmList,osuinttype,2,excepttemps.reasonbuf);
  920. hlcg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel);
  921. end;
  922. if fc_break in tryflowcontrol then
  923. begin
  924. hlcg.a_label(current_asmdata.CurrAsmList,breakfinallylabel);
  925. hlcg.g_exception_reason_discard(current_asmdata.CurrAsmList,osuinttype,excepttemps.reasonbuf);
  926. hlcg.g_exception_reason_save_const(current_asmdata.CurrAsmList,osuinttype,3,excepttemps.reasonbuf);
  927. hlcg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel);
  928. end;
  929. if fc_continue in tryflowcontrol then
  930. begin
  931. hlcg.a_label(current_asmdata.CurrAsmList,continuefinallylabel);
  932. hlcg.g_exception_reason_discard(current_asmdata.CurrAsmList,osuinttype,excepttemps.reasonbuf);
  933. hlcg.g_exception_reason_save_const(current_asmdata.CurrAsmList,osuinttype,4,excepttemps.reasonbuf);
  934. hlcg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel);
  935. end;
  936. end;
  937. unget_exception_temps(current_asmdata.CurrAsmList,excepttemps);
  938. hlcg.a_label(current_asmdata.CurrAsmList,endfinallylabel);
  939. { end cleanup }
  940. current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
  941. current_procinfo.CurrExitLabel:=oldCurrExitLabel;
  942. if assigned(current_procinfo.CurrBreakLabel) then
  943. begin
  944. current_procinfo.CurrContinueLabel:=oldContinueLabel;
  945. current_procinfo.CurrBreakLabel:=oldBreakLabel;
  946. end;
  947. flowcontrol:=oldflowcontrol+(tryflowcontrol-[fc_inflowcontrol]);
  948. end;
  949. begin
  950. cwhilerepeatnode:=tcgwhilerepeatnode;
  951. cifnode:=tcgifnode;
  952. cfornode:=tcgfornode;
  953. cexitnode:=tcgexitnode;
  954. cbreaknode:=tcgbreaknode;
  955. ccontinuenode:=tcgcontinuenode;
  956. cgotonode:=tcggotonode;
  957. clabelnode:=tcglabelnode;
  958. craisenode:=tcgraisenode;
  959. ctryexceptnode:=tcgtryexceptnode;
  960. ctryfinallynode:=tcgtryfinallynode;
  961. connode:=tcgonnode;
  962. end.