ncgflw.pas 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Generate assembler for nodes that influence the flow which are
  5. the same for all (most?) processors
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit ncgflw;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. node,nflw;
  24. type
  25. tcgwhilerepeatnode = class(twhilerepeatnode)
  26. procedure pass_2;override;
  27. end;
  28. tcgifnode = class(tifnode)
  29. procedure pass_2;override;
  30. end;
  31. tcgfornode = class(tfornode)
  32. procedure pass_2;override;
  33. end;
  34. tcgexitnode = class(texitnode)
  35. procedure pass_2;override;
  36. end;
  37. tcgbreaknode = class(tbreaknode)
  38. procedure pass_2;override;
  39. end;
  40. tcgcontinuenode = class(tcontinuenode)
  41. procedure pass_2;override;
  42. end;
  43. tcggotonode = class(tgotonode)
  44. procedure pass_2;override;
  45. end;
  46. tcglabelnode = class(tlabelnode)
  47. procedure pass_2;override;
  48. end;
  49. tcgraisenode = class(traisenode)
  50. procedure pass_2;override;
  51. end;
  52. tcgtryexceptnode = class(ttryexceptnode)
  53. procedure pass_2;override;
  54. end;
  55. tcgtryfinallynode = class(ttryfinallynode)
  56. procedure pass_2;override;
  57. end;
  58. tcgonnode = class(tonnode)
  59. procedure pass_2;override;
  60. end;
  61. implementation
  62. uses
  63. verbose,globals,systems,globtype,
  64. symconst,symsym,aasmbase,aasmtai,aasmcpu,defutil,
  65. procinfo,cgbase,pass_2,
  66. cpubase,cpuinfo,
  67. nld,ncon,
  68. ncgutil,
  69. tgobj,paramgr,
  70. regvars,cgobj
  71. {$ifndef cpu64bit}
  72. ,cg64f32
  73. {$endif cpu64bit}
  74. ;
  75. const
  76. EXCEPT_BUF_SIZE = 12;
  77. {*****************************************************************************
  78. Second_While_RepeatN
  79. *****************************************************************************}
  80. procedure tcgwhilerepeatnode.pass_2;
  81. var
  82. lcont,lbreak,lloop,
  83. oldclabel,oldblabel : tasmlabel;
  84. otlabel,oflabel : tasmlabel;
  85. oldflowcontrol : tflowcontrol;
  86. begin
  87. location_reset(location,LOC_VOID,OS_NO);
  88. objectlibrary.getlabel(lloop);
  89. objectlibrary.getlabel(lcont);
  90. objectlibrary.getlabel(lbreak);
  91. { arrange continue and breaklabels: }
  92. oldflowcontrol:=flowcontrol;
  93. oldclabel:=aktcontinuelabel;
  94. oldblabel:=aktbreaklabel;
  95. {$ifdef OLDREGVARS}
  96. load_all_regvars(exprasmlist);
  97. {$endif OLDREGVARS}
  98. { handling code at the end as it is much more efficient, and makes
  99. while equal to repeat loop, only the end true/false is swapped (PFV) }
  100. if lnf_testatbegin in loopflags then
  101. cg.a_jmp_always(exprasmlist,lcont);
  102. if not(cs_littlesize in aktglobalswitches) then
  103. { align loop target }
  104. exprasmList.concat(Tai_align.Create(aktalignment.loopalign));
  105. cg.a_label(exprasmlist,lloop);
  106. aktcontinuelabel:=lcont;
  107. aktbreaklabel:=lbreak;
  108. if assigned(right) then
  109. secondpass(right);
  110. {$ifdef OLDREGVARS}
  111. load_all_regvars(exprasmlist);
  112. {$endif OLDREGVARS}
  113. cg.a_label(exprasmlist,lcont);
  114. otlabel:=truelabel;
  115. oflabel:=falselabel;
  116. if lnf_checknegate in loopflags then
  117. begin
  118. truelabel:=lbreak;
  119. falselabel:=lloop;
  120. end
  121. else
  122. begin
  123. truelabel:=lloop;
  124. falselabel:=lbreak;
  125. end;
  126. secondpass(left);
  127. maketojumpbool(exprasmlist,left,lr_load_regvars);
  128. cg.a_label(exprasmlist,lbreak);
  129. truelabel:=otlabel;
  130. falselabel:=oflabel;
  131. aktcontinuelabel:=oldclabel;
  132. aktbreaklabel:=oldblabel;
  133. { a break/continue in a while/repeat block can't be seen outside }
  134. flowcontrol:=oldflowcontrol+(flowcontrol-[fc_break,fc_continue]);
  135. end;
  136. {*****************************************************************************
  137. tcgIFNODE
  138. *****************************************************************************}
  139. procedure tcgifnode.pass_2;
  140. var
  141. hl,otlabel,oflabel : tasmlabel;
  142. {$ifdef i386}
  143. (*
  144. org_regvar_loaded_other,
  145. then_regvar_loaded_other,
  146. else_regvar_loaded_other : regvarother_booleanarray;
  147. org_regvar_loaded_int,
  148. then_regvar_loaded_int,
  149. else_regvar_loaded_int : Tsuperregisterset;
  150. org_list,
  151. then_list,
  152. else_list : taasmoutput;
  153. *)
  154. {$endif i386}
  155. begin
  156. location_reset(location,LOC_VOID,OS_NO);
  157. otlabel:=truelabel;
  158. oflabel:=falselabel;
  159. objectlibrary.getlabel(truelabel);
  160. objectlibrary.getlabel(falselabel);
  161. secondpass(left);
  162. {$ifdef i386}
  163. (*
  164. { save regvars loaded in the beginning so that we can restore them }
  165. { when processing the else-block }
  166. if cs_regvars in aktglobalswitches then
  167. begin
  168. org_list := exprasmlist;
  169. exprasmlist := taasmoutput.create;
  170. end;
  171. *)
  172. {$endif i386}
  173. maketojumpbool(exprasmlist,left,lr_dont_load_regvars);
  174. {$ifdef i386}
  175. (*
  176. if cs_regvars in aktglobalswitches then
  177. begin
  178. org_regvar_loaded_int := rg.regvar_loaded_int;
  179. org_regvar_loaded_other := rg.regvar_loaded_other;
  180. end;
  181. *)
  182. {$endif i386}
  183. if assigned(right) then
  184. begin
  185. cg.a_label(exprasmlist,truelabel);
  186. secondpass(right);
  187. end;
  188. {$ifdef i386}
  189. { save current asmlist (previous instructions + then-block) and }
  190. { loaded regvar state and create new clean ones }
  191. if cs_regvars in aktglobalswitches then
  192. begin
  193. { then_regvar_loaded_int := rg.regvar_loaded_int;
  194. then_regvar_loaded_other := rg.regvar_loaded_other;
  195. rg.regvar_loaded_int := org_regvar_loaded_int;
  196. rg.regvar_loaded_other := org_regvar_loaded_other;
  197. then_list := exprasmlist;
  198. exprasmlist := taasmoutput.create;}
  199. end;
  200. {$endif i386}
  201. if assigned(t1) then
  202. begin
  203. if assigned(right) then
  204. begin
  205. objectlibrary.getlabel(hl);
  206. { do go back to if line !! }
  207. (*
  208. {$ifdef i386}
  209. if not(cs_regvars in aktglobalswitches) then
  210. {$endif i386}
  211. *)
  212. aktfilepos:=exprasmList.getlasttaifilepos^
  213. (*
  214. {$ifdef i386}
  215. else
  216. aktfilepos:=then_list.getlasttaifilepos^
  217. {$endif i386}
  218. *)
  219. ;
  220. cg.a_jmp_always(exprasmlist,hl);
  221. end;
  222. cg.a_label(exprasmlist,falselabel);
  223. secondpass(t1);
  224. (*
  225. {$ifdef i386}
  226. { save current asmlist (previous instructions + else-block) }
  227. { and loaded regvar state and create a new clean list }
  228. if cs_regvars in aktglobalswitches then
  229. begin
  230. { else_regvar_loaded_int := rg.regvar_loaded_int;
  231. else_regvar_loaded_other := rg.regvar_loaded_other;}
  232. else_list := exprasmlist;
  233. exprasmlist := taasmoutput.create;
  234. end;
  235. {$endif i386}
  236. *)
  237. if assigned(right) then
  238. cg.a_label(exprasmlist,hl);
  239. end
  240. else
  241. begin
  242. (*
  243. {$ifdef i386}
  244. if cs_regvars in aktglobalswitches then
  245. begin
  246. { else_regvar_loaded_int := rg.regvar_loaded_int;
  247. else_regvar_loaded_other := rg.regvar_loaded_other;}
  248. else_list := exprasmlist;
  249. exprasmlist := taasmoutput.create;
  250. end;
  251. {$endif i386}
  252. *)
  253. cg.a_label(exprasmlist,falselabel);
  254. end;
  255. if not(assigned(right)) then
  256. begin
  257. cg.a_label(exprasmlist,truelabel);
  258. end;
  259. (*
  260. {$ifdef i386}
  261. if cs_regvars in aktglobalswitches then
  262. begin
  263. { add loads of regvars at the end of the then- and else-blocks }
  264. { so that at the end of both blocks the same regvars are loaded }
  265. { no else block? }
  266. if not assigned(t1) then
  267. begin
  268. sync_regvars_int(org_list,then_list,org_regvar_loaded_int,then_regvar_loaded_int);
  269. sync_regvars_other(org_list,then_list,org_regvar_loaded_other,then_regvar_loaded_other);
  270. end
  271. { no then block? }
  272. else if not assigned(right) then
  273. begin
  274. sync_regvars_int(org_list,else_list,org_regvar_loaded_int,else_regvar_loaded_int);
  275. sync_regvars_other(org_list,else_list,org_regvar_loaded_other,else_regvar_loaded_other);
  276. end
  277. { both else and then blocks }
  278. else
  279. begin
  280. sync_regvars_int(then_list,else_list,then_regvar_loaded_int,else_regvar_loaded_int);
  281. sync_regvars_other(then_list,else_list,then_regvar_loaded_other,else_regvar_loaded_other);
  282. end;
  283. { add all lists together }
  284. org_list.concatlist(then_list);
  285. then_list.free;
  286. org_list.concatlist(else_list);
  287. else_list.free;
  288. org_list.concatlist(exprasmlist);
  289. exprasmlist.free;
  290. exprasmlist := org_list;
  291. end;
  292. {$endif i386}
  293. *)
  294. truelabel:=otlabel;
  295. falselabel:=oflabel;
  296. end;
  297. {*****************************************************************************
  298. SecondFor
  299. *****************************************************************************}
  300. procedure tcgfornode.pass_2;
  301. var
  302. l3,oldclabel,oldblabel : tasmlabel;
  303. temptovalue : boolean;
  304. hs : byte;
  305. temp1 : treference;
  306. hop : topcg;
  307. hcond : topcmp;
  308. opsize : tcgsize;
  309. count_var_is_signed,do_loopvar_at_end : boolean;
  310. cmp_const:Tconstexprint;
  311. oldflowcontrol : tflowcontrol;
  312. begin
  313. location_reset(location,LOC_VOID,OS_NO);
  314. oldflowcontrol:=flowcontrol;
  315. oldclabel:=aktcontinuelabel;
  316. oldblabel:=aktbreaklabel;
  317. objectlibrary.getlabel(aktcontinuelabel);
  318. objectlibrary.getlabel(aktbreaklabel);
  319. objectlibrary.getlabel(l3);
  320. { only calculate reference }
  321. secondpass(t2);
  322. hs := t2.resulttype.def.size;
  323. opsize := def_cgsize(t2.resulttype.def);
  324. { first set the to value
  325. because the count var can be in the expression !! }
  326. do_loopvar_at_end:=lnf_dont_mind_loopvar_on_exit in loopflags;
  327. secondpass(right);
  328. { calculate pointer value and check if changeable and if so }
  329. { load into temporary variable }
  330. if right.nodetype<>ordconstn then
  331. begin
  332. do_loopvar_at_end:=false;
  333. tg.GetTemp(exprasmlist,hs,tt_normal,temp1);
  334. temptovalue:=true;
  335. if (right.location.loc=LOC_REGISTER) or
  336. (right.location.loc=LOC_CREGISTER) then
  337. begin
  338. cg.a_load_reg_ref(exprasmlist,opsize,opsize,right.location.register,temp1);
  339. cg.ungetregister(exprasmlist,right.location.register);
  340. end
  341. else
  342. cg.g_concatcopy(exprasmlist,right.location.reference,temp1,
  343. hs,true,false);
  344. end
  345. else
  346. temptovalue:=false;
  347. { produce start assignment }
  348. secondpass(left);
  349. count_var_is_signed:=is_signed(t2.resulttype.def);
  350. if lnf_backward in loopflags then
  351. if count_var_is_signed then
  352. hcond:=OC_LT
  353. else
  354. hcond:=OC_B
  355. else
  356. if count_var_is_signed then
  357. hcond:=OC_GT
  358. else
  359. hcond:=OC_A;
  360. {$ifdef OLDREGVARS}
  361. load_all_regvars(exprasmlist);
  362. {$endif OLDREGVARS}
  363. if temptovalue then
  364. begin
  365. cg.a_cmp_ref_loc_label(exprasmlist,opsize,hcond,
  366. temp1,t2.location,aktbreaklabel);
  367. end
  368. else
  369. begin
  370. if lnf_testatbegin in loopflags then
  371. begin
  372. cg.a_cmp_const_loc_label(exprasmlist,opsize,hcond,
  373. aword(tordconstnode(right).value),
  374. t2.location,aktbreaklabel);
  375. end;
  376. end;
  377. {If the loopvar doesn't mind on exit, we avoid this ugly
  378. dec instruction and do the loopvar inc/dec after the loop
  379. body.}
  380. if not do_loopvar_at_end then
  381. begin
  382. if lnf_backward in loopflags then
  383. hop:=OP_ADD
  384. else
  385. hop:=OP_SUB;
  386. cg.a_op_const_loc(exprasmlist,hop,1,t2.location);
  387. end;
  388. if not(cs_littlesize in aktglobalswitches) then
  389. { align loop target }
  390. exprasmList.concat(Tai_align.Create(aktalignment.loopalign));
  391. cg.a_label(exprasmlist,l3);
  392. {If the loopvar doesn't mind on exit, we avoid the loopvar inc/dec
  393. after the loop body instead of here.}
  394. if not do_loopvar_at_end then
  395. begin
  396. { according to count direction DEC or INC... }
  397. if lnf_backward in loopflags then
  398. hop:=OP_SUB
  399. else
  400. hop:=OP_ADD;
  401. cg.a_op_const_loc(exprasmlist,hop,1,t2.location);
  402. end;
  403. { help register must not be in instruction block }
  404. if assigned(t1) then
  405. begin
  406. secondpass(t1);
  407. {$ifdef OLDREGVARS}
  408. load_all_regvars(exprasmlist);
  409. {$endif OLDREGVARS}
  410. end;
  411. {If the loopvar doesn't mind on exit, we do the loopvar inc/dec
  412. after the loop body instead of here.}
  413. if do_loopvar_at_end then
  414. begin
  415. { according to count direction DEC or INC... }
  416. if lnf_backward in loopflags then
  417. hop:=OP_SUB
  418. else
  419. hop:=OP_ADD;
  420. cg.a_op_const_loc(exprasmlist,hop,1,t2.location);
  421. end;
  422. cg.a_label(exprasmlist,aktcontinuelabel);
  423. if do_loopvar_at_end then
  424. if lnf_backward in loopflags then
  425. if count_var_is_signed then
  426. hcond:=OC_GTE
  427. else
  428. hcond:=OC_AE
  429. else
  430. if count_var_is_signed then
  431. hcond:=OC_LTE
  432. else
  433. hcond:=OC_BE
  434. else
  435. if lnf_backward in loopflags then
  436. if count_var_is_signed then
  437. hcond:=OC_GT
  438. else
  439. hcond:=OC_A
  440. else
  441. if count_var_is_signed then
  442. hcond:=OC_LT
  443. else
  444. hcond:=OC_B;
  445. {$ifdef OLDREGVARS}
  446. load_all_regvars(exprasmlist);
  447. {$endif OLDREGVARS}
  448. cmp_const:=aword(Tordconstnode(right).value);
  449. if do_loopvar_at_end then
  450. begin
  451. {Watch out for wrap around 255 -> 0.}
  452. {Ugly: This code is way to long... Use tables?}
  453. case opsize of
  454. OS_8:
  455. begin
  456. if lnf_backward in loopflags then
  457. begin
  458. if byte(cmp_const)=low(byte) then
  459. begin
  460. hcond:=OC_NE;
  461. cmp_const:=high(byte);
  462. end
  463. end
  464. else
  465. begin
  466. if byte(cmp_const)=high(byte) then
  467. begin
  468. hcond:=OC_NE;
  469. cmp_const:=low(byte);
  470. end
  471. end
  472. end;
  473. OS_16:
  474. begin
  475. if lnf_backward in loopflags then
  476. begin
  477. if word(cmp_const)=high(word) then
  478. begin
  479. hcond:=OC_NE;
  480. cmp_const:=low(word);
  481. end
  482. end
  483. else
  484. begin
  485. if word(cmp_const)=low(word) then
  486. begin
  487. hcond:=OC_NE;
  488. cmp_const:=high(word);
  489. end
  490. end
  491. end;
  492. OS_32:
  493. begin
  494. if lnf_backward in loopflags then
  495. begin
  496. if cardinal(cmp_const)=high(cardinal) then
  497. begin
  498. hcond:=OC_NE;
  499. cmp_const:=low(cardinal);
  500. end
  501. end
  502. else
  503. begin
  504. if cardinal(cmp_const)=low(cardinal) then
  505. begin
  506. hcond:=OC_NE;
  507. cmp_const:=high(cardinal);
  508. end
  509. end
  510. end;
  511. OS_64:
  512. begin
  513. if lnf_backward in loopflags then
  514. begin
  515. if qword(cmp_const)=high(qword) then
  516. begin
  517. hcond:=OC_NE;
  518. cmp_const:=low(qword);
  519. end
  520. end
  521. else
  522. begin
  523. if qword(cmp_const)=low(qword) then
  524. begin
  525. hcond:=OC_NE;
  526. cmp_const:=high(qword);
  527. end
  528. end
  529. end;
  530. OS_S8:
  531. begin
  532. if lnf_backward in loopflags then
  533. begin
  534. if shortint(cmp_const)=low(shortint) then
  535. begin
  536. hcond:=OC_NE;
  537. cmp_const:=high(shortint);
  538. end
  539. end
  540. else
  541. begin
  542. if shortint(cmp_const)=high(shortint) then
  543. begin
  544. hcond:=OC_NE;
  545. cmp_const:=low(shortint);
  546. end
  547. end
  548. end;
  549. OS_S16:
  550. begin
  551. if lnf_backward in loopflags then
  552. begin
  553. if integer(cmp_const)=high(integer) then
  554. begin
  555. hcond:=OC_NE;
  556. cmp_const:=low(integer);
  557. end
  558. end
  559. else
  560. begin
  561. if integer(cmp_const)=low(integer) then
  562. begin
  563. hcond:=OC_NE;
  564. cmp_const:=high(integer);
  565. end
  566. end
  567. end;
  568. OS_S32:
  569. begin
  570. if lnf_backward in loopflags then
  571. begin
  572. if longint(cmp_const)=high(longint) then
  573. begin
  574. hcond:=OC_NE;
  575. cmp_const:=low(longint);
  576. end
  577. end
  578. else
  579. begin
  580. if longint(cmp_const)=low(longint) then
  581. begin
  582. hcond:=OC_NE;
  583. cmp_const:=high(longint);
  584. end
  585. end
  586. end;
  587. OS_S64:
  588. begin
  589. if lnf_backward in loopflags then
  590. begin
  591. if int64(cmp_const)=high(int64) then
  592. begin
  593. hcond:=OC_NE;
  594. cmp_const:=low(int64);
  595. end
  596. end
  597. else
  598. begin
  599. if int64(cmp_const)=low(int64) then
  600. begin
  601. hcond:=OC_NE;
  602. cmp_const:=high(int64);
  603. end
  604. end
  605. end;
  606. else
  607. internalerror(200201021);
  608. end;
  609. end;
  610. { produce comparison and the corresponding }
  611. { jump }
  612. if temptovalue then
  613. begin
  614. cg.a_cmp_ref_loc_label(exprasmlist,opsize,hcond,temp1,
  615. t2.location,l3);
  616. end
  617. else
  618. begin
  619. cg.a_cmp_const_loc_label(exprasmlist,opsize,hcond,
  620. cmp_const,t2.location,l3);
  621. end;
  622. if temptovalue then
  623. tg.ungetiftemp(exprasmlist,temp1);
  624. { this is the break label: }
  625. cg.a_label(exprasmlist,aktbreaklabel);
  626. aktcontinuelabel:=oldclabel;
  627. aktbreaklabel:=oldblabel;
  628. { a break/continue in a while/repeat block can't be seen outside }
  629. flowcontrol:=oldflowcontrol+(flowcontrol-[fc_break,fc_continue]);
  630. end;
  631. {*****************************************************************************
  632. SecondExitN
  633. *****************************************************************************}
  634. procedure tcgexitnode.pass_2;
  635. begin
  636. location_reset(location,LOC_VOID,OS_NO);
  637. include(flowcontrol,fc_exit);
  638. if assigned(left) then
  639. secondpass(left);
  640. cg.a_jmp_always(exprasmlist,current_procinfo.aktexitlabel);
  641. end;
  642. {*****************************************************************************
  643. SecondBreakN
  644. *****************************************************************************}
  645. procedure tcgbreaknode.pass_2;
  646. begin
  647. location_reset(location,LOC_VOID,OS_NO);
  648. include(flowcontrol,fc_break);
  649. if aktbreaklabel<>nil then
  650. begin
  651. {$ifdef OLDREGVARS}
  652. load_all_regvars(exprasmlist);
  653. {$endif OLDREGVARS}
  654. cg.a_jmp_always(exprasmlist,aktbreaklabel)
  655. end
  656. else
  657. CGMessage(cg_e_break_not_allowed);
  658. end;
  659. {*****************************************************************************
  660. SecondContinueN
  661. *****************************************************************************}
  662. procedure tcgcontinuenode.pass_2;
  663. begin
  664. location_reset(location,LOC_VOID,OS_NO);
  665. include(flowcontrol,fc_continue);
  666. if aktcontinuelabel<>nil then
  667. begin
  668. {$ifdef OLDREGVARS}
  669. load_all_regvars(exprasmlist);
  670. {$endif OLDREGVARS}
  671. cg.a_jmp_always(exprasmlist,aktcontinuelabel)
  672. end
  673. else
  674. CGMessage(cg_e_continue_not_allowed);
  675. end;
  676. {*****************************************************************************
  677. SecondGoto
  678. *****************************************************************************}
  679. procedure tcggotonode.pass_2;
  680. begin
  681. location_reset(location,LOC_VOID,OS_NO);
  682. {$ifdef OLDREGVARS}
  683. load_all_regvars(exprasmlist);
  684. {$endif OLDREGVARS}
  685. cg.a_jmp_always(exprasmlist,labsym.lab)
  686. end;
  687. {*****************************************************************************
  688. SecondLabel
  689. *****************************************************************************}
  690. procedure tcglabelnode.pass_2;
  691. begin
  692. location_reset(location,LOC_VOID,OS_NO);
  693. {$ifdef OLDREGVARS}
  694. load_all_regvars(exprasmlist);
  695. {$endif OLDREGVARS}
  696. cg.a_label(exprasmlist,labelnr);
  697. secondpass(left);
  698. end;
  699. {*****************************************************************************
  700. SecondRaise
  701. *****************************************************************************}
  702. procedure tcgraisenode.pass_2;
  703. var
  704. a : tasmlabel;
  705. href2: treference;
  706. paraloc1,paraloc2,paraloc3 : tparalocation;
  707. begin
  708. paraloc1:=paramanager.getintparaloc(pocall_default,1);
  709. paraloc2:=paramanager.getintparaloc(pocall_default,2);
  710. paraloc3:=paramanager.getintparaloc(pocall_default,3);
  711. location_reset(location,LOC_VOID,OS_NO);
  712. if assigned(left) then
  713. begin
  714. { multiple parameters? }
  715. if assigned(right) then
  716. begin
  717. if assigned(frametree) then
  718. secondpass(frametree);
  719. secondpass(right);
  720. end;
  721. secondpass(left);
  722. if codegenerror then
  723. exit;
  724. { Push parameters }
  725. if assigned(right) then
  726. begin
  727. paramanager.allocparaloc(exprasmlist,paraloc3);
  728. if assigned(frametree) then
  729. begin
  730. location_release(exprasmlist,frametree.location);
  731. cg.a_param_loc(exprasmlist,frametree.location,paraloc3)
  732. end
  733. else
  734. cg.a_param_const(exprasmlist,OS_INT,0,paraloc3);
  735. { push address }
  736. location_release(exprasmlist,right.location);
  737. paramanager.allocparaloc(exprasmlist,paraloc2);
  738. cg.a_param_loc(exprasmlist,right.location,paraloc2);
  739. end
  740. else
  741. begin
  742. { get current address }
  743. objectlibrary.getaddrlabel(a);
  744. cg.a_label(exprasmlist,a);
  745. reference_reset_symbol(href2,a,0);
  746. { push current frame }
  747. paramanager.allocparaloc(exprasmlist,paraloc3);
  748. cg.a_param_reg(exprasmlist,OS_ADDR,NR_FRAME_POINTER_REG,paraloc3);
  749. { push current address }
  750. paramanager.allocparaloc(exprasmlist,paraloc2);
  751. if target_info.system <> system_powerpc_macos then
  752. cg.a_paramaddr_ref(exprasmlist,href2,paraloc2)
  753. else
  754. cg.a_param_const(exprasmlist,OS_INT,0,paraloc2);
  755. end;
  756. location_release(exprasmlist,left.location);
  757. paramanager.allocparaloc(exprasmlist,paraloc1);
  758. cg.a_param_loc(exprasmlist,left.location,paraloc1);
  759. paramanager.freeparaloc(exprasmlist,paraloc1);
  760. paramanager.freeparaloc(exprasmlist,paraloc2);
  761. paramanager.freeparaloc(exprasmlist,paraloc3);
  762. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  763. cg.a_call_name(exprasmlist,'FPC_RAISEEXCEPTION');
  764. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  765. end
  766. else
  767. begin
  768. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  769. cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
  770. cg.a_call_name(exprasmlist,'FPC_RERAISE');
  771. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  772. end;
  773. end;
  774. {*****************************************************************************
  775. SecondTryExcept
  776. *****************************************************************************}
  777. var
  778. endexceptlabel : tasmlabel;
  779. procedure try_new_exception(list : taasmoutput;var jmpbuf,envbuf, href : treference;
  780. a : aword; exceptlabel : tasmlabel);
  781. begin
  782. tg.GetTemp(list,EXCEPT_BUF_SIZE,tt_persistent,envbuf);
  783. tg.GetTemp(list,JMP_BUF_SIZE,tt_persistent,jmpbuf);
  784. tg.GetTemp(list,sizeof(aword),tt_persistent,href);
  785. new_exception(list, jmpbuf,envbuf, href, a, exceptlabel);
  786. end;
  787. procedure try_free_exception(list : taasmoutput;var jmpbuf, envbuf, href : treference;
  788. a : aword ; endexceptlabel : tasmlabel; onlyfree : boolean);
  789. begin
  790. free_exception(list, jmpbuf, envbuf, href, a, endexceptlabel, onlyfree);
  791. tg.ungettemp(list,href);
  792. tg.Ungettemp(list,jmpbuf);
  793. tg.ungettemp(list,envbuf);
  794. end;
  795. { does the necessary things to clean up the object stack }
  796. { in the except block }
  797. procedure cleanupobjectstack;
  798. var
  799. paraloc1 : tparalocation;
  800. begin
  801. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  802. cg.a_call_name(exprasmlist,'FPC_POPOBJECTSTACK');
  803. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  804. paraloc1:=paramanager.getintparaloc(pocall_default,1);
  805. paramanager.allocparaloc(exprasmlist,paraloc1);
  806. cg.a_param_reg(exprasmlist,OS_ADDR,NR_FUNCTION_RESULT_REG,paraloc1);
  807. paramanager.freeparaloc(exprasmlist,paraloc1);
  808. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  809. cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION');
  810. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  811. end;
  812. procedure tcgtryexceptnode.pass_2;
  813. var
  814. exceptlabel,doexceptlabel,oldendexceptlabel,
  815. lastonlabel,
  816. exitexceptlabel,
  817. continueexceptlabel,
  818. breakexceptlabel,
  819. exittrylabel,
  820. continuetrylabel,
  821. breaktrylabel,
  822. doobjectdestroy,
  823. doobjectdestroyandreraise,
  824. oldaktexitlabel,
  825. oldaktcontinuelabel,
  826. oldaktbreaklabel : tasmlabel;
  827. oldflowcontrol,tryflowcontrol,
  828. exceptflowcontrol : tflowcontrol;
  829. tempbuf,tempaddr : treference;
  830. href : treference;
  831. paraloc1 : tparalocation;
  832. label
  833. errorexit;
  834. begin
  835. location_reset(location,LOC_VOID,OS_NO);
  836. oldflowcontrol:=flowcontrol;
  837. flowcontrol:=[];
  838. { this can be called recursivly }
  839. oldendexceptlabel:=endexceptlabel;
  840. { save the old labels for control flow statements }
  841. oldaktexitlabel:=current_procinfo.aktexitlabel;
  842. if assigned(aktbreaklabel) then
  843. begin
  844. oldaktcontinuelabel:=aktcontinuelabel;
  845. oldaktbreaklabel:=aktbreaklabel;
  846. end;
  847. { get new labels for the control flow statements }
  848. objectlibrary.getlabel(exittrylabel);
  849. objectlibrary.getlabel(exitexceptlabel);
  850. if assigned(aktbreaklabel) then
  851. begin
  852. objectlibrary.getlabel(breaktrylabel);
  853. objectlibrary.getlabel(continuetrylabel);
  854. objectlibrary.getlabel(breakexceptlabel);
  855. objectlibrary.getlabel(continueexceptlabel);
  856. end;
  857. objectlibrary.getlabel(exceptlabel);
  858. objectlibrary.getlabel(doexceptlabel);
  859. objectlibrary.getlabel(endexceptlabel);
  860. objectlibrary.getlabel(lastonlabel);
  861. try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,exceptlabel);
  862. { try block }
  863. { set control flow labels for the try block }
  864. current_procinfo.aktexitlabel:=exittrylabel;
  865. if assigned(oldaktbreaklabel) then
  866. begin
  867. aktcontinuelabel:=continuetrylabel;
  868. aktbreaklabel:=breaktrylabel;
  869. end;
  870. flowcontrol:=[];
  871. secondpass(left);
  872. tryflowcontrol:=flowcontrol;
  873. if codegenerror then
  874. goto errorexit;
  875. cg.a_label(exprasmlist,exceptlabel);
  876. try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,endexceptlabel,false);
  877. cg.a_label(exprasmlist,doexceptlabel);
  878. { set control flow labels for the except block }
  879. { and the on statements }
  880. current_procinfo.aktexitlabel:=exitexceptlabel;
  881. if assigned(oldaktbreaklabel) then
  882. begin
  883. aktcontinuelabel:=continueexceptlabel;
  884. aktbreaklabel:=breakexceptlabel;
  885. end;
  886. flowcontrol:=[];
  887. { on statements }
  888. if assigned(right) then
  889. secondpass(right);
  890. cg.a_label(exprasmlist,lastonlabel);
  891. { default handling except handling }
  892. if assigned(t1) then
  893. begin
  894. { FPC_CATCHES must be called with
  895. 'default handler' flag (=-1)
  896. }
  897. paraloc1:=paramanager.getintparaloc(pocall_default,1);
  898. paramanager.allocparaloc(exprasmlist,paraloc1);
  899. cg.a_param_const(exprasmlist,OS_ADDR,aword(-1),paraloc1);
  900. paramanager.freeparaloc(exprasmlist,paraloc1);
  901. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  902. cg.a_call_name(exprasmlist,'FPC_CATCHES');
  903. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  904. { the destruction of the exception object must be also }
  905. { guarded by an exception frame }
  906. objectlibrary.getlabel(doobjectdestroy);
  907. objectlibrary.getlabel(doobjectdestroyandreraise);
  908. try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,doobjectdestroyandreraise);
  909. { here we don't have to reset flowcontrol }
  910. { the default and on flowcontrols are handled equal }
  911. secondpass(t1);
  912. exceptflowcontrol:=flowcontrol;
  913. cg.a_label(exprasmlist,doobjectdestroyandreraise);
  914. try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,doobjectdestroy,false);
  915. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  916. cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK');
  917. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  918. paraloc1:=paramanager.getintparaloc(pocall_default,1);
  919. paramanager.allocparaloc(exprasmlist,paraloc1);
  920. cg.a_param_reg(exprasmlist, OS_ADDR, NR_FUNCTION_RESULT_REG, paraloc1);
  921. paramanager.freeparaloc(exprasmlist,paraloc1);
  922. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  923. cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION');
  924. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  925. { we don't need to restore esi here because reraise never }
  926. { returns }
  927. cg.a_call_name(exprasmlist,'FPC_RERAISE');
  928. cg.a_label(exprasmlist,doobjectdestroy);
  929. cleanupobjectstack;
  930. cg.a_jmp_always(exprasmlist,endexceptlabel);
  931. end
  932. else
  933. begin
  934. cg.a_call_name(exprasmlist,'FPC_RERAISE');
  935. exceptflowcontrol:=flowcontrol;
  936. end;
  937. if fc_exit in exceptflowcontrol then
  938. begin
  939. { do some magic for exit in the try block }
  940. cg.a_label(exprasmlist,exitexceptlabel);
  941. { we must also destroy the address frame which guards }
  942. { exception object }
  943. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  944. cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
  945. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  946. cg.g_exception_reason_load(exprasmlist,href);
  947. cleanupobjectstack;
  948. cg.a_jmp_always(exprasmlist,oldaktexitlabel);
  949. end;
  950. if fc_break in exceptflowcontrol then
  951. begin
  952. cg.a_label(exprasmlist,breakexceptlabel);
  953. { we must also destroy the address frame which guards }
  954. { exception object }
  955. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  956. cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
  957. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  958. cg.g_exception_reason_load(exprasmlist,href);
  959. cleanupobjectstack;
  960. cg.a_jmp_always(exprasmlist,oldaktbreaklabel);
  961. end;
  962. if fc_continue in exceptflowcontrol then
  963. begin
  964. cg.a_label(exprasmlist,continueexceptlabel);
  965. { we must also destroy the address frame which guards }
  966. { exception object }
  967. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  968. cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
  969. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  970. cg.g_exception_reason_load(exprasmlist,href);
  971. cleanupobjectstack;
  972. cg.a_jmp_always(exprasmlist,oldaktcontinuelabel);
  973. end;
  974. if fc_exit in tryflowcontrol then
  975. begin
  976. { do some magic for exit in the try block }
  977. cg.a_label(exprasmlist,exittrylabel);
  978. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  979. cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
  980. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  981. cg.g_exception_reason_load(exprasmlist,href);
  982. cg.a_jmp_always(exprasmlist,oldaktexitlabel);
  983. end;
  984. if fc_break in tryflowcontrol then
  985. begin
  986. cg.a_label(exprasmlist,breaktrylabel);
  987. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  988. cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
  989. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  990. cg.g_exception_reason_load(exprasmlist,href);
  991. cg.a_jmp_always(exprasmlist,oldaktbreaklabel);
  992. end;
  993. if fc_continue in tryflowcontrol then
  994. begin
  995. cg.a_label(exprasmlist,continuetrylabel);
  996. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  997. cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK');
  998. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  999. cg.g_exception_reason_load(exprasmlist,href);
  1000. cg.a_jmp_always(exprasmlist,oldaktcontinuelabel);
  1001. end;
  1002. cg.a_label(exprasmlist,endexceptlabel);
  1003. errorexit:
  1004. { restore all saved labels }
  1005. endexceptlabel:=oldendexceptlabel;
  1006. { restore the control flow labels }
  1007. current_procinfo.aktexitlabel:=oldaktexitlabel;
  1008. if assigned(oldaktbreaklabel) then
  1009. begin
  1010. aktcontinuelabel:=oldaktcontinuelabel;
  1011. aktbreaklabel:=oldaktbreaklabel;
  1012. end;
  1013. { return all used control flow statements }
  1014. flowcontrol:=oldflowcontrol+exceptflowcontrol+
  1015. tryflowcontrol;
  1016. end;
  1017. procedure tcgonnode.pass_2;
  1018. var
  1019. nextonlabel,
  1020. exitonlabel,
  1021. continueonlabel,
  1022. breakonlabel,
  1023. oldaktexitlabel,
  1024. oldaktcontinuelabel,
  1025. doobjectdestroyandreraise,
  1026. doobjectdestroy,
  1027. oldaktbreaklabel : tasmlabel;
  1028. oldflowcontrol : tflowcontrol;
  1029. exceptref,
  1030. tempbuf,tempaddr : treference;
  1031. href : treference;
  1032. href2: treference;
  1033. paraloc1 : tparalocation;
  1034. begin
  1035. location_reset(location,LOC_VOID,OS_NO);
  1036. oldflowcontrol:=flowcontrol;
  1037. flowcontrol:=[];
  1038. objectlibrary.getlabel(nextonlabel);
  1039. { send the vmt parameter }
  1040. reference_reset_symbol(href2,objectlibrary.newasmsymboldata(excepttype.vmt_mangledname),0);
  1041. paraloc1:=paramanager.getintparaloc(pocall_default,1);
  1042. paramanager.allocparaloc(exprasmlist,paraloc1);
  1043. cg.a_paramaddr_ref(exprasmlist,href2,paraloc1);
  1044. paramanager.freeparaloc(exprasmlist,paraloc1);
  1045. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  1046. cg.a_call_name(exprasmlist,'FPC_CATCHES');
  1047. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  1048. { is it this catch? No. go to next onlabel }
  1049. cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,NR_FUNCTION_RESULT_REG,nextonlabel);
  1050. { what a hack ! }
  1051. if assigned(exceptsymtable) then
  1052. begin
  1053. tvarsym(exceptsymtable.symindex.first).localloc.loc:=LOC_REFERENCE;
  1054. tg.GetLocal(exprasmlist,POINTER_SIZE,tvarsym(exceptsymtable.symindex.first).localloc.reference);
  1055. reference_reset_base(href,tvarsym(exceptsymtable.symindex.first).localloc.reference.index,
  1056. tvarsym(exceptsymtable.symindex.first).localloc.reference.offset);
  1057. cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,href);
  1058. end
  1059. else
  1060. begin
  1061. tg.GetTemp(exprasmlist,POINTER_SIZE,tt_normal,exceptref);
  1062. cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,exceptref);
  1063. end;
  1064. { in the case that another exception is risen }
  1065. { we've to destroy the old one }
  1066. objectlibrary.getlabel(doobjectdestroyandreraise);
  1067. { call setjmp, and jump to finally label on non-zero result }
  1068. try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,doobjectdestroyandreraise);
  1069. if assigned(right) then
  1070. begin
  1071. oldaktexitlabel:=current_procinfo.aktexitlabel;
  1072. objectlibrary.getlabel(exitonlabel);
  1073. current_procinfo.aktexitlabel:=exitonlabel;
  1074. if assigned(aktbreaklabel) then
  1075. begin
  1076. oldaktcontinuelabel:=aktcontinuelabel;
  1077. oldaktbreaklabel:=aktbreaklabel;
  1078. objectlibrary.getlabel(breakonlabel);
  1079. objectlibrary.getlabel(continueonlabel);
  1080. aktcontinuelabel:=continueonlabel;
  1081. aktbreaklabel:=breakonlabel;
  1082. end;
  1083. secondpass(right);
  1084. end;
  1085. objectlibrary.getlabel(doobjectdestroy);
  1086. cg.a_label(exprasmlist,doobjectdestroyandreraise);
  1087. try_free_exception(exprasmlist,tempbuf,tempaddr,href,0,doobjectdestroy,false);
  1088. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  1089. cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK');
  1090. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  1091. paraloc1:=paramanager.getintparaloc(pocall_default,1);
  1092. paramanager.allocparaloc(exprasmlist,paraloc1);
  1093. cg.a_param_reg(exprasmlist, OS_ADDR, NR_FUNCTION_RESULT_REG, paraloc1);
  1094. paramanager.freeparaloc(exprasmlist,paraloc1);
  1095. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  1096. cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION');
  1097. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  1098. { we don't need to restore esi here because reraise never }
  1099. { returns }
  1100. cg.a_call_name(exprasmlist,'FPC_RERAISE');
  1101. cg.a_label(exprasmlist,doobjectdestroy);
  1102. cleanupobjectstack;
  1103. { clear some stuff }
  1104. if assigned(exceptsymtable) then
  1105. begin
  1106. tg.UngetLocal(exprasmlist,tvarsym(exceptsymtable.symindex.first).localloc.reference);
  1107. tvarsym(exceptsymtable.symindex.first).localloc.loc:=LOC_INVALID;
  1108. end
  1109. else
  1110. tg.Ungettemp(exprasmlist,exceptref);
  1111. cg.a_jmp_always(exprasmlist,endexceptlabel);
  1112. if assigned(right) then
  1113. begin
  1114. { special handling for control flow instructions }
  1115. if fc_exit in flowcontrol then
  1116. begin
  1117. { the address and object pop does secondtryexcept }
  1118. cg.a_label(exprasmlist,exitonlabel);
  1119. cg.a_jmp_always(exprasmlist,oldaktexitlabel);
  1120. end;
  1121. if fc_break in flowcontrol then
  1122. begin
  1123. { the address and object pop does secondtryexcept }
  1124. cg.a_label(exprasmlist,breakonlabel);
  1125. cg.a_jmp_always(exprasmlist,oldaktbreaklabel);
  1126. end;
  1127. if fc_continue in flowcontrol then
  1128. begin
  1129. { the address and object pop does secondtryexcept }
  1130. cg.a_label(exprasmlist,continueonlabel);
  1131. cg.a_jmp_always(exprasmlist,oldaktcontinuelabel);
  1132. end;
  1133. current_procinfo.aktexitlabel:=oldaktexitlabel;
  1134. if assigned(oldaktbreaklabel) then
  1135. begin
  1136. aktcontinuelabel:=oldaktcontinuelabel;
  1137. aktbreaklabel:=oldaktbreaklabel;
  1138. end;
  1139. end;
  1140. cg.a_label(exprasmlist,nextonlabel);
  1141. flowcontrol:=oldflowcontrol+flowcontrol;
  1142. { next on node }
  1143. if assigned(left) then
  1144. secondpass(left);
  1145. end;
  1146. {*****************************************************************************
  1147. SecondTryFinally
  1148. *****************************************************************************}
  1149. procedure tcgtryfinallynode.pass_2;
  1150. var
  1151. reraiselabel,
  1152. finallylabel,
  1153. endfinallylabel,
  1154. exitfinallylabel,
  1155. continuefinallylabel,
  1156. breakfinallylabel,
  1157. oldaktexitlabel,
  1158. oldaktcontinuelabel,
  1159. oldaktbreaklabel : tasmlabel;
  1160. oldflowcontrol,tryflowcontrol : tflowcontrol;
  1161. decconst : longint;
  1162. tempbuf,tempaddr : treference;
  1163. href : treference;
  1164. begin
  1165. location_reset(location,LOC_VOID,OS_NO);
  1166. { check if child nodes do a break/continue/exit }
  1167. oldflowcontrol:=flowcontrol;
  1168. flowcontrol:=[];
  1169. objectlibrary.getlabel(finallylabel);
  1170. objectlibrary.getlabel(endfinallylabel);
  1171. objectlibrary.getlabel(reraiselabel);
  1172. { the finally block must catch break, continue and exit }
  1173. { statements }
  1174. oldaktexitlabel:=current_procinfo.aktexitlabel;
  1175. if implicitframe then
  1176. exitfinallylabel:=finallylabel
  1177. else
  1178. objectlibrary.getlabel(exitfinallylabel);
  1179. current_procinfo.aktexitlabel:=exitfinallylabel;
  1180. if assigned(aktbreaklabel) then
  1181. begin
  1182. oldaktcontinuelabel:=aktcontinuelabel;
  1183. oldaktbreaklabel:=aktbreaklabel;
  1184. if implicitframe then
  1185. begin
  1186. breakfinallylabel:=finallylabel;
  1187. continuefinallylabel:=finallylabel;
  1188. end
  1189. else
  1190. begin
  1191. objectlibrary.getlabel(breakfinallylabel);
  1192. objectlibrary.getlabel(continuefinallylabel);
  1193. end;
  1194. aktcontinuelabel:=continuefinallylabel;
  1195. aktbreaklabel:=breakfinallylabel;
  1196. end;
  1197. { call setjmp, and jump to finally label on non-zero result }
  1198. try_new_exception(exprasmlist,tempbuf,tempaddr,href,1,finallylabel);
  1199. { try code }
  1200. if assigned(left) then
  1201. begin
  1202. secondpass(left);
  1203. tryflowcontrol:=flowcontrol;
  1204. if codegenerror then
  1205. exit;
  1206. end;
  1207. cg.a_label(exprasmlist,finallylabel);
  1208. { just free the frame information }
  1209. try_free_exception(exprasmlist,tempbuf,tempaddr,href,1,finallylabel,true);
  1210. { finally code }
  1211. flowcontrol:=[];
  1212. secondpass(right);
  1213. if flowcontrol<>[] then
  1214. CGMessage(cg_e_control_flow_outside_finally);
  1215. if codegenerror then
  1216. exit;
  1217. { the value should now be in the exception handler }
  1218. cg.g_exception_reason_load(exprasmlist,href);
  1219. if implicitframe then
  1220. begin
  1221. cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel);
  1222. { finally code only needed to be executed on exception }
  1223. flowcontrol:=[];
  1224. secondpass(t1);
  1225. if flowcontrol<>[] then
  1226. CGMessage(cg_e_control_flow_outside_finally);
  1227. if codegenerror then
  1228. exit;
  1229. cg.a_call_name(exprasmlist,'FPC_RERAISE');
  1230. end
  1231. else
  1232. begin
  1233. cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel);
  1234. cg.a_op_const_reg(exprasmlist,OP_SUB,OS_32,1,NR_FUNCTION_RESULT_REG);
  1235. cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,reraiselabel);
  1236. if fc_exit in tryflowcontrol then
  1237. begin
  1238. cg.a_op_const_reg(exprasmlist,OP_SUB,OS_32,1,NR_FUNCTION_RESULT_REG);
  1239. cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktexitlabel);
  1240. decconst:=1;
  1241. end
  1242. else
  1243. decconst:=2;
  1244. if fc_break in tryflowcontrol then
  1245. begin
  1246. cg.a_op_const_reg(exprasmlist,OP_SUB,OS_32,decconst,NR_FUNCTION_RESULT_REG);
  1247. cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktbreaklabel);
  1248. decconst:=1;
  1249. end
  1250. else
  1251. inc(decconst);
  1252. if fc_continue in tryflowcontrol then
  1253. begin
  1254. cg.a_op_const_reg(exprasmlist,OP_SUB,OS_32,decconst,NR_FUNCTION_RESULT_REG);
  1255. cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktcontinuelabel);
  1256. end;
  1257. cg.a_label(exprasmlist,reraiselabel);
  1258. cg.a_call_name(exprasmlist,'FPC_RERAISE');
  1259. { do some magic for exit,break,continue in the try block }
  1260. if fc_exit in tryflowcontrol then
  1261. begin
  1262. cg.a_label(exprasmlist,exitfinallylabel);
  1263. cg.g_exception_reason_load(exprasmlist,href);
  1264. cg.g_exception_reason_save_const(exprasmlist,href,2);
  1265. cg.a_jmp_always(exprasmlist,finallylabel);
  1266. end;
  1267. if fc_break in tryflowcontrol then
  1268. begin
  1269. cg.a_label(exprasmlist,breakfinallylabel);
  1270. cg.g_exception_reason_load(exprasmlist,href);
  1271. cg.g_exception_reason_save_const(exprasmlist,href,3);
  1272. cg.a_jmp_always(exprasmlist,finallylabel);
  1273. end;
  1274. if fc_continue in tryflowcontrol then
  1275. begin
  1276. cg.a_label(exprasmlist,continuefinallylabel);
  1277. cg.g_exception_reason_load(exprasmlist,href);
  1278. cg.g_exception_reason_save_const(exprasmlist,href,4);
  1279. cg.a_jmp_always(exprasmlist,finallylabel);
  1280. end;
  1281. end;
  1282. cg.a_label(exprasmlist,endfinallylabel);
  1283. current_procinfo.aktexitlabel:=oldaktexitlabel;
  1284. if assigned(aktbreaklabel) then
  1285. begin
  1286. aktcontinuelabel:=oldaktcontinuelabel;
  1287. aktbreaklabel:=oldaktbreaklabel;
  1288. end;
  1289. flowcontrol:=oldflowcontrol+tryflowcontrol;
  1290. end;
  1291. begin
  1292. cwhilerepeatnode:=tcgwhilerepeatnode;
  1293. cifnode:=tcgifnode;
  1294. cfornode:=tcgfornode;
  1295. cexitnode:=tcgexitnode;
  1296. cbreaknode:=tcgbreaknode;
  1297. ccontinuenode:=tcgcontinuenode;
  1298. cgotonode:=tcggotonode;
  1299. clabelnode:=tcglabelnode;
  1300. craisenode:=tcgraisenode;
  1301. ctryexceptnode:=tcgtryexceptnode;
  1302. ctryfinallynode:=tcgtryfinallynode;
  1303. connode:=tcgonnode;
  1304. end.
  1305. {
  1306. $Log$
  1307. Revision 1.85 2003-10-17 14:38:32 peter
  1308. * 64k registers supported
  1309. * fixed some memory leaks
  1310. Revision 1.84 2003/10/10 17:48:13 peter
  1311. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  1312. * tregisteralloctor renamed to trgobj
  1313. * removed rgobj from a lot of units
  1314. * moved location_* and reference_* to cgobj
  1315. * first things for mmx register allocation
  1316. Revision 1.83 2003/10/09 21:31:37 daniel
  1317. * Register allocator splitted, ans abstract now
  1318. Revision 1.82 2003/10/01 20:34:48 peter
  1319. * procinfo unit contains tprocinfo
  1320. * cginfo renamed to cgbase
  1321. * moved cgmessage to verbose
  1322. * fixed ppc and sparc compiles
  1323. Revision 1.81 2003/09/23 17:56:05 peter
  1324. * locals and paras are allocated in the code generation
  1325. * tvarsym.localloc contains the location of para/local when
  1326. generating code for the current procedure
  1327. Revision 1.80 2003/09/10 08:31:47 marco
  1328. * Patch from Peter for paraloc
  1329. Revision 1.79 2003/09/07 22:09:35 peter
  1330. * preparations for different default calling conventions
  1331. * various RA fixes
  1332. Revision 1.78 2003/09/03 15:55:00 peter
  1333. * NEWRA branch merged
  1334. Revision 1.77 2003/09/03 11:18:36 florian
  1335. * fixed arm concatcopy
  1336. + arm support in the common compiler sources added
  1337. * moved some generic cg code around
  1338. + tfputype added
  1339. * ...
  1340. Revision 1.76.2.4 2003/09/02 17:48:28 peter
  1341. * first process all parameters for raise before pushing the values
  1342. Revision 1.76.2.3 2003/08/31 21:07:44 daniel
  1343. * callparatemp ripped
  1344. Revision 1.76.2.2 2003/08/29 17:28:59 peter
  1345. * next batch of updates
  1346. Revision 1.76.2.1 2003/08/27 20:23:55 peter
  1347. * remove old ra code
  1348. Revision 1.76 2003/08/24 21:38:43 olle
  1349. * made FPC_RAISEEXCEPTION compatible with MacOS
  1350. Revision 1.75 2003/08/10 17:25:23 peter
  1351. * fixed some reported bugs
  1352. Revision 1.74 2003/08/09 18:56:54 daniel
  1353. * cs_regalloc renamed to cs_regvars to avoid confusion with register
  1354. allocator
  1355. * Some preventive changes to i386 spillinh code
  1356. Revision 1.73 2003/07/23 11:01:14 jonas
  1357. * several rg.allocexplicitregistersint/rg.deallocexplicitregistersint
  1358. pairs round calls to helpers
  1359. Revision 1.72 2003/06/13 21:19:30 peter
  1360. * current_procdef removed, use current_procinfo.procdef instead
  1361. Revision 1.71 2003/06/09 14:38:52 jonas
  1362. * fixed for callparatemp
  1363. Revision 1.70 2003/06/09 12:23:30 peter
  1364. * init/final of procedure data splitted from genentrycode
  1365. * use asmnode getposition to insert final at the correct position
  1366. als for the implicit try...finally
  1367. Revision 1.69 2003/06/07 18:57:04 jonas
  1368. + added freeintparaloc
  1369. * ppc get/freeintparaloc now check whether the parameter regs are
  1370. properly allocated/deallocated (and get an extra list para)
  1371. * ppc a_call_* now internalerrors if pi_do_call is not yet set
  1372. * fixed lot of missing pi_do_call's
  1373. Revision 1.68 2003/06/03 21:11:09 peter
  1374. * cg.a_load_* get a from and to size specifier
  1375. * makeregsize only accepts newregister
  1376. * i386 uses generic tcgnotnode,tcgunaryminus
  1377. Revision 1.67 2003/06/01 21:38:06 peter
  1378. * getregisterfpu size parameter added
  1379. * op_const_reg size parameter added
  1380. * sparc updates
  1381. Revision 1.66 2003/05/30 23:57:08 peter
  1382. * more sparc cleanup
  1383. * accumulator removed, splitted in function_return_reg (called) and
  1384. function_result_reg (caller)
  1385. Revision 1.65 2003/05/30 18:55:21 jonas
  1386. * fixed several regvar related bugs for non-i386. make cycle with -Or now
  1387. works for ppc
  1388. Revision 1.64 2003/05/26 21:17:17 peter
  1389. * procinlinenode removed
  1390. * aktexit2label removed, fast exit removed
  1391. + tcallnode.inlined_pass_2 added
  1392. Revision 1.63 2003/05/23 14:27:35 peter
  1393. * remove some unit dependencies
  1394. * current_procinfo changes to store more info
  1395. Revision 1.62 2003/05/17 13:30:08 jonas
  1396. * changed tt_persistant to tt_persistent :)
  1397. * tempcreatenode now doesn't accept a boolean anymore for persistent
  1398. temps, but a ttemptype, so you can also create ansistring temps etc
  1399. Revision 1.61 2003/05/16 14:33:31 peter
  1400. * regvar fixes
  1401. Revision 1.60 2003/05/13 19:14:41 peter
  1402. * failn removed
  1403. * inherited result code check moven to pexpr
  1404. Revision 1.59 2003/05/11 21:37:03 peter
  1405. * moved implicit exception frame from ncgutil to psub
  1406. * constructor/destructor helpers moved from cobj/ncgutil to psub
  1407. Revision 1.58 2003/04/30 15:45:35 florian
  1408. * merged more x86-64/i386 code
  1409. Revision 1.57 2003/04/29 07:29:14 michael
  1410. + Patch from peter to fix wrong pushing of ansistring function results in open array
  1411. Revision 1.56 2003/04/27 11:21:33 peter
  1412. * aktprocdef renamed to current_procinfo.procdef
  1413. * procinfo renamed to current_procinfo
  1414. * procinfo will now be stored in current_module so it can be
  1415. cleaned up properly
  1416. * gen_main_procsym changed to create_main_proc and release_main_proc
  1417. to also generate a tprocinfo structure
  1418. * fixed unit implicit initfinal
  1419. Revision 1.55 2003/04/22 23:50:22 peter
  1420. * firstpass uses expectloc
  1421. * checks if there are differences between the expectloc and
  1422. location.loc from secondpass in EXTDEBUG
  1423. Revision 1.54 2003/04/17 07:50:24 daniel
  1424. * Some work on interference graph construction
  1425. Revision 1.53 2003/04/06 21:11:23 olle
  1426. * changed newasmsymbol to newasmsymboldata for data symbols
  1427. Revision 1.52 2003/03/28 19:16:56 peter
  1428. * generic constructor working for i386
  1429. * remove fixed self register
  1430. * esi added as address register for i386
  1431. Revision 1.51 2003/02/19 22:00:14 daniel
  1432. * Code generator converted to new register notation
  1433. - Horribily outdated todo.txt removed
  1434. Revision 1.50 2003/02/15 22:17:38 carl
  1435. * bugfix of FPU emulation code
  1436. Revision 1.49 2003/01/08 18:43:56 daniel
  1437. * Tregister changed into a record
  1438. Revision 1.48 2003/01/03 09:51:58 daniel
  1439. * Compiler now cycles with var_notification
  1440. Revision 1.47 2003/01/02 15:29:25 daniel
  1441. * Some debugging on for loop optimization
  1442. Revision 1.46 2002/12/31 09:55:58 daniel
  1443. + Notification implementation complete
  1444. + Add for loop code optimization using notifications
  1445. results in 1.5-1.9% speed improvement in nestloop benchmark
  1446. Optimization incomplete, compiler does not cycle yet with
  1447. notifications enabled.
  1448. Revision 1.45 2002/11/28 11:17:01 florian
  1449. * loop node flags from node flags splitted
  1450. Revision 1.44 2002/11/25 17:43:17 peter
  1451. * splitted defbase in defutil,symutil,defcmp
  1452. * merged isconvertable and is_equal into compare_defs(_ext)
  1453. * made operator search faster by walking the list only once
  1454. Revision 1.43 2002/09/30 07:00:45 florian
  1455. * fixes to common code to get the alpha compiler compiled applied
  1456. Revision 1.42 2002/09/07 15:25:02 peter
  1457. * old logs removed and tabs fixed
  1458. Revision 1.41 2002/09/01 18:47:00 peter
  1459. * assignn check in exitnode changed to use a separate boolean as the
  1460. assignn can be changed to a calln
  1461. Revision 1.40 2002/09/01 14:41:47 peter
  1462. * increase refcount in exit(arg) for arg
  1463. Revision 1.39 2002/08/24 18:41:52 peter
  1464. * fixed wrong label in jump of except block (was also in n386flw wrong)
  1465. * fixed wrong pushing of raise parameters
  1466. * fixed wrong compare in finally
  1467. Revision 1.38 2002/08/23 16:14:48 peter
  1468. * tempgen cleanup
  1469. * tt_noreuse temp type added that will be used in genentrycode
  1470. Revision 1.37 2002/08/19 19:36:43 peter
  1471. * More fixes for cross unit inlining, all tnodes are now implemented
  1472. * Moved pocall_internconst to po_internconst because it is not a
  1473. calling type at all and it conflicted when inlining of these small
  1474. functions was requested
  1475. Revision 1.36 2002/08/15 15:15:55 carl
  1476. * jmpbuf size allocation for exceptions is now cpu specific (as it should)
  1477. * more generic nodes for maths
  1478. * several fixes for better m68k support
  1479. Revision 1.35 2002/08/13 18:01:52 carl
  1480. * rename swatoperands to swapoperands
  1481. + m68k first compilable version (still needs a lot of testing):
  1482. assembler generator, system information , inline
  1483. assembler reader.
  1484. Revision 1.34 2002/08/11 14:32:26 peter
  1485. * renamed current_library to objectlibrary
  1486. Revision 1.33 2002/08/11 13:24:11 peter
  1487. * saving of asmsymbols in ppu supported
  1488. * asmsymbollist global is removed and moved into a new class
  1489. tasmlibrarydata that will hold the info of a .a file which
  1490. corresponds with a single module. Added librarydata to tmodule
  1491. to keep the library info stored for the module. In the future the
  1492. objectfiles will also be stored to the tasmlibrarydata class
  1493. * all getlabel/newasmsymbol and friends are moved to the new class
  1494. Revision 1.32 2002/08/09 19:10:59 carl
  1495. * fixed generic exception management
  1496. Revision 1.31 2002/08/04 19:06:41 carl
  1497. + added generic exception support (still does not work!)
  1498. + more documentation
  1499. Revision 1.30 2002/07/27 19:53:51 jonas
  1500. + generic implementation of tcg.g_flags2ref()
  1501. * tcg.flags2xxx() now also needs a size parameter
  1502. Revision 1.29 2002/07/25 17:56:29 carl
  1503. + FPURESULTREG -> FPU_RESULT_REG
  1504. Revision 1.28 2002/07/21 06:58:49 daniel
  1505. * Changed booleans into flags
  1506. Revision 1.27 2002/07/20 12:54:53 daniel
  1507. * Optimized the code generated for for nodes. The shootout/nestloop benchmark
  1508. now runs 5% faster on my computer.
  1509. Revision 1.26 2002/07/20 11:57:54 florian
  1510. * types.pas renamed to defbase.pas because D6 contains a types
  1511. unit so this would conflicts if D6 programms are compiled
  1512. + Willamette/SSE2 instructions to assembler added
  1513. Revision 1.25 2002/07/20 11:15:51 daniel
  1514. * The for node does a check if the first comparision can be skipped. I moved
  1515. the check from the second pass to the resulttype pass. The advantage is
  1516. that the state tracker can now decide to skip the first comparision too.
  1517. Revision 1.24 2002/07/20 08:14:24 daniel
  1518. * Loops should not be aligned when optimizing for size
  1519. Revision 1.23 2002/07/19 11:41:35 daniel
  1520. * State tracker work
  1521. * The whilen and repeatn are now completely unified into whilerepeatn. This
  1522. allows the state tracker to change while nodes automatically into
  1523. repeat nodes.
  1524. * Resulttypepass improvements to the notn. 'not not a' is optimized away and
  1525. 'not(a>b)' is optimized into 'a<=b'.
  1526. * Resulttypepass improvements to the whilerepeatn. 'while not a' is optimized
  1527. by removing the notn and later switchting the true and falselabels. The
  1528. same is done with 'repeat until not a'.
  1529. Revision 1.22 2002/07/04 20:43:01 florian
  1530. * first x86-64 patches
  1531. }