tcinl.pas 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460
  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. if assigned(p^.left^.right^.right) then
  570. CGMessage(cg_e_illegal_expression);
  571. end;
  572. end
  573. else
  574. CGMessage(type_e_ordinal_expr_expected);
  575. end
  576. else
  577. CGMessage(type_e_mismatch);
  578. end;
  579. in_read_x,
  580. in_readln_x,
  581. in_write_x,
  582. in_writeln_x :
  583. begin
  584. { needs a call }
  585. procinfo.flags:=procinfo.flags or pi_do_call;
  586. p^.resulttype:=voiddef;
  587. { we must know if it is a typed file or not }
  588. { but we must first do the firstpass for it }
  589. file_is_typed:=false;
  590. if assigned(p^.left) then
  591. begin
  592. dowrite:=(p^.inlinenumber in [in_write_x,in_writeln_x]);
  593. firstcallparan(p^.left,nil);
  594. { now we can check }
  595. hp:=p^.left;
  596. while assigned(hp^.right) do
  597. hp:=hp^.right;
  598. { if resulttype is not assigned, then automatically }
  599. { file is not typed. }
  600. if assigned(hp) and assigned(hp^.resulttype) then
  601. Begin
  602. if (hp^.resulttype^.deftype=filedef) and
  603. (pfiledef(hp^.resulttype)^.filetype=ft_typed) then
  604. begin
  605. file_is_typed:=true;
  606. { test the type }
  607. hpp:=p^.left;
  608. while (hpp<>hp) do
  609. begin
  610. if (hpp^.left^.treetype=typen) then
  611. CGMessage(type_e_cant_read_write_type);
  612. if not is_equal(hpp^.resulttype,pfiledef(hp^.resulttype)^.typed_as) then
  613. CGMessage(type_e_mismatch);
  614. { generate the high() value for the shortstring }
  615. if ((not dowrite) and is_shortstring(hpp^.left^.resulttype)) or
  616. (is_chararray(hpp^.left^.resulttype)) then
  617. gen_high_tree(hpp,true);
  618. hpp:=hpp^.right;
  619. end;
  620. end;
  621. end; { endif assigned(hp) }
  622. { insert type conversions for write(ln) }
  623. if (not file_is_typed) then
  624. begin
  625. hp:=p^.left;
  626. while assigned(hp) do
  627. begin
  628. if (hp^.left^.treetype=typen) then
  629. CGMessage(type_e_cant_read_write_type);
  630. if assigned(hp^.left^.resulttype) then
  631. begin
  632. isreal:=false;
  633. { support writeln(procvar) }
  634. if (hp^.left^.resulttype^.deftype=procvardef) then
  635. begin
  636. p1:=gencallnode(nil,nil);
  637. p1^.right:=hp^.left;
  638. p1^.resulttype:=pprocvardef(hp^.left^.resulttype)^.retdef;
  639. firstpass(p1);
  640. hp^.left:=p1;
  641. end;
  642. case hp^.left^.resulttype^.deftype of
  643. filedef :
  644. begin
  645. { only allowed as first parameter }
  646. if assigned(hp^.right) then
  647. CGMessage(type_e_cant_read_write_type);
  648. end;
  649. stringdef :
  650. begin
  651. { generate the high() value for the shortstring }
  652. if (not dowrite) and
  653. is_shortstring(hp^.left^.resulttype) then
  654. gen_high_tree(hp,true);
  655. end;
  656. pointerdef :
  657. begin
  658. if not is_pchar(hp^.left^.resulttype) then
  659. CGMessage(type_e_cant_read_write_type);
  660. end;
  661. floatdef :
  662. begin
  663. isreal:=true;
  664. end;
  665. orddef :
  666. begin
  667. case porddef(hp^.left^.resulttype)^.typ of
  668. uchar,
  669. u32bit,s32bit,
  670. u64bit,s64bit:
  671. ;
  672. u8bit,s8bit,
  673. u16bit,s16bit :
  674. if dowrite then
  675. hp^.left:=gentypeconvnode(hp^.left,s32bitdef);
  676. bool8bit,
  677. bool16bit,
  678. bool32bit :
  679. if dowrite then
  680. hp^.left:=gentypeconvnode(hp^.left,booldef)
  681. else
  682. CGMessage(type_e_cant_read_write_type);
  683. else
  684. CGMessage(type_e_cant_read_write_type);
  685. end;
  686. end;
  687. arraydef :
  688. begin
  689. if is_chararray(hp^.left^.resulttype) then
  690. gen_high_tree(hp,true)
  691. else
  692. CGMessage(type_e_cant_read_write_type);
  693. end;
  694. else
  695. CGMessage(type_e_cant_read_write_type);
  696. end;
  697. { some format options ? }
  698. if hp^.is_colon_para then
  699. begin
  700. if hp^.right^.is_colon_para then
  701. begin
  702. frac_para:=hp;
  703. length_para:=hp^.right;
  704. hp:=hp^.right;
  705. hpp:=hp^.right;
  706. end
  707. else
  708. begin
  709. length_para:=hp;
  710. frac_para:=nil;
  711. hpp:=hp^.right;
  712. end;
  713. isreal:=(hpp^.left^.resulttype^.deftype=floatdef);
  714. if (not is_integer(length_para^.left^.resulttype)) then
  715. CGMessage1(type_e_integer_expr_expected,length_para^.left^.resulttype^.typename)
  716. else
  717. length_para^.left:=gentypeconvnode(length_para^.left,s32bitdef);
  718. if assigned(frac_para) then
  719. begin
  720. if isreal then
  721. begin
  722. if (not is_integer(frac_para^.left^.resulttype)) then
  723. CGMessage1(type_e_integer_expr_expected,frac_para^.left^.resulttype^.typename)
  724. else
  725. frac_para^.left:=gentypeconvnode(frac_para^.left,s32bitdef);
  726. end
  727. else
  728. CGMessage(parser_e_illegal_colon_qualifier);
  729. end;
  730. { do the checking for the colon'd arg }
  731. hp:=length_para;
  732. end;
  733. end;
  734. hp:=hp^.right;
  735. end;
  736. end;
  737. { pass all parameters again for the typeconversions }
  738. if codegenerror then
  739. exit;
  740. must_be_valid:=true;
  741. firstcallparan(p^.left,nil);
  742. { calc registers }
  743. left_right_max(p);
  744. end;
  745. end;
  746. in_settextbuf_file_x :
  747. begin
  748. { warning here p^.left is the callparannode
  749. not the argument directly }
  750. { p^.left^.left is text var }
  751. { p^.left^.right^.left is the buffer var }
  752. { firstcallparan(p^.left,nil);
  753. already done in firstcalln }
  754. { now we know the type of buffer }
  755. getsymonlyin(systemunit,'SETTEXTBUF');
  756. hp:=gencallnode(pprocsym(srsym),systemunit);
  757. hp^.left:=gencallparanode(
  758. genordinalconstnode(p^.left^.left^.resulttype^.size,s32bitdef),p^.left);
  759. putnode(p);
  760. p:=hp;
  761. firstpass(p);
  762. end;
  763. { the firstpass of the arg has been done in firstcalln ? }
  764. in_reset_typedfile,
  765. in_rewrite_typedfile :
  766. begin
  767. procinfo.flags:=procinfo.flags or pi_do_call;
  768. { to be sure the right definition is loaded }
  769. p^.left^.resulttype:=nil;
  770. firstpass(p^.left);
  771. p^.resulttype:=voiddef;
  772. end;
  773. in_str_x_string :
  774. begin
  775. procinfo.flags:=procinfo.flags or pi_do_call;
  776. p^.resulttype:=voiddef;
  777. { check the amount of parameters }
  778. if not(assigned(p^.left)) or
  779. not(assigned(p^.left^.right)) then
  780. begin
  781. CGMessage(parser_e_wrong_parameter_size);
  782. exit;
  783. end;
  784. { first pass just the string for first local use }
  785. hp:=p^.left^.right;
  786. must_be_valid:=false;
  787. count_ref:=true;
  788. p^.left^.right:=nil;
  789. firstcallparan(p^.left,nil);
  790. { remove warning when result is passed }
  791. if (p^.left^.left^.treetype=funcretn) then
  792. procinfo.funcret_is_valid:=true;
  793. must_be_valid:=true;
  794. p^.left^.right:=hp;
  795. firstcallparan(p^.left^.right,nil);
  796. hp:=p^.left;
  797. { valid string ? }
  798. if not assigned(hp) or
  799. (hp^.left^.resulttype^.deftype<>stringdef) or
  800. (hp^.right=nil) or
  801. (hp^.left^.location.loc<>LOC_REFERENCE) then
  802. CGMessage(cg_e_illegal_expression);
  803. { generate the high() value for the shortstring }
  804. if is_shortstring(hp^.left^.resulttype) then
  805. gen_high_tree(hp,true);
  806. { !!!! check length of string }
  807. while assigned(hp^.right) do
  808. hp:=hp^.right;
  809. { check and convert the first param }
  810. if hp^.is_colon_para then
  811. CGMessage(cg_e_illegal_expression);
  812. isreal:=false;
  813. case hp^.resulttype^.deftype of
  814. orddef :
  815. begin
  816. case porddef(hp^.left^.resulttype)^.typ of
  817. u32bit,s32bit,
  818. s64bit,u64bit:
  819. ;
  820. u8bit,s8bit,
  821. u16bit,s16bit:
  822. hp^.left:=gentypeconvnode(hp^.left,s32bitdef);
  823. else
  824. CGMessage(type_e_integer_or_real_expr_expected);
  825. end;
  826. end;
  827. floatdef :
  828. begin
  829. isreal:=true;
  830. end;
  831. else
  832. CGMessage(type_e_integer_or_real_expr_expected);
  833. end;
  834. { some format options ? }
  835. hpp:=p^.left^.right;
  836. if assigned(hpp) and hpp^.is_colon_para then
  837. begin
  838. if (not is_integer(hpp^.resulttype)) then
  839. CGMessage1(type_e_integer_expr_expected,hpp^.resulttype^.typename)
  840. else
  841. hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
  842. hpp:=hpp^.right;
  843. if assigned(hpp) and hpp^.is_colon_para then
  844. begin
  845. if isreal then
  846. begin
  847. if (not is_integer(hpp^.resulttype)) then
  848. CGMessage1(type_e_integer_expr_expected,hpp^.resulttype^.typename)
  849. else
  850. hpp^.left:=gentypeconvnode(hpp^.left,s32bitdef);
  851. end
  852. else
  853. CGMessage(parser_e_illegal_colon_qualifier);
  854. end;
  855. end;
  856. { for first local use }
  857. must_be_valid:=false;
  858. count_ref:=true;
  859. { pass all parameters again for the typeconversions }
  860. if codegenerror then
  861. exit;
  862. must_be_valid:=true;
  863. firstcallparan(p^.left,nil);
  864. { calc registers }
  865. left_right_max(p);
  866. end;
  867. in_val_x :
  868. begin
  869. procinfo.flags:=procinfo.flags or pi_do_call;
  870. p^.resulttype:=voiddef;
  871. { check the amount of parameters }
  872. if not(assigned(p^.left)) or
  873. not(assigned(p^.left^.right)) then
  874. begin
  875. CGMessage(parser_e_wrong_parameter_size);
  876. exit;
  877. end;
  878. If Assigned(p^.left^.right^.right) Then
  879. {there is a "code" parameter}
  880. Begin
  881. { first pass just the code parameter for first local use}
  882. hp := p^.left^.right;
  883. p^.left^.right := nil;
  884. must_be_valid := false;
  885. count_ref := true;
  886. make_not_regable(p^.left^.left);
  887. firstcallparan(p^.left, nil);
  888. if codegenerror then exit;
  889. p^.left^.right := hp;
  890. {code has to be a var parameter}
  891. if (p^.left^.left^.location.loc<>LOC_REFERENCE) then
  892. CGMessage(type_e_variable_id_expected)
  893. else
  894. if (p^.left^.left^.resulttype^.deftype <> orddef) or
  895. not(porddef(p^.left^.left^.resulttype)^.typ in
  896. [u16bit,s16bit,u32bit,s32bit]) then
  897. CGMessage(type_e_mismatch);
  898. hpp := p^.left^.right
  899. End
  900. Else hpp := p^.left;
  901. {now hpp = the destination value tree}
  902. { first pass just the destination parameter for first local use}
  903. hp:=hpp^.right;
  904. must_be_valid:=false;
  905. count_ref:=true;
  906. hpp^.right:=nil;
  907. {hpp = destination}
  908. make_not_regable(hpp^.left);
  909. firstcallparan(hpp,nil);
  910. if codegenerror then
  911. exit;
  912. { remove warning when result is passed }
  913. if (hpp^.left^.treetype=funcretn) then
  914. procinfo.funcret_is_valid:=true;
  915. hpp^.right := hp;
  916. if (hpp^.left^.location.loc<>LOC_REFERENCE) then
  917. CGMessage(type_e_variable_id_expected)
  918. else
  919. If Not((hpp^.left^.resulttype^.deftype = floatdef) or
  920. ((hpp^.left^.resulttype^.deftype = orddef) And
  921. (POrdDef(hpp^.left^.resulttype)^.typ in
  922. [u32bit,s32bit,
  923. u8bit,s8bit,u16bit,s16bit,s64bit,u64bit])))
  924. Then CGMessage(type_e_mismatch);
  925. must_be_valid:=true;
  926. {hp = source (String)}
  927. count_ref := false;
  928. must_be_valid := true;
  929. firstcallparan(hp,nil);
  930. if codegenerror then
  931. exit;
  932. { if not a stringdef then insert a type conv which
  933. does the other type checking }
  934. If (hp^.left^.resulttype^.deftype<>stringdef) then
  935. begin
  936. hp^.left:=gentypeconvnode(hp^.left,cshortstringdef);
  937. firstpass(hp);
  938. end;
  939. { calc registers }
  940. left_right_max(p);
  941. { val doesn't calculate the registers really }
  942. { correct, we need one register extra (FK) }
  943. if is_64bitint(hpp^.left^.resulttype) then
  944. inc(p^.registers32,2)
  945. else
  946. inc(p^.registers32,1);
  947. end;
  948. in_include_x_y,
  949. in_exclude_x_y:
  950. begin
  951. p^.resulttype:=voiddef;
  952. if assigned(p^.left) then
  953. begin
  954. firstcallparan(p^.left,nil);
  955. p^.registers32:=p^.left^.registers32;
  956. p^.registersfpu:=p^.left^.registersfpu;
  957. {$ifdef SUPPORT_MMX}
  958. p^.registersmmx:=p^.left^.registersmmx;
  959. {$endif SUPPORT_MMX}
  960. { remove warning when result is passed }
  961. if (p^.left^.left^.treetype=funcretn) then
  962. procinfo.funcret_is_valid:=true;
  963. { first param must be var }
  964. if (p^.left^.left^.location.loc<>LOC_REFERENCE) and
  965. (p^.left^.left^.location.loc<>LOC_CREGISTER) then
  966. CGMessage(cg_e_illegal_expression);
  967. { check type }
  968. if (p^.left^.resulttype^.deftype=setdef) then
  969. begin
  970. { two paras ? }
  971. if assigned(p^.left^.right) then
  972. begin
  973. { insert a type conversion }
  974. { to the type of the set elements }
  975. p^.left^.right^.left:=gentypeconvnode(
  976. p^.left^.right^.left,
  977. psetdef(p^.left^.resulttype)^.setof);
  978. { check the type conversion }
  979. firstpass(p^.left^.right^.left);
  980. { only three parameters are allowed }
  981. if assigned(p^.left^.right^.right) then
  982. CGMessage(cg_e_illegal_expression);
  983. end;
  984. end
  985. else
  986. CGMessage(type_e_mismatch);
  987. end
  988. else
  989. CGMessage(type_e_mismatch);
  990. end;
  991. in_low_x,
  992. in_high_x:
  993. begin
  994. if p^.left^.treetype in [typen,loadn,subscriptn] then
  995. begin
  996. case p^.left^.resulttype^.deftype of
  997. orddef,enumdef:
  998. begin
  999. do_lowhigh(p^.left^.resulttype);
  1000. firstpass(p);
  1001. end;
  1002. setdef:
  1003. begin
  1004. do_lowhigh(Psetdef(p^.left^.resulttype)^.setof);
  1005. firstpass(p);
  1006. end;
  1007. arraydef:
  1008. begin
  1009. if p^.inlinenumber=in_low_x then
  1010. begin
  1011. hp:=genordinalconstnode(Parraydef(p^.left^.resulttype)^.lowrange,
  1012. Parraydef(p^.left^.resulttype)^.rangedef);
  1013. disposetree(p);
  1014. p:=hp;
  1015. firstpass(p);
  1016. end
  1017. else
  1018. begin
  1019. if is_open_array(p^.left^.resulttype) or
  1020. is_array_of_const(p^.left^.resulttype) then
  1021. begin
  1022. getsymonlyin(p^.left^.symtable,'high'+pvarsym(p^.left^.symtableentry)^.name);
  1023. hp:=genloadnode(pvarsym(srsym),p^.left^.symtable);
  1024. disposetree(p);
  1025. p:=hp;
  1026. firstpass(p);
  1027. end
  1028. else
  1029. begin
  1030. hp:=genordinalconstnode(Parraydef(p^.left^.resulttype)^.highrange,
  1031. Parraydef(p^.left^.resulttype)^.rangedef);
  1032. disposetree(p);
  1033. p:=hp;
  1034. firstpass(p);
  1035. end;
  1036. end;
  1037. end;
  1038. stringdef:
  1039. begin
  1040. if p^.inlinenumber=in_low_x then
  1041. begin
  1042. hp:=genordinalconstnode(0,u8bitdef);
  1043. disposetree(p);
  1044. p:=hp;
  1045. firstpass(p);
  1046. end
  1047. else
  1048. begin
  1049. if is_open_string(p^.left^.resulttype) then
  1050. begin
  1051. getsymonlyin(p^.left^.symtable,'high'+pvarsym(p^.left^.symtableentry)^.name);
  1052. hp:=genloadnode(pvarsym(srsym),p^.left^.symtable);
  1053. disposetree(p);
  1054. p:=hp;
  1055. firstpass(p);
  1056. end
  1057. else
  1058. begin
  1059. hp:=genordinalconstnode(Pstringdef(p^.left^.resulttype)^.len,u8bitdef);
  1060. disposetree(p);
  1061. p:=hp;
  1062. firstpass(p);
  1063. end;
  1064. end;
  1065. end;
  1066. else
  1067. CGMessage(type_e_mismatch);
  1068. end;
  1069. end
  1070. else
  1071. CGMessage(type_e_varid_or_typeid_expected);
  1072. end;
  1073. in_cos_extended:
  1074. begin
  1075. if p^.left^.treetype in [ordconstn,realconstn] then
  1076. setconstrealvalue(cos(getconstrealvalue))
  1077. else
  1078. handleextendedfunction;
  1079. end;
  1080. in_sin_extended:
  1081. begin
  1082. if p^.left^.treetype in [ordconstn,realconstn] then
  1083. setconstrealvalue(sin(getconstrealvalue))
  1084. else
  1085. handleextendedfunction;
  1086. end;
  1087. in_arctan_extended:
  1088. begin
  1089. if p^.left^.treetype in [ordconstn,realconstn] then
  1090. setconstrealvalue(arctan(getconstrealvalue))
  1091. else
  1092. handleextendedfunction;
  1093. end;
  1094. in_pi:
  1095. if block_type=bt_const then
  1096. setconstrealvalue(pi)
  1097. else
  1098. begin
  1099. p^.location.loc:=LOC_FPU;
  1100. p^.resulttype:=s80floatdef;
  1101. end;
  1102. in_abs_extended:
  1103. begin
  1104. if p^.left^.treetype in [ordconstn,realconstn] then
  1105. setconstrealvalue(abs(getconstrealvalue))
  1106. else
  1107. handleextendedfunction;
  1108. end;
  1109. in_sqr_extended:
  1110. begin
  1111. if p^.left^.treetype in [ordconstn,realconstn] then
  1112. setconstrealvalue(sqr(getconstrealvalue))
  1113. else
  1114. handleextendedfunction;
  1115. end;
  1116. in_sqrt_extended:
  1117. begin
  1118. if p^.left^.treetype in [ordconstn,realconstn] then
  1119. begin
  1120. vr:=getconstrealvalue;
  1121. if vr<0.0 then
  1122. begin
  1123. CGMessage(type_e_wrong_math_argument);
  1124. setconstrealvalue(0);
  1125. end
  1126. else
  1127. setconstrealvalue(sqrt(vr));
  1128. end
  1129. else
  1130. handleextendedfunction;
  1131. end;
  1132. in_ln_extended:
  1133. begin
  1134. if p^.left^.treetype in [ordconstn,realconstn] then
  1135. begin
  1136. vr:=getconstrealvalue;
  1137. if vr<=0.0 then
  1138. begin
  1139. CGMessage(type_e_wrong_math_argument);
  1140. setconstrealvalue(0);
  1141. end
  1142. else
  1143. setconstrealvalue(ln(vr));
  1144. end
  1145. else
  1146. handleextendedfunction;
  1147. end;
  1148. {$ifdef SUPPORT_MMX}
  1149. in_mmx_pcmpeqb..in_mmx_pcmpgtw:
  1150. begin
  1151. end;
  1152. {$endif SUPPORT_MMX}
  1153. in_assert_x_y :
  1154. begin
  1155. p^.resulttype:=voiddef;
  1156. if assigned(p^.left) then
  1157. begin
  1158. firstcallparan(p^.left,nil);
  1159. p^.registers32:=p^.left^.registers32;
  1160. p^.registersfpu:=p^.left^.registersfpu;
  1161. {$ifdef SUPPORT_MMX}
  1162. p^.registersmmx:=p^.left^.registersmmx;
  1163. {$endif SUPPORT_MMX}
  1164. { check type }
  1165. if is_boolean(p^.left^.resulttype) then
  1166. begin
  1167. { must always be a string }
  1168. p^.left^.right^.left:=gentypeconvnode(p^.left^.right^.left,cshortstringdef);
  1169. firstpass(p^.left^.right^.left);
  1170. end
  1171. else
  1172. CGMessage(type_e_mismatch);
  1173. end
  1174. else
  1175. CGMessage(type_e_mismatch);
  1176. end;
  1177. else
  1178. internalerror(8);
  1179. end;
  1180. end;
  1181. { generate an error if no resulttype is set }
  1182. if not assigned(p^.resulttype) then
  1183. p^.resulttype:=generrordef;
  1184. must_be_valid:=store_valid;
  1185. count_ref:=store_count_ref;
  1186. end;
  1187. end.
  1188. {
  1189. $Log$
  1190. Revision 1.51 1999-09-15 20:35:46 florian
  1191. * small fix to operator overloading when in MMX mode
  1192. + the compiler uses now fldz and fld1 if possible
  1193. + some fixes to floating point registers
  1194. + some math. functions (arctan, ln, sin, cos, sqrt, sqr, pi) are now inlined
  1195. * .... ???
  1196. Revision 1.50 1999/09/07 14:05:11 pierre
  1197. * halt removed in do_lowhigh
  1198. Revision 1.49 1999/08/28 15:34:21 florian
  1199. * bug 519 fixed
  1200. Revision 1.48 1999/08/23 23:41:04 pierre
  1201. * in_inc_x register allocation corrected
  1202. Revision 1.47 1999/08/06 12:43:13 jonas
  1203. * fix for regvars with the val code
  1204. Revision 1.46 1999/08/05 16:53:23 peter
  1205. * V_Fatal=1, all other V_ are also increased
  1206. * Check for local procedure when assigning procvar
  1207. * fixed comment parsing because directives
  1208. * oldtp mode directives better supported
  1209. * added some messages to errore.msg
  1210. Revision 1.45 1999/08/04 00:23:40 florian
  1211. * renamed i386asm and i386base to cpuasm and cpubase
  1212. Revision 1.44 1999/08/03 22:03:32 peter
  1213. * moved bitmask constants to sets
  1214. * some other type/const renamings
  1215. Revision 1.43 1999/07/30 12:28:43 peter
  1216. * fixed crash with unknown id and colon parameter in write
  1217. Revision 1.42 1999/07/18 14:47:35 florian
  1218. * bug 487 fixed, (inc(<property>) isn't allowed)
  1219. * more fixes to compile with Delphi
  1220. Revision 1.41 1999/07/05 20:25:40 peter
  1221. * merged
  1222. Revision 1.40 1999/07/05 20:13:18 peter
  1223. * removed temp defines
  1224. Revision 1.39 1999/07/03 14:14:31 florian
  1225. + start of val(int64/qword)
  1226. * longbool, wordbool constants weren't written, fixed
  1227. Revision 1.38 1999/07/01 15:49:22 florian
  1228. * int64/qword type release
  1229. + lo/hi for int64/qword
  1230. Revision 1.37 1999/06/25 10:02:56 florian
  1231. * bug 459 fixed
  1232. Revision 1.36 1999/06/15 18:58:36 peter
  1233. * merged
  1234. Revision 1.35.2.2 1999/07/05 20:06:46 peter
  1235. * give error instead of warning for ln(0) and sqrt(0)
  1236. Revision 1.35.2.1 1999/06/15 18:54:54 peter
  1237. * more procvar fixes
  1238. Revision 1.35 1999/05/27 19:45:19 peter
  1239. * removed oldasm
  1240. * plabel -> pasmlabel
  1241. * -a switches to source writing automaticly
  1242. * assembler readers OOPed
  1243. * asmsymbol automaticly external
  1244. * jumptables and other label fixes for asm readers
  1245. Revision 1.34 1999/05/23 18:42:20 florian
  1246. * better error recovering in typed constants
  1247. * some problems with arrays of const fixed, some problems
  1248. due my previous
  1249. - the location type of array constructor is now LOC_MEM
  1250. - the pushing of high fixed
  1251. - parameter copying fixed
  1252. - zero temp. allocation removed
  1253. * small problem in the assembler writers fixed:
  1254. ref to nil wasn't written correctly
  1255. Revision 1.33 1999/05/06 09:05:35 peter
  1256. * generic write_float and str_float
  1257. * fixed constant float conversions
  1258. Revision 1.32 1999/05/05 22:25:21 florian
  1259. * fixed register allocation for val
  1260. Revision 1.31 1999/05/02 21:33:57 florian
  1261. * several bugs regarding -Or fixed
  1262. Revision 1.30 1999/05/01 13:24:53 peter
  1263. * merged nasm compiler
  1264. * old asm moved to oldasm/
  1265. Revision 1.29 1999/04/28 06:02:15 florian
  1266. * changes of Bruessel:
  1267. + message handler can now take an explicit self
  1268. * typinfo fixed: sometimes the type names weren't written
  1269. * the type checking for pointer comparisations and subtraction
  1270. and are now more strict (was also buggy)
  1271. * small bug fix to link.pas to support compiling on another
  1272. drive
  1273. * probable bug in popt386 fixed: call/jmp => push/jmp
  1274. transformation didn't count correctly the jmp references
  1275. + threadvar support
  1276. * warning if ln/sqrt gets an invalid constant argument
  1277. Revision 1.28 1999/04/26 18:28:12 peter
  1278. * better read/write array
  1279. Revision 1.27 1999/04/26 09:32:22 peter
  1280. * try to convert to string for val()
  1281. Revision 1.26 1999/04/15 14:10:51 pierre
  1282. * fix for bug0238.pp
  1283. Revision 1.25 1999/04/15 10:00:35 peter
  1284. * writeln(procvar) support for tp7 mode
  1285. Revision 1.24 1999/04/14 09:15:07 peter
  1286. * first things to store the symbol/def number in the ppu
  1287. Revision 1.23 1999/04/08 10:16:48 peter
  1288. * funcret_valid flag is set for inline functions
  1289. Revision 1.22 1999/03/26 00:05:48 peter
  1290. * released valintern
  1291. + deffile is now removed when compiling is finished
  1292. * ^( compiles now correct
  1293. + static directive
  1294. * shrd fixed
  1295. Revision 1.21 1999/03/24 23:17:37 peter
  1296. * fixed bugs 212,222,225,227,229,231,233
  1297. Revision 1.20 1999/03/16 17:52:55 jonas
  1298. * changes for internal Val code (do a "make cycle OPT=-dvalintern" to test)
  1299. * in cgi386inl: also range checking for subrange types (compile with "-dreadrangecheck")
  1300. * in cgai386: also small fixes to emitrangecheck
  1301. Revision 1.19 1999/02/22 12:36:34 florian
  1302. + warning for lo/hi(longint/dword) in -So and -Sd mode added
  1303. Revision 1.18 1999/02/22 02:15:49 peter
  1304. * updates for ag386bin
  1305. Revision 1.17 1999/02/01 00:00:50 florian
  1306. * compiler crash fixed when constant arguments passed to round/trunc
  1307. exceeds the longint range
  1308. Revision 1.16 1999/01/28 19:43:43 peter
  1309. * fixed high generation for ansistrings with str,writeln
  1310. Revision 1.15 1999/01/27 16:28:22 pierre
  1311. * bug0157 solved : write(x:5.3) is rejected now
  1312. Revision 1.14 1999/01/21 22:10:50 peter
  1313. * fixed array of const
  1314. * generic platform independent high() support
  1315. Revision 1.13 1998/12/30 22:13:13 peter
  1316. * check the amount of paras for Str()
  1317. Revision 1.12 1998/12/15 10:23:31 peter
  1318. + -iSO, -iSP, -iTO, -iTP
  1319. Revision 1.11 1998/12/11 23:36:08 florian
  1320. + again more stuff for int64/qword:
  1321. - comparision operators
  1322. - code generation for: str, read(ln), write(ln)
  1323. Revision 1.10 1998/11/27 14:50:53 peter
  1324. + open strings, $P switch support
  1325. Revision 1.9 1998/11/24 17:04:28 peter
  1326. * fixed length(char) when char is a variable
  1327. Revision 1.8 1998/11/14 10:51:33 peter
  1328. * fixed low/high for record.field
  1329. Revision 1.7 1998/11/13 10:15:52 peter
  1330. * fixed ptr() with constants
  1331. Revision 1.6 1998/11/05 12:03:05 peter
  1332. * released useansistring
  1333. * removed -Sv, its now available in fpc modes
  1334. Revision 1.5 1998/10/20 11:16:47 pierre
  1335. + length(c) where C is a char is allways 1
  1336. Revision 1.4 1998/10/06 20:49:11 peter
  1337. * m68k compiler compiles again
  1338. Revision 1.3 1998/10/05 12:32:49 peter
  1339. + assert() support
  1340. Revision 1.2 1998/10/02 09:24:23 peter
  1341. * more constant expression evaluators
  1342. Revision 1.1 1998/09/23 20:42:24 peter
  1343. * splitted pass_1
  1344. }