tcadd.pas 51 KB

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