tcadd.pas 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Type checking and register allocation for add node
  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 tcadd;
  19. interface
  20. uses
  21. tree;
  22. procedure firstadd(var p : ptree);
  23. implementation
  24. uses
  25. globtype,systems,tokens,
  26. cobjects,verbose,globals,
  27. symconst,symtable,aasm,types,
  28. hcodegen,htypechk,pass_1,
  29. cpubase,tccnv
  30. ;
  31. {*****************************************************************************
  32. FirstAdd
  33. *****************************************************************************}
  34. procedure firstadd(var p : ptree);
  35. procedure make_bool_equal_size(var p:ptree);
  36. begin
  37. if porddef(p^.left^.resulttype)^.typ>porddef(p^.right^.resulttype)^.typ then
  38. begin
  39. p^.right:=gentypeconvnode(p^.right,porddef(p^.left^.resulttype));
  40. p^.right^.convtyp:=tc_bool_2_int;
  41. p^.right^.explizit:=true;
  42. firstpass(p^.right);
  43. end
  44. else
  45. if porddef(p^.left^.resulttype)^.typ<porddef(p^.right^.resulttype)^.typ then
  46. begin
  47. p^.left:=gentypeconvnode(p^.left,porddef(p^.right^.resulttype));
  48. p^.left^.convtyp:=tc_bool_2_int;
  49. p^.left^.explizit:=true;
  50. firstpass(p^.left);
  51. end;
  52. end;
  53. var
  54. t,hp : ptree;
  55. ot,
  56. lt,rt : ttreetyp;
  57. rv,lv : longint;
  58. rvd,lvd : bestreal;
  59. resdef,
  60. rd,ld : pdef;
  61. tempdef : pdef;
  62. concatstrings : boolean;
  63. { to evalute const sets }
  64. resultset : pconstset;
  65. i : longint;
  66. b : boolean;
  67. convdone : boolean;
  68. s1,s2 : pchar;
  69. l1,l2 : longint;
  70. { this totally forgets to set the pi_do_call flag !! }
  71. label
  72. no_overload;
  73. begin
  74. { first do the two subtrees }
  75. firstpass(p^.left);
  76. firstpass(p^.right);
  77. lt:=p^.left^.treetype;
  78. rt:=p^.right^.treetype;
  79. rd:=p^.right^.resulttype;
  80. ld:=p^.left^.resulttype;
  81. convdone:=false;
  82. if codegenerror then
  83. exit;
  84. { overloaded operator ? }
  85. if (p^.treetype=starstarn) or
  86. (ld^.deftype=recorddef) or
  87. ((ld^.deftype=arraydef) and
  88. not((cs_mmx in aktlocalswitches) and
  89. is_mmx_able_array(ld)) and
  90. (not (rd^.deftype in [setdef,orddef])) and
  91. (not is_chararray(ld))
  92. ) or
  93. { <> and = are defined for classes }
  94. ((ld^.deftype=objectdef) and
  95. (not(pobjectdef(ld)^.is_class) or
  96. not(p^.treetype in [equaln,unequaln])
  97. )
  98. ) or
  99. (rd^.deftype=recorddef) or
  100. ((rd^.deftype=arraydef) and
  101. not((cs_mmx in aktlocalswitches) and
  102. is_mmx_able_array(rd)) and
  103. (not (ld^.deftype in [setdef,orddef])) and
  104. (not is_chararray(rd))
  105. ) or
  106. { <> and = are defined for classes }
  107. ((rd^.deftype=objectdef) and
  108. (not(pobjectdef(rd)^.is_class) or
  109. not(p^.treetype in [equaln,unequaln])
  110. )
  111. ) then
  112. begin
  113. {!!!!!!!!! handle paras }
  114. case p^.treetype of
  115. { the nil as symtable signs firstcalln that this is
  116. an overloaded operator }
  117. addn:
  118. t:=gencallnode(overloaded_operators[_plus],nil);
  119. subn:
  120. t:=gencallnode(overloaded_operators[_minus],nil);
  121. muln:
  122. t:=gencallnode(overloaded_operators[_star],nil);
  123. starstarn:
  124. t:=gencallnode(overloaded_operators[_starstar],nil);
  125. slashn:
  126. t:=gencallnode(overloaded_operators[_slash],nil);
  127. ltn:
  128. t:=gencallnode(overloaded_operators[tokens._lt],nil);
  129. gtn:
  130. t:=gencallnode(overloaded_operators[_gt],nil);
  131. lten:
  132. t:=gencallnode(overloaded_operators[_lte],nil);
  133. gten:
  134. t:=gencallnode(overloaded_operators[_gte],nil);
  135. equaln,unequaln :
  136. t:=gencallnode(overloaded_operators[_equal],nil);
  137. else goto no_overload;
  138. end;
  139. { we have to convert p^.left and p^.right into
  140. callparanodes }
  141. if t^.symtableprocentry=nil then
  142. begin
  143. CGMessage(parser_e_operator_not_overloaded);
  144. putnode(t);
  145. end
  146. else
  147. begin
  148. t^.left:=gencallparanode(p^.left,nil);
  149. t^.left:=gencallparanode(p^.right,t^.left);
  150. if p^.treetype=unequaln then
  151. t:=gensinglenode(notn,t);
  152. firstpass(t);
  153. putnode(p);
  154. p:=t;
  155. exit;
  156. end;
  157. end;
  158. no_overload:
  159. { compact consts }
  160. { convert int consts to real consts, if the }
  161. { other operand is a real const }
  162. if (rt=realconstn) and is_constintnode(p^.left) then
  163. begin
  164. t:=genrealconstnode(p^.left^.value,p^.right^.resulttype);
  165. disposetree(p^.left);
  166. p^.left:=t;
  167. lt:=realconstn;
  168. end;
  169. if (lt=realconstn) and is_constintnode(p^.right) then
  170. begin
  171. t:=genrealconstnode(p^.right^.value,p^.left^.resulttype);
  172. disposetree(p^.right);
  173. p^.right:=t;
  174. rt:=realconstn;
  175. end;
  176. { both are int constants, also allow operations on two equal enums
  177. in fpc mode (Needed for conversion of C code) }
  178. if ((lt=ordconstn) and (rt=ordconstn)) and
  179. ((is_constintnode(p^.left) and is_constintnode(p^.right)) or
  180. (is_constboolnode(p^.left) and is_constboolnode(p^.right) and
  181. (p^.treetype in [ltn,lten,gtn,gten,equaln,unequaln]))) then
  182. begin
  183. resdef:=s32bitdef;
  184. lv:=p^.left^.value;
  185. rv:=p^.right^.value;
  186. case p^.treetype of
  187. addn : t:=genordinalconstnode(lv+rv,resdef);
  188. subn : t:=genordinalconstnode(lv-rv,resdef);
  189. muln : t:=genordinalconstnode(lv*rv,resdef);
  190. xorn : t:=genordinalconstnode(lv xor rv,resdef);
  191. orn : t:=genordinalconstnode(lv or rv,resdef);
  192. andn : t:=genordinalconstnode(lv and rv,resdef);
  193. ltn : t:=genordinalconstnode(ord(lv<rv),booldef);
  194. lten : t:=genordinalconstnode(ord(lv<=rv),booldef);
  195. gtn : t:=genordinalconstnode(ord(lv>rv),booldef);
  196. gten : t:=genordinalconstnode(ord(lv>=rv),booldef);
  197. equaln : t:=genordinalconstnode(ord(lv=rv),booldef);
  198. unequaln : t:=genordinalconstnode(ord(lv<>rv),booldef);
  199. slashn : begin
  200. { int/int becomes a real }
  201. if int(rv)=0 then
  202. begin
  203. Message(parser_e_invalid_float_operation);
  204. t:=genrealconstnode(0,bestrealdef^);
  205. end
  206. else
  207. t:=genrealconstnode(int(lv)/int(rv),bestrealdef^);
  208. firstpass(t);
  209. end;
  210. else
  211. CGMessage(type_e_mismatch);
  212. end;
  213. disposetree(p);
  214. firstpass(t);
  215. p:=t;
  216. exit;
  217. end;
  218. { both real constants ? }
  219. if (lt=realconstn) and (rt=realconstn) then
  220. begin
  221. lvd:=p^.left^.value_real;
  222. rvd:=p^.right^.value_real;
  223. case p^.treetype of
  224. addn : t:=genrealconstnode(lvd+rvd,bestrealdef^);
  225. subn : t:=genrealconstnode(lvd-rvd,bestrealdef^);
  226. muln : t:=genrealconstnode(lvd*rvd,bestrealdef^);
  227. caretn : t:=genrealconstnode(exp(ln(lvd)*rvd),bestrealdef^);
  228. slashn : begin
  229. if rvd=0 then
  230. begin
  231. Message(parser_e_invalid_float_operation);
  232. t:=genrealconstnode(0,bestrealdef^);
  233. end
  234. else
  235. t:=genrealconstnode(lvd/rvd,bestrealdef^);
  236. end;
  237. ltn : t:=genordinalconstnode(ord(lvd<rvd),booldef);
  238. lten : t:=genordinalconstnode(ord(lvd<=rvd),booldef);
  239. gtn : t:=genordinalconstnode(ord(lvd>rvd),booldef);
  240. gten : t:=genordinalconstnode(ord(lvd>=rvd),booldef);
  241. equaln : t:=genordinalconstnode(ord(lvd=rvd),booldef);
  242. unequaln : t:=genordinalconstnode(ord(lvd<>rvd),booldef);
  243. else
  244. CGMessage(type_e_mismatch);
  245. end;
  246. disposetree(p);
  247. p:=t;
  248. firstpass(p);
  249. exit;
  250. end;
  251. { concating strings ? }
  252. concatstrings:=false;
  253. s1:=nil;
  254. s2:=nil;
  255. if (lt=ordconstn) and (rt=ordconstn) and
  256. is_char(ld) and is_char(rd) then
  257. begin
  258. s1:=strpnew(char(byte(p^.left^.value)));
  259. s2:=strpnew(char(byte(p^.right^.value)));
  260. l1:=1;
  261. l2:=1;
  262. concatstrings:=true;
  263. end
  264. else
  265. if (lt=stringconstn) and (rt=ordconstn) and is_char(rd) then
  266. begin
  267. s1:=getpcharcopy(p^.left);
  268. l1:=p^.left^.length;
  269. s2:=strpnew(char(byte(p^.right^.value)));
  270. l2:=1;
  271. concatstrings:=true;
  272. end
  273. else
  274. if (lt=ordconstn) and (rt=stringconstn) and is_char(ld) then
  275. begin
  276. s1:=strpnew(char(byte(p^.left^.value)));
  277. l1:=1;
  278. s2:=getpcharcopy(p^.right);
  279. l2:=p^.right^.length;
  280. concatstrings:=true;
  281. end
  282. else if (lt=stringconstn) and (rt=stringconstn) then
  283. begin
  284. s1:=getpcharcopy(p^.left);
  285. l1:=p^.left^.length;
  286. s2:=getpcharcopy(p^.right);
  287. l2:=p^.right^.length;
  288. concatstrings:=true;
  289. end;
  290. { I will need to translate all this to ansistrings !!! }
  291. if concatstrings then
  292. begin
  293. case p^.treetype of
  294. addn :
  295. t:=genpcharconstnode(concatansistrings(s1,s2,l1,l2),l1+l2);
  296. ltn :
  297. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)<0),booldef);
  298. lten :
  299. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)<=0),booldef);
  300. gtn :
  301. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)>0),booldef);
  302. gten :
  303. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)>=0),booldef);
  304. equaln :
  305. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)=0),booldef);
  306. unequaln :
  307. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)<>0),booldef);
  308. end;
  309. ansistringdispose(s1,l1);
  310. ansistringdispose(s2,l2);
  311. disposetree(p);
  312. firstpass(t);
  313. p:=t;
  314. exit;
  315. end;
  316. { if both are orddefs then check sub types }
  317. if (ld^.deftype=orddef) and (rd^.deftype=orddef) then
  318. begin
  319. { 2 booleans ? }
  320. if is_boolean(ld) and is_boolean(rd) then
  321. begin
  322. case p^.treetype of
  323. andn,
  324. orn:
  325. begin
  326. calcregisters(p,0,0,0);
  327. make_bool_equal_size(p);
  328. p^.location.loc:=LOC_JUMP;
  329. end;
  330. xorn,ltn,lten,gtn,gten :
  331. begin
  332. make_bool_equal_size(p);
  333. if (p^.left^.location.loc in [LOC_JUMP,LOC_FLAGS]) and
  334. (p^.left^.location.loc in [LOC_JUMP,LOC_FLAGS]) then
  335. calcregisters(p,2,0,0)
  336. else
  337. calcregisters(p,1,0,0);
  338. end;
  339. unequaln,
  340. equaln:
  341. begin
  342. make_bool_equal_size(p);
  343. { Remove any compares with constants }
  344. if (p^.left^.treetype=ordconstn) then
  345. begin
  346. hp:=p^.right;
  347. b:=(p^.left^.value<>0);
  348. ot:=p^.treetype;
  349. disposetree(p^.left);
  350. putnode(p);
  351. p:=hp;
  352. if (not(b) and (ot=equaln)) or
  353. (b and (ot=unequaln)) then
  354. begin
  355. p:=gensinglenode(notn,p);
  356. firstpass(p);
  357. end;
  358. exit;
  359. end;
  360. if (p^.right^.treetype=ordconstn) then
  361. begin
  362. hp:=p^.left;
  363. b:=(p^.right^.value<>0);
  364. ot:=p^.treetype;
  365. disposetree(p^.right);
  366. putnode(p);
  367. p:=hp;
  368. if (not(b) and (ot=equaln)) or
  369. (b and (ot=unequaln)) then
  370. begin
  371. p:=gensinglenode(notn,p);
  372. firstpass(p);
  373. end;
  374. exit;
  375. end;
  376. if (p^.left^.location.loc in [LOC_JUMP,LOC_FLAGS]) and
  377. (p^.left^.location.loc in [LOC_JUMP,LOC_FLAGS]) then
  378. calcregisters(p,2,0,0)
  379. else
  380. calcregisters(p,1,0,0);
  381. end;
  382. else
  383. CGMessage(type_e_mismatch);
  384. end;
  385. { these one can't be in flags! }
  386. if p^.treetype in [xorn,unequaln,equaln] then
  387. begin
  388. if p^.left^.location.loc=LOC_FLAGS then
  389. begin
  390. p^.left:=gentypeconvnode(p^.left,porddef(p^.left^.resulttype));
  391. p^.left^.convtyp:=tc_bool_2_int;
  392. p^.left^.explizit:=true;
  393. firstpass(p^.left);
  394. end;
  395. if p^.right^.location.loc=LOC_FLAGS then
  396. begin
  397. p^.right:=gentypeconvnode(p^.right,porddef(p^.right^.resulttype));
  398. p^.right^.convtyp:=tc_bool_2_int;
  399. p^.right^.explizit:=true;
  400. firstpass(p^.right);
  401. end;
  402. { readjust registers }
  403. calcregisters(p,1,0,0);
  404. end;
  405. convdone:=true;
  406. end
  407. else
  408. { Both are chars? only convert to shortstrings for addn }
  409. if is_char(rd) and is_char(ld) then
  410. begin
  411. if p^.treetype=addn then
  412. begin
  413. p^.left:=gentypeconvnode(p^.left,cshortstringdef);
  414. p^.right:=gentypeconvnode(p^.right,cshortstringdef);
  415. firstpass(p^.left);
  416. firstpass(p^.right);
  417. { here we call STRCOPY }
  418. procinfo.flags:=procinfo.flags or pi_do_call;
  419. calcregisters(p,0,0,0);
  420. p^.location.loc:=LOC_MEM;
  421. end
  422. else
  423. calcregisters(p,1,0,0);
  424. convdone:=true;
  425. end
  426. { is there a 64 bit type ? }
  427. else if (porddef(rd)^.typ=s64bit) or (porddef(ld)^.typ=s64bit) then
  428. begin
  429. if (porddef(ld)^.typ<>s64bit) then
  430. begin
  431. p^.left:=gentypeconvnode(p^.left,cs64bitdef);
  432. firstpass(p^.left);
  433. end;
  434. if (porddef(rd)^.typ<>s64bit) then
  435. begin
  436. p^.right:=gentypeconvnode(p^.right,cs64bitdef);
  437. firstpass(p^.right);
  438. end;
  439. calcregisters(p,2,0,0);
  440. convdone:=true;
  441. end
  442. else if (porddef(rd)^.typ=u64bit) or (porddef(ld)^.typ=u64bit) then
  443. begin
  444. if (porddef(ld)^.typ<>u64bit) then
  445. begin
  446. p^.left:=gentypeconvnode(p^.left,cu64bitdef);
  447. firstpass(p^.left);
  448. end;
  449. if (porddef(rd)^.typ<>u64bit) then
  450. begin
  451. p^.right:=gentypeconvnode(p^.right,cu64bitdef);
  452. firstpass(p^.right);
  453. end;
  454. calcregisters(p,2,0,0);
  455. convdone:=true;
  456. end
  457. else
  458. { is there a cardinal? }
  459. if (porddef(rd)^.typ=u32bit) or (porddef(ld)^.typ=u32bit) then
  460. begin
  461. { convert constants to u32bit }
  462. if (porddef(ld)^.typ<>u32bit) then
  463. begin
  464. { s32bit will be used for when the other is also s32bit }
  465. if (porddef(rd)^.typ=s32bit) and (lt<>ordconstn) then
  466. p^.left:=gentypeconvnode(p^.left,s32bitdef)
  467. else
  468. p^.left:=gentypeconvnode(p^.left,u32bitdef);
  469. firstpass(p^.left);
  470. end;
  471. if (porddef(rd)^.typ<>u32bit) then
  472. begin
  473. { s32bit will be used for when the other is also s32bit }
  474. if (porddef(ld)^.typ=s32bit) and (rt<>ordconstn) then
  475. p^.right:=gentypeconvnode(p^.right,s32bitdef)
  476. else
  477. p^.right:=gentypeconvnode(p^.right,u32bitdef);
  478. firstpass(p^.right);
  479. end;
  480. calcregisters(p,1,0,0);
  481. { for unsigned mul we need an extra register }
  482. { p^.registers32:=p^.left^.registers32+p^.right^.registers32; }
  483. if p^.treetype=muln then
  484. inc(p^.registers32);
  485. convdone:=true;
  486. end;
  487. end
  488. else
  489. { left side a setdef, must be before string processing,
  490. else array constructor can be seen as array of char (PFV) }
  491. if (ld^.deftype=setdef) or is_array_constructor(ld) then
  492. begin
  493. { convert array constructors to sets }
  494. if is_array_constructor(ld) then
  495. begin
  496. arrayconstructor_to_set(p^.left);
  497. ld:=p^.left^.resulttype;
  498. end;
  499. if is_array_constructor(rd) then
  500. begin
  501. arrayconstructor_to_set(p^.right);
  502. rd:=p^.right^.resulttype;
  503. end;
  504. { trying to add a set element? }
  505. if (p^.treetype=addn) and (rd^.deftype<>setdef) then
  506. begin
  507. if (rt=setelementn) then
  508. begin
  509. if not(is_equal(psetdef(ld)^.setof,rd)) then
  510. CGMessage(type_e_set_element_are_not_comp);
  511. end
  512. else
  513. CGMessage(type_e_mismatch)
  514. end
  515. else
  516. begin
  517. if not(p^.treetype in [addn,subn,symdifn,muln,equaln,unequaln
  518. {$IfNDef NoSetInclusion}
  519. ,lten,gten
  520. {$EndIf NoSetInclusion}
  521. ]) then
  522. CGMessage(type_e_set_operation_unknown);
  523. { right def must be a also be set }
  524. if (rd^.deftype<>setdef) or not(is_equal(rd,ld)) then
  525. CGMessage(type_e_set_element_are_not_comp);
  526. end;
  527. { ranges require normsets }
  528. if (psetdef(ld)^.settype=smallset) and
  529. (rt=setelementn) and
  530. assigned(p^.right^.right) then
  531. begin
  532. { generate a temporary normset def }
  533. tempdef:=new(psetdef,init(psetdef(ld)^.setof,255));
  534. p^.left:=gentypeconvnode(p^.left,tempdef);
  535. firstpass(p^.left);
  536. dispose(tempdef,done);
  537. ld:=p^.left^.resulttype;
  538. end;
  539. { if the destination is not a smallset then insert a typeconv
  540. which loads a smallset into a normal set }
  541. if (psetdef(ld)^.settype<>smallset) and
  542. (psetdef(rd)^.settype=smallset) then
  543. begin
  544. if (p^.right^.treetype=setconstn) then
  545. begin
  546. t:=gensetconstnode(p^.right^.value_set,psetdef(p^.left^.resulttype));
  547. t^.left:=p^.right^.left;
  548. putnode(p^.right);
  549. p^.right:=t;
  550. end
  551. else
  552. p^.right:=gentypeconvnode(p^.right,psetdef(p^.left^.resulttype));
  553. firstpass(p^.right);
  554. end;
  555. { do constant evaluation }
  556. if (p^.right^.treetype=setconstn) and
  557. not assigned(p^.right^.left) and
  558. (p^.left^.treetype=setconstn) and
  559. not assigned(p^.left^.left) then
  560. begin
  561. new(resultset);
  562. case p^.treetype of
  563. addn : begin
  564. for i:=0 to 31 do
  565. resultset^[i]:=
  566. p^.right^.value_set^[i] or p^.left^.value_set^[i];
  567. t:=gensetconstnode(resultset,psetdef(ld));
  568. end;
  569. muln : begin
  570. for i:=0 to 31 do
  571. resultset^[i]:=
  572. p^.right^.value_set^[i] and p^.left^.value_set^[i];
  573. t:=gensetconstnode(resultset,psetdef(ld));
  574. end;
  575. subn : begin
  576. for i:=0 to 31 do
  577. resultset^[i]:=
  578. p^.left^.value_set^[i] and not(p^.right^.value_set^[i]);
  579. t:=gensetconstnode(resultset,psetdef(ld));
  580. end;
  581. symdifn : begin
  582. for i:=0 to 31 do
  583. resultset^[i]:=
  584. p^.left^.value_set^[i] xor p^.right^.value_set^[i];
  585. t:=gensetconstnode(resultset,psetdef(ld));
  586. end;
  587. unequaln : begin
  588. b:=true;
  589. for i:=0 to 31 do
  590. if p^.right^.value_set^[i]=p^.left^.value_set^[i] then
  591. begin
  592. b:=false;
  593. break;
  594. end;
  595. t:=genordinalconstnode(ord(b),booldef);
  596. end;
  597. equaln : begin
  598. b:=true;
  599. for i:=0 to 31 do
  600. if p^.right^.value_set^[i]<>p^.left^.value_set^[i] then
  601. begin
  602. b:=false;
  603. break;
  604. end;
  605. t:=genordinalconstnode(ord(b),booldef);
  606. end;
  607. {$IfNDef NoSetInclusion}
  608. lten : Begin
  609. b := true;
  610. For i := 0 to 31 Do
  611. If (p^.right^.value_set^[i] And p^.left^.value_set^[i]) <>
  612. p^.left^.value_set^[i] Then
  613. Begin
  614. b := false;
  615. Break
  616. End;
  617. t := genordinalconstnode(ord(b),booldef);
  618. End;
  619. gten : Begin
  620. b := true;
  621. For i := 0 to 31 Do
  622. If (p^.left^.value_set^[i] And p^.right^.value_set^[i]) <>
  623. p^.right^.value_set^[i] Then
  624. Begin
  625. b := false;
  626. Break
  627. End;
  628. t := genordinalconstnode(ord(b),booldef);
  629. End;
  630. {$EndIf NoSetInclusion}
  631. end;
  632. dispose(resultset);
  633. disposetree(p);
  634. p:=t;
  635. firstpass(p);
  636. exit;
  637. end
  638. else
  639. if psetdef(ld)^.settype=smallset then
  640. begin
  641. calcregisters(p,1,0,0);
  642. { are we adding set elements ? }
  643. if p^.right^.treetype=setelementn then
  644. begin
  645. { we need at least two registers PM }
  646. if p^.registers32<2 then
  647. p^.registers32:=2;
  648. end;
  649. p^.location.loc:=LOC_REGISTER;
  650. end
  651. else
  652. begin
  653. calcregisters(p,0,0,0);
  654. { here we call SET... }
  655. procinfo.flags:=procinfo.flags or pi_do_call;
  656. p^.location.loc:=LOC_MEM;
  657. end;
  658. convdone:=true;
  659. end
  660. else
  661. { is one of the operands a string?,
  662. chararrays are also handled as strings (after conversion) }
  663. if (rd^.deftype=stringdef) or (ld^.deftype=stringdef) or
  664. (is_chararray(rd) and is_chararray(ld)) then
  665. begin
  666. if is_widestring(rd) or is_widestring(ld) then
  667. begin
  668. if not(is_widestring(rd)) then
  669. p^.right:=gentypeconvnode(p^.right,cwidestringdef);
  670. if not(is_widestring(ld)) then
  671. p^.left:=gentypeconvnode(p^.left,cwidestringdef);
  672. p^.resulttype:=cwidestringdef;
  673. { this is only for add, the comparisaion is handled later }
  674. p^.location.loc:=LOC_REGISTER;
  675. end
  676. else if is_ansistring(rd) or is_ansistring(ld) then
  677. begin
  678. if not(is_ansistring(rd)) then
  679. p^.right:=gentypeconvnode(p^.right,cansistringdef);
  680. if not(is_ansistring(ld)) then
  681. p^.left:=gentypeconvnode(p^.left,cansistringdef);
  682. p^.resulttype:=cansistringdef;
  683. { this is only for add, the comparisaion is handled later }
  684. p^.location.loc:=LOC_REGISTER;
  685. end
  686. else if is_longstring(rd) or is_longstring(ld) then
  687. begin
  688. if not(is_longstring(rd)) then
  689. p^.right:=gentypeconvnode(p^.right,clongstringdef);
  690. if not(is_longstring(ld)) then
  691. p^.left:=gentypeconvnode(p^.left,clongstringdef);
  692. p^.resulttype:=clongstringdef;
  693. { this is only for add, the comparisaion is handled later }
  694. p^.location.loc:=LOC_MEM;
  695. end
  696. else
  697. begin
  698. if not(is_shortstring(rd)) then
  699. p^.right:=gentypeconvnode(p^.right,cshortstringdef);
  700. if not(is_shortstring(ld)) then
  701. p^.left:=gentypeconvnode(p^.left,cshortstringdef);
  702. p^.resulttype:=cshortstringdef;
  703. { this is only for add, the comparisaion is handled later }
  704. p^.location.loc:=LOC_MEM;
  705. end;
  706. { only if there is a type cast we need to do again }
  707. { the first pass }
  708. if p^.left^.treetype=typeconvn then
  709. firstpass(p^.left);
  710. if p^.right^.treetype=typeconvn then
  711. firstpass(p^.right);
  712. { here we call STRCONCAT or STRCMP or STRCOPY }
  713. procinfo.flags:=procinfo.flags or pi_do_call;
  714. if p^.location.loc=LOC_MEM then
  715. calcregisters(p,0,0,0)
  716. else
  717. calcregisters(p,1,0,0);
  718. convdone:=true;
  719. end
  720. else
  721. { is one a real float ? }
  722. if (rd^.deftype=floatdef) or (ld^.deftype=floatdef) then
  723. begin
  724. { if one is a fixed, then convert to f32bit }
  725. if ((rd^.deftype=floatdef) and (pfloatdef(rd)^.typ=f32bit)) or
  726. ((ld^.deftype=floatdef) and (pfloatdef(ld)^.typ=f32bit)) then
  727. begin
  728. if not is_integer(rd) or (p^.treetype<>muln) then
  729. p^.right:=gentypeconvnode(p^.right,s32fixeddef);
  730. if not is_integer(ld) or (p^.treetype<>muln) then
  731. p^.left:=gentypeconvnode(p^.left,s32fixeddef);
  732. firstpass(p^.left);
  733. firstpass(p^.right);
  734. calcregisters(p,1,0,0);
  735. p^.location.loc:=LOC_REGISTER;
  736. end
  737. else
  738. { convert both to bestreal }
  739. begin
  740. p^.right:=gentypeconvnode(p^.right,bestrealdef^);
  741. p^.left:=gentypeconvnode(p^.left,bestrealdef^);
  742. firstpass(p^.left);
  743. firstpass(p^.right);
  744. calcregisters(p,1,1,0);
  745. p^.location.loc:=LOC_FPU;
  746. end;
  747. convdone:=true;
  748. end
  749. else
  750. { pointer comperation and subtraction }
  751. if (rd^.deftype=pointerdef) and (ld^.deftype=pointerdef) then
  752. begin
  753. p^.location.loc:=LOC_REGISTER;
  754. { p^.right:=gentypeconvnode(p^.right,ld); }
  755. { firstpass(p^.right); }
  756. calcregisters(p,1,0,0);
  757. case p^.treetype of
  758. equaln,unequaln :
  759. begin
  760. if is_equal(p^.right^.resulttype,voidpointerdef) then
  761. begin
  762. p^.right:=gentypeconvnode(p^.right,ld);
  763. firstpass(p^.right);
  764. end
  765. else if is_equal(p^.left^.resulttype,voidpointerdef) then
  766. begin
  767. p^.left:=gentypeconvnode(p^.left,rd);
  768. firstpass(p^.left);
  769. end
  770. else if not(is_equal(ld,rd)) then
  771. CGMessage(type_e_mismatch);
  772. end;
  773. ltn,lten,gtn,gten:
  774. begin
  775. if is_equal(p^.right^.resulttype,voidpointerdef) then
  776. begin
  777. p^.right:=gentypeconvnode(p^.right,ld);
  778. firstpass(p^.right);
  779. end
  780. else if is_equal(p^.left^.resulttype,voidpointerdef) then
  781. begin
  782. p^.left:=gentypeconvnode(p^.left,rd);
  783. firstpass(p^.left);
  784. end
  785. else if not(is_equal(ld,rd)) then
  786. CGMessage(type_e_mismatch);
  787. if not(cs_extsyntax in aktmoduleswitches) then
  788. CGMessage(type_e_mismatch);
  789. end;
  790. subn:
  791. begin
  792. if not(is_equal(ld,rd)) then
  793. CGMessage(type_e_mismatch);
  794. if not(cs_extsyntax in aktmoduleswitches) then
  795. CGMessage(type_e_mismatch);
  796. p^.resulttype:=s32bitdef;
  797. exit;
  798. end;
  799. else CGMessage(type_e_mismatch);
  800. end;
  801. convdone:=true;
  802. end
  803. else
  804. if (rd^.deftype=objectdef) and (ld^.deftype=objectdef) and
  805. pobjectdef(rd)^.is_class and pobjectdef(ld)^.is_class then
  806. begin
  807. p^.location.loc:=LOC_REGISTER;
  808. if pobjectdef(rd)^.is_related(pobjectdef(ld)) then
  809. p^.right:=gentypeconvnode(p^.right,ld)
  810. else
  811. p^.left:=gentypeconvnode(p^.left,rd);
  812. firstpass(p^.right);
  813. firstpass(p^.left);
  814. calcregisters(p,1,0,0);
  815. case p^.treetype of
  816. equaln,unequaln : ;
  817. else CGMessage(type_e_mismatch);
  818. end;
  819. convdone:=true;
  820. end
  821. else
  822. if (rd^.deftype=classrefdef) and (ld^.deftype=classrefdef) then
  823. begin
  824. p^.location.loc:=LOC_REGISTER;
  825. if pobjectdef(pclassrefdef(rd)^.definition)^.is_related(pobjectdef(
  826. pclassrefdef(ld)^.definition)) then
  827. p^.right:=gentypeconvnode(p^.right,ld)
  828. else
  829. p^.left:=gentypeconvnode(p^.left,rd);
  830. firstpass(p^.right);
  831. firstpass(p^.left);
  832. calcregisters(p,1,0,0);
  833. case p^.treetype of
  834. equaln,unequaln : ;
  835. else CGMessage(type_e_mismatch);
  836. end;
  837. convdone:=true;
  838. end
  839. else
  840. { allows comperasion with nil pointer }
  841. if (rd^.deftype=objectdef) and
  842. pobjectdef(rd)^.is_class then
  843. begin
  844. p^.location.loc:=LOC_REGISTER;
  845. p^.left:=gentypeconvnode(p^.left,rd);
  846. firstpass(p^.left);
  847. calcregisters(p,1,0,0);
  848. case p^.treetype of
  849. equaln,unequaln : ;
  850. else CGMessage(type_e_mismatch);
  851. end;
  852. convdone:=true;
  853. end
  854. else
  855. if (ld^.deftype=objectdef) and
  856. pobjectdef(ld)^.is_class then
  857. begin
  858. p^.location.loc:=LOC_REGISTER;
  859. p^.right:=gentypeconvnode(p^.right,ld);
  860. firstpass(p^.right);
  861. calcregisters(p,1,0,0);
  862. case p^.treetype of
  863. equaln,unequaln : ;
  864. else CGMessage(type_e_mismatch);
  865. end;
  866. convdone:=true;
  867. end
  868. else
  869. if (rd^.deftype=classrefdef) then
  870. begin
  871. p^.left:=gentypeconvnode(p^.left,rd);
  872. firstpass(p^.left);
  873. calcregisters(p,1,0,0);
  874. case p^.treetype of
  875. equaln,unequaln : ;
  876. else CGMessage(type_e_mismatch);
  877. end;
  878. convdone:=true;
  879. end
  880. else
  881. if (ld^.deftype=classrefdef) then
  882. begin
  883. p^.right:=gentypeconvnode(p^.right,ld);
  884. firstpass(p^.right);
  885. calcregisters(p,1,0,0);
  886. case p^.treetype of
  887. equaln,unequaln : ;
  888. else
  889. CGMessage(type_e_mismatch);
  890. end;
  891. convdone:=true;
  892. end
  893. else
  894. { support procvar=nil,procvar<>nil }
  895. if ((ld^.deftype=procvardef) and (rt=niln)) or
  896. ((rd^.deftype=procvardef) and (lt=niln)) then
  897. begin
  898. calcregisters(p,1,0,0);
  899. p^.location.loc:=LOC_REGISTER;
  900. case p^.treetype of
  901. equaln,unequaln : ;
  902. else
  903. CGMessage(type_e_mismatch);
  904. end;
  905. convdone:=true;
  906. end
  907. else
  908. if (rd^.deftype=pointerdef) or
  909. is_zero_based_array(rd) then
  910. begin
  911. if is_zero_based_array(rd) then
  912. begin
  913. p^.resulttype:=new(ppointerdef,init(parraydef(rd)^.definition));
  914. p^.right:=gentypeconvnode(p^.right,p^.resulttype);
  915. firstpass(p^.right);
  916. end;
  917. p^.location.loc:=LOC_REGISTER;
  918. p^.left:=gentypeconvnode(p^.left,s32bitdef);
  919. firstpass(p^.left);
  920. calcregisters(p,1,0,0);
  921. if p^.treetype=addn then
  922. begin
  923. if not(cs_extsyntax in aktmoduleswitches) or
  924. (not(is_pchar(ld)) and not(m_add_pointer in aktmodeswitches)) then
  925. CGMessage(type_e_mismatch);
  926. { Dirty hack, to support multiple firstpasses (PFV) }
  927. if (p^.resulttype=nil) and
  928. (rd^.deftype=pointerdef) and
  929. (ppointerdef(rd)^.definition^.size>1) then
  930. begin
  931. p^.left:=gennode(muln,p^.left,genordinalconstnode(ppointerdef(rd)^.definition^.size,s32bitdef));
  932. firstpass(p^.left);
  933. end;
  934. end
  935. else
  936. CGMessage(type_e_mismatch);
  937. convdone:=true;
  938. end
  939. else
  940. if (ld^.deftype=pointerdef) or
  941. is_zero_based_array(ld) then
  942. begin
  943. if is_zero_based_array(ld) then
  944. begin
  945. p^.resulttype:=new(ppointerdef,init(parraydef(ld)^.definition));
  946. p^.left:=gentypeconvnode(p^.left,p^.resulttype);
  947. firstpass(p^.left);
  948. end;
  949. p^.location.loc:=LOC_REGISTER;
  950. p^.right:=gentypeconvnode(p^.right,s32bitdef);
  951. firstpass(p^.right);
  952. calcregisters(p,1,0,0);
  953. case p^.treetype of
  954. addn,subn : begin
  955. if not(cs_extsyntax in aktmoduleswitches) or
  956. (not(is_pchar(ld)) and not(m_add_pointer in aktmodeswitches)) then
  957. CGMessage(type_e_mismatch);
  958. { Dirty hack, to support multiple firstpasses (PFV) }
  959. if (p^.resulttype=nil) and
  960. (ld^.deftype=pointerdef) and
  961. (ppointerdef(ld)^.definition^.size>1) then
  962. begin
  963. p^.right:=gennode(muln,p^.right,
  964. genordinalconstnode(ppointerdef(ld)^.definition^.size,s32bitdef));
  965. firstpass(p^.right);
  966. end;
  967. end;
  968. else
  969. CGMessage(type_e_mismatch);
  970. end;
  971. convdone:=true;
  972. end
  973. else
  974. if (rd^.deftype=procvardef) and (ld^.deftype=procvardef) and is_equal(rd,ld) then
  975. begin
  976. calcregisters(p,1,0,0);
  977. p^.location.loc:=LOC_REGISTER;
  978. case p^.treetype of
  979. equaln,unequaln : ;
  980. else
  981. CGMessage(type_e_mismatch);
  982. end;
  983. convdone:=true;
  984. end
  985. else
  986. {$ifdef SUPPORT_MMX}
  987. if (cs_mmx in aktlocalswitches) and is_mmx_able_array(ld) and
  988. is_mmx_able_array(rd) and is_equal(ld,rd) then
  989. begin
  990. firstpass(p^.right);
  991. firstpass(p^.left);
  992. case p^.treetype of
  993. addn,subn,xorn,orn,andn:
  994. ;
  995. { mul is a little bit restricted }
  996. muln:
  997. if not(mmx_type(p^.left^.resulttype) in
  998. [mmxu16bit,mmxs16bit,mmxfixed16]) then
  999. CGMessage(type_e_mismatch);
  1000. else
  1001. CGMessage(type_e_mismatch);
  1002. end;
  1003. p^.location.loc:=LOC_MMXREGISTER;
  1004. calcregisters(p,0,0,1);
  1005. convdone:=true;
  1006. end
  1007. else
  1008. {$endif SUPPORT_MMX}
  1009. if (ld^.deftype=enumdef) and (rd^.deftype=enumdef) and (is_equal(ld,rd)) then
  1010. begin
  1011. calcregisters(p,1,0,0);
  1012. case p^.treetype of
  1013. equaln,unequaln,
  1014. ltn,lten,gtn,gten : ;
  1015. else CGMessage(type_e_mismatch);
  1016. end;
  1017. convdone:=true;
  1018. end;
  1019. { the general solution is to convert to 32 bit int }
  1020. if not convdone then
  1021. begin
  1022. { but an int/int gives real/real! }
  1023. if p^.treetype=slashn then
  1024. begin
  1025. CGMessage(type_h_use_div_for_int);
  1026. p^.right:=gentypeconvnode(p^.right,bestrealdef^);
  1027. p^.left:=gentypeconvnode(p^.left,bestrealdef^);
  1028. firstpass(p^.left);
  1029. firstpass(p^.right);
  1030. { maybe we need an integer register to save }
  1031. { a reference }
  1032. if ((p^.left^.location.loc<>LOC_FPU) or
  1033. (p^.right^.location.loc<>LOC_FPU)) and
  1034. (p^.left^.registers32=p^.right^.registers32) then
  1035. calcregisters(p,1,1,0)
  1036. else
  1037. calcregisters(p,0,1,0);
  1038. p^.location.loc:=LOC_FPU;
  1039. end
  1040. else
  1041. begin
  1042. p^.right:=gentypeconvnode(p^.right,s32bitdef);
  1043. p^.left:=gentypeconvnode(p^.left,s32bitdef);
  1044. firstpass(p^.left);
  1045. firstpass(p^.right);
  1046. calcregisters(p,1,0,0);
  1047. p^.location.loc:=LOC_REGISTER;
  1048. end;
  1049. end;
  1050. if codegenerror then
  1051. exit;
  1052. { determines result type for comparions }
  1053. { here the is a problem with multiple passes }
  1054. { example length(s)+1 gets internal 'longint' type first }
  1055. { if it is a arg it is converted to 'LONGINT' }
  1056. { but a second first pass will reset this to 'longint' }
  1057. case p^.treetype of
  1058. ltn,lten,gtn,gten,equaln,unequaln:
  1059. begin
  1060. if (not assigned(p^.resulttype)) or
  1061. (p^.resulttype^.deftype=stringdef) then
  1062. p^.resulttype:=booldef;
  1063. if is_64bitint(p^.left^.resulttype) then
  1064. p^.location.loc:=LOC_JUMP
  1065. else
  1066. p^.location.loc:=LOC_FLAGS;
  1067. end;
  1068. xorn:
  1069. begin
  1070. if not assigned(p^.resulttype) then
  1071. p^.resulttype:=p^.left^.resulttype;
  1072. p^.location.loc:=LOC_REGISTER;
  1073. end;
  1074. addn:
  1075. begin
  1076. if not assigned(p^.resulttype) then
  1077. begin
  1078. { for strings, return is always a 255 char string }
  1079. if is_shortstring(p^.left^.resulttype) then
  1080. p^.resulttype:=cshortstringdef
  1081. else
  1082. p^.resulttype:=p^.left^.resulttype;
  1083. end;
  1084. end;
  1085. else
  1086. p^.resulttype:=p^.left^.resulttype;
  1087. end;
  1088. end;
  1089. end.
  1090. {
  1091. $Log$
  1092. Revision 1.48 1999-09-15 20:35:45 florian
  1093. * small fix to operator overloading when in MMX mode
  1094. + the compiler uses now fldz and fld1 if possible
  1095. + some fixes to floating point registers
  1096. + some math. functions (arctan, ln, sin, cos, sqrt, sqr, pi) are now inlined
  1097. * .... ???
  1098. Revision 1.47 1999/09/13 16:28:05 peter
  1099. * typo in previous commit open_array -> chararray :(
  1100. Revision 1.46 1999/09/10 15:40:46 peter
  1101. * fixed array check for operators, becuase array can also be a set
  1102. Revision 1.45 1999/09/08 16:05:29 peter
  1103. * pointer add/sub is now as expected and the same results as inc/dec
  1104. Revision 1.44 1999/09/07 07:52:19 peter
  1105. * > < >= <= support for boolean
  1106. * boolean constants are now calculated like integer constants
  1107. Revision 1.43 1999/08/23 23:44:05 pierre
  1108. * setelementn registers32 corrected
  1109. Revision 1.42 1999/08/07 11:29:27 peter
  1110. * better fix for muln register allocation
  1111. Revision 1.41 1999/08/05 21:58:57 peter
  1112. * fixed register count ord*ord
  1113. Revision 1.40 1999/08/04 13:03:13 jonas
  1114. * all tokens now start with an underscore
  1115. * PowerPC compiles!!
  1116. Revision 1.39 1999/08/04 00:23:33 florian
  1117. * renamed i386asm and i386base to cpuasm and cpubase
  1118. Revision 1.38 1999/08/03 22:03:24 peter
  1119. * moved bitmask constants to sets
  1120. * some other type/const renamings
  1121. Revision 1.37 1999/07/16 10:04:37 peter
  1122. * merged
  1123. Revision 1.36 1999/06/17 15:32:48 pierre
  1124. * merged from 0-99-12 branch
  1125. Revision 1.34.2.3 1999/07/16 09:54:58 peter
  1126. * @procvar support in tp7 mode works again
  1127. Revision 1.34.2.2 1999/06/17 15:25:07 pierre
  1128. * for arrays of char operators can not be overloaded
  1129. Revision 1.35 1999/06/17 13:19:57 pierre
  1130. * merged from 0_99_12 branch
  1131. Revision 1.34.2.1 1999/06/17 12:35:23 pierre
  1132. * allow array binary operator overloading if not with orddef
  1133. Revision 1.34 1999/06/02 10:11:52 florian
  1134. * make cycle fixed i.e. compilation with 0.99.10
  1135. * some fixes for qword
  1136. * start of register calling conventions
  1137. Revision 1.33 1999/05/27 19:45:12 peter
  1138. * removed oldasm
  1139. * plabel -> pasmlabel
  1140. * -a switches to source writing automaticly
  1141. * assembler readers OOPed
  1142. * asmsymbol automaticly external
  1143. * jumptables and other label fixes for asm readers
  1144. Revision 1.32 1999/05/23 18:42:18 florian
  1145. * better error recovering in typed constants
  1146. * some problems with arrays of const fixed, some problems
  1147. due my previous
  1148. - the location type of array constructor is now LOC_MEM
  1149. - the pushing of high fixed
  1150. - parameter copying fixed
  1151. - zero temp. allocation removed
  1152. * small problem in the assembler writers fixed:
  1153. ref to nil wasn't written correctly
  1154. Revision 1.31 1999/05/19 20:40:14 florian
  1155. * fixed a couple of array related bugs:
  1156. - var a : array[0..1] of char; p : pchar; p:=a+123; works now
  1157. - open arrays with an odd size doesn't work: movsb wasn't generated
  1158. - introduced some new array type helper routines (is_special_array) etc.
  1159. - made the array type checking in isconvertable more strict, often
  1160. open array can be used where is wasn't allowed etc...
  1161. Revision 1.30 1999/05/11 00:47:02 peter
  1162. + constant operations on enums, only in fpc mode
  1163. Revision 1.29 1999/05/06 09:05:32 peter
  1164. * generic write_float and str_float
  1165. * fixed constant float conversions
  1166. Revision 1.28 1999/05/01 13:24:46 peter
  1167. * merged nasm compiler
  1168. * old asm moved to oldasm/
  1169. Revision 1.27 1999/04/28 06:02:14 florian
  1170. * changes of Bruessel:
  1171. + message handler can now take an explicit self
  1172. * typinfo fixed: sometimes the type names weren't written
  1173. * the type checking for pointer comparisations and subtraction
  1174. and are now more strict (was also buggy)
  1175. * small bug fix to link.pas to support compiling on another
  1176. drive
  1177. * probable bug in popt386 fixed: call/jmp => push/jmp
  1178. transformation didn't count correctly the jmp references
  1179. + threadvar support
  1180. * warning if ln/sqrt gets an invalid constant argument
  1181. Revision 1.26 1999/04/16 20:44:37 florian
  1182. * the boolean operators =;<>;xor with LOC_JUMP and LOC_FLAGS
  1183. operands fixed, small things for new ansistring management
  1184. Revision 1.25 1999/04/15 09:01:34 peter
  1185. * fixed set loading
  1186. * object inheritance support for browser
  1187. Revision 1.24 1999/04/08 11:34:00 peter
  1188. * int/int warning removed, only the hint is left
  1189. Revision 1.23 1999/03/02 22:52:19 peter
  1190. * fixed char array, which can start with all possible values
  1191. Revision 1.22 1999/02/22 02:15:43 peter
  1192. * updates for ag386bin
  1193. Revision 1.21 1999/01/20 21:05:09 peter
  1194. * fixed set operations which still had array constructor as type
  1195. Revision 1.20 1999/01/20 17:39:26 jonas
  1196. + fixed bug0163 (set1 <= set2 support)
  1197. Revision 1.19 1998/12/30 13:35:35 peter
  1198. * fix for boolean=true compares
  1199. Revision 1.18 1998/12/15 17:12:35 peter
  1200. * pointer+ord not allowed in tp mode
  1201. Revision 1.17 1998/12/11 00:03:51 peter
  1202. + globtype,tokens,version unit splitted from globals
  1203. Revision 1.16 1998/12/10 09:47:31 florian
  1204. + basic operations with int64/qord (compiler with -dint64)
  1205. + rtti of enumerations extended: names are now written
  1206. Revision 1.15 1998/11/24 22:59:05 peter
  1207. * handle array of char the same as strings
  1208. Revision 1.14 1998/11/17 00:36:47 peter
  1209. * more ansistring fixes
  1210. Revision 1.13 1998/11/16 15:33:05 peter
  1211. * fixed return for ansistrings
  1212. Revision 1.12 1998/11/05 14:28:16 peter
  1213. * fixed unknown set operation msg
  1214. Revision 1.11 1998/11/05 12:03:02 peter
  1215. * released useansistring
  1216. * removed -Sv, its now available in fpc modes
  1217. Revision 1.10 1998/11/04 10:11:46 peter
  1218. * ansistring fixes
  1219. Revision 1.9 1998/10/25 23:32:04 peter
  1220. * fixed u32bit - s32bit conversion problems
  1221. Revision 1.8 1998/10/22 12:12:28 pierre
  1222. + better error info on unimplemented set operators
  1223. Revision 1.7 1998/10/21 15:12:57 pierre
  1224. * bug fix for IOCHECK inside a procedure with iocheck modifier
  1225. * removed the GPF for unexistant overloading
  1226. (firstcall was called with procedinition=nil !)
  1227. * changed typen to what Florian proposed
  1228. gentypenode(p : pdef) sets the typenodetype field
  1229. and resulttype is only set if inside bt_type block !
  1230. Revision 1.6 1998/10/20 15:09:24 florian
  1231. + binary operators for ansi strings
  1232. Revision 1.5 1998/10/20 08:07:05 pierre
  1233. * several memory corruptions due to double freemem solved
  1234. => never use p^.loc.location:=p^.left^.loc.location;
  1235. + finally I added now by default
  1236. that ra386dir translates global and unit symbols
  1237. + added a first field in tsymtable and
  1238. a nextsym field in tsym
  1239. (this allows to obtain ordered type info for
  1240. records and objects in gdb !)
  1241. Revision 1.4 1998/10/14 12:53:39 peter
  1242. * fixed small tp7 things
  1243. * boolean:=longbool and longbool fixed
  1244. Revision 1.3 1998/10/11 14:31:19 peter
  1245. + checks for division by zero
  1246. Revision 1.2 1998/10/05 21:33:31 peter
  1247. * fixed 161,165,166,167,168
  1248. Revision 1.1 1998/09/23 20:42:24 peter
  1249. * splitted pass_1
  1250. }