tcadd.pas 49 KB

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