tcadd.pas 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304
  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. (rd^.deftype<>orddef) and
  89. ((parraydef(ld)^.definition^.deftype<>orddef) or
  90. (porddef(parraydef(ld)^.definition)^.typ<>uchar))) 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. (ld^.deftype<>orddef) and
  100. ((parraydef(rd)^.definition^.deftype<>orddef) or
  101. (porddef(parraydef(rd)^.definition)^.typ<>uchar))) 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. ((ld^.deftype=enumdef) and is_equal(ld,rd) and (m_fpc in aktmodeswitches))) then
  177. begin
  178. if ld^.deftype=enumdef then
  179. resdef:=ld
  180. else
  181. resdef:=s32bitdef;
  182. lv:=p^.left^.value;
  183. rv:=p^.right^.value;
  184. case p^.treetype of
  185. addn : t:=genordinalconstnode(lv+rv,resdef);
  186. subn : t:=genordinalconstnode(lv-rv,resdef);
  187. muln : t:=genordinalconstnode(lv*rv,resdef);
  188. xorn : t:=genordinalconstnode(lv xor rv,resdef);
  189. orn : t:=genordinalconstnode(lv or rv,resdef);
  190. andn : t:=genordinalconstnode(lv and rv,resdef);
  191. ltn : t:=genordinalconstnode(ord(lv<rv),booldef);
  192. lten : t:=genordinalconstnode(ord(lv<=rv),booldef);
  193. gtn : t:=genordinalconstnode(ord(lv>rv),booldef);
  194. gten : t:=genordinalconstnode(ord(lv>=rv),booldef);
  195. equaln : t:=genordinalconstnode(ord(lv=rv),booldef);
  196. unequaln : t:=genordinalconstnode(ord(lv<>rv),booldef);
  197. slashn : begin
  198. { int/int becomes a real }
  199. if int(rv)=0 then
  200. begin
  201. Message(parser_e_invalid_float_operation);
  202. t:=genrealconstnode(0,bestrealdef^);
  203. end
  204. else
  205. t:=genrealconstnode(int(lv)/int(rv),bestrealdef^);
  206. firstpass(t);
  207. end;
  208. else
  209. CGMessage(type_e_mismatch);
  210. end;
  211. disposetree(p);
  212. firstpass(t);
  213. p:=t;
  214. exit;
  215. end;
  216. { both real constants ? }
  217. if (lt=realconstn) and (rt=realconstn) then
  218. begin
  219. lvd:=p^.left^.value_real;
  220. rvd:=p^.right^.value_real;
  221. case p^.treetype of
  222. addn : t:=genrealconstnode(lvd+rvd,bestrealdef^);
  223. subn : t:=genrealconstnode(lvd-rvd,bestrealdef^);
  224. muln : t:=genrealconstnode(lvd*rvd,bestrealdef^);
  225. caretn : t:=genrealconstnode(exp(ln(lvd)*rvd),bestrealdef^);
  226. slashn : begin
  227. if rvd=0 then
  228. begin
  229. Message(parser_e_invalid_float_operation);
  230. t:=genrealconstnode(0,bestrealdef^);
  231. end
  232. else
  233. t:=genrealconstnode(lvd/rvd,bestrealdef^);
  234. end;
  235. ltn : t:=genordinalconstnode(ord(lvd<rvd),booldef);
  236. lten : t:=genordinalconstnode(ord(lvd<=rvd),booldef);
  237. gtn : t:=genordinalconstnode(ord(lvd>rvd),booldef);
  238. gten : t:=genordinalconstnode(ord(lvd>=rvd),booldef);
  239. equaln : t:=genordinalconstnode(ord(lvd=rvd),booldef);
  240. unequaln : t:=genordinalconstnode(ord(lvd<>rvd),booldef);
  241. else
  242. CGMessage(type_e_mismatch);
  243. end;
  244. disposetree(p);
  245. p:=t;
  246. firstpass(p);
  247. exit;
  248. end;
  249. { concating strings ? }
  250. concatstrings:=false;
  251. s1:=nil;
  252. s2:=nil;
  253. if (lt=ordconstn) and (rt=ordconstn) and
  254. is_char(ld) and is_char(rd) then
  255. begin
  256. s1:=strpnew(char(byte(p^.left^.value)));
  257. s2:=strpnew(char(byte(p^.right^.value)));
  258. l1:=1;
  259. l2:=1;
  260. concatstrings:=true;
  261. end
  262. else
  263. if (lt=stringconstn) and (rt=ordconstn) and is_char(rd) then
  264. begin
  265. s1:=getpcharcopy(p^.left);
  266. l1:=p^.left^.length;
  267. s2:=strpnew(char(byte(p^.right^.value)));
  268. l2:=1;
  269. concatstrings:=true;
  270. end
  271. else
  272. if (lt=ordconstn) and (rt=stringconstn) and is_char(ld) then
  273. begin
  274. s1:=strpnew(char(byte(p^.left^.value)));
  275. l1:=1;
  276. s2:=getpcharcopy(p^.right);
  277. l2:=p^.right^.length;
  278. concatstrings:=true;
  279. end
  280. else if (lt=stringconstn) and (rt=stringconstn) then
  281. begin
  282. s1:=getpcharcopy(p^.left);
  283. l1:=p^.left^.length;
  284. s2:=getpcharcopy(p^.right);
  285. l2:=p^.right^.length;
  286. concatstrings:=true;
  287. end;
  288. { I will need to translate all this to ansistrings !!! }
  289. if concatstrings then
  290. begin
  291. case p^.treetype of
  292. addn :
  293. t:=genpcharconstnode(concatansistrings(s1,s2,l1,l2),l1+l2);
  294. ltn :
  295. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)<0),booldef);
  296. lten :
  297. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)<=0),booldef);
  298. gtn :
  299. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)>0),booldef);
  300. gten :
  301. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)>=0),booldef);
  302. equaln :
  303. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)=0),booldef);
  304. unequaln :
  305. t:=genordinalconstnode(byte(compareansistrings(s1,s2,l1,l2)<>0),booldef);
  306. end;
  307. ansistringdispose(s1,l1);
  308. ansistringdispose(s2,l2);
  309. disposetree(p);
  310. firstpass(t);
  311. p:=t;
  312. exit;
  313. end;
  314. { if both are orddefs then check sub types }
  315. if (ld^.deftype=orddef) and (rd^.deftype=orddef) then
  316. begin
  317. { 2 booleans ? }
  318. if is_boolean(ld) and is_boolean(rd) then
  319. begin
  320. case p^.treetype of
  321. andn,
  322. orn:
  323. begin
  324. calcregisters(p,0,0,0);
  325. make_bool_equal_size(p);
  326. p^.location.loc:=LOC_JUMP;
  327. end;
  328. xorn:
  329. begin
  330. make_bool_equal_size(p);
  331. if (p^.left^.location.loc in [LOC_JUMP,LOC_FLAGS]) and
  332. (p^.left^.location.loc in [LOC_JUMP,LOC_FLAGS]) then
  333. calcregisters(p,2,0,0)
  334. else
  335. calcregisters(p,1,0,0);
  336. end;
  337. unequaln,
  338. equaln:
  339. begin
  340. make_bool_equal_size(p);
  341. { Remove any compares with constants, becuase then
  342. we get a compare with Flags in the codegen which
  343. is not supported (PFV) }
  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. p^.location.loc:=LOC_REGISTER;
  643. end
  644. else
  645. begin
  646. calcregisters(p,0,0,0);
  647. { here we call SET... }
  648. procinfo.flags:=procinfo.flags or pi_do_call;
  649. p^.location.loc:=LOC_MEM;
  650. end;
  651. convdone:=true;
  652. end
  653. else
  654. { is one of the operands a string?,
  655. chararrays are also handled as strings (after conversion) }
  656. if (rd^.deftype=stringdef) or (ld^.deftype=stringdef) or
  657. (is_chararray(rd) and is_chararray(ld)) then
  658. begin
  659. if is_widestring(rd) or is_widestring(ld) then
  660. begin
  661. if not(is_widestring(rd)) then
  662. p^.right:=gentypeconvnode(p^.right,cwidestringdef);
  663. if not(is_widestring(ld)) then
  664. p^.left:=gentypeconvnode(p^.left,cwidestringdef);
  665. p^.resulttype:=cwidestringdef;
  666. { this is only for add, the comparisaion is handled later }
  667. p^.location.loc:=LOC_REGISTER;
  668. end
  669. else if is_ansistring(rd) or is_ansistring(ld) then
  670. begin
  671. if not(is_ansistring(rd)) then
  672. p^.right:=gentypeconvnode(p^.right,cansistringdef);
  673. if not(is_ansistring(ld)) then
  674. p^.left:=gentypeconvnode(p^.left,cansistringdef);
  675. p^.resulttype:=cansistringdef;
  676. { this is only for add, the comparisaion is handled later }
  677. p^.location.loc:=LOC_REGISTER;
  678. end
  679. else if is_longstring(rd) or is_longstring(ld) then
  680. begin
  681. if not(is_longstring(rd)) then
  682. p^.right:=gentypeconvnode(p^.right,clongstringdef);
  683. if not(is_longstring(ld)) then
  684. p^.left:=gentypeconvnode(p^.left,clongstringdef);
  685. p^.resulttype:=clongstringdef;
  686. { this is only for add, the comparisaion is handled later }
  687. p^.location.loc:=LOC_MEM;
  688. end
  689. else
  690. begin
  691. if not(is_shortstring(rd)) then
  692. p^.right:=gentypeconvnode(p^.right,cshortstringdef);
  693. if not(is_shortstring(ld)) then
  694. p^.left:=gentypeconvnode(p^.left,cshortstringdef);
  695. p^.resulttype:=cshortstringdef;
  696. { this is only for add, the comparisaion is handled later }
  697. p^.location.loc:=LOC_MEM;
  698. end;
  699. { only if there is a type cast we need to do again }
  700. { the first pass }
  701. if p^.left^.treetype=typeconvn then
  702. firstpass(p^.left);
  703. if p^.right^.treetype=typeconvn then
  704. firstpass(p^.right);
  705. { here we call STRCONCAT or STRCMP or STRCOPY }
  706. procinfo.flags:=procinfo.flags or pi_do_call;
  707. if p^.location.loc=LOC_MEM then
  708. calcregisters(p,0,0,0)
  709. else
  710. calcregisters(p,1,0,0);
  711. convdone:=true;
  712. end
  713. else
  714. { is one a real float ? }
  715. if (rd^.deftype=floatdef) or (ld^.deftype=floatdef) then
  716. begin
  717. { if one is a fixed, then convert to f32bit }
  718. if ((rd^.deftype=floatdef) and (pfloatdef(rd)^.typ=f32bit)) or
  719. ((ld^.deftype=floatdef) and (pfloatdef(ld)^.typ=f32bit)) then
  720. begin
  721. if not is_integer(rd) or (p^.treetype<>muln) then
  722. p^.right:=gentypeconvnode(p^.right,s32fixeddef);
  723. if not is_integer(ld) or (p^.treetype<>muln) then
  724. p^.left:=gentypeconvnode(p^.left,s32fixeddef);
  725. firstpass(p^.left);
  726. firstpass(p^.right);
  727. calcregisters(p,1,0,0);
  728. p^.location.loc:=LOC_REGISTER;
  729. end
  730. else
  731. { convert both to bestreal }
  732. begin
  733. p^.right:=gentypeconvnode(p^.right,bestrealdef^);
  734. p^.left:=gentypeconvnode(p^.left,bestrealdef^);
  735. firstpass(p^.left);
  736. firstpass(p^.right);
  737. calcregisters(p,1,1,0);
  738. p^.location.loc:=LOC_FPU;
  739. end;
  740. convdone:=true;
  741. end
  742. else
  743. { pointer comperation and subtraction }
  744. if (rd^.deftype=pointerdef) and (ld^.deftype=pointerdef) then
  745. begin
  746. p^.location.loc:=LOC_REGISTER;
  747. { p^.right:=gentypeconvnode(p^.right,ld); }
  748. { firstpass(p^.right); }
  749. calcregisters(p,1,0,0);
  750. case p^.treetype of
  751. equaln,unequaln :
  752. begin
  753. if is_equal(p^.right^.resulttype,voidpointerdef) then
  754. begin
  755. p^.right:=gentypeconvnode(p^.right,ld);
  756. firstpass(p^.right);
  757. end
  758. else if is_equal(p^.left^.resulttype,voidpointerdef) then
  759. begin
  760. p^.left:=gentypeconvnode(p^.left,rd);
  761. firstpass(p^.left);
  762. end
  763. else if not(is_equal(ld,rd)) then
  764. CGMessage(type_e_mismatch);
  765. end;
  766. ltn,lten,gtn,gten:
  767. begin
  768. if is_equal(p^.right^.resulttype,voidpointerdef) then
  769. begin
  770. p^.right:=gentypeconvnode(p^.right,ld);
  771. firstpass(p^.right);
  772. end
  773. else if is_equal(p^.left^.resulttype,voidpointerdef) then
  774. begin
  775. p^.left:=gentypeconvnode(p^.left,rd);
  776. firstpass(p^.left);
  777. end
  778. else if not(is_equal(ld,rd)) then
  779. CGMessage(type_e_mismatch);
  780. if not(cs_extsyntax in aktmoduleswitches) then
  781. CGMessage(type_e_mismatch);
  782. end;
  783. subn:
  784. begin
  785. 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. p^.resulttype:=s32bitdef;
  790. exit;
  791. end;
  792. else CGMessage(type_e_mismatch);
  793. end;
  794. convdone:=true;
  795. end
  796. else
  797. if (rd^.deftype=objectdef) and (ld^.deftype=objectdef) and
  798. pobjectdef(rd)^.is_class and pobjectdef(ld)^.is_class then
  799. begin
  800. p^.location.loc:=LOC_REGISTER;
  801. if pobjectdef(rd)^.is_related(pobjectdef(ld)) then
  802. p^.right:=gentypeconvnode(p^.right,ld)
  803. else
  804. p^.left:=gentypeconvnode(p^.left,rd);
  805. firstpass(p^.right);
  806. firstpass(p^.left);
  807. calcregisters(p,1,0,0);
  808. case p^.treetype of
  809. equaln,unequaln : ;
  810. else CGMessage(type_e_mismatch);
  811. end;
  812. convdone:=true;
  813. end
  814. else
  815. if (rd^.deftype=classrefdef) and (ld^.deftype=classrefdef) then
  816. begin
  817. p^.location.loc:=LOC_REGISTER;
  818. if pobjectdef(pclassrefdef(rd)^.definition)^.is_related(pobjectdef(
  819. pclassrefdef(ld)^.definition)) then
  820. p^.right:=gentypeconvnode(p^.right,ld)
  821. else
  822. p^.left:=gentypeconvnode(p^.left,rd);
  823. firstpass(p^.right);
  824. firstpass(p^.left);
  825. calcregisters(p,1,0,0);
  826. case p^.treetype of
  827. equaln,unequaln : ;
  828. else CGMessage(type_e_mismatch);
  829. end;
  830. convdone:=true;
  831. end
  832. else
  833. { allows comperasion with nil pointer }
  834. if (rd^.deftype=objectdef) and
  835. pobjectdef(rd)^.is_class then
  836. begin
  837. p^.location.loc:=LOC_REGISTER;
  838. p^.left:=gentypeconvnode(p^.left,rd);
  839. firstpass(p^.left);
  840. calcregisters(p,1,0,0);
  841. case p^.treetype of
  842. equaln,unequaln : ;
  843. else CGMessage(type_e_mismatch);
  844. end;
  845. convdone:=true;
  846. end
  847. else
  848. if (ld^.deftype=objectdef) and
  849. pobjectdef(ld)^.is_class then
  850. begin
  851. p^.location.loc:=LOC_REGISTER;
  852. p^.right:=gentypeconvnode(p^.right,ld);
  853. firstpass(p^.right);
  854. calcregisters(p,1,0,0);
  855. case p^.treetype of
  856. equaln,unequaln : ;
  857. else CGMessage(type_e_mismatch);
  858. end;
  859. convdone:=true;
  860. end
  861. else
  862. if (rd^.deftype=classrefdef) then
  863. begin
  864. p^.left:=gentypeconvnode(p^.left,rd);
  865. firstpass(p^.left);
  866. calcregisters(p,1,0,0);
  867. case p^.treetype of
  868. equaln,unequaln : ;
  869. else CGMessage(type_e_mismatch);
  870. end;
  871. convdone:=true;
  872. end
  873. else
  874. if (ld^.deftype=classrefdef) then
  875. begin
  876. p^.right:=gentypeconvnode(p^.right,ld);
  877. firstpass(p^.right);
  878. calcregisters(p,1,0,0);
  879. case p^.treetype of
  880. equaln,unequaln : ;
  881. else
  882. CGMessage(type_e_mismatch);
  883. end;
  884. convdone:=true;
  885. end
  886. else
  887. { support procvar=nil,procvar<>nil }
  888. if ((ld^.deftype=procvardef) and (rt=niln)) or
  889. ((rd^.deftype=procvardef) and (lt=niln)) then
  890. begin
  891. calcregisters(p,1,0,0);
  892. p^.location.loc:=LOC_REGISTER;
  893. case p^.treetype of
  894. equaln,unequaln : ;
  895. else
  896. CGMessage(type_e_mismatch);
  897. end;
  898. convdone:=true;
  899. end
  900. else
  901. if (rd^.deftype=pointerdef) or
  902. is_zero_based_array(rd) then
  903. begin
  904. if is_zero_based_array(rd) then
  905. begin
  906. p^.resulttype:=new(ppointerdef,init(parraydef(rd)^.definition));
  907. p^.right:=gentypeconvnode(p^.right,p^.resulttype);
  908. firstpass(p^.right);
  909. end;
  910. p^.location.loc:=LOC_REGISTER;
  911. p^.left:=gentypeconvnode(p^.left,s32bitdef);
  912. firstpass(p^.left);
  913. calcregisters(p,1,0,0);
  914. if p^.treetype=addn then
  915. begin
  916. if not(cs_extsyntax in aktmoduleswitches) or
  917. (not(is_pchar(ld)) and (m_tp in aktmodeswitches)) then
  918. CGMessage(type_e_mismatch);
  919. end
  920. else
  921. CGMessage(type_e_mismatch);
  922. convdone:=true;
  923. end
  924. else
  925. if (ld^.deftype=pointerdef) or
  926. is_zero_based_array(ld) then
  927. begin
  928. if is_zero_based_array(ld) then
  929. begin
  930. p^.resulttype:=new(ppointerdef,init(parraydef(ld)^.definition));
  931. p^.left:=gentypeconvnode(p^.left,p^.resulttype);
  932. firstpass(p^.left);
  933. end;
  934. p^.location.loc:=LOC_REGISTER;
  935. p^.right:=gentypeconvnode(p^.right,s32bitdef);
  936. firstpass(p^.right);
  937. calcregisters(p,1,0,0);
  938. case p^.treetype of
  939. addn,subn : begin
  940. if not(cs_extsyntax in aktmoduleswitches) or
  941. (not(is_pchar(ld)) and (m_tp in aktmodeswitches)) then
  942. CGMessage(type_e_mismatch);
  943. end;
  944. else
  945. CGMessage(type_e_mismatch);
  946. end;
  947. convdone:=true;
  948. end
  949. else
  950. if (rd^.deftype=procvardef) and (ld^.deftype=procvardef) and is_equal(rd,ld) then
  951. begin
  952. calcregisters(p,1,0,0);
  953. p^.location.loc:=LOC_REGISTER;
  954. case p^.treetype of
  955. equaln,unequaln : ;
  956. else
  957. CGMessage(type_e_mismatch);
  958. end;
  959. convdone:=true;
  960. end
  961. else
  962. {$ifdef SUPPORT_MMX}
  963. if (cs_mmx in aktlocalswitches) and is_mmx_able_array(ld) and
  964. is_mmx_able_array(rd) and is_equal(ld,rd) then
  965. begin
  966. firstpass(p^.right);
  967. firstpass(p^.left);
  968. case p^.treetype of
  969. addn,subn,xorn,orn,andn:
  970. ;
  971. { mul is a little bit restricted }
  972. muln:
  973. if not(mmx_type(p^.left^.resulttype) in
  974. [mmxu16bit,mmxs16bit,mmxfixed16]) then
  975. CGMessage(type_e_mismatch);
  976. else
  977. CGMessage(type_e_mismatch);
  978. end;
  979. p^.location.loc:=LOC_MMXREGISTER;
  980. calcregisters(p,0,0,1);
  981. convdone:=true;
  982. end
  983. else
  984. {$endif SUPPORT_MMX}
  985. if (ld^.deftype=enumdef) and (rd^.deftype=enumdef) and (is_equal(ld,rd)) then
  986. begin
  987. calcregisters(p,1,0,0);
  988. case p^.treetype of
  989. equaln,unequaln,
  990. ltn,lten,gtn,gten : ;
  991. else CGMessage(type_e_mismatch);
  992. end;
  993. convdone:=true;
  994. end;
  995. { the general solution is to convert to 32 bit int }
  996. if not convdone then
  997. begin
  998. { but an int/int gives real/real! }
  999. if p^.treetype=slashn then
  1000. begin
  1001. CGMessage(type_h_use_div_for_int);
  1002. p^.right:=gentypeconvnode(p^.right,bestrealdef^);
  1003. p^.left:=gentypeconvnode(p^.left,bestrealdef^);
  1004. firstpass(p^.left);
  1005. firstpass(p^.right);
  1006. { maybe we need an integer register to save }
  1007. { a reference }
  1008. if ((p^.left^.location.loc<>LOC_FPU) or
  1009. (p^.right^.location.loc<>LOC_FPU)) and
  1010. (p^.left^.registers32=p^.right^.registers32) then
  1011. calcregisters(p,1,1,0)
  1012. else
  1013. calcregisters(p,0,1,0);
  1014. p^.location.loc:=LOC_FPU;
  1015. end
  1016. else
  1017. begin
  1018. p^.right:=gentypeconvnode(p^.right,s32bitdef);
  1019. p^.left:=gentypeconvnode(p^.left,s32bitdef);
  1020. firstpass(p^.left);
  1021. firstpass(p^.right);
  1022. calcregisters(p,1,0,0);
  1023. p^.location.loc:=LOC_REGISTER;
  1024. end;
  1025. end;
  1026. if codegenerror then
  1027. exit;
  1028. { determines result type for comparions }
  1029. { here the is a problem with multiple passes }
  1030. { example length(s)+1 gets internal 'longint' type first }
  1031. { if it is a arg it is converted to 'LONGINT' }
  1032. { but a second first pass will reset this to 'longint' }
  1033. case p^.treetype of
  1034. ltn,lten,gtn,gten,equaln,unequaln:
  1035. begin
  1036. if (not assigned(p^.resulttype)) or
  1037. (p^.resulttype^.deftype=stringdef) then
  1038. p^.resulttype:=booldef;
  1039. if is_64bitint(p^.left^.resulttype) then
  1040. p^.location.loc:=LOC_JUMP
  1041. else
  1042. p^.location.loc:=LOC_FLAGS;
  1043. end;
  1044. xorn:
  1045. begin
  1046. if not assigned(p^.resulttype) then
  1047. p^.resulttype:=p^.left^.resulttype;
  1048. p^.location.loc:=LOC_REGISTER;
  1049. end;
  1050. addn:
  1051. begin
  1052. if not assigned(p^.resulttype) then
  1053. begin
  1054. { for strings, return is always a 255 char string }
  1055. if is_shortstring(p^.left^.resulttype) then
  1056. p^.resulttype:=cshortstringdef
  1057. else
  1058. p^.resulttype:=p^.left^.resulttype;
  1059. end;
  1060. end;
  1061. else
  1062. p^.resulttype:=p^.left^.resulttype;
  1063. end;
  1064. end;
  1065. end.
  1066. {
  1067. $Log$
  1068. Revision 1.42 1999-08-07 11:29:27 peter
  1069. * better fix for muln register allocation
  1070. Revision 1.41 1999/08/05 21:58:57 peter
  1071. * fixed register count ord*ord
  1072. Revision 1.40 1999/08/04 13:03:13 jonas
  1073. * all tokens now start with an underscore
  1074. * PowerPC compiles!!
  1075. Revision 1.39 1999/08/04 00:23:33 florian
  1076. * renamed i386asm and i386base to cpuasm and cpubase
  1077. Revision 1.38 1999/08/03 22:03:24 peter
  1078. * moved bitmask constants to sets
  1079. * some other type/const renamings
  1080. Revision 1.37 1999/07/16 10:04:37 peter
  1081. * merged
  1082. Revision 1.36 1999/06/17 15:32:48 pierre
  1083. * merged from 0-99-12 branch
  1084. Revision 1.34.2.3 1999/07/16 09:54:58 peter
  1085. * @procvar support in tp7 mode works again
  1086. Revision 1.34.2.2 1999/06/17 15:25:07 pierre
  1087. * for arrays of char operators can not be overloaded
  1088. Revision 1.35 1999/06/17 13:19:57 pierre
  1089. * merged from 0_99_12 branch
  1090. Revision 1.34.2.1 1999/06/17 12:35:23 pierre
  1091. * allow array binary operator overloading if not with orddef
  1092. Revision 1.34 1999/06/02 10:11:52 florian
  1093. * make cycle fixed i.e. compilation with 0.99.10
  1094. * some fixes for qword
  1095. * start of register calling conventions
  1096. Revision 1.33 1999/05/27 19:45:12 peter
  1097. * removed oldasm
  1098. * plabel -> pasmlabel
  1099. * -a switches to source writing automaticly
  1100. * assembler readers OOPed
  1101. * asmsymbol automaticly external
  1102. * jumptables and other label fixes for asm readers
  1103. Revision 1.32 1999/05/23 18:42:18 florian
  1104. * better error recovering in typed constants
  1105. * some problems with arrays of const fixed, some problems
  1106. due my previous
  1107. - the location type of array constructor is now LOC_MEM
  1108. - the pushing of high fixed
  1109. - parameter copying fixed
  1110. - zero temp. allocation removed
  1111. * small problem in the assembler writers fixed:
  1112. ref to nil wasn't written correctly
  1113. Revision 1.31 1999/05/19 20:40:14 florian
  1114. * fixed a couple of array related bugs:
  1115. - var a : array[0..1] of char; p : pchar; p:=a+123; works now
  1116. - open arrays with an odd size doesn't work: movsb wasn't generated
  1117. - introduced some new array type helper routines (is_special_array) etc.
  1118. - made the array type checking in isconvertable more strict, often
  1119. open array can be used where is wasn't allowed etc...
  1120. Revision 1.30 1999/05/11 00:47:02 peter
  1121. + constant operations on enums, only in fpc mode
  1122. Revision 1.29 1999/05/06 09:05:32 peter
  1123. * generic write_float and str_float
  1124. * fixed constant float conversions
  1125. Revision 1.28 1999/05/01 13:24:46 peter
  1126. * merged nasm compiler
  1127. * old asm moved to oldasm/
  1128. Revision 1.27 1999/04/28 06:02:14 florian
  1129. * changes of Bruessel:
  1130. + message handler can now take an explicit self
  1131. * typinfo fixed: sometimes the type names weren't written
  1132. * the type checking for pointer comparisations and subtraction
  1133. and are now more strict (was also buggy)
  1134. * small bug fix to link.pas to support compiling on another
  1135. drive
  1136. * probable bug in popt386 fixed: call/jmp => push/jmp
  1137. transformation didn't count correctly the jmp references
  1138. + threadvar support
  1139. * warning if ln/sqrt gets an invalid constant argument
  1140. Revision 1.26 1999/04/16 20:44:37 florian
  1141. * the boolean operators =;<>;xor with LOC_JUMP and LOC_FLAGS
  1142. operands fixed, small things for new ansistring management
  1143. Revision 1.25 1999/04/15 09:01:34 peter
  1144. * fixed set loading
  1145. * object inheritance support for browser
  1146. Revision 1.24 1999/04/08 11:34:00 peter
  1147. * int/int warning removed, only the hint is left
  1148. Revision 1.23 1999/03/02 22:52:19 peter
  1149. * fixed char array, which can start with all possible values
  1150. Revision 1.22 1999/02/22 02:15:43 peter
  1151. * updates for ag386bin
  1152. Revision 1.21 1999/01/20 21:05:09 peter
  1153. * fixed set operations which still had array constructor as type
  1154. Revision 1.20 1999/01/20 17:39:26 jonas
  1155. + fixed bug0163 (set1 <= set2 support)
  1156. Revision 1.19 1998/12/30 13:35:35 peter
  1157. * fix for boolean=true compares
  1158. Revision 1.18 1998/12/15 17:12:35 peter
  1159. * pointer+ord not allowed in tp mode
  1160. Revision 1.17 1998/12/11 00:03:51 peter
  1161. + globtype,tokens,version unit splitted from globals
  1162. Revision 1.16 1998/12/10 09:47:31 florian
  1163. + basic operations with int64/qord (compiler with -dint64)
  1164. + rtti of enumerations extended: names are now written
  1165. Revision 1.15 1998/11/24 22:59:05 peter
  1166. * handle array of char the same as strings
  1167. Revision 1.14 1998/11/17 00:36:47 peter
  1168. * more ansistring fixes
  1169. Revision 1.13 1998/11/16 15:33:05 peter
  1170. * fixed return for ansistrings
  1171. Revision 1.12 1998/11/05 14:28:16 peter
  1172. * fixed unknown set operation msg
  1173. Revision 1.11 1998/11/05 12:03:02 peter
  1174. * released useansistring
  1175. * removed -Sv, its now available in fpc modes
  1176. Revision 1.10 1998/11/04 10:11:46 peter
  1177. * ansistring fixes
  1178. Revision 1.9 1998/10/25 23:32:04 peter
  1179. * fixed u32bit - s32bit conversion problems
  1180. Revision 1.8 1998/10/22 12:12:28 pierre
  1181. + better error info on unimplemented set operators
  1182. Revision 1.7 1998/10/21 15:12:57 pierre
  1183. * bug fix for IOCHECK inside a procedure with iocheck modifier
  1184. * removed the GPF for unexistant overloading
  1185. (firstcall was called with procedinition=nil !)
  1186. * changed typen to what Florian proposed
  1187. gentypenode(p : pdef) sets the typenodetype field
  1188. and resulttype is only set if inside bt_type block !
  1189. Revision 1.6 1998/10/20 15:09:24 florian
  1190. + binary operators for ansi strings
  1191. Revision 1.5 1998/10/20 08:07:05 pierre
  1192. * several memory corruptions due to double freemem solved
  1193. => never use p^.loc.location:=p^.left^.loc.location;
  1194. + finally I added now by default
  1195. that ra386dir translates global and unit symbols
  1196. + added a first field in tsymtable and
  1197. a nextsym field in tsym
  1198. (this allows to obtain ordered type info for
  1199. records and objects in gdb !)
  1200. Revision 1.4 1998/10/14 12:53:39 peter
  1201. * fixed small tp7 things
  1202. * boolean:=longbool and longbool fixed
  1203. Revision 1.3 1998/10/11 14:31:19 peter
  1204. + checks for division by zero
  1205. Revision 1.2 1998/10/05 21:33:31 peter
  1206. * fixed 161,165,166,167,168
  1207. Revision 1.1 1998/09/23 20:42:24 peter
  1208. * splitted pass_1
  1209. }