ninl.pas 81 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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 ninl;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. node,htypechk,cpuinfo;
  23. {$i compinnr.inc}
  24. type
  25. tinlinenode = class(tunarynode)
  26. inlinenumber : byte;
  27. constructor create(number : byte;is_const:boolean;l : tnode);virtual;
  28. function getcopy : tnode;override;
  29. function pass_1 : tnode;override;
  30. function det_resulttype:tnode;override;
  31. function docompare(p: tnode): boolean; override;
  32. {$ifdef hascompilerproc}
  33. private
  34. function str_pass_1: tnode;
  35. function reset_rewrite_typed_pass_1: tnode;
  36. {$endif hascompilerproc}
  37. end;
  38. var
  39. cinlinenode : class of tinlinenode;
  40. function geninlinenode(number : byte;is_const:boolean;l : tnode) : tinlinenode;
  41. implementation
  42. uses
  43. verbose,globals,systems,
  44. globtype,
  45. symconst,symtype,symdef,symsym,symtable,types,
  46. pass_1,
  47. ncal,ncon,ncnv,nadd,nld,nbas,
  48. cpubase,hcodegen,tgcpu
  49. {$ifdef newcg}
  50. ,cgbase
  51. {$endif newcg}
  52. ;
  53. function geninlinenode(number : byte;is_const:boolean;l : tnode) : tinlinenode;
  54. begin
  55. geninlinenode:=cinlinenode.create(number,is_const,l);
  56. end;
  57. {*****************************************************************************
  58. TINLINENODE
  59. *****************************************************************************}
  60. constructor tinlinenode.create(number : byte;is_const:boolean;l : tnode);
  61. begin
  62. inherited create(inlinen,l);
  63. if is_const then
  64. include(flags,nf_inlineconst);
  65. inlinenumber:=number;
  66. end;
  67. function tinlinenode.getcopy : tnode;
  68. var
  69. n : tinlinenode;
  70. begin
  71. n:=tinlinenode(inherited getcopy);
  72. n.inlinenumber:=inlinenumber;
  73. result:=n;
  74. end;
  75. function tinlinenode.det_resulttype:tnode;
  76. function do_lowhigh(const t:ttype) : tnode;
  77. var
  78. v : tconstexprint;
  79. enum : tenumsym;
  80. hp : tnode;
  81. begin
  82. case t.def.deftype of
  83. orddef:
  84. begin
  85. if inlinenumber=in_low_x then
  86. v:=torddef(t.def).low
  87. else
  88. v:=torddef(t.def).high;
  89. { low/high of torddef are longints, so we need special }
  90. { handling for cardinal and 64bit types (JM) }
  91. { 1.0.x doesn't support int64($ffffffff) correct, it'll expand
  92. to -1 instead of staying $ffffffff. Therefor we use $ffff with
  93. shl twice (PFV) }
  94. if is_signed(t.def) and
  95. is_64bitint(t.def) then
  96. if (inlinenumber=in_low_x) then
  97. v := int64($80000000) shl 32
  98. else
  99. v := (int64($7fffffff) shl 32) or int64($ffff) shl 16 or int64($ffff)
  100. else
  101. if is_64bitint(t.def) then
  102. { we have to use a dirty trick for high(qword), }
  103. { because it's bigger than high(tconstexprint) (JM) }
  104. v := 0
  105. else
  106. if not is_signed(t.def) then
  107. v := cardinal(v);
  108. hp:=cordconstnode.create(v,t);
  109. resulttypepass(hp);
  110. { fix high(qword) }
  111. if not is_signed(t.def) and
  112. is_64bitint(t.def) and
  113. (inlinenumber = in_high_x) then
  114. tordconstnode(hp).value := -1; { is the same as qword($ffffffffffffffff) }
  115. do_lowhigh:=hp;
  116. end;
  117. enumdef:
  118. begin
  119. enum:=tenumsym(tenumdef(t.def).firstenum);
  120. v:=tenumdef(t.def).maxval;
  121. if inlinenumber=in_high_x then
  122. while assigned(enum) and (enum.value <> v) do
  123. enum:=enum.nextenum;
  124. if not assigned(enum) then
  125. internalerror(309993)
  126. else
  127. hp:=genenumnode(enum);
  128. do_lowhigh:=hp;
  129. end;
  130. else
  131. internalerror(87);
  132. end;
  133. end;
  134. function getconstrealvalue : bestreal;
  135. begin
  136. case left.nodetype of
  137. ordconstn:
  138. getconstrealvalue:=tordconstnode(left).value;
  139. realconstn:
  140. getconstrealvalue:=trealconstnode(left).value_real;
  141. else
  142. internalerror(309992);
  143. end;
  144. end;
  145. procedure setconstrealvalue(r : bestreal);
  146. var
  147. hp : tnode;
  148. begin
  149. hp:=crealconstnode.create(r,pbestrealtype^);
  150. resulttypepass(hp);
  151. result:=hp;
  152. end;
  153. var
  154. counter : longint;
  155. ppn : tcallparanode;
  156. dummycoll : tparaitem;
  157. vl,vl2 : longint;
  158. vr : bestreal;
  159. hp : tnode;
  160. srsym : tsym;
  161. p1,hpp : tnode;
  162. frac_para,
  163. length_para : tnode;
  164. isreal,
  165. iswrite,
  166. file_is_typed : boolean;
  167. label
  168. myexit;
  169. begin
  170. result:=nil;
  171. { if we handle writeln; left contains no valid address }
  172. if assigned(left) then
  173. begin
  174. if left.nodetype=callparan then
  175. tcallparanode(left).get_paratype
  176. else
  177. resulttypepass(left);
  178. end;
  179. inc(parsing_para_level);
  180. { handle intern constant functions in separate case }
  181. if nf_inlineconst in flags then
  182. begin
  183. { no parameters? }
  184. if not assigned(left) then
  185. begin
  186. case inlinenumber of
  187. in_const_pi :
  188. hp:=crealconstnode.create(pi,pbestrealtype^);
  189. else
  190. internalerror(89);
  191. end;
  192. end
  193. else
  194. begin
  195. vl:=0;
  196. vl2:=0; { second parameter Ex: ptr(vl,vl2) }
  197. vr:=0;
  198. isreal:=false;
  199. case left.nodetype of
  200. realconstn :
  201. begin
  202. isreal:=true;
  203. vr:=trealconstnode(left).value_real;
  204. end;
  205. ordconstn :
  206. vl:=tordconstnode(left).value;
  207. callparan :
  208. begin
  209. { both exists, else it was not generated }
  210. vl:=tordconstnode(tcallparanode(left).left).value;
  211. vl2:=tordconstnode(tcallparanode(tcallparanode(left).right).left).value;
  212. end;
  213. else
  214. CGMessage(cg_e_illegal_expression);
  215. end;
  216. case inlinenumber of
  217. in_const_trunc :
  218. begin
  219. if isreal then
  220. begin
  221. if (vr>=2147483648.0) or (vr<=-2147483649.0) then
  222. begin
  223. CGMessage(parser_e_range_check_error);
  224. hp:=cordconstnode.create(1,s32bittype)
  225. end
  226. else
  227. hp:=cordconstnode.create(trunc(vr),s32bittype)
  228. end
  229. else
  230. hp:=cordconstnode.create(trunc(vl),s32bittype);
  231. end;
  232. in_const_round :
  233. begin
  234. if isreal then
  235. begin
  236. if (vr>=2147483647.5) or (vr<=-2147483648.5) then
  237. begin
  238. CGMessage(parser_e_range_check_error);
  239. hp:=cordconstnode.create(1,s32bittype)
  240. end
  241. else
  242. hp:=cordconstnode.create(round(vr),s32bittype)
  243. end
  244. else
  245. hp:=cordconstnode.create(round(vl),s32bittype);
  246. end;
  247. in_const_frac :
  248. begin
  249. if isreal then
  250. hp:=crealconstnode.create(frac(vr),pbestrealtype^)
  251. else
  252. hp:=crealconstnode.create(frac(vl),pbestrealtype^);
  253. end;
  254. in_const_int :
  255. begin
  256. if isreal then
  257. hp:=crealconstnode.create(int(vr),pbestrealtype^)
  258. else
  259. hp:=crealconstnode.create(int(vl),pbestrealtype^);
  260. end;
  261. in_const_abs :
  262. begin
  263. if isreal then
  264. hp:=crealconstnode.create(abs(vr),pbestrealtype^)
  265. else
  266. hp:=cordconstnode.create(abs(vl),left.resulttype);
  267. end;
  268. in_const_sqr :
  269. begin
  270. if isreal then
  271. hp:=crealconstnode.create(sqr(vr),pbestrealtype^)
  272. else
  273. hp:=cordconstnode.create(sqr(vl),left.resulttype);
  274. end;
  275. in_const_odd :
  276. begin
  277. if isreal then
  278. CGMessage1(type_e_integer_expr_expected,left.resulttype.def.typename)
  279. else
  280. hp:=cordconstnode.create(byte(odd(vl)),booltype);
  281. end;
  282. in_const_swap_word :
  283. begin
  284. if isreal then
  285. CGMessage1(type_e_integer_expr_expected,left.resulttype.def.typename)
  286. else
  287. hp:=cordconstnode.create((vl and $ff) shl 8+(vl shr 8),left.resulttype);
  288. end;
  289. in_const_swap_long :
  290. begin
  291. if isreal then
  292. CGMessage(type_e_mismatch)
  293. else
  294. hp:=cordconstnode.create((vl and $ffff) shl 16+(vl shr 16),left.resulttype);
  295. end;
  296. in_const_ptr :
  297. begin
  298. if isreal then
  299. CGMessage(type_e_mismatch)
  300. else
  301. hp:=cpointerconstnode.create((vl2 shl 4)+vl,voidfarpointertype);
  302. end;
  303. in_const_sqrt :
  304. begin
  305. if isreal then
  306. begin
  307. if vr<0.0 then
  308. CGMessage(type_e_wrong_math_argument)
  309. else
  310. hp:=crealconstnode.create(sqrt(vr),pbestrealtype^)
  311. end
  312. else
  313. begin
  314. if vl<0 then
  315. CGMessage(type_e_wrong_math_argument)
  316. else
  317. hp:=crealconstnode.create(sqrt(vl),pbestrealtype^);
  318. end;
  319. end;
  320. in_const_arctan :
  321. begin
  322. if isreal then
  323. hp:=crealconstnode.create(arctan(vr),pbestrealtype^)
  324. else
  325. hp:=crealconstnode.create(arctan(vl),pbestrealtype^);
  326. end;
  327. in_const_cos :
  328. begin
  329. if isreal then
  330. hp:=crealconstnode.create(cos(vr),pbestrealtype^)
  331. else
  332. hp:=crealconstnode.create(cos(vl),pbestrealtype^);
  333. end;
  334. in_const_sin :
  335. begin
  336. if isreal then
  337. hp:=crealconstnode.create(sin(vr),pbestrealtype^)
  338. else
  339. hp:=crealconstnode.create(sin(vl),pbestrealtype^);
  340. end;
  341. in_const_exp :
  342. begin
  343. if isreal then
  344. hp:=crealconstnode.create(exp(vr),pbestrealtype^)
  345. else
  346. hp:=crealconstnode.create(exp(vl),pbestrealtype^);
  347. end;
  348. in_const_ln :
  349. begin
  350. if isreal then
  351. begin
  352. if vr<=0.0 then
  353. CGMessage(type_e_wrong_math_argument)
  354. else
  355. hp:=crealconstnode.create(ln(vr),pbestrealtype^)
  356. end
  357. else
  358. begin
  359. if vl<=0 then
  360. CGMessage(type_e_wrong_math_argument)
  361. else
  362. hp:=crealconstnode.create(ln(vl),pbestrealtype^);
  363. end;
  364. end;
  365. else
  366. internalerror(88);
  367. end;
  368. end;
  369. if hp=nil then
  370. hp:=tnode.create(errorn);
  371. resulttypepass(hp);
  372. result:=hp;
  373. goto myexit;
  374. end
  375. else
  376. begin
  377. case inlinenumber of
  378. in_lo_long,
  379. in_hi_long,
  380. in_lo_qword,
  381. in_hi_qword,
  382. in_lo_word,
  383. in_hi_word :
  384. begin
  385. { give warning for incompatibility with tp and delphi }
  386. if (inlinenumber in [in_lo_long,in_hi_long,in_lo_qword,in_hi_qword]) and
  387. ((m_tp in aktmodeswitches) or
  388. (m_delphi in aktmodeswitches)) then
  389. CGMessage(type_w_maybe_wrong_hi_lo);
  390. { constant folding }
  391. if left.nodetype=ordconstn then
  392. begin
  393. case inlinenumber of
  394. in_lo_word :
  395. hp:=cordconstnode.create(tordconstnode(left).value and $ff,left.resulttype);
  396. in_hi_word :
  397. hp:=cordconstnode.create(tordconstnode(left).value shr 8,left.resulttype);
  398. in_lo_long :
  399. hp:=cordconstnode.create(tordconstnode(left).value and $ffff,left.resulttype);
  400. in_hi_long :
  401. hp:=cordconstnode.create(tordconstnode(left).value shr 16,left.resulttype);
  402. in_lo_qword :
  403. hp:=cordconstnode.create(tordconstnode(left).value and $ffffffff,left.resulttype);
  404. in_hi_qword :
  405. hp:=cordconstnode.create(tordconstnode(left).value shr 32,left.resulttype);
  406. end;
  407. resulttypepass(hp);
  408. result:=hp;
  409. goto myexit;
  410. end;
  411. set_varstate(left,true);
  412. if not is_integer(left.resulttype.def) then
  413. CGMessage(type_e_mismatch);
  414. case inlinenumber of
  415. in_lo_word,
  416. in_hi_word :
  417. resulttype:=u8bittype;
  418. in_lo_long,
  419. in_hi_long :
  420. resulttype:=u16bittype;
  421. in_lo_qword,
  422. in_hi_qword :
  423. resulttype:=u32bittype;
  424. end;
  425. end;
  426. in_sizeof_x:
  427. begin
  428. set_varstate(left,false);
  429. resulttype:=s32bittype;
  430. end;
  431. in_typeof_x:
  432. begin
  433. set_varstate(left,false);
  434. resulttype:=voidpointertype;
  435. end;
  436. in_ord_x:
  437. begin
  438. if (left.nodetype=ordconstn) then
  439. begin
  440. hp:=cordconstnode.create(tordconstnode(left).value,s32bittype);
  441. resulttypepass(hp);
  442. result:=hp;
  443. goto myexit;
  444. end;
  445. set_varstate(left,true);
  446. case left.resulttype.def.deftype of
  447. orddef :
  448. begin
  449. case torddef(left.resulttype.def).typ of
  450. bool8bit,
  451. uchar:
  452. begin
  453. { change to byte() }
  454. hp:=ctypeconvnode.create(left,u8bittype);
  455. left:=nil;
  456. include(hp.flags,nf_explizit);
  457. resulttypepass(hp);
  458. result:=hp;
  459. end;
  460. bool16bit,
  461. uwidechar :
  462. begin
  463. { change to word() }
  464. hp:=ctypeconvnode.create(left,u16bittype);
  465. left:=nil;
  466. include(hp.flags,nf_explizit);
  467. resulttypepass(hp);
  468. result:=hp;
  469. end;
  470. bool32bit :
  471. begin
  472. { change to dword() }
  473. hp:=ctypeconvnode.create(left,u32bittype);
  474. left:=nil;
  475. include(hp.flags,nf_explizit);
  476. resulttypepass(hp);
  477. result:=hp;
  478. end;
  479. uvoid :
  480. CGMessage(type_e_mismatch)
  481. else
  482. begin
  483. { all other orddef need no transformation }
  484. hp:=left;
  485. left:=nil;
  486. result:=hp;
  487. end;
  488. end;
  489. end;
  490. enumdef :
  491. begin
  492. hp:=ctypeconvnode.create(left,s32bittype);
  493. left:=nil;
  494. include(hp.flags,nf_explizit);
  495. resulttypepass(hp);
  496. result:=hp;
  497. end;
  498. else
  499. CGMessage(type_e_mismatch);
  500. end;
  501. end;
  502. in_chr_byte:
  503. begin
  504. { convert to explicit char() }
  505. set_varstate(left,true);
  506. hp:=ctypeconvnode.create(left,cchartype);
  507. include(hp.flags,nf_explizit);
  508. left:=nil;
  509. resulttypepass(hp);
  510. result:=hp;
  511. end;
  512. in_length_x:
  513. begin
  514. set_varstate(left,true);
  515. case left.resulttype.def.deftype of
  516. stringdef :
  517. begin
  518. { we don't need string convertions here }
  519. if (left.nodetype=typeconvn) and
  520. (ttypeconvnode(left).left.resulttype.def.deftype=stringdef) then
  521. begin
  522. hp:=ttypeconvnode(left).left;
  523. ttypeconvnode(left).left:=nil;
  524. left.free;
  525. left:=hp;
  526. end;
  527. { evaluates length of constant strings direct }
  528. if (left.nodetype=stringconstn) then
  529. begin
  530. hp:=cordconstnode.create(tstringconstnode(left).len,s32bittype);
  531. resulttypepass(hp);
  532. result:=hp;
  533. goto myexit;
  534. end;
  535. end;
  536. orddef :
  537. begin
  538. { length of char is one allways }
  539. if is_char(left.resulttype.def) or
  540. is_widechar(left.resulttype.def) then
  541. begin
  542. hp:=cordconstnode.create(1,s32bittype);
  543. resulttypepass(hp);
  544. result:=hp;
  545. goto myexit;
  546. end
  547. else
  548. CGMessage(type_e_mismatch);
  549. end;
  550. arraydef :
  551. begin
  552. if is_open_array(left.resulttype.def) or
  553. is_array_of_const(left.resulttype.def) then
  554. begin
  555. srsym:=searchsymonlyin(tloadnode(left).symtable,'high'+tvarsym(tloadnode(left).symtableentry).name);
  556. hp:=caddnode.create(addn,cloadnode.create(tvarsym(srsym),tloadnode(left).symtable),
  557. cordconstnode.create(1,s32bittype));
  558. resulttypepass(hp);
  559. result:=hp;
  560. goto myexit;
  561. end
  562. else
  563. if not is_dynamic_array(left.resulttype.def) then
  564. begin
  565. hp:=cordconstnode.create(tarraydef(left.resulttype.def).highrange-
  566. tarraydef(left.resulttype.def).lowrange+1,
  567. s32bittype);
  568. resulttypepass(hp);
  569. result:=hp;
  570. goto myexit;
  571. end;
  572. end;
  573. else
  574. CGMessage(type_e_mismatch);
  575. end;
  576. { shortstring return an 8 bit value as the length
  577. is the first byte of the string }
  578. if is_shortstring(left.resulttype.def) then
  579. resulttype:=u8bittype
  580. else
  581. resulttype:=s32bittype;
  582. end;
  583. in_typeinfo_x:
  584. begin
  585. set_varstate(left,true);
  586. resulttype:=voidpointertype;
  587. end;
  588. in_assigned_x:
  589. begin
  590. set_varstate(left,true);
  591. resulttype:=booltype;
  592. end;
  593. in_ofs_x :
  594. internalerror(2000101001);
  595. in_seg_x :
  596. begin
  597. set_varstate(left,false);
  598. hp:=cordconstnode.create(0,s32bittype);
  599. resulttypepass(hp);
  600. result:=hp;
  601. goto myexit;
  602. end;
  603. in_pred_x,
  604. in_succ_x:
  605. begin
  606. set_varstate(left,true);
  607. resulttype:=left.resulttype;
  608. if not is_ordinal(resulttype.def) then
  609. CGMessage(type_e_ordinal_expr_expected)
  610. else
  611. begin
  612. if (resulttype.def.deftype=enumdef) and
  613. (tenumdef(resulttype.def).has_jumps) then
  614. CGMessage(type_e_succ_and_pred_enums_with_assign_not_possible);
  615. end;
  616. { do constant folding after check for jumps }
  617. if left.nodetype=ordconstn then
  618. begin
  619. if inlinenumber=in_succ_x then
  620. hp:=cordconstnode.create(tordconstnode(left).value+1,left.resulttype)
  621. else
  622. hp:=cordconstnode.create(tordconstnode(left).value-1,left.resulttype);
  623. resulttypepass(hp);
  624. result:=hp;
  625. end;
  626. end;
  627. in_setlength_x:
  628. begin
  629. resulttype:=voidtype;
  630. if assigned(left) then
  631. begin
  632. ppn:=tcallparanode(left);
  633. counter:=0;
  634. { check type }
  635. while assigned(ppn.right) do
  636. begin
  637. set_varstate(ppn.left,true);
  638. inserttypeconv(ppn.left,s32bittype);
  639. inc(counter);
  640. ppn:=tcallparanode(ppn.right);
  641. end;
  642. { last param must be var }
  643. valid_for_var(ppn.left);
  644. set_varstate(ppn.left,false);
  645. { first param must be a string or dynamic array ...}
  646. if not((ppn.left.resulttype.def.deftype=stringdef) or
  647. (is_dynamic_array(ppn.left.resulttype.def))) then
  648. CGMessage(type_e_mismatch);
  649. { only dynamic arrays accept more dimensions }
  650. if (counter>1) and
  651. (not(is_dynamic_array(left.resulttype.def))) then
  652. CGMessage(type_e_mismatch);
  653. { convert shortstrings to openstring parameters }
  654. { (generate the hightree) (JM) }
  655. if (ppn.left.resulttype.def.deftype = stringdef) and
  656. (tstringdef(ppn.left.resulttype.def).string_typ =
  657. st_shortstring) then
  658. begin
  659. dummycoll:=tparaitem.create;
  660. dummycoll.paratyp:=vs_var;
  661. dummycoll.paratype:=openshortstringtype;
  662. tcallparanode(ppn).insert_typeconv(dummycoll,false);
  663. dummycoll.destroy;
  664. end;
  665. end
  666. else
  667. CGMessage(type_e_mismatch);
  668. end;
  669. in_finalize_x:
  670. begin
  671. resulttype:=voidtype;
  672. if assigned(left) and assigned(tcallparanode(left).left) then
  673. begin
  674. { first param must be var }
  675. valid_for_var(tcallparanode(left).left);
  676. set_varstate(tcallparanode(left).left,true);
  677. { two parameters?, the last parameter must be a longint }
  678. if assigned(tcallparanode(left).right) then
  679. inserttypeconv(tcallparanode(tcallparanode(left).right).left,s32bittype);
  680. end
  681. else
  682. CGMessage(type_e_mismatch);
  683. end;
  684. in_inc_x,
  685. in_dec_x:
  686. begin
  687. resulttype:=voidtype;
  688. if assigned(left) then
  689. begin
  690. set_varstate(left,true);
  691. if codegenerror then
  692. exit;
  693. { first param must be var }
  694. valid_for_var(tcallparanode(left).left);
  695. if (left.resulttype.def.deftype in [enumdef,pointerdef]) or
  696. is_ordinal(left.resulttype.def) then
  697. begin
  698. { two paras ? }
  699. if assigned(tcallparanode(left).right) then
  700. begin
  701. { insert a type conversion }
  702. { the second param is always longint }
  703. inserttypeconv(tcallparanode(tcallparanode(left).right).left,s32bittype);
  704. if assigned(tcallparanode(tcallparanode(left).right).right) then
  705. CGMessage(cg_e_illegal_expression);
  706. end;
  707. end
  708. else
  709. CGMessage(type_e_ordinal_expr_expected);
  710. end
  711. else
  712. CGMessage(type_e_mismatch);
  713. end;
  714. in_read_x,
  715. in_readln_x,
  716. in_write_x,
  717. in_writeln_x :
  718. begin
  719. resulttype:=voidtype;
  720. { we must know if it is a typed file or not }
  721. { but we must first do the firstpass for it }
  722. file_is_typed:=false;
  723. if assigned(left) then
  724. begin
  725. iswrite:=(inlinenumber in [in_write_x,in_writeln_x]);
  726. set_varstate(left,iswrite);
  727. { now we can check }
  728. hp:=left;
  729. while assigned(tcallparanode(hp).right) do
  730. hp:=tcallparanode(hp).right;
  731. { if resulttype.def is not assigned, then automatically }
  732. { file is not typed. }
  733. if assigned(hp) and assigned(hp.resulttype.def) then
  734. Begin
  735. if (hp.resulttype.def.deftype=filedef) then
  736. if (tfiledef(hp.resulttype.def).filetyp=ft_untyped) then
  737. begin
  738. if (inlinenumber in [in_readln_x,in_writeln_x]) then
  739. CGMessage(type_e_no_readln_writeln_for_typed_file)
  740. else
  741. CGMessage(type_e_no_read_write_for_untyped_file);
  742. end
  743. else if (tfiledef(hp.resulttype.def).filetyp=ft_typed) then
  744. begin
  745. file_is_typed:=true;
  746. { test the type }
  747. if (inlinenumber in [in_readln_x,in_writeln_x]) then
  748. CGMessage(type_e_no_readln_writeln_for_typed_file);
  749. hpp:=left;
  750. while (hpp<>hp) do
  751. begin
  752. if (tcallparanode(hpp).left.nodetype=typen) then
  753. CGMessage(type_e_cant_read_write_type);
  754. if not is_equal(hpp.resulttype.def,tfiledef(hp.resulttype.def).typedfiletype.def) then
  755. CGMessage(type_e_mismatch);
  756. { generate the high() value for the shortstring }
  757. if ((not iswrite) and is_shortstring(tcallparanode(hpp).left.resulttype.def)) or
  758. (is_chararray(tcallparanode(hpp).left.resulttype.def)) then
  759. tcallparanode(hpp).gen_high_tree(true);
  760. { read(ln) is call by reference (JM) }
  761. { and so is the data param of FPC_TYPED_WRITE (JM) }
  762. if not iswrite or file_is_typed then
  763. make_not_regable(tcallparanode(hpp).left);
  764. hpp:=tcallparanode(hpp).right;
  765. end;
  766. end;
  767. end; { endif assigned(hp) }
  768. { insert type conversions for write(ln) }
  769. if (not file_is_typed) then
  770. begin
  771. hp:=left;
  772. while assigned(hp) do
  773. begin
  774. if (tcallparanode(hp).left.nodetype=typen) then
  775. CGMessage(type_e_cant_read_write_type);
  776. if assigned(tcallparanode(hp).left.resulttype.def) then
  777. begin
  778. isreal:=false;
  779. { support writeln(procvar) }
  780. if (tcallparanode(hp).left.resulttype.def.deftype=procvardef) then
  781. begin
  782. p1:=ccallnode.create(nil,nil,nil,nil);
  783. tcallnode(p1).set_procvar(tcallparanode(hp).left);
  784. resulttypepass(p1);
  785. tcallparanode(hp).left:=p1;
  786. end;
  787. case tcallparanode(hp).left.resulttype.def.deftype of
  788. filedef :
  789. begin
  790. { only allowed as first parameter }
  791. if assigned(tcallparanode(hp).right) then
  792. CGMessage(type_e_cant_read_write_type);
  793. end;
  794. stringdef :
  795. begin
  796. { generate the high() value for the shortstring }
  797. if (not iswrite) and
  798. is_shortstring(tcallparanode(hp).left.resulttype.def) then
  799. tcallparanode(hp).gen_high_tree(true);
  800. end;
  801. pointerdef :
  802. begin
  803. if not is_pchar(tcallparanode(hp).left.resulttype.def) then
  804. CGMessage(type_e_cant_read_write_type);
  805. end;
  806. floatdef :
  807. begin
  808. isreal:=true;
  809. end;
  810. orddef :
  811. begin
  812. case torddef(tcallparanode(hp).left.resulttype.def).typ of
  813. uchar,uwidechar,
  814. u32bit,s32bit,
  815. u64bit,s64bit:
  816. ;
  817. u8bit,s8bit,
  818. u16bit,s16bit :
  819. if iswrite then
  820. inserttypeconv(tcallparanode(hp).left,s32bittype);
  821. bool8bit,
  822. bool16bit,
  823. bool32bit :
  824. if iswrite then
  825. inserttypeconv(tcallparanode(hp).left,booltype)
  826. else
  827. CGMessage(type_e_cant_read_write_type);
  828. else
  829. CGMessage(type_e_cant_read_write_type);
  830. end;
  831. end;
  832. arraydef :
  833. begin
  834. if is_chararray(tcallparanode(hp).left.resulttype.def) then
  835. tcallparanode(hp).gen_high_tree(true)
  836. else
  837. CGMessage(type_e_cant_read_write_type);
  838. end;
  839. else
  840. CGMessage(type_e_cant_read_write_type);
  841. end;
  842. { some format options ? }
  843. if cpf_is_colon_para in tcallparanode(hp).callparaflags then
  844. begin
  845. if cpf_is_colon_para in tcallparanode(tcallparanode(hp).right).callparaflags then
  846. begin
  847. frac_para:=hp;
  848. length_para:=tcallparanode(hp).right;
  849. hp:=tcallparanode(hp).right;
  850. hpp:=tcallparanode(hp).right;
  851. end
  852. else
  853. begin
  854. length_para:=hp;
  855. frac_para:=nil;
  856. hpp:=tcallparanode(hp).right;
  857. end;
  858. { can be nil if you use "write(e:0:6)" while e is undeclared (JM) }
  859. if assigned(tcallparanode(hpp).left.resulttype.def) then
  860. isreal:=(tcallparanode(hpp).left.resulttype.def.deftype=floatdef)
  861. else
  862. exit;
  863. if (not is_integer(tcallparanode(length_para).left.resulttype.def)) then
  864. CGMessage1(type_e_integer_expr_expected,tcallparanode(length_para).left.resulttype.def.typename)
  865. else
  866. inserttypeconv(tcallparanode(length_para).left,s32bittype);
  867. if assigned(frac_para) then
  868. begin
  869. if isreal then
  870. begin
  871. if (not is_integer(tcallparanode(frac_para).left.resulttype.def)) then
  872. CGMessage1(type_e_integer_expr_expected,tcallparanode(frac_para).left.resulttype.def.typename)
  873. else
  874. inserttypeconv(tcallparanode(frac_para).left,s32bittype);
  875. end
  876. else
  877. CGMessage(parser_e_illegal_colon_qualifier);
  878. end;
  879. { do the checking for the colon'd arg }
  880. hp:=length_para;
  881. end;
  882. end;
  883. hp:=tcallparanode(hp).right;
  884. end;
  885. end;
  886. if codegenerror then
  887. exit;
  888. set_varstate(left,true);
  889. end;
  890. end;
  891. in_settextbuf_file_x :
  892. begin
  893. resulttype:=voidtype;
  894. { now we know the type of buffer }
  895. srsym:=searchsymonlyin(systemunit,'SETTEXTBUF');
  896. hp:=ccallparanode.create(cordconstnode.create(tcallparanode(left).left.resulttype.def.size,s32bittype),left);
  897. hp:=ccallnode.create(hp,tprocsym(srsym),systemunit,nil);
  898. left:=nil;
  899. resulttypepass(hp);
  900. result:=hp;
  901. end;
  902. { the firstpass of the arg has been done in firstcalln ? }
  903. in_reset_typedfile,
  904. in_rewrite_typedfile :
  905. begin
  906. set_varstate(left,true);
  907. resulttype:=voidtype;
  908. end;
  909. in_str_x_string :
  910. begin
  911. resulttype:=voidtype;
  912. set_varstate(left,false);
  913. { remove warning when result is passed }
  914. set_funcret_is_valid(tcallparanode(left).left);
  915. set_varstate(tcallparanode(tcallparanode(left).right).left,true);
  916. hp:=left;
  917. { valid string ? }
  918. if not assigned(hp) or
  919. (tcallparanode(hp).left.resulttype.def.deftype<>stringdef) or
  920. (tcallparanode(hp).right=nil) then
  921. CGMessage(cg_e_illegal_expression);
  922. { we need a var parameter }
  923. valid_for_var(tcallparanode(hp).left);
  924. {$ifndef hascompilerproc}
  925. { with compilerproc's, this is not necessary anymore, the callnode }
  926. { will convert it to an openstring itself if necessary (JM) }
  927. { generate the high() value for the shortstring }
  928. if is_shortstring(tcallparanode(hp).left.resulttype.def) then
  929. tcallparanode(hp).gen_high_tree(true);
  930. {$endif not hascompilerproc}
  931. { !!!! check length of string }
  932. while assigned(tcallparanode(hp).right) do
  933. hp:=tcallparanode(hp).right;
  934. if not assigned(tcallparanode(hp).resulttype.def) then
  935. exit;
  936. { check and convert the first param }
  937. if (cpf_is_colon_para in tcallparanode(hp).callparaflags) or
  938. not assigned(hp.resulttype.def) then
  939. CGMessage(cg_e_illegal_expression);
  940. isreal:=false;
  941. case hp.resulttype.def.deftype of
  942. orddef :
  943. begin
  944. case torddef(tcallparanode(hp).left.resulttype.def).typ of
  945. u32bit,s32bit,
  946. s64bit,u64bit:
  947. ;
  948. u8bit,s8bit,
  949. u16bit,s16bit:
  950. inserttypeconv(tcallparanode(hp).left,s32bittype);
  951. else
  952. CGMessage(type_e_integer_or_real_expr_expected);
  953. end;
  954. end;
  955. floatdef :
  956. begin
  957. isreal:=true;
  958. end;
  959. else
  960. CGMessage(type_e_integer_or_real_expr_expected);
  961. end;
  962. { some format options ? }
  963. hpp:=tcallparanode(left).right;
  964. if assigned(hpp) and (cpf_is_colon_para in tcallparanode(hpp).callparaflags) then
  965. begin
  966. set_varstate(tcallparanode(hpp).left,true);
  967. if (not is_integer(tcallparanode(hpp).left.resulttype.def)) then
  968. CGMessage1(type_e_integer_expr_expected,tcallparanode(hpp).left.resulttype.def.typename)
  969. else
  970. inserttypeconv(tcallparanode(hpp).left,s32bittype);
  971. hpp:=tcallparanode(hpp).right;
  972. if assigned(hpp) and (cpf_is_colon_para in tcallparanode(hpp).callparaflags) then
  973. begin
  974. if isreal then
  975. begin
  976. if (not is_integer(tcallparanode(hpp).left.resulttype.def)) then
  977. CGMessage1(type_e_integer_expr_expected,tcallparanode(hpp).left.resulttype.def.typename)
  978. else
  979. begin
  980. set_varstate(tcallparanode(hpp).left,true);
  981. inserttypeconv(tcallparanode(hpp).left,s32bittype);
  982. end;
  983. end
  984. else
  985. CGMessage(parser_e_illegal_colon_qualifier);
  986. end;
  987. end;
  988. end;
  989. in_val_x :
  990. begin
  991. resulttype:=voidtype;
  992. { check the amount of parameters }
  993. if not(assigned(left)) or
  994. not(assigned(tcallparanode(left).right)) then
  995. begin
  996. CGMessage(parser_e_wrong_parameter_size);
  997. exit;
  998. end;
  999. { there is a "code" parameter }
  1000. If Assigned(tcallparanode(tcallparanode(left).right).right) Then
  1001. Begin
  1002. { first pass just the code parameter for first local use}
  1003. hp := tcallparanode(left).right;
  1004. tcallparanode(left).right := nil;
  1005. make_not_regable(tcallparanode(left).left);
  1006. set_varstate(left,false);
  1007. if codegenerror then
  1008. exit;
  1009. tcallparanode(left).right := hp;
  1010. { code has to be a var parameter }
  1011. if valid_for_var(tcallparanode(left).left) then
  1012. begin
  1013. if (tcallparanode(left).left.resulttype.def.deftype <> orddef) or
  1014. not(torddef(tcallparanode(left).left.resulttype.def).typ in [u16bit,s16bit,u32bit,s32bit]) then
  1015. CGMessage(type_e_mismatch);
  1016. end;
  1017. hpp := tcallparanode(left).right
  1018. End
  1019. Else
  1020. hpp := left;
  1021. { now hpp = the destination value tree }
  1022. { first pass just the destination parameter for first local use }
  1023. hp:=tcallparanode(hpp).right;
  1024. tcallparanode(hpp).right:=nil;
  1025. { hpp = destination }
  1026. make_not_regable(tcallparanode(hpp).left);
  1027. set_varstate(hpp,false);
  1028. if codegenerror then
  1029. exit;
  1030. { remove warning when result is passed }
  1031. set_funcret_is_valid(tcallparanode(hpp).left);
  1032. tcallparanode(hpp).right := hp;
  1033. if valid_for_var(tcallparanode(hpp).left) then
  1034. begin
  1035. If Not((tcallparanode(hpp).left.resulttype.def.deftype = floatdef) or
  1036. is_integer(tcallparanode(hpp).left.resulttype.def)) then
  1037. CGMessage(type_e_mismatch);
  1038. end;
  1039. { hp = source (String) }
  1040. { if not a stringdef then insert a type conv which
  1041. does the other type checking }
  1042. If (tcallparanode(hp).left.resulttype.def.deftype<>stringdef) then
  1043. inserttypeconv(tcallparanode(hp).left,cshortstringtype);
  1044. set_varstate(hp,true);
  1045. end;
  1046. in_include_x_y,
  1047. in_exclude_x_y:
  1048. begin
  1049. resulttype:=voidtype;
  1050. if assigned(left) then
  1051. begin
  1052. set_varstate(left,true);
  1053. { remove warning when result is passed }
  1054. set_funcret_is_valid(tcallparanode(left).left);
  1055. { first param must be var }
  1056. valid_for_var(tcallparanode(left).left);
  1057. { check type }
  1058. if assigned(left.resulttype.def) and
  1059. (left.resulttype.def.deftype=setdef) then
  1060. begin
  1061. { two paras ? }
  1062. if assigned(tcallparanode(left).right) then
  1063. begin
  1064. { insert a type conversion }
  1065. { to the type of the set elements }
  1066. inserttypeconv(tcallparanode(tcallparanode(left).right).left,
  1067. tsetdef(left.resulttype.def).elementtype);
  1068. { only three parameters are allowed }
  1069. if assigned(tcallparanode(tcallparanode(left).right).right) then
  1070. CGMessage(cg_e_illegal_expression);
  1071. end;
  1072. end
  1073. else
  1074. CGMessage(type_e_mismatch);
  1075. end
  1076. else
  1077. CGMessage(type_e_mismatch);
  1078. end;
  1079. in_low_x,
  1080. in_high_x:
  1081. begin
  1082. set_varstate(left,false);
  1083. case left.resulttype.def.deftype of
  1084. orddef,
  1085. enumdef:
  1086. begin
  1087. hp:=do_lowhigh(left.resulttype);
  1088. resulttypepass(hp);
  1089. result:=hp;
  1090. end;
  1091. setdef:
  1092. begin
  1093. hp:=do_lowhigh(tsetdef(left.resulttype.def).elementtype);
  1094. resulttypepass(hp);
  1095. result:=hp;
  1096. end;
  1097. arraydef:
  1098. begin
  1099. if inlinenumber=in_low_x then
  1100. begin
  1101. hp:=cordconstnode.create(tarraydef(left.resulttype.def).lowrange,tarraydef(left.resulttype.def).rangetype);
  1102. resulttypepass(hp);
  1103. result:=hp;
  1104. end
  1105. else
  1106. begin
  1107. if is_open_array(left.resulttype.def) or
  1108. is_array_of_const(left.resulttype.def) then
  1109. begin
  1110. srsym:=searchsymonlyin(tloadnode(left).symtable,'high'+tvarsym(tloadnode(left).symtableentry).name);
  1111. hp:=cloadnode.create(tvarsym(srsym),tloadnode(left).symtable);
  1112. resulttypepass(hp);
  1113. result:=hp;
  1114. end
  1115. else
  1116. if is_dynamic_array(left.resulttype.def) then
  1117. begin
  1118. {$ifndef hascompilerproc}
  1119. writeln('Error: high(dynamic_array) isn''t implemented yet');
  1120. codegenerror := true;
  1121. {$else hascompilerproc}
  1122. { can't use inserttypeconv because we need }
  1123. { an explicit type conversion (JM) }
  1124. hp := ctypeconvnode.create(left,voidpointertype);
  1125. hp.toggleflag(nf_explizit);
  1126. hp := ccallparanode.create(hp,nil);
  1127. hp := ccallnode.createintern('fpc_dynarray_high',hp);
  1128. { make sure the left node doesn't get disposed, since it's }
  1129. { reused in the new node (JM) }
  1130. left:=nil;
  1131. resulttypepass(hp);
  1132. result:=hp;
  1133. {$endif hascompilerproc}
  1134. end
  1135. else
  1136. begin
  1137. hp:=cordconstnode.create(tarraydef(left.resulttype.def).highrange,tarraydef(left.resulttype.def).rangetype);
  1138. resulttypepass(hp);
  1139. result:=hp;
  1140. end;
  1141. end;
  1142. end;
  1143. stringdef:
  1144. begin
  1145. if inlinenumber=in_low_x then
  1146. begin
  1147. hp:=cordconstnode.create(0,u8bittype);
  1148. resulttypepass(hp);
  1149. result:=hp;
  1150. end
  1151. else
  1152. begin
  1153. if is_open_string(left.resulttype.def) then
  1154. begin
  1155. srsym:=searchsymonlyin(tloadnode(left).symtable,'high'+tvarsym(tloadnode(left).symtableentry).name);
  1156. hp:=cloadnode.create(tvarsym(srsym),tloadnode(left).symtable);
  1157. resulttypepass(hp);
  1158. result:=hp;
  1159. end
  1160. else
  1161. begin
  1162. hp:=cordconstnode.create(tstringdef(left.resulttype.def).len,u8bittype);
  1163. resulttypepass(hp);
  1164. result:=hp;
  1165. end;
  1166. end;
  1167. end;
  1168. else
  1169. CGMessage(type_e_mismatch);
  1170. end;
  1171. end;
  1172. in_pi:
  1173. begin
  1174. if block_type=bt_const then
  1175. setconstrealvalue(pi)
  1176. else
  1177. resulttype:=s80floattype;
  1178. end;
  1179. in_cos_extended :
  1180. begin
  1181. if left.nodetype in [ordconstn,realconstn] then
  1182. setconstrealvalue(cos(getconstrealvalue))
  1183. else
  1184. begin
  1185. set_varstate(left,true);
  1186. inserttypeconv(left,s80floattype);
  1187. resulttype:=s80floattype;
  1188. end;
  1189. end;
  1190. in_sin_extended :
  1191. begin
  1192. if left.nodetype in [ordconstn,realconstn] then
  1193. setconstrealvalue(sin(getconstrealvalue))
  1194. else
  1195. begin
  1196. set_varstate(left,true);
  1197. inserttypeconv(left,s80floattype);
  1198. resulttype:=s80floattype;
  1199. end;
  1200. end;
  1201. in_arctan_extended :
  1202. begin
  1203. if left.nodetype in [ordconstn,realconstn] then
  1204. setconstrealvalue(arctan(getconstrealvalue))
  1205. else
  1206. begin
  1207. set_varstate(left,true);
  1208. inserttypeconv(left,s80floattype);
  1209. resulttype:=s80floattype;
  1210. end;
  1211. end;
  1212. in_abs_extended :
  1213. begin
  1214. if left.nodetype in [ordconstn,realconstn] then
  1215. setconstrealvalue(abs(getconstrealvalue))
  1216. else
  1217. begin
  1218. set_varstate(left,true);
  1219. inserttypeconv(left,s80floattype);
  1220. resulttype:=s80floattype;
  1221. end;
  1222. end;
  1223. in_sqr_extended :
  1224. begin
  1225. if left.nodetype in [ordconstn,realconstn] then
  1226. setconstrealvalue(sqr(getconstrealvalue))
  1227. else
  1228. begin
  1229. set_varstate(left,true);
  1230. inserttypeconv(left,s80floattype);
  1231. resulttype:=s80floattype;
  1232. end;
  1233. end;
  1234. in_sqrt_extended :
  1235. begin
  1236. if left.nodetype in [ordconstn,realconstn] then
  1237. begin
  1238. vr:=getconstrealvalue;
  1239. if vr<0.0 then
  1240. begin
  1241. CGMessage(type_e_wrong_math_argument);
  1242. setconstrealvalue(0);
  1243. end
  1244. else
  1245. setconstrealvalue(sqrt(vr));
  1246. end
  1247. else
  1248. begin
  1249. set_varstate(left,true);
  1250. inserttypeconv(left,s80floattype);
  1251. resulttype:=s80floattype;
  1252. end;
  1253. end;
  1254. in_ln_extended :
  1255. begin
  1256. if left.nodetype in [ordconstn,realconstn] then
  1257. begin
  1258. vr:=getconstrealvalue;
  1259. if vr<=0.0 then
  1260. begin
  1261. CGMessage(type_e_wrong_math_argument);
  1262. setconstrealvalue(0);
  1263. end
  1264. else
  1265. setconstrealvalue(ln(vr));
  1266. end
  1267. else
  1268. begin
  1269. set_varstate(left,true);
  1270. inserttypeconv(left,s80floattype);
  1271. resulttype:=s80floattype;
  1272. end;
  1273. end;
  1274. {$ifdef SUPPORT_MMX}
  1275. in_mmx_pcmpeqb..in_mmx_pcmpgtw:
  1276. begin
  1277. end;
  1278. {$endif SUPPORT_MMX}
  1279. in_assert_x_y :
  1280. begin
  1281. resulttype:=voidtype;
  1282. if assigned(left) then
  1283. begin
  1284. set_varstate(left,true);
  1285. { check type }
  1286. if is_boolean(left.resulttype.def) then
  1287. begin
  1288. { must always be a string }
  1289. inserttypeconv(tcallparanode(tcallparanode(left).right).left,cshortstringtype);
  1290. end
  1291. else
  1292. CGMessage(type_e_mismatch);
  1293. end
  1294. else
  1295. CGMessage(type_e_mismatch);
  1296. end;
  1297. else
  1298. internalerror(8);
  1299. end;
  1300. end;
  1301. myexit:
  1302. { Run get_paratype again to update maybe inserted typeconvs }
  1303. if not codegenerror then
  1304. begin
  1305. if assigned(left) and
  1306. (left.nodetype=callparan) then
  1307. tcallparanode(left).get_paratype;
  1308. end;
  1309. dec(parsing_para_level);
  1310. end;
  1311. {$ifdef fpc}
  1312. {$maxfpuregisters 0}
  1313. {$endif fpc}
  1314. {$ifdef hascompilerproc}
  1315. function tinlinenode.str_pass_1 : tnode;
  1316. var
  1317. lenpara,
  1318. fracpara,
  1319. newparas,
  1320. dest,
  1321. source : tcallparanode;
  1322. newnode : tnode;
  1323. len,
  1324. fraclen : longint;
  1325. procname: string;
  1326. is_real : boolean;
  1327. begin
  1328. { get destination string }
  1329. dest := tcallparanode(left);
  1330. { get source para (number) }
  1331. source := dest;
  1332. while assigned(source.right) do
  1333. source := tcallparanode(source.right);
  1334. is_real := source.resulttype.def.deftype = floatdef;
  1335. { get len/frac parameters }
  1336. lenpara := nil;
  1337. fracpara := nil;
  1338. if (cpf_is_colon_para in tcallparanode(dest.right).callparaflags) then
  1339. begin
  1340. lenpara := tcallparanode(dest.right);
  1341. if (cpf_is_colon_para in tcallparanode(lenpara.right).callparaflags) then
  1342. begin
  1343. fracpara := lenpara;
  1344. lenpara := tcallparanode(lenpara.right);
  1345. end;
  1346. end;
  1347. { generate the parameter list for the compilerproc }
  1348. newparas := dest;
  1349. { if we have a float parameter, insert the realtype, len and fracpara parameters }
  1350. if is_real then
  1351. begin
  1352. { insert realtype parameter }
  1353. newparas.right := ccallparanode.create(cordconstnode.create(
  1354. ord(tfloatdef(source.left.resulttype.def).typ),s32bittype),newparas.right);
  1355. { if necessary, insert a fraction parameter }
  1356. if not assigned(fracpara) then
  1357. begin
  1358. tcallparanode(newparas.right).right := ccallparanode.create(
  1359. cordconstnode.create(-1,s32bittype),tcallparanode(newparas.right).right);
  1360. fracpara := tcallparanode(tcallparanode(newparas.right).right);
  1361. end;
  1362. { if necessary, insert a length para }
  1363. if not assigned(lenpara) then
  1364. fracpara.right := ccallparanode.create(cordconstnode.create(-32767,s32bittype),
  1365. fracpara.right);
  1366. end
  1367. else
  1368. { for a normal parameter, insert a only length parameter if one is missing }
  1369. if not assigned(lenpara) then
  1370. newparas.right := ccallparanode.create(cordconstnode.create(-1,s32bittype),
  1371. newparas.right);
  1372. { remove the parameters from the original node so they won't get disposed, }
  1373. { since they're reused }
  1374. left := nil;
  1375. { create procedure name }
  1376. procname := 'fpc_' + lowercase(tstringdef(dest.resulttype.def).stringtypname)+'_';
  1377. if is_real then
  1378. procname := procname + 'float'
  1379. else
  1380. case torddef(dest.resulttype.def).typ of
  1381. u32bit:
  1382. procname := procname + 'cardinal';
  1383. u64bit:
  1384. procname := procname + 'qword';
  1385. s64bit:
  1386. procname := procname + 'int64';
  1387. else
  1388. procname := procname + 'longint';
  1389. end;
  1390. { create the call node, }
  1391. newnode := ccallnode.createintern(procname,newparas);
  1392. { firstpass it }
  1393. firstpass(newnode);
  1394. { and return it }
  1395. result := newnode;
  1396. end;
  1397. function tinlinenode.reset_rewrite_typed_pass_1: tnode;
  1398. begin
  1399. { add the recsize parameter }
  1400. { note: for some reason, the parameter of intern procedures with only one }
  1401. { parameter is gets lifted out of its original tcallparanode (see round }
  1402. { line 1301 of ncal.pas), so recreate a tcallparanode here (JM) }
  1403. left := ccallparanode.create(cordconstnode.create(
  1404. tfiledef(left.resulttype.def).typedfiletype.def.size,s32bittype),
  1405. ccallparanode.create(left,nil));
  1406. { create the correct call }
  1407. if inlinenumber=in_reset_typedfile then
  1408. result := ccallnode.createintern('fpc_reset_typed',left)
  1409. else
  1410. result := ccallnode.createintern('fpc_rewrite_typed',left);
  1411. firstpass(result);
  1412. { make sure left doesn't get disposed, since we use it in the new call }
  1413. left := nil;
  1414. end;
  1415. {$endif hascompilerproc}
  1416. function tinlinenode.pass_1 : tnode;
  1417. var
  1418. srsym : tsym;
  1419. hp,hpp : tnode;
  1420. extra_register,
  1421. iswrite,
  1422. file_is_typed : boolean;
  1423. begin
  1424. result:=nil;
  1425. { if we handle writeln; left contains no valid address }
  1426. if assigned(left) then
  1427. begin
  1428. if left.nodetype=callparan then
  1429. tcallparanode(left).firstcallparan(nil,false)
  1430. else
  1431. firstpass(left);
  1432. left_max;
  1433. set_location(location,left.location);
  1434. end;
  1435. inc(parsing_para_level);
  1436. { intern const should already be handled }
  1437. if nf_inlineconst in flags then
  1438. internalerror(200104044);
  1439. case inlinenumber of
  1440. in_lo_qword,
  1441. in_hi_qword,
  1442. in_lo_long,
  1443. in_hi_long,
  1444. in_lo_word,
  1445. in_hi_word:
  1446. begin
  1447. if registers32<1 then
  1448. registers32:=1;
  1449. location.loc:=LOC_REGISTER;
  1450. end;
  1451. in_sizeof_x:
  1452. begin
  1453. if push_high_param(left.resulttype.def) then
  1454. begin
  1455. srsym:=searchsymonlyin(tloadnode(left).symtable,'high'+tvarsym(tloadnode(left).symtableentry).name);
  1456. hp:=caddnode.create(addn,cloadnode.create(tvarsym(srsym),tloadnode(left).symtable),
  1457. cordconstnode.create(1,s32bittype));
  1458. if (left.resulttype.def.deftype=arraydef) and
  1459. (tarraydef(left.resulttype.def).elesize<>1) then
  1460. hp:=caddnode.create(muln,hp,cordconstnode.create(tarraydef(left.resulttype.def).elesize,s32bittype));
  1461. firstpass(hp);
  1462. result:=hp;
  1463. end
  1464. else
  1465. begin
  1466. if registers32<1 then
  1467. registers32:=1;
  1468. location.loc:=LOC_REGISTER;
  1469. end;
  1470. end;
  1471. in_typeof_x:
  1472. begin
  1473. if registers32<1 then
  1474. registers32:=1;
  1475. location.loc:=LOC_REGISTER;
  1476. end;
  1477. in_ord_x,
  1478. in_chr_byte:
  1479. begin
  1480. { should not happend as it's converted to typeconv }
  1481. internalerror(200104045);
  1482. end;
  1483. in_length_x:
  1484. begin
  1485. if is_shortstring(left.resulttype.def) then
  1486. location.loc:=LOC_REFERENCE
  1487. else
  1488. begin
  1489. { ansi/wide string }
  1490. if registers32<1 then
  1491. registers32:=1;
  1492. location.loc:=LOC_REGISTER;
  1493. end;
  1494. end;
  1495. in_typeinfo_x:
  1496. begin
  1497. location.loc:=LOC_REGISTER;
  1498. registers32:=1;
  1499. end;
  1500. in_assigned_x:
  1501. begin
  1502. location.loc:=LOC_FLAGS;
  1503. end;
  1504. in_ofs_x :
  1505. internalerror(2000101001);
  1506. in_seg_x :
  1507. internalerror(200104046);
  1508. in_pred_x,
  1509. in_succ_x:
  1510. begin
  1511. if is_64bitint(resulttype.def) then
  1512. begin
  1513. if (registers32<2) then
  1514. registers32:=2
  1515. end
  1516. else
  1517. begin
  1518. if (registers32<1) then
  1519. registers32:=1;
  1520. end;
  1521. location.loc:=LOC_REGISTER;
  1522. end;
  1523. in_setlength_x:
  1524. begin
  1525. end;
  1526. in_finalize_x:
  1527. begin
  1528. end;
  1529. in_inc_x,
  1530. in_dec_x:
  1531. begin
  1532. { check type }
  1533. if is_64bitint(left.resulttype.def) or
  1534. { range/overflow checking doesn't work properly }
  1535. { with the inc/dec code that's generated (JM) }
  1536. ((left.resulttype.def.deftype = orddef) and
  1537. not(is_char(left.resulttype.def)) and
  1538. not(is_boolean(left.resulttype.def)) and
  1539. (aktlocalswitches *
  1540. [cs_check_overflow,cs_check_range] <> [])) then
  1541. { convert to simple add (JM) }
  1542. begin
  1543. { extra parameter? }
  1544. if assigned(tcallparanode(left).right) then
  1545. begin
  1546. { Yes, use for add node }
  1547. hpp := tcallparanode(tcallparanode(left).right).left;
  1548. tcallparanode(tcallparanode(left).right).left := nil;
  1549. if assigned(tcallparanode(tcallparanode(left).right).right) then
  1550. CGMessage(cg_e_illegal_expression);
  1551. end
  1552. else
  1553. { no, create constant 1 }
  1554. hpp := cordconstnode.create(1,s32bittype);
  1555. { addition/substraction depending on inc/dec }
  1556. if inlinenumber = in_inc_x then
  1557. hp := caddnode.create(addn,tcallparanode(left).left.getcopy,hpp)
  1558. else
  1559. hp := caddnode.create(subn,tcallparanode(left).left.getcopy,hpp);
  1560. { assign result of addition }
  1561. hpp := cassignmentnode.create(tcallparanode(left).left,hp);
  1562. tcallparanode(left).left := nil;
  1563. { firstpass it }
  1564. firstpass(hpp);
  1565. { return new node }
  1566. result := hpp;
  1567. end
  1568. else if (left.resulttype.def.deftype in [enumdef,pointerdef]) or
  1569. is_ordinal(left.resulttype.def) then
  1570. begin
  1571. { two paras ? }
  1572. if assigned(tcallparanode(left).right) then
  1573. begin
  1574. { need we an additional register ? }
  1575. if not(is_constintnode(tcallparanode(tcallparanode(left).right).left)) and
  1576. (tcallparanode(tcallparanode(left).right).left.location.loc in [LOC_MEM,LOC_REFERENCE]) and
  1577. (tcallparanode(tcallparanode(left).right).left.registers32<=1) then
  1578. inc(registers32);
  1579. { do we need an additional register to restore the first parameter? }
  1580. if tcallparanode(tcallparanode(left).right).left.registers32>=registers32 then
  1581. inc(registers32);
  1582. end;
  1583. end;
  1584. end;
  1585. in_read_x,
  1586. in_readln_x,
  1587. in_write_x,
  1588. in_writeln_x :
  1589. begin
  1590. { needs a call }
  1591. procinfo^.flags:=procinfo^.flags or pi_do_call;
  1592. { true, if readln needs an extra register }
  1593. extra_register:=false;
  1594. { we must know if it is a typed file or not }
  1595. { but we must first do the firstpass for it }
  1596. file_is_typed:=false;
  1597. if assigned(left) then
  1598. begin
  1599. iswrite:=(inlinenumber in [in_write_x,in_writeln_x]);
  1600. { now we can check }
  1601. hp:=left;
  1602. while assigned(tcallparanode(hp).right) do
  1603. hp:=tcallparanode(hp).right;
  1604. { if resulttype.def is not assigned, then automatically }
  1605. { file is not typed. }
  1606. if assigned(hp) then
  1607. Begin
  1608. if (hp.resulttype.def.deftype=filedef) and
  1609. (tfiledef(hp.resulttype.def).filetyp=ft_typed) then
  1610. file_is_typed:=true;
  1611. end; { endif assigned(hp) }
  1612. if (not file_is_typed) then
  1613. begin
  1614. hp:=left;
  1615. while assigned(hp) do
  1616. begin
  1617. {$ifdef i386}
  1618. incrementregisterpushed($ff);
  1619. {$else}
  1620. incrementregisterpushed(ALL_REGISTERS);
  1621. {$endif}
  1622. if assigned(tcallparanode(hp).left.resulttype.def) then
  1623. begin
  1624. case tcallparanode(hp).left.resulttype.def.deftype of
  1625. orddef :
  1626. begin
  1627. if not(iswrite) and
  1628. not(is_64bitint(tcallparanode(hp).left.resulttype.def)) then
  1629. extra_register:=true;
  1630. end;
  1631. end;
  1632. end;
  1633. hp:=tcallparanode(hp).right;
  1634. end;
  1635. end;
  1636. { calc registers }
  1637. left_max;
  1638. if extra_register then
  1639. inc(registers32);
  1640. end;
  1641. end;
  1642. in_settextbuf_file_x :
  1643. internalerror(200104262);
  1644. in_reset_typedfile,
  1645. in_rewrite_typedfile :
  1646. begin
  1647. {$ifndef hascompilerproc}
  1648. procinfo^.flags:=procinfo^.flags or pi_do_call;
  1649. {$else not hascompilerproc}
  1650. result := reset_rewrite_typed_pass_1;
  1651. {$endif not hascompilerproc}
  1652. end;
  1653. in_str_x_string :
  1654. begin
  1655. {$ifndef hascompilerproc}
  1656. procinfo^.flags:=procinfo^.flags or pi_do_call;
  1657. { calc registers }
  1658. left_max;
  1659. {$else not hascompilerproc}
  1660. result := str_pass_1;
  1661. {$endif not hascompilerproc}
  1662. end;
  1663. in_val_x :
  1664. begin
  1665. procinfo^.flags:=procinfo^.flags or pi_do_call;
  1666. { calc registers }
  1667. left_max;
  1668. { val doesn't calculate the registers really }
  1669. { correct, we need one register extra (FK) }
  1670. { there is a "code" parameter }
  1671. If Assigned(tcallparanode(tcallparanode(left).right).right) Then
  1672. hpp := tcallparanode(left).right
  1673. Else
  1674. hpp := left;
  1675. { now hpp = the destination value tree }
  1676. if is_64bitint(tcallparanode(hpp).left.resulttype.def) then
  1677. inc(registers32,2)
  1678. else
  1679. inc(registers32,1);
  1680. end;
  1681. in_include_x_y,
  1682. in_exclude_x_y:
  1683. begin
  1684. registers32:=left.registers32;
  1685. registersfpu:=left.registersfpu;
  1686. {$ifdef SUPPORT_MMX}
  1687. registersmmx:=left.registersmmx;
  1688. {$endif SUPPORT_MMX}
  1689. end;
  1690. in_low_x,
  1691. in_high_x:
  1692. internalerror(200104047);
  1693. in_cos_extended:
  1694. begin
  1695. location.loc:=LOC_FPU;
  1696. registers32:=left.registers32;
  1697. registersfpu:=left.registersfpu;
  1698. {$ifdef SUPPORT_MMX}
  1699. registersmmx:=left.registersmmx;
  1700. {$endif SUPPORT_MMX}
  1701. end;
  1702. in_sin_extended:
  1703. begin
  1704. location.loc:=LOC_FPU;
  1705. registers32:=left.registers32;
  1706. registersfpu:=left.registersfpu;
  1707. {$ifdef SUPPORT_MMX}
  1708. registersmmx:=left.registersmmx;
  1709. {$endif SUPPORT_MMX}
  1710. end;
  1711. in_arctan_extended:
  1712. begin
  1713. location.loc:=LOC_FPU;
  1714. registers32:=left.registers32;
  1715. registersfpu:=left.registersfpu;
  1716. {$ifdef SUPPORT_MMX}
  1717. registersmmx:=left.registersmmx;
  1718. {$endif SUPPORT_MMX}
  1719. end;
  1720. in_pi:
  1721. begin
  1722. location.loc:=LOC_FPU;
  1723. end;
  1724. in_abs_extended:
  1725. begin
  1726. location.loc:=LOC_FPU;
  1727. registers32:=left.registers32;
  1728. registersfpu:=left.registersfpu;
  1729. {$ifdef SUPPORT_MMX}
  1730. registersmmx:=left.registersmmx;
  1731. {$endif SUPPORT_MMX}
  1732. end;
  1733. in_sqr_extended:
  1734. begin
  1735. location.loc:=LOC_FPU;
  1736. registers32:=left.registers32;
  1737. registersfpu:=left.registersfpu;
  1738. {$ifdef SUPPORT_MMX}
  1739. registersmmx:=left.registersmmx;
  1740. {$endif SUPPORT_MMX}
  1741. end;
  1742. in_sqrt_extended:
  1743. begin
  1744. location.loc:=LOC_FPU;
  1745. registers32:=left.registers32;
  1746. registersfpu:=left.registersfpu;
  1747. {$ifdef SUPPORT_MMX}
  1748. registersmmx:=left.registersmmx;
  1749. {$endif SUPPORT_MMX}
  1750. end;
  1751. in_ln_extended:
  1752. begin
  1753. location.loc:=LOC_FPU;
  1754. registers32:=left.registers32;
  1755. registersfpu:=left.registersfpu;
  1756. {$ifdef SUPPORT_MMX}
  1757. registersmmx:=left.registersmmx;
  1758. {$endif SUPPORT_MMX}
  1759. end;
  1760. {$ifdef SUPPORT_MMX}
  1761. in_mmx_pcmpeqb..in_mmx_pcmpgtw:
  1762. begin
  1763. end;
  1764. {$endif SUPPORT_MMX}
  1765. in_assert_x_y :
  1766. begin
  1767. { We've checked the whole statement for correctness, now we
  1768. can remove it if assertions are off }
  1769. if not(cs_do_assertion in aktlocalswitches) then
  1770. begin
  1771. { we need a valid node, so insert a nothingn }
  1772. result:=cnothingnode.create;
  1773. end
  1774. else
  1775. begin
  1776. registers32:=left.registers32;
  1777. registersfpu:=left.registersfpu;
  1778. {$ifdef SUPPORT_MMX}
  1779. registersmmx:=left.registersmmx;
  1780. {$endif SUPPORT_MMX}
  1781. end;
  1782. end;
  1783. else
  1784. internalerror(8);
  1785. end;
  1786. dec(parsing_para_level);
  1787. end;
  1788. {$ifdef fpc}
  1789. {$maxfpuregisters default}
  1790. {$endif fpc}
  1791. function tinlinenode.docompare(p: tnode): boolean;
  1792. begin
  1793. docompare :=
  1794. inherited docompare(p) and
  1795. (inlinenumber = tinlinenode(p).inlinenumber);
  1796. end;
  1797. begin
  1798. cinlinenode:=tinlinenode;
  1799. end.
  1800. {
  1801. $Log$
  1802. Revision 1.48 2001-08-13 15:39:52 jonas
  1803. * made in_reset_typedfile/in_rewrite_typedfile handling processor
  1804. independent
  1805. Revision 1.47 2001/08/13 12:41:57 jonas
  1806. * made code for str(x,y) completely processor independent
  1807. Revision 1.46 2001/08/06 12:47:31 jonas
  1808. * parameters to FPC_TYPED_WRITE can't be regvars (merged)
  1809. Revision 1.45 2001/08/06 09:44:10 jonas
  1810. + support for high(dynarray) using compilerproc (forgot to commit
  1811. previously)
  1812. Revision 1.44 2001/07/09 21:15:40 peter
  1813. * Length made internal
  1814. * Add array support for Length
  1815. Revision 1.43 2001/07/08 21:00:15 peter
  1816. * various widestring updates, it works now mostly without charset
  1817. mapping supported
  1818. Revision 1.42 2001/06/04 11:48:01 peter
  1819. * better const to var checking
  1820. Revision 1.41 2001/06/03 20:12:53 peter
  1821. * changed int64($ffffffff) that is buggy under 1.0.x to expression
  1822. with a shl
  1823. Revision 1.40 2001/05/06 17:16:43 jonas
  1824. + added warning about missing implementation for high(dynamic_array)
  1825. Revision 1.39 2001/04/26 21:57:05 peter
  1826. * moved code from firstpass to det_resulttype and remove extraneous
  1827. calls to firstcallparan for in_str,in_write,in_val
  1828. Revision 1.38 2001/04/21 12:03:11 peter
  1829. * m68k updates merged from fixes branch
  1830. Revision 1.37 2001/04/13 22:22:30 peter
  1831. * call set_varstate for setlength
  1832. * ptr returns pointerconstnode instead of ordconstnode
  1833. Revision 1.36 2001/04/13 01:22:09 peter
  1834. * symtable change to classes
  1835. * range check generation and errors fixed, make cycle DEBUG=1 works
  1836. * memory leaks fixed
  1837. Revision 1.35 2001/04/05 21:02:13 peter
  1838. * fixed fpu inline functions typeconvs
  1839. Revision 1.34 2001/04/04 22:42:40 peter
  1840. * move constant folding into det_resulttype
  1841. Revision 1.33 2001/04/04 21:30:43 florian
  1842. * applied several fixes to get the DD8 Delphi Unit compiled
  1843. e.g. "forward"-interfaces are working now
  1844. Revision 1.32 2001/04/02 21:20:31 peter
  1845. * resulttype rewrite
  1846. Revision 1.31 2001/03/23 00:16:07 florian
  1847. + some stuff to compile FreeCLX added
  1848. Revision 1.30 2001/03/12 12:47:46 michael
  1849. + Patches from peter
  1850. Revision 1.29 2001/03/03 12:38:08 jonas
  1851. * fixed low() for signed types < 64bit
  1852. Revision 1.28 2001/02/26 19:44:53 peter
  1853. * merged generic m68k updates from fixes branch
  1854. Revision 1.27 2001/02/22 11:24:40 jonas
  1855. * fixed bug in previous fix (hopped over revision 1.26 because that one
  1856. also removed the fix for high(cardinal))
  1857. Revision 1.26 2001/02/21 20:50:59 peter
  1858. * fix to compile again, but high(cardinal) with $R+ still fails!
  1859. Revision 1.25 2001/02/21 12:57:46 jonas
  1860. * fixed high/low for cardinal, int64 and qword
  1861. Revision 1.24 2001/01/06 19:54:11 peter
  1862. * merged fix for 1310
  1863. Revision 1.23 2001/01/06 18:28:39 peter
  1864. * fixed wrong notes about locals
  1865. Revision 1.22 2000/12/31 11:14:10 jonas
  1866. + implemented/fixed docompare() mathods for all nodes (not tested)
  1867. + nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
  1868. and constant strings/chars together
  1869. * n386add.pas: don't copy temp strings (of size 256) to another temp string
  1870. when adding
  1871. Revision 1.21 2000/12/25 00:07:26 peter
  1872. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  1873. tlinkedlist objects)
  1874. Revision 1.20 2000/12/17 14:35:41 peter
  1875. * fixed crash with val()
  1876. Revision 1.19 2000/11/29 00:30:33 florian
  1877. * unused units removed from uses clause
  1878. * some changes for widestrings
  1879. Revision 1.18 2000/11/12 15:27:22 jonas
  1880. * also don't do conversion for chars/booleans (hopefully final change :/)
  1881. Revision 1.17 2000/11/11 21:08:13 jonas
  1882. * don't do inc/dec to add/sub conversion for enums
  1883. Revision 1.16 2000/11/11 16:18:35 peter
  1884. * ptr returns farpointer
  1885. Revision 1.15 2000/11/11 15:59:07 jonas
  1886. * convert inc/dec to add/sub when range/overflow checking is on
  1887. Revision 1.14 2000/11/09 17:46:54 florian
  1888. * System.TypeInfo fixed
  1889. + System.Finalize implemented
  1890. + some new keywords for interface support added
  1891. Revision 1.13 2000/11/04 16:48:32 florian
  1892. * innr.inc renamed to make compiler compilation easier because the rtl contains
  1893. a file of the same name
  1894. Revision 1.12 2000/10/31 22:02:48 peter
  1895. * symtable splitted, no real code changes
  1896. Revision 1.11 2000/10/26 14:15:06 jonas
  1897. * fixed setlength for shortstrings
  1898. Revision 1.10 2000/10/21 18:16:11 florian
  1899. * a lot of changes:
  1900. - basic dyn. array support
  1901. - basic C++ support
  1902. - some work for interfaces done
  1903. ....
  1904. Revision 1.9 2000/10/15 08:38:46 jonas
  1905. * added missing getcopy for previous addition
  1906. Revision 1.8 2000/10/14 18:27:53 jonas
  1907. * merged fix for inc/dec on 64bit types from tcinl
  1908. Revision 1.7 2000/10/14 10:14:50 peter
  1909. * moehrendorf oct 2000 rewrite
  1910. Revision 1.6 2000/10/01 19:48:24 peter
  1911. * lot of compile updates for cg11
  1912. Revision 1.5 2000/09/28 19:49:52 florian
  1913. *** empty log message ***
  1914. Revision 1.4 2000/09/28 16:34:47 florian
  1915. *** empty log message ***
  1916. Revision 1.3 2000/09/27 21:33:22 florian
  1917. * finally nadd.pas compiles
  1918. Revision 1.2 2000/09/27 20:25:44 florian
  1919. * more stuff fixed
  1920. Revision 1.1 2000/09/26 14:59:34 florian
  1921. * more conversion work done
  1922. }