tcadd.pas 48 KB

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