tcadd.pas 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314
  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. (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 (m_tp in aktmodeswitches)) then
  921. CGMessage(type_e_mismatch);
  922. end
  923. else
  924. CGMessage(type_e_mismatch);
  925. convdone:=true;
  926. end
  927. else
  928. if (ld^.deftype=pointerdef) or
  929. is_zero_based_array(ld) then
  930. begin
  931. if is_zero_based_array(ld) then
  932. begin
  933. p^.resulttype:=new(ppointerdef,init(parraydef(ld)^.definition));
  934. p^.left:=gentypeconvnode(p^.left,p^.resulttype);
  935. firstpass(p^.left);
  936. end;
  937. p^.location.loc:=LOC_REGISTER;
  938. p^.right:=gentypeconvnode(p^.right,s32bitdef);
  939. firstpass(p^.right);
  940. calcregisters(p,1,0,0);
  941. case p^.treetype of
  942. addn,subn : begin
  943. if not(cs_extsyntax in aktmoduleswitches) or
  944. (not(is_pchar(ld)) and (m_tp in aktmodeswitches)) then
  945. CGMessage(type_e_mismatch);
  946. end;
  947. else
  948. CGMessage(type_e_mismatch);
  949. end;
  950. convdone:=true;
  951. end
  952. else
  953. if (rd^.deftype=procvardef) and (ld^.deftype=procvardef) and is_equal(rd,ld) then
  954. begin
  955. calcregisters(p,1,0,0);
  956. p^.location.loc:=LOC_REGISTER;
  957. case p^.treetype of
  958. equaln,unequaln : ;
  959. else
  960. CGMessage(type_e_mismatch);
  961. end;
  962. convdone:=true;
  963. end
  964. else
  965. {$ifdef SUPPORT_MMX}
  966. if (cs_mmx in aktlocalswitches) and is_mmx_able_array(ld) and
  967. is_mmx_able_array(rd) and is_equal(ld,rd) then
  968. begin
  969. firstpass(p^.right);
  970. firstpass(p^.left);
  971. case p^.treetype of
  972. addn,subn,xorn,orn,andn:
  973. ;
  974. { mul is a little bit restricted }
  975. muln:
  976. if not(mmx_type(p^.left^.resulttype) in
  977. [mmxu16bit,mmxs16bit,mmxfixed16]) then
  978. CGMessage(type_e_mismatch);
  979. else
  980. CGMessage(type_e_mismatch);
  981. end;
  982. p^.location.loc:=LOC_MMXREGISTER;
  983. calcregisters(p,0,0,1);
  984. convdone:=true;
  985. end
  986. else
  987. {$endif SUPPORT_MMX}
  988. if (ld^.deftype=enumdef) and (rd^.deftype=enumdef) and (is_equal(ld,rd)) then
  989. begin
  990. calcregisters(p,1,0,0);
  991. case p^.treetype of
  992. equaln,unequaln,
  993. ltn,lten,gtn,gten : ;
  994. else CGMessage(type_e_mismatch);
  995. end;
  996. convdone:=true;
  997. end;
  998. { the general solution is to convert to 32 bit int }
  999. if not convdone then
  1000. begin
  1001. { but an int/int gives real/real! }
  1002. if p^.treetype=slashn then
  1003. begin
  1004. CGMessage(type_h_use_div_for_int);
  1005. p^.right:=gentypeconvnode(p^.right,bestrealdef^);
  1006. p^.left:=gentypeconvnode(p^.left,bestrealdef^);
  1007. firstpass(p^.left);
  1008. firstpass(p^.right);
  1009. { maybe we need an integer register to save }
  1010. { a reference }
  1011. if ((p^.left^.location.loc<>LOC_FPU) or
  1012. (p^.right^.location.loc<>LOC_FPU)) and
  1013. (p^.left^.registers32=p^.right^.registers32) then
  1014. calcregisters(p,1,1,0)
  1015. else
  1016. calcregisters(p,0,1,0);
  1017. p^.location.loc:=LOC_FPU;
  1018. end
  1019. else
  1020. begin
  1021. p^.right:=gentypeconvnode(p^.right,s32bitdef);
  1022. p^.left:=gentypeconvnode(p^.left,s32bitdef);
  1023. firstpass(p^.left);
  1024. firstpass(p^.right);
  1025. calcregisters(p,1,0,0);
  1026. p^.location.loc:=LOC_REGISTER;
  1027. end;
  1028. end;
  1029. if codegenerror then
  1030. exit;
  1031. { determines result type for comparions }
  1032. { here the is a problem with multiple passes }
  1033. { example length(s)+1 gets internal 'longint' type first }
  1034. { if it is a arg it is converted to 'LONGINT' }
  1035. { but a second first pass will reset this to 'longint' }
  1036. case p^.treetype of
  1037. ltn,lten,gtn,gten,equaln,unequaln:
  1038. begin
  1039. if (not assigned(p^.resulttype)) or
  1040. (p^.resulttype^.deftype=stringdef) then
  1041. p^.resulttype:=booldef;
  1042. if is_64bitint(p^.left^.resulttype) then
  1043. p^.location.loc:=LOC_JUMP
  1044. else
  1045. p^.location.loc:=LOC_FLAGS;
  1046. end;
  1047. xorn:
  1048. begin
  1049. if not assigned(p^.resulttype) then
  1050. p^.resulttype:=p^.left^.resulttype;
  1051. p^.location.loc:=LOC_REGISTER;
  1052. end;
  1053. addn:
  1054. begin
  1055. if not assigned(p^.resulttype) then
  1056. begin
  1057. { for strings, return is always a 255 char string }
  1058. if is_shortstring(p^.left^.resulttype) then
  1059. p^.resulttype:=cshortstringdef
  1060. else
  1061. p^.resulttype:=p^.left^.resulttype;
  1062. end;
  1063. end;
  1064. else
  1065. p^.resulttype:=p^.left^.resulttype;
  1066. end;
  1067. end;
  1068. end.
  1069. {
  1070. $Log$
  1071. Revision 1.44 1999-09-07 07:52:19 peter
  1072. * > < >= <= support for boolean
  1073. * boolean constants are now calculated like integer constants
  1074. Revision 1.43 1999/08/23 23:44:05 pierre
  1075. * setelementn registers32 corrected
  1076. Revision 1.42 1999/08/07 11:29:27 peter
  1077. * better fix for muln register allocation
  1078. Revision 1.41 1999/08/05 21:58:57 peter
  1079. * fixed register count ord*ord
  1080. Revision 1.40 1999/08/04 13:03:13 jonas
  1081. * all tokens now start with an underscore
  1082. * PowerPC compiles!!
  1083. Revision 1.39 1999/08/04 00:23:33 florian
  1084. * renamed i386asm and i386base to cpuasm and cpubase
  1085. Revision 1.38 1999/08/03 22:03:24 peter
  1086. * moved bitmask constants to sets
  1087. * some other type/const renamings
  1088. Revision 1.37 1999/07/16 10:04:37 peter
  1089. * merged
  1090. Revision 1.36 1999/06/17 15:32:48 pierre
  1091. * merged from 0-99-12 branch
  1092. Revision 1.34.2.3 1999/07/16 09:54:58 peter
  1093. * @procvar support in tp7 mode works again
  1094. Revision 1.34.2.2 1999/06/17 15:25:07 pierre
  1095. * for arrays of char operators can not be overloaded
  1096. Revision 1.35 1999/06/17 13:19:57 pierre
  1097. * merged from 0_99_12 branch
  1098. Revision 1.34.2.1 1999/06/17 12:35:23 pierre
  1099. * allow array binary operator overloading if not with orddef
  1100. Revision 1.34 1999/06/02 10:11:52 florian
  1101. * make cycle fixed i.e. compilation with 0.99.10
  1102. * some fixes for qword
  1103. * start of register calling conventions
  1104. Revision 1.33 1999/05/27 19:45:12 peter
  1105. * removed oldasm
  1106. * plabel -> pasmlabel
  1107. * -a switches to source writing automaticly
  1108. * assembler readers OOPed
  1109. * asmsymbol automaticly external
  1110. * jumptables and other label fixes for asm readers
  1111. Revision 1.32 1999/05/23 18:42:18 florian
  1112. * better error recovering in typed constants
  1113. * some problems with arrays of const fixed, some problems
  1114. due my previous
  1115. - the location type of array constructor is now LOC_MEM
  1116. - the pushing of high fixed
  1117. - parameter copying fixed
  1118. - zero temp. allocation removed
  1119. * small problem in the assembler writers fixed:
  1120. ref to nil wasn't written correctly
  1121. Revision 1.31 1999/05/19 20:40:14 florian
  1122. * fixed a couple of array related bugs:
  1123. - var a : array[0..1] of char; p : pchar; p:=a+123; works now
  1124. - open arrays with an odd size doesn't work: movsb wasn't generated
  1125. - introduced some new array type helper routines (is_special_array) etc.
  1126. - made the array type checking in isconvertable more strict, often
  1127. open array can be used where is wasn't allowed etc...
  1128. Revision 1.30 1999/05/11 00:47:02 peter
  1129. + constant operations on enums, only in fpc mode
  1130. Revision 1.29 1999/05/06 09:05:32 peter
  1131. * generic write_float and str_float
  1132. * fixed constant float conversions
  1133. Revision 1.28 1999/05/01 13:24:46 peter
  1134. * merged nasm compiler
  1135. * old asm moved to oldasm/
  1136. Revision 1.27 1999/04/28 06:02:14 florian
  1137. * changes of Bruessel:
  1138. + message handler can now take an explicit self
  1139. * typinfo fixed: sometimes the type names weren't written
  1140. * the type checking for pointer comparisations and subtraction
  1141. and are now more strict (was also buggy)
  1142. * small bug fix to link.pas to support compiling on another
  1143. drive
  1144. * probable bug in popt386 fixed: call/jmp => push/jmp
  1145. transformation didn't count correctly the jmp references
  1146. + threadvar support
  1147. * warning if ln/sqrt gets an invalid constant argument
  1148. Revision 1.26 1999/04/16 20:44:37 florian
  1149. * the boolean operators =;<>;xor with LOC_JUMP and LOC_FLAGS
  1150. operands fixed, small things for new ansistring management
  1151. Revision 1.25 1999/04/15 09:01:34 peter
  1152. * fixed set loading
  1153. * object inheritance support for browser
  1154. Revision 1.24 1999/04/08 11:34:00 peter
  1155. * int/int warning removed, only the hint is left
  1156. Revision 1.23 1999/03/02 22:52:19 peter
  1157. * fixed char array, which can start with all possible values
  1158. Revision 1.22 1999/02/22 02:15:43 peter
  1159. * updates for ag386bin
  1160. Revision 1.21 1999/01/20 21:05:09 peter
  1161. * fixed set operations which still had array constructor as type
  1162. Revision 1.20 1999/01/20 17:39:26 jonas
  1163. + fixed bug0163 (set1 <= set2 support)
  1164. Revision 1.19 1998/12/30 13:35:35 peter
  1165. * fix for boolean=true compares
  1166. Revision 1.18 1998/12/15 17:12:35 peter
  1167. * pointer+ord not allowed in tp mode
  1168. Revision 1.17 1998/12/11 00:03:51 peter
  1169. + globtype,tokens,version unit splitted from globals
  1170. Revision 1.16 1998/12/10 09:47:31 florian
  1171. + basic operations with int64/qord (compiler with -dint64)
  1172. + rtti of enumerations extended: names are now written
  1173. Revision 1.15 1998/11/24 22:59:05 peter
  1174. * handle array of char the same as strings
  1175. Revision 1.14 1998/11/17 00:36:47 peter
  1176. * more ansistring fixes
  1177. Revision 1.13 1998/11/16 15:33:05 peter
  1178. * fixed return for ansistrings
  1179. Revision 1.12 1998/11/05 14:28:16 peter
  1180. * fixed unknown set operation msg
  1181. Revision 1.11 1998/11/05 12:03:02 peter
  1182. * released useansistring
  1183. * removed -Sv, its now available in fpc modes
  1184. Revision 1.10 1998/11/04 10:11:46 peter
  1185. * ansistring fixes
  1186. Revision 1.9 1998/10/25 23:32:04 peter
  1187. * fixed u32bit - s32bit conversion problems
  1188. Revision 1.8 1998/10/22 12:12:28 pierre
  1189. + better error info on unimplemented set operators
  1190. Revision 1.7 1998/10/21 15:12:57 pierre
  1191. * bug fix for IOCHECK inside a procedure with iocheck modifier
  1192. * removed the GPF for unexistant overloading
  1193. (firstcall was called with procedinition=nil !)
  1194. * changed typen to what Florian proposed
  1195. gentypenode(p : pdef) sets the typenodetype field
  1196. and resulttype is only set if inside bt_type block !
  1197. Revision 1.6 1998/10/20 15:09:24 florian
  1198. + binary operators for ansi strings
  1199. Revision 1.5 1998/10/20 08:07:05 pierre
  1200. * several memory corruptions due to double freemem solved
  1201. => never use p^.loc.location:=p^.left^.loc.location;
  1202. + finally I added now by default
  1203. that ra386dir translates global and unit symbols
  1204. + added a first field in tsymtable and
  1205. a nextsym field in tsym
  1206. (this allows to obtain ordered type info for
  1207. records and objects in gdb !)
  1208. Revision 1.4 1998/10/14 12:53:39 peter
  1209. * fixed small tp7 things
  1210. * boolean:=longbool and longbool fixed
  1211. Revision 1.3 1998/10/11 14:31:19 peter
  1212. + checks for division by zero
  1213. Revision 1.2 1998/10/05 21:33:31 peter
  1214. * fixed 161,165,166,167,168
  1215. Revision 1.1 1998/09/23 20:42:24 peter
  1216. * splitted pass_1
  1217. }