tcinl.pas 60 KB

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