nadd.pas 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. Type checking and register allocation for add nodes
  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 nadd;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. node;
  23. type
  24. taddnode = class(tbinopnode)
  25. constructor create(tt : tnodetype;l,r : tnode);override;
  26. function pass_1 : tnode;override;
  27. function det_resulttype:tnode;override;
  28. end;
  29. var
  30. { caddnode is used to create nodes of the add type }
  31. { the virtual constructor allows to assign }
  32. { another class type to caddnode => processor }
  33. { specific node types can be created }
  34. caddnode : class of taddnode;
  35. implementation
  36. uses
  37. globtype,systems,
  38. cutils,verbose,globals,
  39. symconst,symtype,symdef,types,
  40. cpuinfo,
  41. {$ifdef newcg}
  42. cgbase,
  43. {$else newcg}
  44. hcodegen,
  45. {$endif newcg}
  46. htypechk,pass_1,
  47. nmat,ncnv,nld,ncon,nset,nopt,
  48. cpubase;
  49. {*****************************************************************************
  50. TADDNODE
  51. *****************************************************************************}
  52. {$ifdef fpc}
  53. {$maxfpuregisters 0}
  54. {$endif fpc}
  55. constructor taddnode.create(tt : tnodetype;l,r : tnode);
  56. begin
  57. inherited create(tt,l,r);
  58. end;
  59. function taddnode.det_resulttype:tnode;
  60. var
  61. hp,t : tnode;
  62. lt,rt : tnodetype;
  63. rd,ld : pdef;
  64. htype : ttype;
  65. ot : tnodetype;
  66. concatstrings : boolean;
  67. resultset : pconstset;
  68. i : longint;
  69. b : boolean;
  70. s1,s2 : pchar;
  71. l1,l2 : longint;
  72. rv,lv : tconstexprint;
  73. rvd,lvd : bestreal;
  74. begin
  75. result:=nil;
  76. { first do the two subtrees }
  77. resulttypepass(left);
  78. resulttypepass(right);
  79. { both left and right need to be valid }
  80. set_varstate(left,true);
  81. set_varstate(right,true);
  82. if codegenerror then
  83. exit;
  84. { load easier access variables }
  85. rd:=right.resulttype.def;
  86. ld:=left.resulttype.def;
  87. rt:=right.nodetype;
  88. lt:=left.nodetype;
  89. { convert array constructors to sets, because there is no other operator
  90. possible for array constructors }
  91. if is_array_constructor(ld) then
  92. begin
  93. arrayconstructor_to_set(tarrayconstructornode(left));
  94. resulttypepass(left);
  95. ld:=left.resulttype.def;
  96. end;
  97. if is_array_constructor(rd) then
  98. begin
  99. arrayconstructor_to_set(tarrayconstructornode(right));
  100. resulttypepass(right);
  101. rd:=right.resulttype.def;
  102. end;
  103. { both are int constants }
  104. if (((is_constintnode(left) and is_constintnode(right)) or
  105. (is_constboolnode(left) and is_constboolnode(right) and
  106. (nodetype in [ltn,lten,gtn,gten,equaln,unequaln,andn,xorn,orn])))) or
  107. { support pointer arithmetics on constants (JM) }
  108. ((lt = pointerconstn) and is_constintnode(right) and
  109. (nodetype in [addn,subn])) or
  110. ((lt = pointerconstn) and (rt = pointerconstn) and
  111. (nodetype in [ltn,lten,gtn,gten,equaln,unequaln,subn])) then
  112. begin
  113. { when comparing/substracting pointers, make sure they are }
  114. { of the same type (JM) }
  115. if (lt = pointerconstn) and (rt = pointerconstn) then
  116. begin
  117. if not(cs_extsyntax in aktmoduleswitches) and
  118. not(nodetype in [equaln,unequaln]) then
  119. CGMessage(type_e_mismatch)
  120. else
  121. if (nodetype <> subn) and
  122. is_voidpointer(rd) then
  123. inserttypeconv(right,left.resulttype)
  124. else if (nodetype <> subn) and
  125. is_voidpointer(ld) then
  126. inserttypeconv(left,right.resulttype)
  127. else if not(is_equal(ld,rd)) then
  128. CGMessage(type_e_mismatch);
  129. end
  130. else if (lt=ordconstn) and (rt=ordconstn) then
  131. begin
  132. { make left const type the biggest, this type will be used
  133. for orn,andn,xorn }
  134. if rd^.size>ld^.size then
  135. inserttypeconv(left,right.resulttype);
  136. end;
  137. { load values }
  138. if (lt = ordconstn) then
  139. lv:=tordconstnode(left).value
  140. else
  141. lv:=tpointerconstnode(left).value;
  142. if (rt = ordconstn) then
  143. rv:=tordconstnode(right).value
  144. else
  145. rv:=tpointerconstnode(right).value;
  146. if (lt = pointerconstn) and
  147. (rt <> pointerconstn) then
  148. rv := rv * ppointerdef(left.resulttype.def)^.pointertype.def^.size;
  149. if (rt = pointerconstn) and
  150. (lt <> pointerconstn) then
  151. lv := lv * ppointerdef(right.resulttype.def)^.pointertype.def^.size;
  152. case nodetype of
  153. addn :
  154. if (lt <> pointerconstn) then
  155. t := genintconstnode(lv+rv)
  156. else
  157. t := cpointerconstnode.create(lv+rv,left.resulttype);
  158. subn :
  159. if (lt <> pointerconstn) or (rt = pointerconstn) then
  160. t := genintconstnode(lv-rv)
  161. else
  162. t := cpointerconstnode.create(lv-rv,left.resulttype);
  163. muln :
  164. t:=genintconstnode(lv*rv);
  165. xorn :
  166. t:=cordconstnode.create(lv xor rv,left.resulttype);
  167. orn :
  168. t:=cordconstnode.create(lv or rv,left.resulttype);
  169. andn :
  170. t:=cordconstnode.create(lv and rv,left.resulttype);
  171. ltn :
  172. t:=cordconstnode.create(ord(lv<rv),booltype);
  173. lten :
  174. t:=cordconstnode.create(ord(lv<=rv),booltype);
  175. gtn :
  176. t:=cordconstnode.create(ord(lv>rv),booltype);
  177. gten :
  178. t:=cordconstnode.create(ord(lv>=rv),booltype);
  179. equaln :
  180. t:=cordconstnode.create(ord(lv=rv),booltype);
  181. unequaln :
  182. t:=cordconstnode.create(ord(lv<>rv),booltype);
  183. slashn :
  184. begin
  185. { int/int becomes a real }
  186. if int(rv)=0 then
  187. begin
  188. Message(parser_e_invalid_float_operation);
  189. t:=crealconstnode.create(0,pbestrealtype^);
  190. end
  191. else
  192. t:=crealconstnode.create(int(lv)/int(rv),pbestrealtype^);
  193. end;
  194. else
  195. CGMessage(type_e_mismatch);
  196. end;
  197. resulttypepass(t);
  198. result:=t;
  199. exit;
  200. end;
  201. { both real constants ? }
  202. if (lt=realconstn) and (rt=realconstn) then
  203. begin
  204. lvd:=trealconstnode(left).value_real;
  205. rvd:=trealconstnode(right).value_real;
  206. case nodetype of
  207. addn :
  208. t:=crealconstnode.create(lvd+rvd,pbestrealtype^);
  209. subn :
  210. t:=crealconstnode.create(lvd-rvd,pbestrealtype^);
  211. muln :
  212. t:=crealconstnode.create(lvd*rvd,pbestrealtype^);
  213. starstarn,
  214. caretn :
  215. begin
  216. if lvd<0 then
  217. begin
  218. Message(parser_e_invalid_float_operation);
  219. t:=crealconstnode.create(0,pbestrealtype^);
  220. end
  221. else if lvd=0 then
  222. t:=crealconstnode.create(1.0,pbestrealtype^)
  223. else
  224. t:=crealconstnode.create(exp(ln(lvd)*rvd),pbestrealtype^);
  225. end;
  226. slashn :
  227. begin
  228. if rvd=0 then
  229. begin
  230. Message(parser_e_invalid_float_operation);
  231. t:=crealconstnode.create(0,pbestrealtype^);
  232. end
  233. else
  234. t:=crealconstnode.create(lvd/rvd,pbestrealtype^);
  235. end;
  236. ltn :
  237. t:=cordconstnode.create(ord(lvd<rvd),booltype);
  238. lten :
  239. t:=cordconstnode.create(ord(lvd<=rvd),booltype);
  240. gtn :
  241. t:=cordconstnode.create(ord(lvd>rvd),booltype);
  242. gten :
  243. t:=cordconstnode.create(ord(lvd>=rvd),booltype);
  244. equaln :
  245. t:=cordconstnode.create(ord(lvd=rvd),booltype);
  246. unequaln :
  247. t:=cordconstnode.create(ord(lvd<>rvd),booltype);
  248. else
  249. CGMessage(type_e_mismatch);
  250. end;
  251. resulttypepass(t);
  252. result:=t;
  253. exit;
  254. end;
  255. { concating strings ? }
  256. concatstrings:=false;
  257. s1:=nil;
  258. s2:=nil;
  259. if (lt=ordconstn) and (rt=ordconstn) and
  260. is_char(ld) and is_char(rd) then
  261. begin
  262. s1:=strpnew(char(byte(tordconstnode(left).value)));
  263. s2:=strpnew(char(byte(tordconstnode(right).value)));
  264. l1:=1;
  265. l2:=1;
  266. concatstrings:=true;
  267. end
  268. else
  269. if (lt=stringconstn) and (rt=ordconstn) and is_char(rd) then
  270. begin
  271. s1:=tstringconstnode(left).getpcharcopy;
  272. l1:=tstringconstnode(left).len;
  273. s2:=strpnew(char(byte(tordconstnode(right).value)));
  274. l2:=1;
  275. concatstrings:=true;
  276. end
  277. else
  278. if (lt=ordconstn) and (rt=stringconstn) and is_char(ld) then
  279. begin
  280. s1:=strpnew(char(byte(tordconstnode(left).value)));
  281. l1:=1;
  282. s2:=tstringconstnode(right).getpcharcopy;
  283. l2:=tstringconstnode(right).len;
  284. concatstrings:=true;
  285. end
  286. else if (lt=stringconstn) and (rt=stringconstn) then
  287. begin
  288. s1:=tstringconstnode(left).getpcharcopy;
  289. l1:=tstringconstnode(left).len;
  290. s2:=tstringconstnode(right).getpcharcopy;
  291. l2:=tstringconstnode(right).len;
  292. concatstrings:=true;
  293. end;
  294. if concatstrings then
  295. begin
  296. case nodetype of
  297. addn :
  298. t:=cstringconstnode.createpchar(concatansistrings(s1,s2,l1,l2),l1+l2);
  299. ltn :
  300. t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<0),booltype);
  301. lten :
  302. t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<=0),booltype);
  303. gtn :
  304. t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>0),booltype);
  305. gten :
  306. t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)>=0),booltype);
  307. equaln :
  308. t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)=0),booltype);
  309. unequaln :
  310. t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<>0),booltype);
  311. end;
  312. ansistringdispose(s1,l1);
  313. ansistringdispose(s2,l2);
  314. resulttypepass(t);
  315. result:=t;
  316. exit;
  317. end;
  318. { set constant evaluation }
  319. if (right.nodetype=setconstn) and
  320. not assigned(tsetconstnode(right).left) and
  321. (left.nodetype=setconstn) and
  322. not assigned(tsetconstnode(left).left) then
  323. begin
  324. new(resultset);
  325. case nodetype of
  326. addn :
  327. begin
  328. for i:=0 to 31 do
  329. resultset^[i]:=tsetconstnode(right).value_set^[i] or tsetconstnode(left).value_set^[i];
  330. t:=csetconstnode.create(resultset,left.resulttype);
  331. end;
  332. muln :
  333. begin
  334. for i:=0 to 31 do
  335. resultset^[i]:=tsetconstnode(right).value_set^[i] and tsetconstnode(left).value_set^[i];
  336. t:=csetconstnode.create(resultset,left.resulttype);
  337. end;
  338. subn :
  339. begin
  340. for i:=0 to 31 do
  341. resultset^[i]:=tsetconstnode(left).value_set^[i] and not(tsetconstnode(right).value_set^[i]);
  342. t:=csetconstnode.create(resultset,left.resulttype);
  343. end;
  344. symdifn :
  345. begin
  346. for i:=0 to 31 do
  347. resultset^[i]:=tsetconstnode(left).value_set^[i] xor tsetconstnode(right).value_set^[i];
  348. t:=csetconstnode.create(resultset,left.resulttype);
  349. end;
  350. unequaln :
  351. begin
  352. b:=true;
  353. for i:=0 to 31 do
  354. if tsetconstnode(right).value_set^[i]=tsetconstnode(left).value_set^[i] then
  355. begin
  356. b:=false;
  357. break;
  358. end;
  359. t:=cordconstnode.create(ord(b),booltype);
  360. end;
  361. equaln :
  362. begin
  363. b:=true;
  364. for i:=0 to 31 do
  365. if tsetconstnode(right).value_set^[i]<>tsetconstnode(left).value_set^[i] then
  366. begin
  367. b:=false;
  368. break;
  369. end;
  370. t:=cordconstnode.create(ord(b),booltype);
  371. end;
  372. lten :
  373. begin
  374. b := true;
  375. For i := 0 to 31 Do
  376. If (tsetconstnode(right).value_set^[i] And tsetconstnode(left).value_set^[i]) <>
  377. tsetconstnode(left).value_set^[i] Then
  378. Begin
  379. b := false;
  380. Break
  381. End;
  382. t := cordconstnode.create(ord(b),booltype);
  383. End;
  384. gten :
  385. Begin
  386. b := true;
  387. For i := 0 to 31 Do
  388. If (tsetconstnode(left).value_set^[i] And tsetconstnode(right).value_set^[i]) <>
  389. tsetconstnode(right).value_set^[i] Then
  390. Begin
  391. b := false;
  392. Break
  393. End;
  394. t := cordconstnode.create(ord(b),booltype);
  395. End;
  396. end;
  397. dispose(resultset);
  398. resulttypepass(t);
  399. result:=t;
  400. exit;
  401. end;
  402. { allow operator overloading }
  403. hp:=self;
  404. if isbinaryoverloaded(hp) then
  405. begin
  406. resulttypepass(hp);
  407. result:=hp;
  408. exit;
  409. end;
  410. { but an int/int gives real/real! }
  411. if nodetype=slashn then
  412. begin
  413. CGMessage(type_h_use_div_for_int);
  414. inserttypeconv(right,pbestrealtype^);
  415. inserttypeconv(left,pbestrealtype^);
  416. end
  417. { if both are orddefs then check sub types }
  418. else if (ld^.deftype=orddef) and (rd^.deftype=orddef) then
  419. begin
  420. { 2 booleans? Make them equal to the largest boolean }
  421. if is_boolean(ld) and is_boolean(rd) then
  422. begin
  423. if porddef(left.resulttype.def)^.size>porddef(right.resulttype.def)^.size then
  424. begin
  425. inserttypeconv(right,left.resulttype);
  426. ttypeconvnode(right).convtype:=tc_bool_2_int;
  427. include(right.flags,nf_explizit);
  428. end
  429. else if porddef(left.resulttype.def)^.size<porddef(right.resulttype.def)^.size then
  430. begin
  431. inserttypeconv(left,right.resulttype);
  432. ttypeconvnode(left).convtype:=tc_bool_2_int;
  433. include(left.flags,nf_explizit);
  434. end;
  435. case nodetype of
  436. xorn,
  437. ltn,
  438. lten,
  439. gtn,
  440. gten,
  441. andn,
  442. orn:
  443. begin
  444. end;
  445. unequaln,
  446. equaln:
  447. begin
  448. if not(cs_full_boolean_eval in aktlocalswitches) then
  449. begin
  450. { Remove any compares with constants }
  451. if (left.nodetype=ordconstn) then
  452. begin
  453. hp:=right;
  454. b:=(tordconstnode(left).value<>0);
  455. ot:=nodetype;
  456. left.free;
  457. left:=nil;
  458. right:=nil;
  459. if (not(b) and (ot=equaln)) or
  460. (b and (ot=unequaln)) then
  461. begin
  462. hp:=cnotnode.create(hp);
  463. resulttypepass(hp);
  464. end;
  465. result:=hp;
  466. exit;
  467. end;
  468. if (right.nodetype=ordconstn) then
  469. begin
  470. hp:=left;
  471. b:=(tordconstnode(right).value<>0);
  472. ot:=nodetype;
  473. right.free;
  474. right:=nil;
  475. left:=nil;
  476. if (not(b) and (ot=equaln)) or
  477. (b and (ot=unequaln)) then
  478. begin
  479. hp:=cnotnode.create(hp);
  480. resulttypepass(hp);
  481. end;
  482. result:=hp;
  483. exit;
  484. end;
  485. end;
  486. end;
  487. else
  488. CGMessage(type_e_mismatch);
  489. end;
  490. end
  491. { Both are chars? }
  492. else if is_char(rd) and is_char(ld) then
  493. begin
  494. if nodetype=addn then
  495. begin
  496. resulttype:=cshortstringtype;
  497. if not(is_constcharnode(left) and is_constcharnode(right)) then
  498. begin
  499. inserttypeconv(left,cshortstringtype);
  500. hp := genaddsstringcharoptnode(self);
  501. resulttypepass(hp);
  502. result := hp;
  503. exit;
  504. end;
  505. end;
  506. end
  507. { is there a signed 64 bit type ? }
  508. else if ((porddef(rd)^.typ=s64bit) or (porddef(ld)^.typ=s64bit)) then
  509. begin
  510. if (porddef(ld)^.typ<>s64bit) then
  511. inserttypeconv(left,cs64bittype);
  512. if (porddef(rd)^.typ<>s64bit) then
  513. inserttypeconv(right,cs64bittype);
  514. end
  515. { is there a unsigned 64 bit type ? }
  516. else if ((porddef(rd)^.typ=u64bit) or (porddef(ld)^.typ=u64bit)) then
  517. begin
  518. if (porddef(ld)^.typ<>u64bit) then
  519. inserttypeconv(left,cu64bittype);
  520. if (porddef(rd)^.typ<>u64bit) then
  521. inserttypeconv(right,cu64bittype);
  522. end
  523. { is there a cardinal? }
  524. else if ((porddef(rd)^.typ=u32bit) or (porddef(ld)^.typ=u32bit)) then
  525. begin
  526. if is_signed(ld) and
  527. { then rd = u32bit }
  528. { convert positive constants to u32bit }
  529. not(is_constintnode(left) and
  530. (tordconstnode(left).value >= 0)) and
  531. { range/overflow checking on mixed signed/cardinal expressions }
  532. { is only possible if you convert everything to 64bit (JM) }
  533. ((aktlocalswitches * [cs_check_overflow,cs_check_range] <> []) and
  534. (nodetype in [addn,subn,muln])) then
  535. begin
  536. { perform the operation in 64bit }
  537. CGMessage(type_w_mixed_signed_unsigned);
  538. inserttypeconv(left,cs64bittype);
  539. inserttypeconv(right,cs64bittype);
  540. end
  541. else
  542. begin
  543. if is_signed(ld) and
  544. not(is_constintnode(left) and
  545. (tordconstnode(left).value >= 0)) and
  546. (cs_check_range in aktlocalswitches) then
  547. CGMessage(type_w_mixed_signed_unsigned2);
  548. inserttypeconv(left,u32bittype);
  549. if is_signed(rd) and
  550. { then ld = u32bit }
  551. { convert positive constants to u32bit }
  552. not(is_constintnode(right) and
  553. (tordconstnode(right).value >= 0)) and
  554. ((aktlocalswitches * [cs_check_overflow,cs_check_range] <> []) and
  555. (nodetype in [addn,subn,muln])) then
  556. begin
  557. { perform the operation in 64bit }
  558. CGMessage(type_w_mixed_signed_unsigned);
  559. inserttypeconv(left,cs64bittype);
  560. inserttypeconv(right,cs64bittype);
  561. end
  562. else
  563. begin
  564. if is_signed(rd) and
  565. not(is_constintnode(right) and
  566. (tordconstnode(right).value >= 0)) and
  567. (cs_check_range in aktlocalswitches) then
  568. CGMessage(type_w_mixed_signed_unsigned2);
  569. inserttypeconv(right,u32bittype);
  570. end;
  571. end;
  572. end
  573. { generic ord conversion is s32bit }
  574. else
  575. begin
  576. inserttypeconv(right,s32bittype);
  577. inserttypeconv(left,s32bittype);
  578. end;
  579. end
  580. { left side a setdef, must be before string processing,
  581. else array constructor can be seen as array of char (PFV) }
  582. else if (ld^.deftype=setdef) then
  583. begin
  584. { trying to add a set element? }
  585. if (nodetype=addn) and (rd^.deftype<>setdef) then
  586. begin
  587. if (rt=setelementn) then
  588. begin
  589. if not(is_equal(psetdef(ld)^.elementtype.def,rd)) then
  590. CGMessage(type_e_set_element_are_not_comp);
  591. end
  592. else
  593. CGMessage(type_e_mismatch)
  594. end
  595. else
  596. begin
  597. if not(nodetype in [addn,subn,symdifn,muln,equaln,unequaln,lten,gten]) then
  598. CGMessage(type_e_set_operation_unknown);
  599. { right def must be a also be set }
  600. if (rd^.deftype<>setdef) or not(is_equal(rd,ld)) then
  601. CGMessage(type_e_set_element_are_not_comp);
  602. end;
  603. { ranges require normsets }
  604. if (psetdef(ld)^.settype=smallset) and
  605. (rt=setelementn) and
  606. assigned(tsetelementnode(right).right) then
  607. begin
  608. { generate a temporary normset def, it'll be destroyed
  609. when the symtable is unloaded }
  610. htype.setdef(new(psetdef,init(psetdef(ld)^.elementtype,255)));
  611. inserttypeconv(left,htype);
  612. end;
  613. end
  614. { compare pchar to char arrays by addresses like BP/Delphi }
  615. else if (is_pchar(ld) and is_chararray(rd)) or
  616. (is_pchar(rd) and is_chararray(ld)) then
  617. begin
  618. if is_chararray(rd) then
  619. inserttypeconv(right,left.resulttype)
  620. else
  621. inserttypeconv(left,right.resulttype);
  622. end
  623. { is one of the operands a string?,
  624. chararrays are also handled as strings (after conversion), also take
  625. care of chararray+chararray and chararray+char }
  626. else if (rd^.deftype=stringdef) or (ld^.deftype=stringdef) or
  627. ((is_chararray(rd) or is_char(rd)) and
  628. (is_chararray(ld) or is_char(ld))) then
  629. begin
  630. if is_widestring(rd) or is_widestring(ld) then
  631. begin
  632. if not(is_widestring(rd)) then
  633. inserttypeconv(right,cwidestringtype);
  634. if not(is_widestring(ld)) then
  635. inserttypeconv(left,cwidestringtype);
  636. end
  637. else if is_ansistring(rd) or is_ansistring(ld) then
  638. begin
  639. if not(is_ansistring(rd)) then
  640. inserttypeconv(right,cansistringtype);
  641. if not(is_ansistring(ld)) then
  642. inserttypeconv(left,cansistringtype);
  643. end
  644. else if is_longstring(rd) or is_longstring(ld) then
  645. begin
  646. if not(is_longstring(rd)) then
  647. inserttypeconv(right,clongstringtype);
  648. if not(is_longstring(ld)) then
  649. inserttypeconv(left,clongstringtype);
  650. location.loc:=LOC_MEM;
  651. end
  652. else
  653. begin
  654. if not(is_shortstring(ld)) then
  655. inserttypeconv(left,cshortstringtype);
  656. { don't convert char, that can be handled by the optimized node }
  657. if not(is_shortstring(rd) or is_char(rd)) then
  658. inserttypeconv(right,cshortstringtype);
  659. end;
  660. end
  661. { is one a real float ? }
  662. else if (rd^.deftype=floatdef) or (ld^.deftype=floatdef) then
  663. begin
  664. { convert both to bestreal }
  665. inserttypeconv(right,pbestrealtype^);
  666. inserttypeconv(left,pbestrealtype^);
  667. end
  668. { pointer comparision and subtraction }
  669. else if (rd^.deftype=pointerdef) and (ld^.deftype=pointerdef) then
  670. begin
  671. case nodetype of
  672. equaln,unequaln :
  673. begin
  674. if is_voidpointer(right.resulttype.def) then
  675. inserttypeconv(right,left.resulttype)
  676. else if is_voidpointer(left.resulttype.def) then
  677. inserttypeconv(left,right.resulttype)
  678. else if not(is_equal(ld,rd)) then
  679. CGMessage(type_e_mismatch);
  680. end;
  681. ltn,lten,gtn,gten:
  682. begin
  683. if (cs_extsyntax in aktmoduleswitches) then
  684. begin
  685. if is_voidpointer(right.resulttype.def) then
  686. inserttypeconv(right,left.resulttype)
  687. else if is_voidpointer(left.resulttype.def) then
  688. inserttypeconv(left,right.resulttype)
  689. else if not(is_equal(ld,rd)) then
  690. CGMessage(type_e_mismatch);
  691. end
  692. else
  693. CGMessage(type_e_mismatch);
  694. end;
  695. subn:
  696. begin
  697. if (cs_extsyntax in aktmoduleswitches) then
  698. begin
  699. if is_voidpointer(right.resulttype.def) then
  700. inserttypeconv(right,left.resulttype)
  701. else if is_voidpointer(left.resulttype.def) then
  702. inserttypeconv(left,right.resulttype)
  703. else if not(is_equal(ld,rd)) then
  704. CGMessage(type_e_mismatch);
  705. end
  706. else
  707. CGMessage(type_e_mismatch);
  708. resulttype:=s32bittype;
  709. exit;
  710. end;
  711. addn:
  712. begin
  713. if (cs_extsyntax in aktmoduleswitches) then
  714. begin
  715. if is_voidpointer(right.resulttype.def) then
  716. inserttypeconv(right,left.resulttype)
  717. else if is_voidpointer(left.resulttype.def) then
  718. inserttypeconv(left,right.resulttype)
  719. else if not(is_equal(ld,rd)) then
  720. CGMessage(type_e_mismatch);
  721. end
  722. else
  723. CGMessage(type_e_mismatch);
  724. resulttype:=s32bittype;
  725. exit;
  726. end;
  727. else
  728. CGMessage(type_e_mismatch);
  729. end;
  730. end
  731. { class or interface equation }
  732. else if is_class_or_interface(rd) or is_class_or_interface(ld) then
  733. begin
  734. if is_class_or_interface(rd) and is_class_or_interface(ld) then
  735. begin
  736. if pobjectdef(rd)^.is_related(pobjectdef(ld)) then
  737. inserttypeconv(right,left.resulttype)
  738. else
  739. inserttypeconv(left,right.resulttype);
  740. end
  741. else if is_class_or_interface(rd) then
  742. inserttypeconv(left,right.resulttype)
  743. else
  744. inserttypeconv(right,left.resulttype);
  745. if not(nodetype in [equaln,unequaln]) then
  746. CGMessage(type_e_mismatch);
  747. end
  748. else if (rd^.deftype=classrefdef) and (ld^.deftype=classrefdef) then
  749. begin
  750. if pobjectdef(pclassrefdef(rd)^.pointertype.def)^.is_related(
  751. pobjectdef(pclassrefdef(ld)^.pointertype.def)) then
  752. inserttypeconv(right,left.resulttype)
  753. else
  754. inserttypeconv(left,right.resulttype);
  755. if not(nodetype in [equaln,unequaln]) then
  756. CGMessage(type_e_mismatch);
  757. end
  758. { allows comperasion with nil pointer }
  759. else if is_class_or_interface(rd) or (rd^.deftype=classrefdef) then
  760. begin
  761. inserttypeconv(left,right.resulttype);
  762. if not(nodetype in [equaln,unequaln]) then
  763. CGMessage(type_e_mismatch);
  764. end
  765. else if is_class_or_interface(ld) or (ld^.deftype=classrefdef) then
  766. begin
  767. inserttypeconv(right,left.resulttype);
  768. if not(nodetype in [equaln,unequaln]) then
  769. CGMessage(type_e_mismatch);
  770. end
  771. { support procvar=nil,procvar<>nil }
  772. else if ((ld^.deftype=procvardef) and (rt=niln)) or
  773. ((rd^.deftype=procvardef) and (lt=niln)) then
  774. begin
  775. if not(nodetype in [equaln,unequaln]) then
  776. CGMessage(type_e_mismatch);
  777. end
  778. {$ifdef SUPPORT_MMX}
  779. { mmx support, this must be before the zero based array
  780. check }
  781. else if (cs_mmx in aktlocalswitches) and
  782. is_mmx_able_array(ld) and
  783. is_mmx_able_array(rd) and
  784. is_equal(ld,rd) then
  785. begin
  786. case nodetype of
  787. addn,subn,xorn,orn,andn:
  788. ;
  789. { mul is a little bit restricted }
  790. muln:
  791. if not(mmx_type(ld) in [mmxu16bit,mmxs16bit,mmxfixed16]) then
  792. CGMessage(type_e_mismatch);
  793. else
  794. CGMessage(type_e_mismatch);
  795. end;
  796. end
  797. {$endif SUPPORT_MMX}
  798. { this is a little bit dangerous, also the left type }
  799. { pointer to should be checked! This broke the mmx support }
  800. else if (rd^.deftype=pointerdef) or is_zero_based_array(rd) then
  801. begin
  802. if is_zero_based_array(rd) then
  803. begin
  804. resulttype.setdef(new(ppointerdef,init(parraydef(rd)^.elementtype)));
  805. inserttypeconv(right,resulttype);
  806. end;
  807. inserttypeconv(left,s32bittype);
  808. if nodetype=addn then
  809. begin
  810. if not(cs_extsyntax in aktmoduleswitches) or
  811. (not(is_pchar(ld)) and not(m_add_pointer in aktmodeswitches)) then
  812. CGMessage(type_e_mismatch);
  813. if (rd^.deftype=pointerdef) and
  814. (ppointerdef(rd)^.pointertype.def^.size>1) then
  815. left:=caddnode.create(muln,left,cordconstnode.create(ppointerdef(rd)^.pointertype.def^.size,s32bittype));
  816. end
  817. else
  818. CGMessage(type_e_mismatch);
  819. end
  820. else if (ld^.deftype=pointerdef) or is_zero_based_array(ld) then
  821. begin
  822. if is_zero_based_array(ld) then
  823. begin
  824. resulttype.setdef(new(ppointerdef,init(parraydef(ld)^.elementtype)));
  825. inserttypeconv(left,resulttype);
  826. end;
  827. inserttypeconv(right,s32bittype);
  828. if nodetype in [addn,subn] then
  829. begin
  830. if not(cs_extsyntax in aktmoduleswitches) or
  831. (not(is_pchar(ld)) and not(m_add_pointer in aktmodeswitches)) then
  832. CGMessage(type_e_mismatch);
  833. if (ld^.deftype=pointerdef) and
  834. (ppointerdef(ld)^.pointertype.def^.size>1) then
  835. right:=caddnode.create(muln,right,cordconstnode.create(ppointerdef(ld)^.pointertype.def^.size,s32bittype));
  836. end
  837. else
  838. CGMessage(type_e_mismatch);
  839. end
  840. else if (rd^.deftype=procvardef) and (ld^.deftype=procvardef) and is_equal(rd,ld) then
  841. begin
  842. if not (nodetype in [equaln,unequaln]) then
  843. CGMessage(type_e_mismatch);
  844. end
  845. { enums }
  846. else if (ld^.deftype=enumdef) and (rd^.deftype=enumdef) then
  847. begin
  848. if not(is_equal(ld,rd)) then
  849. inserttypeconv(right,left.resulttype);
  850. if not(nodetype in [equaln,unequaln,ltn,lten,gtn,gten]) then
  851. CGMessage(type_e_mismatch);
  852. end
  853. { generic conversion }
  854. else
  855. begin
  856. {$ifdef EXTDEBUG}
  857. Comment(V_Warning,'Generic conversion to s32bit');
  858. {$endif}
  859. inserttypeconv(right,s32bittype);
  860. inserttypeconv(left,s32bittype);
  861. end;
  862. { set resulttype if not already done }
  863. if not assigned(resulttype.def) then
  864. begin
  865. case nodetype of
  866. ltn,lten,gtn,gten,equaln,unequaln :
  867. resulttype:=booltype;
  868. slashn :
  869. resulttype:=pbestrealtype^;
  870. addn:
  871. begin
  872. { for strings, return is always a 255 char string }
  873. if is_shortstring(left.resulttype.def) then
  874. resulttype:=cshortstringtype
  875. else
  876. resulttype:=left.resulttype;
  877. end;
  878. else
  879. resulttype:=left.resulttype;
  880. end;
  881. end;
  882. end;
  883. function taddnode.pass_1 : tnode;
  884. var
  885. hp : tnode;
  886. lt,rt : tnodetype;
  887. rd,ld : pdef;
  888. begin
  889. result:=nil;
  890. { first do the two subtrees }
  891. firstpass(left);
  892. firstpass(right);
  893. if codegenerror then
  894. exit;
  895. { load easier access variables }
  896. rd:=right.resulttype.def;
  897. ld:=left.resulttype.def;
  898. rt:=right.nodetype;
  899. lt:=left.nodetype;
  900. { int/int gives real/real! }
  901. if nodetype=slashn then
  902. begin
  903. { maybe we need an integer register to save }
  904. { a reference }
  905. if ((left.location.loc<>LOC_FPU) or
  906. (right.location.loc<>LOC_FPU)) and
  907. (left.registers32=right.registers32) then
  908. calcregisters(self,1,1,0)
  909. else
  910. calcregisters(self,0,1,0);
  911. location.loc:=LOC_FPU;
  912. end
  913. { if both are orddefs then check sub types }
  914. else if (ld^.deftype=orddef) and (rd^.deftype=orddef) then
  915. begin
  916. { 2 booleans ? }
  917. if is_boolean(ld) and is_boolean(rd) then
  918. begin
  919. if not(cs_full_boolean_eval in aktlocalswitches) and
  920. (nodetype in [andn,orn]) then
  921. begin
  922. calcregisters(self,0,0,0);
  923. location.loc:=LOC_JUMP;
  924. end
  925. else
  926. begin
  927. if (left.location.loc in [LOC_JUMP,LOC_FLAGS]) and
  928. (left.location.loc in [LOC_JUMP,LOC_FLAGS]) then
  929. calcregisters(self,2,0,0)
  930. else
  931. calcregisters(self,1,0,0);
  932. end;
  933. end
  934. else
  935. { Both are chars? only convert to shortstrings for addn }
  936. if is_char(ld) then
  937. begin
  938. if nodetype=addn then
  939. internalerror(200103291);
  940. calcregisters(self,1,0,0);
  941. end
  942. { is there a 64 bit type ? }
  943. else if (porddef(ld)^.typ in [s64bit,u64bit]) then
  944. calcregisters(self,2,0,0)
  945. { is there a cardinal? }
  946. else if (porddef(ld)^.typ=u32bit) then
  947. begin
  948. calcregisters(self,1,0,0);
  949. { for unsigned mul we need an extra register }
  950. if nodetype=muln then
  951. inc(registers32);
  952. end
  953. { generic s32bit conversion }
  954. else
  955. calcregisters(self,1,0,0);
  956. end
  957. { left side a setdef, must be before string processing,
  958. else array constructor can be seen as array of char (PFV) }
  959. else if (ld^.deftype=setdef) then
  960. begin
  961. if psetdef(ld)^.settype=smallset then
  962. begin
  963. { are we adding set elements ? }
  964. if right.nodetype=setelementn then
  965. calcregisters(self,2,0,0)
  966. else
  967. calcregisters(self,1,0,0);
  968. location.loc:=LOC_REGISTER;
  969. end
  970. else
  971. begin
  972. calcregisters(self,0,0,0);
  973. { here we call SET... }
  974. procinfo^.flags:=procinfo^.flags or pi_do_call;
  975. location.loc:=LOC_MEM;
  976. end;
  977. end
  978. { compare pchar by addresses like BP/Delphi }
  979. else if is_pchar(ld) then
  980. begin
  981. location.loc:=LOC_REGISTER;
  982. calcregisters(self,1,0,0);
  983. end
  984. { is one of the operands a string }
  985. else if (ld^.deftype=stringdef) then
  986. begin
  987. if is_widestring(ld) then
  988. begin
  989. { we use reference counted widestrings so no fast exit here }
  990. procinfo^.no_fast_exit:=true;
  991. { this is only for add, the comparisaion is handled later }
  992. location.loc:=LOC_REGISTER;
  993. end
  994. else if is_ansistring(ld) then
  995. begin
  996. { we use ansistrings so no fast exit here }
  997. procinfo^.no_fast_exit:=true;
  998. { this is only for add, the comparisaion is handled later }
  999. location.loc:=LOC_REGISTER;
  1000. end
  1001. else if is_longstring(ld) then
  1002. begin
  1003. { this is only for add, the comparisaion is handled later }
  1004. location.loc:=LOC_MEM;
  1005. end
  1006. else
  1007. begin
  1008. if canbeaddsstringcharoptnode(self) then
  1009. begin
  1010. hp := genaddsstringcharoptnode(self);
  1011. firstpass(hp);
  1012. pass_1 := hp;
  1013. exit;
  1014. end
  1015. else
  1016. begin
  1017. { Fix right to be shortstring }
  1018. if is_char(right.resulttype.def) then
  1019. begin
  1020. inserttypeconv(right,cshortstringtype);
  1021. firstpass(right);
  1022. end;
  1023. end;
  1024. if canbeaddsstringcsstringoptnode(self) then
  1025. begin
  1026. hp := genaddsstringcsstringoptnode(self);
  1027. firstpass(hp);
  1028. pass_1 := hp;
  1029. exit;
  1030. end;
  1031. { this is only for add, the comparisaion is handled later }
  1032. location.loc:=LOC_MEM;
  1033. end;
  1034. { here we call STRCONCAT or STRCMP or STRCOPY }
  1035. procinfo^.flags:=procinfo^.flags or pi_do_call;
  1036. if location.loc=LOC_MEM then
  1037. calcregisters(self,0,0,0)
  1038. else
  1039. calcregisters(self,1,0,0);
  1040. end
  1041. { is one a real float ? }
  1042. else if (rd^.deftype=floatdef) or (ld^.deftype=floatdef) then
  1043. begin
  1044. calcregisters(self,0,1,0);
  1045. location.loc:=LOC_FPU;
  1046. end
  1047. { pointer comperation and subtraction }
  1048. else if (ld^.deftype=pointerdef) then
  1049. begin
  1050. location.loc:=LOC_REGISTER;
  1051. calcregisters(self,1,0,0);
  1052. end
  1053. else if is_class_or_interface(ld) then
  1054. begin
  1055. location.loc:=LOC_REGISTER;
  1056. calcregisters(self,1,0,0);
  1057. end
  1058. else if (ld^.deftype=classrefdef) then
  1059. begin
  1060. location.loc:=LOC_REGISTER;
  1061. calcregisters(self,1,0,0);
  1062. end
  1063. { support procvar=nil,procvar<>nil }
  1064. else if ((ld^.deftype=procvardef) and (rt=niln)) or
  1065. ((rd^.deftype=procvardef) and (lt=niln)) then
  1066. begin
  1067. calcregisters(self,1,0,0);
  1068. location.loc:=LOC_REGISTER;
  1069. end
  1070. {$ifdef SUPPORT_MMX}
  1071. { mmx support, this must be before the zero based array
  1072. check }
  1073. else if (cs_mmx in aktlocalswitches) and is_mmx_able_array(ld) and
  1074. is_mmx_able_array(rd) then
  1075. begin
  1076. location.loc:=LOC_MMXREGISTER;
  1077. calcregisters(self,0,0,1);
  1078. end
  1079. {$endif SUPPORT_MMX}
  1080. else if (rd^.deftype=pointerdef) or (ld^.deftype=pointerdef) then
  1081. begin
  1082. location.loc:=LOC_REGISTER;
  1083. calcregisters(self,1,0,0);
  1084. end
  1085. else if (rd^.deftype=procvardef) and (ld^.deftype=procvardef) and is_equal(rd,ld) then
  1086. begin
  1087. calcregisters(self,1,0,0);
  1088. location.loc:=LOC_REGISTER;
  1089. end
  1090. else if (ld^.deftype=enumdef) then
  1091. begin
  1092. calcregisters(self,1,0,0);
  1093. end
  1094. {$ifdef SUPPORT_MMX}
  1095. else if (cs_mmx in aktlocalswitches) and
  1096. is_mmx_able_array(ld) and
  1097. is_mmx_able_array(rd) then
  1098. begin
  1099. location.loc:=LOC_MMXREGISTER;
  1100. calcregisters(self,0,0,1);
  1101. end
  1102. {$endif SUPPORT_MMX}
  1103. { the general solution is to convert to 32 bit int }
  1104. else
  1105. begin
  1106. calcregisters(self,1,0,0);
  1107. location.loc:=LOC_REGISTER;
  1108. end;
  1109. case nodetype of
  1110. ltn,lten,gtn,gten,equaln,unequaln:
  1111. begin
  1112. if is_64bitint(left.resulttype.def) then
  1113. location.loc:=LOC_JUMP
  1114. else
  1115. location.loc:=LOC_FLAGS;
  1116. end;
  1117. xorn:
  1118. begin
  1119. location.loc:=LOC_REGISTER;
  1120. end;
  1121. end;
  1122. end;
  1123. begin
  1124. caddnode:=taddnode;
  1125. end.
  1126. {
  1127. $Log$
  1128. Revision 1.24 2001-04-04 22:42:39 peter
  1129. * move constant folding into det_resulttype
  1130. Revision 1.23 2001/04/02 21:20:30 peter
  1131. * resulttype rewrite
  1132. Revision 1.22 2001/02/04 11:12:17 jonas
  1133. * fixed web bug 1377 & const pointer arithmtic
  1134. Revision 1.21 2001/01/14 22:13:13 peter
  1135. * constant calculation fixed. The type of the new constant is now
  1136. defined after the calculation is done. This should remove a lot
  1137. of wrong warnings (and errors with -Cr).
  1138. Revision 1.20 2000/12/31 11:14:10 jonas
  1139. + implemented/fixed docompare() mathods for all nodes (not tested)
  1140. + nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
  1141. and constant strings/chars together
  1142. * n386add.pas: don't copy temp strings (of size 256) to another temp string
  1143. when adding
  1144. Revision 1.19 2000/12/16 15:55:32 jonas
  1145. + warning when there is a chance to get a range check error because of
  1146. automatic type conversion to u32bit
  1147. * arithmetic operations with a cardinal and a signed operand are carried
  1148. out in 64bit when range checking is on ("merged" from fixes branch)
  1149. Revision 1.18 2000/11/29 00:30:31 florian
  1150. * unused units removed from uses clause
  1151. * some changes for widestrings
  1152. Revision 1.17 2000/11/20 15:30:42 jonas
  1153. * changed types of values used for constant expression evaluation to
  1154. tconstexprint
  1155. Revision 1.16 2000/11/13 11:30:55 florian
  1156. * some bugs with interfaces and NIL fixed
  1157. Revision 1.15 2000/11/04 14:25:20 florian
  1158. + merged Attila's changes for interfaces, not tested yet
  1159. Revision 1.14 2000/10/31 22:02:47 peter
  1160. * symtable splitted, no real code changes
  1161. Revision 1.13 2000/10/14 10:14:50 peter
  1162. * moehrendorf oct 2000 rewrite
  1163. Revision 1.12 2000/10/01 19:48:23 peter
  1164. * lot of compile updates for cg11
  1165. Revision 1.11 2000/09/30 16:08:45 peter
  1166. * more cg11 updates
  1167. Revision 1.10 2000/09/28 19:49:52 florian
  1168. *** empty log message ***
  1169. Revision 1.9 2000/09/27 21:33:22 florian
  1170. * finally nadd.pas compiles
  1171. Revision 1.8 2000/09/27 20:25:44 florian
  1172. * more stuff fixed
  1173. Revision 1.7 2000/09/27 18:14:31 florian
  1174. * fixed a lot of syntax errors in the n*.pas stuff
  1175. Revision 1.6 2000/09/24 15:06:19 peter
  1176. * use defines.inc
  1177. Revision 1.5 2000/09/22 22:42:52 florian
  1178. * more fixes
  1179. Revision 1.4 2000/09/21 12:22:42 jonas
  1180. * put piece of code between -dnewoptimizations2 since it wasn't
  1181. necessary otherwise
  1182. + support for full boolean evaluation (from tcadd)
  1183. Revision 1.3 2000/09/20 21:50:59 florian
  1184. * updated
  1185. Revision 1.2 2000/08/29 08:24:45 jonas
  1186. * some modifications to -dcardinalmulfix code
  1187. Revision 1.1 2000/08/26 12:24:20 florian
  1188. * initial release
  1189. }