tcadd.pas 49 KB

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