tcinl.pas 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Type checking and register allocation for inline nodes
  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 tcinl;
  19. interface
  20. uses
  21. tree;
  22. procedure firstinline(var p : ptree);
  23. implementation
  24. uses
  25. cobjects,verbose,globals,systems,
  26. globtype,
  27. symconst,symtable,aasm,types,
  28. hcodegen,htypechk,pass_1,
  29. tccal,cpubase
  30. {$ifdef i386}
  31. ,tgeni386
  32. {$endif}
  33. ;
  34. {*****************************************************************************
  35. FirstInLine
  36. *****************************************************************************}
  37. procedure firstinline(var p : ptree);
  38. var
  39. vl,vl2 : longint;
  40. vr : bestreal;
  41. p1,hp,hpp : ptree;
  42. {$ifndef NOCOLONCHECK}
  43. frac_para,length_para : ptree;
  44. {$endif ndef NOCOLONCHECK}
  45. store_count_ref,
  46. isreal,
  47. dowrite,
  48. store_valid,
  49. file_is_typed : boolean;
  50. procedure do_lowhigh(adef : pdef);
  51. var
  52. v : longint;
  53. enum : penumsym;
  54. begin
  55. case Adef^.deftype of
  56. orddef:
  57. begin
  58. if p^.inlinenumber=in_low_x then
  59. v:=porddef(Adef)^.low
  60. else
  61. v:=porddef(Adef)^.high;
  62. hp:=genordinalconstnode(v,adef);
  63. firstpass(hp);
  64. disposetree(p);
  65. p:=hp;
  66. end;
  67. enumdef:
  68. begin
  69. enum:=Penumdef(Adef)^.firstenum;
  70. if p^.inlinenumber=in_high_x then
  71. while enum^.nextenum<>nil do
  72. enum:=enum^.nextenum;
  73. hp:=genenumnode(enum);
  74. disposetree(p);
  75. p:=hp;
  76. end;
  77. else
  78. internalerror(87);
  79. end;
  80. end;
  81. function getconstrealvalue : bestreal;
  82. begin
  83. case p^.left^.treetype of
  84. ordconstn:
  85. getconstrealvalue:=p^.left^.value;
  86. realconstn:
  87. getconstrealvalue:=p^.left^.value_real;
  88. else
  89. internalerror(309992);
  90. end;
  91. end;
  92. procedure setconstrealvalue(r : bestreal);
  93. var
  94. hp : ptree;
  95. begin
  96. hp:=genrealconstnode(r,bestrealdef^);
  97. disposetree(p);
  98. p:=hp;
  99. firstpass(p);
  100. end;
  101. procedure handleextendedfunction;
  102. begin
  103. p^.location.loc:=LOC_FPU;
  104. p^.resulttype:=s80floatdef;
  105. if (p^.left^.resulttype^.deftype<>floatdef) or
  106. (pfloatdef(p^.left^.resulttype)^.typ<>s80real) then
  107. begin
  108. p^.left:=gentypeconvnode(p^.left,s80floatdef);
  109. firstpass(p^.left);
  110. end;
  111. p^.registers32:=p^.left^.registers32;
  112. p^.registersfpu:=p^.left^.registersfpu;
  113. {$ifdef SUPPORT_MMX}
  114. p^.registersmmx:=p^.left^.registersmmx;
  115. {$endif SUPPORT_MMX}
  116. end;
  117. begin
  118. store_valid:=must_be_valid;
  119. store_count_ref:=count_ref;
  120. count_ref:=false;
  121. if not (p^.inlinenumber in [in_read_x,in_readln_x,in_sizeof_x,
  122. in_typeof_x,in_ord_x,in_str_x_string,in_val_x,
  123. in_reset_typedfile,in_rewrite_typedfile]) then
  124. must_be_valid:=true
  125. else
  126. must_be_valid:=false;
  127. { if we handle writeln; p^.left contains no valid address }
  128. if assigned(p^.left) then
  129. begin
  130. if p^.left^.treetype=callparan then
  131. firstcallparan(p^.left,nil)
  132. else
  133. firstpass(p^.left);
  134. left_right_max(p);
  135. set_location(p^.location,p^.left^.location);
  136. end;
  137. { handle intern constant functions in separate case }
  138. if p^.inlineconst then
  139. begin
  140. hp:=nil;
  141. { no parameters? }
  142. if not assigned(p^.left) then
  143. begin
  144. case p^.inlinenumber of
  145. in_const_pi :
  146. hp:=genrealconstnode(pi,bestrealdef^);
  147. else
  148. internalerror(89);
  149. end;
  150. end
  151. else
  152. { process constant expression with parameter }
  153. begin
  154. vl:=0;
  155. vl2:=0; { second parameter Ex: ptr(vl,vl2) }
  156. vr:=0;
  157. isreal:=false;
  158. case p^.left^.treetype of
  159. realconstn :
  160. begin
  161. isreal:=true;
  162. vr:=p^.left^.value_real;
  163. end;
  164. ordconstn :
  165. vl:=p^.left^.value;
  166. callparan :
  167. begin
  168. { both exists, else it was not generated }
  169. vl:=p^.left^.left^.value;
  170. vl2:=p^.left^.right^.left^.value;
  171. end;
  172. else
  173. CGMessage(cg_e_illegal_expression);
  174. end;
  175. case p^.inlinenumber of
  176. in_const_trunc :
  177. begin
  178. if isreal then
  179. begin
  180. if (vr>=2147483648.0) or (vr<=-2147483649.0) then
  181. begin
  182. CGMessage(parser_e_range_check_error);
  183. hp:=genordinalconstnode(1,s32bitdef)
  184. end
  185. else
  186. hp:=genordinalconstnode(trunc(vr),s32bitdef)
  187. end
  188. else
  189. hp:=genordinalconstnode(trunc(vl),s32bitdef);
  190. end;
  191. in_const_round :
  192. begin
  193. if isreal then
  194. begin
  195. if (vr>=2147483647.5) or (vr<=-2147483648.5) then
  196. begin
  197. CGMessage(parser_e_range_check_error);
  198. hp:=genordinalconstnode(1,s32bitdef)
  199. end
  200. else
  201. hp:=genordinalconstnode(round(vr),s32bitdef)
  202. end
  203. else
  204. hp:=genordinalconstnode(round(vl),s32bitdef);
  205. end;
  206. in_const_frac :
  207. begin
  208. if isreal then
  209. hp:=genrealconstnode(frac(vr),bestrealdef^)
  210. else
  211. hp:=genrealconstnode(frac(vl),bestrealdef^);
  212. end;
  213. in_const_int :
  214. begin
  215. if isreal then
  216. hp:=genrealconstnode(int(vr),bestrealdef^)
  217. else
  218. hp:=genrealconstnode(int(vl),bestrealdef^);
  219. end;
  220. in_const_abs :
  221. begin
  222. if isreal then
  223. hp:=genrealconstnode(abs(vr),bestrealdef^)
  224. else
  225. hp:=genordinalconstnode(abs(vl),p^.left^.resulttype);
  226. end;
  227. in_const_sqr :
  228. begin
  229. if isreal then
  230. hp:=genrealconstnode(sqr(vr),bestrealdef^)
  231. else
  232. hp:=genordinalconstnode(sqr(vl),p^.left^.resulttype);
  233. end;
  234. in_const_odd :
  235. begin
  236. if isreal then
  237. CGMessage1(type_e_integer_expr_expected,p^.left^.resulttype^.typename)
  238. else
  239. hp:=genordinalconstnode(byte(odd(vl)),booldef);
  240. end;
  241. in_const_swap_word :
  242. begin
  243. if isreal then
  244. CGMessage1(type_e_integer_expr_expected,p^.left^.resulttype^.typename)
  245. else
  246. hp:=genordinalconstnode((vl and $ff) shl 8+(vl shr 8),p^.left^.resulttype);
  247. end;
  248. in_const_swap_long :
  249. begin
  250. if isreal then
  251. CGMessage(type_e_mismatch)
  252. else
  253. hp:=genordinalconstnode((vl and $ffff) shl 16+(vl shr 16),p^.left^.resulttype);
  254. end;
  255. in_const_ptr :
  256. begin
  257. if isreal then
  258. CGMessage(type_e_mismatch)
  259. else
  260. hp:=genordinalconstnode((vl2 shl 16) or vl,voidpointerdef);
  261. end;
  262. in_const_sqrt :
  263. begin
  264. if isreal then
  265. begin
  266. if vr<0.0 then
  267. CGMessage(type_e_wrong_math_argument)
  268. else
  269. hp:=genrealconstnode(sqrt(vr),bestrealdef^)
  270. end
  271. else
  272. begin
  273. if vl<0 then
  274. CGMessage(type_e_wrong_math_argument)
  275. else
  276. hp:=genrealconstnode(sqrt(vl),bestrealdef^);
  277. end;
  278. end;
  279. in_const_arctan :
  280. begin
  281. if isreal then
  282. hp:=genrealconstnode(arctan(vr),bestrealdef^)
  283. else
  284. hp:=genrealconstnode(arctan(vl),bestrealdef^);
  285. end;
  286. in_const_cos :
  287. begin
  288. if isreal then
  289. hp:=genrealconstnode(cos(vr),bestrealdef^)
  290. else
  291. hp:=genrealconstnode(cos(vl),bestrealdef^);
  292. end;
  293. in_const_sin :
  294. begin
  295. if isreal then
  296. hp:=genrealconstnode(sin(vr),bestrealdef^)
  297. else
  298. hp:=genrealconstnode(sin(vl),bestrealdef^);
  299. end;
  300. in_const_exp :
  301. begin
  302. if isreal then
  303. hp:=genrealconstnode(exp(vr),bestrealdef^)
  304. else
  305. hp:=genrealconstnode(exp(vl),bestrealdef^);
  306. end;
  307. in_const_ln :
  308. begin
  309. if isreal then
  310. begin
  311. if vr<=0.0 then
  312. CGMessage(type_e_wrong_math_argument)
  313. else
  314. hp:=genrealconstnode(ln(vr),bestrealdef^)
  315. end
  316. else
  317. begin
  318. if vl<=0 then
  319. CGMessage(type_e_wrong_math_argument)
  320. else
  321. hp:=genrealconstnode(ln(vl),bestrealdef^);
  322. end;
  323. end;
  324. else
  325. internalerror(88);
  326. end;
  327. end;
  328. disposetree(p);
  329. if hp=nil then
  330. hp:=genzeronode(errorn);
  331. firstpass(hp);
  332. p:=hp;
  333. end
  334. else
  335. begin
  336. case p^.inlinenumber of
  337. in_lo_qword,
  338. in_hi_qword,
  339. in_lo_long,
  340. in_hi_long,
  341. in_lo_word,
  342. in_hi_word:
  343. begin
  344. if p^.registers32<1 then
  345. p^.registers32:=1;
  346. if p^.inlinenumber in [in_lo_word,in_hi_word] then
  347. p^.resulttype:=u8bitdef
  348. else if p^.inlinenumber in [in_lo_qword,in_hi_qword] then
  349. begin
  350. p^.resulttype:=u32bitdef;
  351. if (m_tp in aktmodeswitches) or
  352. (m_delphi in aktmodeswitches) then
  353. CGMessage(type_w_maybe_wrong_hi_lo);
  354. end
  355. else
  356. begin
  357. p^.resulttype:=u16bitdef;
  358. if (m_tp in aktmodeswitches) or
  359. (m_delphi in aktmodeswitches) then
  360. CGMessage(type_w_maybe_wrong_hi_lo);
  361. end;
  362. p^.location.loc:=LOC_REGISTER;
  363. if not is_integer(p^.left^.resulttype) then
  364. CGMessage(type_e_mismatch)
  365. else
  366. begin
  367. if p^.left^.treetype=ordconstn then
  368. begin
  369. case p^.inlinenumber of
  370. in_lo_word : hp:=genordinalconstnode(p^.left^.value and $ff,p^.left^.resulttype);
  371. in_hi_word : hp:=genordinalconstnode(p^.left^.value shr 8,p^.left^.resulttype);
  372. in_lo_long : hp:=genordinalconstnode(p^.left^.value and $ffff,p^.left^.resulttype);
  373. in_hi_long : hp:=genordinalconstnode(p^.left^.value shr 16,p^.left^.resulttype);
  374. in_lo_qword : hp:=genordinalconstnode(p^.left^.value and $ffffffff,p^.left^.resulttype);
  375. in_hi_qword : hp:=genordinalconstnode(p^.left^.value shr 32,p^.left^.resulttype);
  376. end;
  377. disposetree(p);
  378. firstpass(hp);
  379. p:=hp;
  380. end;
  381. end;
  382. end;
  383. in_sizeof_x:
  384. begin
  385. if push_high_param(p^.left^.resulttype) then
  386. begin
  387. getsymonlyin(p^.left^.symtable,'high'+pvarsym(p^.left^.symtableentry)^.name);
  388. hp:=gennode(addn,genloadnode(pvarsym(srsym),p^.left^.symtable),
  389. genordinalconstnode(1,s32bitdef));
  390. if (p^.left^.resulttype^.deftype=arraydef) and
  391. (parraydef(p^.left^.resulttype)^.elesize<>1) then
  392. hp:=gennode(muln,hp,genordinalconstnode(parraydef(p^.left^.resulttype)^.elesize,s32bitdef));
  393. disposetree(p);
  394. p:=hp;
  395. firstpass(p);
  396. end;
  397. if p^.registers32<1 then
  398. p^.registers32:=1;
  399. p^.resulttype:=s32bitdef;
  400. p^.location.loc:=LOC_REGISTER;
  401. end;
  402. in_typeof_x:
  403. begin
  404. if p^.registers32<1 then
  405. p^.registers32:=1;
  406. p^.location.loc:=LOC_REGISTER;
  407. p^.resulttype:=voidpointerdef;
  408. end;
  409. in_ord_x:
  410. begin
  411. if (p^.left^.treetype=ordconstn) then
  412. begin
  413. hp:=genordinalconstnode(p^.left^.value,s32bitdef);
  414. disposetree(p);
  415. p:=hp;
  416. firstpass(p);
  417. end
  418. else
  419. begin
  420. if (p^.left^.resulttype^.deftype=orddef) then
  421. if (porddef(p^.left^.resulttype)^.typ in [uchar,bool8bit]) then
  422. begin
  423. if porddef(p^.left^.resulttype)^.typ=bool8bit then
  424. begin
  425. hp:=gentypeconvnode(p^.left,u8bitdef);
  426. putnode(p);
  427. p:=hp;
  428. p^.convtyp:=tc_bool_2_int;
  429. p^.explizit:=true;
  430. firstpass(p);
  431. end
  432. else
  433. begin
  434. hp:=gentypeconvnode(p^.left,u8bitdef);
  435. putnode(p);
  436. p:=hp;
  437. p^.explizit:=true;
  438. firstpass(p);
  439. end;
  440. end
  441. { can this happen ? }
  442. else if (porddef(p^.left^.resulttype)^.typ=uvoid) then
  443. CGMessage(type_e_mismatch)
  444. else
  445. { all other orddef need no transformation }
  446. begin
  447. hp:=p^.left;
  448. putnode(p);
  449. p:=hp;
  450. end
  451. else if (p^.left^.resulttype^.deftype=enumdef) then
  452. begin
  453. hp:=gentypeconvnode(p^.left,s32bitdef);
  454. putnode(p);
  455. p:=hp;
  456. p^.explizit:=true;
  457. firstpass(p);
  458. end
  459. else
  460. begin
  461. { can anything else be ord() ?}
  462. CGMessage(type_e_mismatch);
  463. end;
  464. end;
  465. end;
  466. in_chr_byte:
  467. begin
  468. hp:=gentypeconvnode(p^.left,cchardef);
  469. putnode(p);
  470. p:=hp;
  471. p^.explizit:=true;
  472. firstpass(p);
  473. end;
  474. in_length_string:
  475. begin
  476. if is_ansistring(p^.left^.resulttype) then
  477. p^.resulttype:=s32bitdef
  478. else
  479. p^.resulttype:=u8bitdef;
  480. { we don't need string conversations here }
  481. if (p^.left^.treetype=typeconvn) and
  482. (p^.left^.left^.resulttype^.deftype=stringdef) then
  483. begin
  484. hp:=p^.left^.left;
  485. putnode(p^.left);
  486. p^.left:=hp;
  487. end;
  488. { check the type, must be string or char }
  489. if (p^.left^.resulttype^.deftype<>stringdef) and
  490. (not is_char(p^.left^.resulttype)) then
  491. CGMessage(type_e_mismatch);
  492. { evaluates length of constant strings direct }
  493. if (p^.left^.treetype=stringconstn) then
  494. begin
  495. hp:=genordinalconstnode(p^.left^.length,s32bitdef);
  496. disposetree(p);
  497. firstpass(hp);
  498. p:=hp;
  499. end
  500. { length of char is one allways }
  501. else if is_constcharnode(p^.left) then
  502. begin
  503. hp:=genordinalconstnode(1,s32bitdef);
  504. disposetree(p);
  505. firstpass(hp);
  506. p:=hp;
  507. end;
  508. end;
  509. in_assigned_x:
  510. begin
  511. p^.resulttype:=booldef;
  512. p^.location.loc:=LOC_FLAGS;
  513. end;
  514. in_pred_x,
  515. in_succ_x:
  516. begin
  517. inc(p^.registers32);
  518. p^.resulttype:=p^.left^.resulttype;
  519. p^.location.loc:=LOC_REGISTER;
  520. if not is_ordinal(p^.resulttype) then
  521. CGMessage(type_e_ordinal_expr_expected)
  522. else
  523. begin
  524. if (p^.resulttype^.deftype=enumdef) and
  525. (penumdef(p^.resulttype)^.has_jumps) then
  526. CGMessage(type_e_succ_and_pred_enums_with_assign_not_possible)
  527. else
  528. if p^.left^.treetype=ordconstn then
  529. begin
  530. if p^.inlinenumber=in_succ_x then
  531. hp:=genordinalconstnode(p^.left^.value+1,p^.left^.resulttype)
  532. else
  533. hp:=genordinalconstnode(p^.left^.value-1,p^.left^.resulttype);
  534. disposetree(p);
  535. firstpass(hp);
  536. p:=hp;
  537. end;
  538. end;
  539. end;
  540. in_inc_x,
  541. in_dec_x:
  542. begin
  543. p^.resulttype:=voiddef;
  544. if assigned(p^.left) then
  545. begin
  546. firstcallparan(p^.left,nil);
  547. if codegenerror then
  548. exit;
  549. { first param must be var }
  550. if p^.left^.left^.location.loc<>LOC_REFERENCE then
  551. CGMessage(type_e_argument_must_be_lvalue);
  552. { check type }
  553. if (p^.left^.resulttype^.deftype in [enumdef,pointerdef]) or
  554. is_ordinal(p^.left^.resulttype) then
  555. begin
  556. { two paras ? }
  557. if assigned(p^.left^.right) then
  558. begin
  559. { insert a type conversion }
  560. { the second param is always longint }
  561. p^.left^.right^.left:=gentypeconvnode(p^.left^.right^.left,s32bitdef);
  562. { check the type conversion }
  563. firstpass(p^.left^.right^.left);
  564. { need we an additional register ? }
  565. if not(is_constintnode(p^.left^.right^.left)) and
  566. (p^.left^.right^.left^.location.loc in [LOC_MEM,LOC_REFERENCE]) and
  567. (p^.left^.right^.left^.registers32<=1) then
  568. inc(p^.registers32);
  569. { do we need an additional register to restore the first parameter? }
  570. if p^.left^.right^.left^.registers32>=p^.registers32 then
  571. inc(p^.registers32);
  572. if assigned(p^.left^.right^.right) then
  573. CGMessage(cg_e_illegal_expression);
  574. end;
  575. end
  576. else
  577. CGMessage(type_e_ordinal_expr_expected);
  578. end
  579. else
  580. CGMessage(type_e_mismatch);
  581. end;
  582. in_read_x,
  583. in_readln_x,
  584. in_write_x,
  585. in_writeln_x :
  586. begin
  587. { needs a call }
  588. procinfo^.flags:=procinfo^.flags or pi_do_call;
  589. p^.resulttype:=voiddef;
  590. { we must know if it is a typed file or not }
  591. { but we must first do the firstpass for it }
  592. file_is_typed:=false;
  593. if assigned(p^.left) then
  594. begin
  595. dowrite:=(p^.inlinenumber in [in_write_x,in_writeln_x]);
  596. firstcallparan(p^.left,nil);
  597. { now we can check }
  598. hp:=p^.left;
  599. while assigned(hp^.right) do
  600. hp:=hp^.right;
  601. { if resulttype is not assigned, then automatically }
  602. { file is not typed. }
  603. if assigned(hp) and assigned(hp^.resulttype) then
  604. Begin
  605. if (hp^.resulttype^.deftype=filedef) and
  606. (pfiledef(hp^.resulttype)^.filetype=ft_typed) then
  607. begin
  608. file_is_typed:=true;
  609. { test the type }
  610. hpp:=p^.left;
  611. while (hpp<>hp) do
  612. begin
  613. if (hpp^.left^.treetype=typen) then
  614. CGMessage(type_e_cant_read_write_type);
  615. if not is_equal(hpp^.resulttype,pfiledef(hp^.resulttype)^.typed_as) then
  616. CGMessage(type_e_mismatch);
  617. { generate the high() value for the shortstring }
  618. if ((not dowrite) and is_shortstring(hpp^.left^.resulttype)) or
  619. (is_chararray(hpp^.left^.resulttype)) then
  620. gen_high_tree(hpp,true);
  621. hpp:=hpp^.right;
  622. end;
  623. end;
  624. end; { endif assigned(hp) }
  625. { insert type conversions for write(ln) }
  626. if (not file_is_typed) then
  627. begin
  628. hp:=p^.left;
  629. while assigned(hp) do
  630. begin
  631. if (hp^.left^.treetype=typen) then
  632. CGMessage(type_e_cant_read_write_type);
  633. if assigned(hp^.left^.resulttype) then
  634. begin
  635. isreal:=false;
  636. { support writeln(procvar) }
  637. if (hp^.left^.resulttype^.deftype=procvardef) then
  638. begin
  639. p1:=gencallnode(nil,nil);
  640. p1^.right:=hp^.left;
  641. p1^.resulttype:=pprocvardef(hp^.left^.resulttype)^.retdef;
  642. firstpass(p1);
  643. hp^.left:=p1;
  644. end;
  645. case hp^.left^.resulttype^.deftype of
  646. filedef :
  647. begin
  648. { only allowed as first parameter }
  649. if assigned(hp^.right) then
  650. CGMessage(type_e_cant_read_write_type);
  651. end;
  652. stringdef :
  653. begin
  654. { generate the high() value for the shortstring }
  655. if (not dowrite) and
  656. is_shortstring(hp^.left^.resulttype) then
  657. gen_high_tree(hp,true);
  658. end;
  659. pointerdef :
  660. begin
  661. if not is_pchar(hp^.left^.resulttype) then
  662. CGMessage(type_e_cant_read_write_type);
  663. end;
  664. floatdef :
  665. begin
  666. isreal:=true;
  667. end;
  668. orddef :
  669. begin
  670. case porddef(hp^.left^.resulttype)^.typ of
  671. uchar,
  672. u32bit,s32bit,
  673. u64bit,s64bit:
  674. ;
  675. u8bit,s8bit,
  676. u16bit,s16bit :
  677. if dowrite then
  678. hp^.left:=gentypeconvnode(hp^.left,s32bitdef);
  679. bool8bit,
  680. bool16bit,
  681. bool32bit :
  682. if dowrite then
  683. hp^.left:=gentypeconvnode(hp^.left,booldef)
  684. else
  685. CGMessage(type_e_cant_read_write_type);
  686. else
  687. CGMessage(type_e_cant_read_write_type);
  688. end;
  689. end;
  690. arraydef :
  691. begin
  692. if is_chararray(hp^.left^.resulttype) then
  693. gen_high_tree(hp,true)
  694. else
  695. CGMessage(type_e_cant_read_write_type);
  696. end;
  697. else
  698. CGMessage(type_e_cant_read_write_type);
  699. end;
  700. { some format options ? }
  701. if hp^.is_colon_para then
  702. begin
  703. if hp^.right^.is_colon_para then
  704. begin
  705. frac_para:=hp;
  706. length_para:=hp^.right;
  707. hp:=hp^.right;
  708. hpp:=hp^.right;
  709. end
  710. else
  711. begin
  712. length_para:=hp;
  713. frac_para:=nil;
  714. hpp:=hp^.right;
  715. end;
  716. isreal:=(hpp^.left^.resulttype^.deftype=floatdef);
  717. if (not is_integer(length_para^.left^.resulttype)) then
  718. CGMessage1(type_e_integer_expr_expected,length_para^.left^.resulttype^.typename)
  719. else
  720. length_para^.left:=gentypeconvnode(length_para^.left,s32bitdef);
  721. if assigned(frac_para) then
  722. begin
  723. if isreal then
  724. begin
  725. if (not is_integer(frac_para^.left^.resulttype)) then
  726. CGMessage1(type_e_integer_expr_expected,frac_para^.left^.resulttype^.typename)
  727. else
  728. frac_para^.left:=gentypeconvnode(frac_para^.left,s32bitdef);
  729. end
  730. else
  731. CGMessage(parser_e_illegal_colon_qualifier);
  732. end;
  733. { do the checking for the colon'd arg }
  734. hp:=length_para;
  735. end;
  736. end;
  737. hp:=hp^.right;
  738. end;
  739. end;
  740. { pass all parameters again for the typeconversions }
  741. if codegenerror then
  742. exit;
  743. must_be_valid:=true;
  744. firstcallparan(p^.left,nil);
  745. { calc registers }
  746. left_right_max(p);
  747. end;
  748. end;
  749. in_settextbuf_file_x :
  750. begin
  751. { warning here p^.left is the callparannode
  752. not the argument directly }
  753. { p^.left^.left is text var }
  754. { p^.left^.right^.left is the buffer var }
  755. { firstcallparan(p^.left,nil);
  756. already done in firstcalln }
  757. { now we know the type of buffer }
  758. getsymonlyin(systemunit,'SETTEXTBUF');
  759. hp:=gencallnode(pprocsym(srsym),systemunit);
  760. hp^.left:=gencallparanode(
  761. genordinalconstnode(p^.left^.left^.resulttype^.size,s32bitdef),p^.left);
  762. putnode(p);
  763. p:=hp;
  764. firstpass(p);
  765. end;
  766. { the firstpass of the arg has been done in firstcalln ? }
  767. in_reset_typedfile,
  768. in_rewrite_typedfile :
  769. begin
  770. procinfo^.flags:=procinfo^.flags or pi_do_call;
  771. { to be sure the right definition is loaded }
  772. p^.left^.resulttype:=nil;
  773. firstpass(p^.left);
  774. p^.resulttype:=voiddef;
  775. end;
  776. in_str_x_string :
  777. begin
  778. procinfo^.flags:=procinfo^.flags or pi_do_call;
  779. p^.resulttype:=voiddef;
  780. { check the amount of parameters }
  781. if not(assigned(p^.left)) or
  782. not(assigned(p^.left^.right)) then
  783. begin
  784. CGMessage(parser_e_wrong_parameter_size);
  785. exit;
  786. end;
  787. { first pass just the string for first local use }
  788. hp:=p^.left^.right;
  789. must_be_valid:=false;
  790. count_ref:=true;
  791. p^.left^.right:=nil;
  792. firstcallparan(p^.left,nil);
  793. { remove warning when result is passed }
  794. if (p^.left^.left^.treetype=funcretn) then
  795. procinfo^.funcret_is_valid:=true;
  796. must_be_valid:=true;
  797. p^.left^.right:=hp;
  798. firstcallparan(p^.left^.right,nil);
  799. hp:=p^.left;
  800. { valid string ? }
  801. if not assigned(hp) or
  802. (hp^.left^.resulttype^.deftype<>stringdef) or
  803. (hp^.right=nil) or
  804. (hp^.left^.location.loc<>LOC_REFERENCE) then
  805. CGMessage(cg_e_illegal_expression);
  806. { generate the high() value for the shortstring }
  807. if is_shortstring(hp^.left^.resulttype) then
  808. gen_high_tree(hp,true);
  809. { !!!! check length of string }
  810. while assigned(hp^.right) do
  811. hp:=hp^.right;
  812. { check and convert the first param }
  813. if hp^.is_colon_para then
  814. CGMessage(cg_e_illegal_expression);
  815. isreal:=false;
  816. case hp^.resulttype^.deftype of
  817. orddef :
  818. begin
  819. case porddef(hp^.left^.resulttype)^.typ of
  820. u32bit,s32bit,
  821. s64bit,u64bit:
  822. ;
  823. u8bit,s8bit,
  824. u16bit,s16bit:
  825. hp^.left:=gentypeconvnode(hp^.left,s32bitdef);
  826. else
  827. CGMessage(type_e_integer_or_real_expr_expected);
  828. end;
  829. end;
  830. floatdef :
  831. begin
  832. isreal:=true;
  833. end;
  834. else
  835. CGMessage(type_e_integer_or_real_expr_expected);
  836. end;
  837. { some format options ? }
  838. hpp:=p^.left^.right;
  839. if assigned(hpp) and hpp^.is_colon_para then
  840. begin
  841. if (not is_integer(hpp^.resulttype)) then
  842. CGMessage1(type_e_integer_expr_expected,hpp^.resulttype^.typename)
  843. else
  844. hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
  845. hpp:=hpp^.right;
  846. if assigned(hpp) and hpp^.is_colon_para then
  847. begin
  848. if isreal then
  849. begin
  850. if (not is_integer(hpp^.resulttype)) then
  851. CGMessage1(type_e_integer_expr_expected,hpp^.resulttype^.typename)
  852. else
  853. hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
  854. end
  855. else
  856. CGMessage(parser_e_illegal_colon_qualifier);
  857. end;
  858. end;
  859. { for first local use }
  860. must_be_valid:=false;
  861. count_ref:=true;
  862. { pass all parameters again for the typeconversions }
  863. if codegenerror then
  864. exit;
  865. must_be_valid:=true;
  866. firstcallparan(p^.left,nil);
  867. { calc registers }
  868. left_right_max(p);
  869. end;
  870. in_val_x :
  871. begin
  872. procinfo^.flags:=procinfo^.flags or pi_do_call;
  873. p^.resulttype:=voiddef;
  874. { check the amount of parameters }
  875. if not(assigned(p^.left)) or
  876. not(assigned(p^.left^.right)) then
  877. begin
  878. CGMessage(parser_e_wrong_parameter_size);
  879. exit;
  880. end;
  881. If Assigned(p^.left^.right^.right) Then
  882. {there is a "code" parameter}
  883. Begin
  884. { first pass just the code parameter for first local use}
  885. hp := p^.left^.right;
  886. p^.left^.right := nil;
  887. must_be_valid := false;
  888. count_ref := true;
  889. make_not_regable(p^.left^.left);
  890. firstcallparan(p^.left, nil);
  891. if codegenerror then exit;
  892. p^.left^.right := hp;
  893. {code has to be a var parameter}
  894. if (p^.left^.left^.location.loc<>LOC_REFERENCE) then
  895. CGMessage(type_e_variable_id_expected)
  896. else
  897. if (p^.left^.left^.resulttype^.deftype <> orddef) or
  898. not(porddef(p^.left^.left^.resulttype)^.typ in
  899. [u16bit,s16bit,u32bit,s32bit]) then
  900. CGMessage(type_e_mismatch);
  901. hpp := p^.left^.right
  902. End
  903. Else hpp := p^.left;
  904. {now hpp = the destination value tree}
  905. { first pass just the destination parameter for first local use}
  906. hp:=hpp^.right;
  907. must_be_valid:=false;
  908. count_ref:=true;
  909. hpp^.right:=nil;
  910. {hpp = destination}
  911. make_not_regable(hpp^.left);
  912. firstcallparan(hpp,nil);
  913. if codegenerror then
  914. exit;
  915. { remove warning when result is passed }
  916. if (hpp^.left^.treetype=funcretn) then
  917. procinfo^.funcret_is_valid:=true;
  918. hpp^.right := hp;
  919. if (hpp^.left^.location.loc<>LOC_REFERENCE) then
  920. CGMessage(type_e_variable_id_expected)
  921. else
  922. If Not((hpp^.left^.resulttype^.deftype = floatdef) or
  923. ((hpp^.left^.resulttype^.deftype = orddef) And
  924. (POrdDef(hpp^.left^.resulttype)^.typ in
  925. [u32bit,s32bit,
  926. u8bit,s8bit,u16bit,s16bit,s64bit,u64bit])))
  927. Then CGMessage(type_e_mismatch);
  928. must_be_valid:=true;
  929. {hp = source (String)}
  930. count_ref := false;
  931. must_be_valid := true;
  932. firstcallparan(hp,nil);
  933. if codegenerror then
  934. exit;
  935. { if not a stringdef then insert a type conv which
  936. does the other type checking }
  937. If (hp^.left^.resulttype^.deftype<>stringdef) then
  938. begin
  939. hp^.left:=gentypeconvnode(hp^.left,cshortstringdef);
  940. firstpass(hp);
  941. end;
  942. { calc registers }
  943. left_right_max(p);
  944. { val doesn't calculate the registers really }
  945. { correct, we need one register extra (FK) }
  946. if is_64bitint(hpp^.left^.resulttype) then
  947. inc(p^.registers32,2)
  948. else
  949. inc(p^.registers32,1);
  950. end;
  951. in_include_x_y,
  952. in_exclude_x_y:
  953. begin
  954. p^.resulttype:=voiddef;
  955. if assigned(p^.left) then
  956. begin
  957. firstcallparan(p^.left,nil);
  958. p^.registers32:=p^.left^.registers32;
  959. p^.registersfpu:=p^.left^.registersfpu;
  960. {$ifdef SUPPORT_MMX}
  961. p^.registersmmx:=p^.left^.registersmmx;
  962. {$endif SUPPORT_MMX}
  963. { remove warning when result is passed }
  964. if (p^.left^.left^.treetype=funcretn) then
  965. procinfo^.funcret_is_valid:=true;
  966. { first param must be var }
  967. if (p^.left^.left^.location.loc<>LOC_REFERENCE) and
  968. (p^.left^.left^.location.loc<>LOC_CREGISTER) then
  969. CGMessage(cg_e_illegal_expression);
  970. { check type }
  971. if (p^.left^.resulttype^.deftype=setdef) then
  972. begin
  973. { two paras ? }
  974. if assigned(p^.left^.right) then
  975. begin
  976. { insert a type conversion }
  977. { to the type of the set elements }
  978. p^.left^.right^.left:=gentypeconvnode(
  979. p^.left^.right^.left,
  980. psetdef(p^.left^.resulttype)^.setof);
  981. { check the type conversion }
  982. firstpass(p^.left^.right^.left);
  983. { only three parameters are allowed }
  984. if assigned(p^.left^.right^.right) then
  985. CGMessage(cg_e_illegal_expression);
  986. end;
  987. end
  988. else
  989. CGMessage(type_e_mismatch);
  990. end
  991. else
  992. CGMessage(type_e_mismatch);
  993. end;
  994. in_low_x,
  995. in_high_x:
  996. begin
  997. if p^.left^.treetype in [typen,loadn,subscriptn] then
  998. begin
  999. case p^.left^.resulttype^.deftype of
  1000. orddef,enumdef:
  1001. begin
  1002. do_lowhigh(p^.left^.resulttype);
  1003. firstpass(p);
  1004. end;
  1005. setdef:
  1006. begin
  1007. do_lowhigh(Psetdef(p^.left^.resulttype)^.setof);
  1008. firstpass(p);
  1009. end;
  1010. arraydef:
  1011. begin
  1012. if p^.inlinenumber=in_low_x then
  1013. begin
  1014. hp:=genordinalconstnode(Parraydef(p^.left^.resulttype)^.lowrange,
  1015. Parraydef(p^.left^.resulttype)^.rangedef);
  1016. disposetree(p);
  1017. p:=hp;
  1018. firstpass(p);
  1019. end
  1020. else
  1021. begin
  1022. if is_open_array(p^.left^.resulttype) or
  1023. is_array_of_const(p^.left^.resulttype) then
  1024. begin
  1025. getsymonlyin(p^.left^.symtable,'high'+pvarsym(p^.left^.symtableentry)^.name);
  1026. hp:=genloadnode(pvarsym(srsym),p^.left^.symtable);
  1027. disposetree(p);
  1028. p:=hp;
  1029. firstpass(p);
  1030. end
  1031. else
  1032. begin
  1033. hp:=genordinalconstnode(Parraydef(p^.left^.resulttype)^.highrange,
  1034. Parraydef(p^.left^.resulttype)^.rangedef);
  1035. disposetree(p);
  1036. p:=hp;
  1037. firstpass(p);
  1038. end;
  1039. end;
  1040. end;
  1041. stringdef:
  1042. begin
  1043. if p^.inlinenumber=in_low_x then
  1044. begin
  1045. hp:=genordinalconstnode(0,u8bitdef);
  1046. disposetree(p);
  1047. p:=hp;
  1048. firstpass(p);
  1049. end
  1050. else
  1051. begin
  1052. if is_open_string(p^.left^.resulttype) then
  1053. begin
  1054. getsymonlyin(p^.left^.symtable,'high'+pvarsym(p^.left^.symtableentry)^.name);
  1055. hp:=genloadnode(pvarsym(srsym),p^.left^.symtable);
  1056. disposetree(p);
  1057. p:=hp;
  1058. firstpass(p);
  1059. end
  1060. else
  1061. begin
  1062. hp:=genordinalconstnode(Pstringdef(p^.left^.resulttype)^.len,u8bitdef);
  1063. disposetree(p);
  1064. p:=hp;
  1065. firstpass(p);
  1066. end;
  1067. end;
  1068. end;
  1069. else
  1070. CGMessage(type_e_mismatch);
  1071. end;
  1072. end
  1073. else
  1074. CGMessage(type_e_varid_or_typeid_expected);
  1075. end;
  1076. in_cos_extended:
  1077. begin
  1078. if p^.left^.treetype in [ordconstn,realconstn] then
  1079. setconstrealvalue(cos(getconstrealvalue))
  1080. else
  1081. handleextendedfunction;
  1082. end;
  1083. in_sin_extended:
  1084. begin
  1085. if p^.left^.treetype in [ordconstn,realconstn] then
  1086. setconstrealvalue(sin(getconstrealvalue))
  1087. else
  1088. handleextendedfunction;
  1089. end;
  1090. in_arctan_extended:
  1091. begin
  1092. if p^.left^.treetype in [ordconstn,realconstn] then
  1093. setconstrealvalue(arctan(getconstrealvalue))
  1094. else
  1095. handleextendedfunction;
  1096. end;
  1097. in_pi:
  1098. if block_type=bt_const then
  1099. setconstrealvalue(pi)
  1100. else
  1101. begin
  1102. p^.location.loc:=LOC_FPU;
  1103. p^.resulttype:=s80floatdef;
  1104. end;
  1105. in_abs_extended:
  1106. begin
  1107. if p^.left^.treetype in [ordconstn,realconstn] then
  1108. setconstrealvalue(abs(getconstrealvalue))
  1109. else
  1110. handleextendedfunction;
  1111. end;
  1112. in_sqr_extended:
  1113. begin
  1114. if p^.left^.treetype in [ordconstn,realconstn] then
  1115. setconstrealvalue(sqr(getconstrealvalue))
  1116. else
  1117. handleextendedfunction;
  1118. end;
  1119. in_sqrt_extended:
  1120. begin
  1121. if p^.left^.treetype in [ordconstn,realconstn] then
  1122. begin
  1123. vr:=getconstrealvalue;
  1124. if vr<0.0 then
  1125. begin
  1126. CGMessage(type_e_wrong_math_argument);
  1127. setconstrealvalue(0);
  1128. end
  1129. else
  1130. setconstrealvalue(sqrt(vr));
  1131. end
  1132. else
  1133. handleextendedfunction;
  1134. end;
  1135. in_ln_extended:
  1136. begin
  1137. if p^.left^.treetype in [ordconstn,realconstn] then
  1138. begin
  1139. vr:=getconstrealvalue;
  1140. if vr<=0.0 then
  1141. begin
  1142. CGMessage(type_e_wrong_math_argument);
  1143. setconstrealvalue(0);
  1144. end
  1145. else
  1146. setconstrealvalue(ln(vr));
  1147. end
  1148. else
  1149. handleextendedfunction;
  1150. end;
  1151. {$ifdef SUPPORT_MMX}
  1152. in_mmx_pcmpeqb..in_mmx_pcmpgtw:
  1153. begin
  1154. end;
  1155. {$endif SUPPORT_MMX}
  1156. in_assert_x_y :
  1157. begin
  1158. p^.resulttype:=voiddef;
  1159. if assigned(p^.left) then
  1160. begin
  1161. firstcallparan(p^.left,nil);
  1162. p^.registers32:=p^.left^.registers32;
  1163. p^.registersfpu:=p^.left^.registersfpu;
  1164. {$ifdef SUPPORT_MMX}
  1165. p^.registersmmx:=p^.left^.registersmmx;
  1166. {$endif SUPPORT_MMX}
  1167. { check type }
  1168. if is_boolean(p^.left^.resulttype) then
  1169. begin
  1170. { must always be a string }
  1171. p^.left^.right^.left:=gentypeconvnode(p^.left^.right^.left,cshortstringdef);
  1172. firstpass(p^.left^.right^.left);
  1173. end
  1174. else
  1175. CGMessage(type_e_mismatch);
  1176. end
  1177. else
  1178. CGMessage(type_e_mismatch);
  1179. end;
  1180. else
  1181. internalerror(8);
  1182. end;
  1183. end;
  1184. { generate an error if no resulttype is set }
  1185. if not assigned(p^.resulttype) then
  1186. p^.resulttype:=generrordef;
  1187. must_be_valid:=store_valid;
  1188. count_ref:=store_count_ref;
  1189. end;
  1190. end.
  1191. {
  1192. $Log$
  1193. Revision 1.53 1999-09-28 20:48:27 florian
  1194. * fixed bug 610
  1195. + added $D- for TP in symtable.pas else it can't be compiled anymore
  1196. (too much symbols :()
  1197. Revision 1.52 1999/09/27 23:45:01 peter
  1198. * procinfo is now a pointer
  1199. * support for result setting in sub procedure
  1200. Revision 1.51 1999/09/15 20:35:46 florian
  1201. * small fix to operator overloading when in MMX mode
  1202. + the compiler uses now fldz and fld1 if possible
  1203. + some fixes to floating point registers
  1204. + some math. functions (arctan, ln, sin, cos, sqrt, sqr, pi) are now inlined
  1205. * .... ???
  1206. Revision 1.50 1999/09/07 14:05:11 pierre
  1207. * halt removed in do_lowhigh
  1208. Revision 1.49 1999/08/28 15:34:21 florian
  1209. * bug 519 fixed
  1210. Revision 1.48 1999/08/23 23:41:04 pierre
  1211. * in_inc_x register allocation corrected
  1212. Revision 1.47 1999/08/06 12:43:13 jonas
  1213. * fix for regvars with the val code
  1214. Revision 1.46 1999/08/05 16:53:23 peter
  1215. * V_Fatal=1, all other V_ are also increased
  1216. * Check for local procedure when assigning procvar
  1217. * fixed comment parsing because directives
  1218. * oldtp mode directives better supported
  1219. * added some messages to errore.msg
  1220. Revision 1.45 1999/08/04 00:23:40 florian
  1221. * renamed i386asm and i386base to cpuasm and cpubase
  1222. Revision 1.44 1999/08/03 22:03:32 peter
  1223. * moved bitmask constants to sets
  1224. * some other type/const renamings
  1225. Revision 1.43 1999/07/30 12:28:43 peter
  1226. * fixed crash with unknown id and colon parameter in write
  1227. Revision 1.42 1999/07/18 14:47:35 florian
  1228. * bug 487 fixed, (inc(<property>) isn't allowed)
  1229. * more fixes to compile with Delphi
  1230. Revision 1.41 1999/07/05 20:25:40 peter
  1231. * merged
  1232. Revision 1.40 1999/07/05 20:13:18 peter
  1233. * removed temp defines
  1234. Revision 1.39 1999/07/03 14:14:31 florian
  1235. + start of val(int64/qword)
  1236. * longbool, wordbool constants weren't written, fixed
  1237. Revision 1.38 1999/07/01 15:49:22 florian
  1238. * int64/qword type release
  1239. + lo/hi for int64/qword
  1240. Revision 1.37 1999/06/25 10:02:56 florian
  1241. * bug 459 fixed
  1242. Revision 1.36 1999/06/15 18:58:36 peter
  1243. * merged
  1244. Revision 1.35.2.2 1999/07/05 20:06:46 peter
  1245. * give error instead of warning for ln(0) and sqrt(0)
  1246. Revision 1.35.2.1 1999/06/15 18:54:54 peter
  1247. * more procvar fixes
  1248. Revision 1.35 1999/05/27 19:45:19 peter
  1249. * removed oldasm
  1250. * plabel -> pasmlabel
  1251. * -a switches to source writing automaticly
  1252. * assembler readers OOPed
  1253. * asmsymbol automaticly external
  1254. * jumptables and other label fixes for asm readers
  1255. Revision 1.34 1999/05/23 18:42:20 florian
  1256. * better error recovering in typed constants
  1257. * some problems with arrays of const fixed, some problems
  1258. due my previous
  1259. - the location type of array constructor is now LOC_MEM
  1260. - the pushing of high fixed
  1261. - parameter copying fixed
  1262. - zero temp. allocation removed
  1263. * small problem in the assembler writers fixed:
  1264. ref to nil wasn't written correctly
  1265. Revision 1.33 1999/05/06 09:05:35 peter
  1266. * generic write_float and str_float
  1267. * fixed constant float conversions
  1268. Revision 1.32 1999/05/05 22:25:21 florian
  1269. * fixed register allocation for val
  1270. Revision 1.31 1999/05/02 21:33:57 florian
  1271. * several bugs regarding -Or fixed
  1272. Revision 1.30 1999/05/01 13:24:53 peter
  1273. * merged nasm compiler
  1274. * old asm moved to oldasm/
  1275. Revision 1.29 1999/04/28 06:02:15 florian
  1276. * changes of Bruessel:
  1277. + message handler can now take an explicit self
  1278. * typinfo fixed: sometimes the type names weren't written
  1279. * the type checking for pointer comparisations and subtraction
  1280. and are now more strict (was also buggy)
  1281. * small bug fix to link.pas to support compiling on another
  1282. drive
  1283. * probable bug in popt386 fixed: call/jmp => push/jmp
  1284. transformation didn't count correctly the jmp references
  1285. + threadvar support
  1286. * warning if ln/sqrt gets an invalid constant argument
  1287. Revision 1.28 1999/04/26 18:28:12 peter
  1288. * better read/write array
  1289. Revision 1.27 1999/04/26 09:32:22 peter
  1290. * try to convert to string for val()
  1291. Revision 1.26 1999/04/15 14:10:51 pierre
  1292. * fix for bug0238.pp
  1293. Revision 1.25 1999/04/15 10:00:35 peter
  1294. * writeln(procvar) support for tp7 mode
  1295. Revision 1.24 1999/04/14 09:15:07 peter
  1296. * first things to store the symbol/def number in the ppu
  1297. Revision 1.23 1999/04/08 10:16:48 peter
  1298. * funcret_valid flag is set for inline functions
  1299. Revision 1.22 1999/03/26 00:05:48 peter
  1300. * released valintern
  1301. + deffile is now removed when compiling is finished
  1302. * ^( compiles now correct
  1303. + static directive
  1304. * shrd fixed
  1305. Revision 1.21 1999/03/24 23:17:37 peter
  1306. * fixed bugs 212,222,225,227,229,231,233
  1307. Revision 1.20 1999/03/16 17:52:55 jonas
  1308. * changes for internal Val code (do a "make cycle OPT=-dvalintern" to test)
  1309. * in cgi386inl: also range checking for subrange types (compile with "-dreadrangecheck")
  1310. * in cgai386: also small fixes to emitrangecheck
  1311. Revision 1.19 1999/02/22 12:36:34 florian
  1312. + warning for lo/hi(longint/dword) in -So and -Sd mode added
  1313. Revision 1.18 1999/02/22 02:15:49 peter
  1314. * updates for ag386bin
  1315. Revision 1.17 1999/02/01 00:00:50 florian
  1316. * compiler crash fixed when constant arguments passed to round/trunc
  1317. exceeds the longint range
  1318. Revision 1.16 1999/01/28 19:43:43 peter
  1319. * fixed high generation for ansistrings with str,writeln
  1320. Revision 1.15 1999/01/27 16:28:22 pierre
  1321. * bug0157 solved : write(x:5.3) is rejected now
  1322. Revision 1.14 1999/01/21 22:10:50 peter
  1323. * fixed array of const
  1324. * generic platform independent high() support
  1325. Revision 1.13 1998/12/30 22:13:13 peter
  1326. * check the amount of paras for Str()
  1327. Revision 1.12 1998/12/15 10:23:31 peter
  1328. + -iSO, -iSP, -iTO, -iTP
  1329. Revision 1.11 1998/12/11 23:36:08 florian
  1330. + again more stuff for int64/qword:
  1331. - comparision operators
  1332. - code generation for: str, read(ln), write(ln)
  1333. Revision 1.10 1998/11/27 14:50:53 peter
  1334. + open strings, $P switch support
  1335. Revision 1.9 1998/11/24 17:04:28 peter
  1336. * fixed length(char) when char is a variable
  1337. Revision 1.8 1998/11/14 10:51:33 peter
  1338. * fixed low/high for record.field
  1339. Revision 1.7 1998/11/13 10:15:52 peter
  1340. * fixed ptr() with constants
  1341. Revision 1.6 1998/11/05 12:03:05 peter
  1342. * released useansistring
  1343. * removed -Sv, its now available in fpc modes
  1344. Revision 1.5 1998/10/20 11:16:47 pierre
  1345. + length(c) where C is a char is allways 1
  1346. Revision 1.4 1998/10/06 20:49:11 peter
  1347. * m68k compiler compiles again
  1348. Revision 1.3 1998/10/05 12:32:49 peter
  1349. + assert() support
  1350. Revision 1.2 1998/10/02 09:24:23 peter
  1351. * more constant expression evaluators
  1352. Revision 1.1 1998/09/23 20:42:24 peter
  1353. * splitted pass_1
  1354. }