tgobj.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. This unit implements the base object for temp. generator
  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. {#@abstract(Temporary reference allocator unit)}
  19. unit tgobj;
  20. {$i defines.inc}
  21. interface
  22. uses
  23. globals,
  24. cpubase,
  25. cpuinfo,
  26. cpuasm,
  27. tainst,
  28. cclasses,globtype,cgbase,aasm;
  29. type
  30. ttemptype = (tt_none,tt_free,tt_normal,tt_persistant,
  31. tt_ansistring,tt_freeansistring,tt_widestring,tt_freewidestring,
  32. tt_interfacecom,tt_freeinterfacecom);
  33. ttemptypeset = set of ttemptype;
  34. ptemprecord = ^ttemprecord;
  35. ttemprecord = record
  36. temptype : ttemptype;
  37. pos : longint;
  38. size : longint;
  39. next : ptemprecord;
  40. nextfree : ptemprecord; { for faster freeblock checking }
  41. {$ifdef EXTDEBUG}
  42. posinfo,
  43. releaseposinfo : tfileposinfo;
  44. {$endif}
  45. end;
  46. {# Generates temporary variables }
  47. ttgobj = class
  48. { contains all temps }
  49. templist : ptemprecord;
  50. { contains all free temps using nextfree links }
  51. tempfreelist : ptemprecord;
  52. { Offsets of the first/last temp }
  53. firsttemp,
  54. lasttemp : longint;
  55. lasttempofsize : ptemprecord;
  56. { tries to hold the amount of times which the current tree is processed }
  57. t_times: longint;
  58. constructor create;
  59. {# Clear and free the complete linked list of temporary memory
  60. locations. The list is set to nil.}
  61. procedure resettempgen;
  62. {# Sets the first offset from the frame pointer or stack pointer where
  63. the temporary references will be allocated. It is to note that this
  64. value should always be negative.
  65. @param(l start offset where temps will start in stack)
  66. }
  67. procedure setfirsttemp(l : longint);
  68. function gettempsize : longint;
  69. { special call for inlined procedures }
  70. function gettempofsizepersistant(list: taasmoutput; size : longint) : longint;
  71. procedure gettempofsizereferencepersistant(list: taasmoutput; l : longint;var ref : treference);
  72. procedure gettemppointerreferencefortype(list: taasmoutput; var ref : treference; const usedtype, freetype: ttemptype);
  73. function ungettemppointeriftype(list: taasmoutput; const ref : treference; const usedtype, freetype: ttemptype) : boolean;
  74. { for parameter func returns }
  75. procedure normaltemptopersistant(pos : longint);
  76. {# Searches the list of currently allocated persistent memory space
  77. as the specified address @var(pos) , and if found, converts this memory
  78. space to normal volatile memory space which can be freed and reused.
  79. @param(pos offset from current frame pointer to memory area to convert)
  80. }
  81. procedure persistanttemptonormal(pos : longint);
  82. {procedure ungettemp(pos : longint;size : longint);}
  83. procedure ungetpersistanttemp(list: taasmoutput; pos : longint);
  84. procedure ungetpersistanttempreference(list: taasmoutput; const ref : treference);
  85. {# This routine is used to assign and allocate extra temporary volatile memory space
  86. on the stack from a reference. @var(l) is the size of the persistent memory space to
  87. allocate, while @var(ref) is a reference entry which will be set to the correct offset
  88. and correct base register (which is the current @var(procinfo^.framepointer)) register.
  89. The offset and base fields of ref will be set appropriately in this routine, and can be
  90. considered valid on exit of this routine.
  91. @param(l size of the area to allocate)
  92. @param(ref allocated reference)
  93. }
  94. procedure gettempofsizereference(list: taasmoutput; l : longint;var ref : treference);
  95. {# Returns TRUE if the reference ref is allocated in temporary volatile memory space,
  96. otherwise returns FALSE.
  97. @param(ref reference to verify)
  98. }
  99. function istemp(const ref : treference) : boolean;
  100. {# Frees a reference @var(ref) which was allocated in the volatile temporary memory space.
  101. The freed space can later be reallocated and reused. If this reference
  102. is not in the temporary memory, it is simply not freed.
  103. }
  104. procedure ungetiftemp(list: taasmoutput; const ref : treference);
  105. function getsizeoftemp(const ref: treference): longint;
  106. function ungetiftempansi(list: taasmoutput; const ref : treference) : boolean;
  107. procedure gettempansistringreference(list: taasmoutput; var ref : treference);
  108. function ungetiftempwidestr(list: taasmoutput; const ref : treference) : boolean;
  109. procedure gettempwidestringreference(list: taasmoutput; var ref : treference);
  110. function ungetiftempintfcom(list: taasmoutput; const ref : treference) : boolean;
  111. procedure gettempintfcomreference(list: taasmoutput; var ref : treference);
  112. private
  113. function ungettemp(list: taasmoutput; pos:longint;allowtype:ttemptype):ttemptype;
  114. function newtempofsize(size : longint) : longint;
  115. function gettempofsize(list: taasmoutput; size : longint) : longint;
  116. end;
  117. var
  118. tg: ttgobj;
  119. implementation
  120. uses
  121. systems,
  122. verbose,cutils;
  123. constructor ttgobj.create;
  124. begin
  125. tempfreelist:=nil;
  126. templist:=nil;
  127. lasttempofsize := nil;
  128. end;
  129. procedure ttgobj.resettempgen;
  130. var
  131. hp : ptemprecord;
  132. begin
  133. { Clear the old templist }
  134. while assigned(templist) do
  135. begin
  136. {$ifdef EXTDEBUG}
  137. case templist^.temptype of
  138. tt_normal,
  139. tt_persistant :
  140. Comment(V_Warning,'temporary assignment of size '+
  141. tostr(templist^.size)+' from pos '+tostr(templist^.posinfo.line)+
  142. ':'+tostr(templist^.posinfo.column)+
  143. ' at pos '+tostr(templist^.pos)+
  144. ' not freed at the end of the procedure');
  145. tt_ansistring :
  146. Comment(V_Warning,'temporary ANSI assignment of size '+
  147. tostr(templist^.size)+' from pos '+tostr(templist^.posinfo.line)+
  148. ':'+tostr(templist^.posinfo.column)+
  149. ' at pos '+tostr(templist^.pos)+
  150. ' not freed at the end of the procedure');
  151. tt_widestring :
  152. Comment(V_Warning,'temporary WIDE assignment of size '+
  153. tostr(templist^.size)+' from pos '+tostr(templist^.posinfo.line)+
  154. ':'+tostr(templist^.posinfo.column)+
  155. ' at pos '+tostr(templist^.pos)+
  156. ' not freed at the end of the procedure');
  157. end;
  158. {$endif}
  159. hp:=templist;
  160. templist:=hp^.next;
  161. dispose(hp);
  162. end;
  163. templist:=nil;
  164. tempfreelist:=nil;
  165. firsttemp:=0;
  166. lasttemp:=0;
  167. end;
  168. procedure ttgobj.setfirsttemp(l : longint);
  169. begin
  170. { this is a negative value normally }
  171. if l < 0 then
  172. Begin
  173. if odd(l) then
  174. Dec(l);
  175. end
  176. else
  177. Begin
  178. if odd(l) then
  179. Inc(l);
  180. end;
  181. firsttemp:=l;
  182. lasttemp:=l;
  183. end;
  184. function ttgobj.newtempofsize(size : longint) : longint;
  185. var
  186. tl : ptemprecord;
  187. begin
  188. { we need to allocate at least a minimum of 4 bytes, else
  189. we get two temps at the same position resulting in problems
  190. when finding the corresponding temprecord }
  191. if size=0 then
  192. size:=4;
  193. { Just extend the temp, everything below has been use
  194. already }
  195. dec(lasttemp,size);
  196. { now we can create the templist entry }
  197. new(tl);
  198. tl^.temptype:=tt_normal;
  199. tl^.pos:=lasttemp;
  200. tl^.size:=size;
  201. tl^.next:=templist;
  202. tl^.nextfree:=nil;
  203. templist:=tl;
  204. newtempofsize:=tl^.pos;
  205. end;
  206. function ttgobj.gettempofsize(list: taasmoutput; size : longint) : longint;
  207. var
  208. tl,
  209. bestslot,bestprev,
  210. hprev,hp : ptemprecord;
  211. bestsize,ofs : longint;
  212. begin
  213. bestprev:=nil;
  214. bestslot:=nil;
  215. tl:=nil;
  216. bestsize:=0;
  217. {$ifdef EXTDEBUG}
  218. if size=0 then
  219. Comment(V_Warning,'Temp of size 0 requested');
  220. {$endif}
  221. { Align needed size on 4 bytes }
  222. if (size mod 4)<>0 then
  223. size:=size+(4-(size mod 4));
  224. { First check the tmpfreelist }
  225. if assigned(tempfreelist) then
  226. begin
  227. { Check for a slot with the same size first }
  228. hprev:=nil;
  229. hp:=tempfreelist;
  230. while assigned(hp) do
  231. begin
  232. {$ifdef EXTDEBUG}
  233. if hp^.temptype<>tt_free then
  234. Comment(V_Warning,'Temp in freelist is not set to tt_free');
  235. {$endif}
  236. if hp^.size>=size then
  237. begin
  238. { Slot is the same size, then leave immediatly }
  239. if hp^.size=size then
  240. begin
  241. bestprev:=hprev;
  242. bestslot:=hp;
  243. bestsize:=size;
  244. break;
  245. end
  246. else
  247. begin
  248. if (bestsize=0) or (hp^.size<bestsize) then
  249. begin
  250. bestprev:=hprev;
  251. bestslot:=hp;
  252. bestsize:=hp^.size;
  253. end;
  254. end;
  255. end;
  256. hprev:=hp;
  257. hp:=hp^.nextfree;
  258. end;
  259. end;
  260. { Reuse an old temp ? }
  261. if assigned(bestslot) then
  262. begin
  263. if bestsize=size then
  264. begin
  265. bestslot^.temptype:=tt_normal;
  266. ofs:=bestslot^.pos;
  267. tl:=bestslot;
  268. { Remove from the tempfreelist }
  269. if assigned(bestprev) then
  270. bestprev^.nextfree:=bestslot^.nextfree
  271. else
  272. tempfreelist:=bestslot^.nextfree;
  273. end
  274. else
  275. begin
  276. { Resize the old block }
  277. dec(bestslot^.size,size);
  278. { Create new block and link after bestslot }
  279. new(tl);
  280. tl^.temptype:=tt_normal;
  281. tl^.pos:=bestslot^.pos+bestslot^.size;
  282. ofs:=tl^.pos;
  283. tl^.size:=size;
  284. tl^.nextfree:=nil;
  285. { link the new block }
  286. tl^.next:=bestslot^.next;
  287. bestslot^.next:=tl;
  288. end;
  289. end
  290. else
  291. begin
  292. ofs:=newtempofsize(size);
  293. tl:=templist;
  294. end;
  295. lasttempofsize:=tl;
  296. {$ifdef EXTDEBUG}
  297. tl^.posinfo:=aktfilepos;
  298. {$endif}
  299. list.concat(Taitempalloc.alloc(ofs,size));
  300. gettempofsize:=ofs;
  301. end;
  302. function ttgobj.gettempofsizepersistant(list: taasmoutput; size : longint) : longint;
  303. var
  304. l : longint;
  305. begin
  306. l:=gettempofsize(list, size);
  307. lasttempofsize^.temptype:=tt_persistant;
  308. {$ifdef EXTDEBUG}
  309. Comment(V_Debug,'temp managment : call to gettempofsizepersistant()'+
  310. ' with size '+tostr(size)+' returned '+tostr(l));
  311. {$endif}
  312. gettempofsizepersistant:=l;
  313. end;
  314. function ttgobj.gettempsize : longint;
  315. var
  316. _align : longint;
  317. begin
  318. { align to 4 bytes at least
  319. otherwise all those subl $2,%esp are meaningless PM }
  320. _align:=target_info.alignment.localalignmin;
  321. if _align<4 then
  322. _align:=4;
  323. gettempsize:=Align(-lasttemp,_align);
  324. end;
  325. procedure ttgobj.gettempofsizereference(list: taasmoutput; l : longint;var ref : treference);
  326. begin
  327. { do a reset, because the reference isn't used }
  328. FillChar(ref,sizeof(treference),0);
  329. ref.offset:=gettempofsize(list,l);
  330. ref.base:=procinfo^.framepointer;
  331. end;
  332. procedure ttgobj.gettempofsizereferencepersistant(list: taasmoutput; l : longint;var ref : treference);
  333. begin
  334. { do a reset, because the reference isn't used }
  335. FillChar(ref,sizeof(treference),0);
  336. ref.offset:=gettempofsizepersistant(list,l);
  337. ref.base:=procinfo^.framepointer;
  338. end;
  339. procedure ttgobj.gettemppointerreferencefortype(list: taasmoutput; var ref : treference; const usedtype, freetype: ttemptype);
  340. var
  341. foundslot,tl : ptemprecord;
  342. begin
  343. { do a reset, because the reference isn't used }
  344. FillChar(ref,sizeof(treference),0);
  345. ref.base:=procinfo^.framepointer;
  346. { Reuse old slot ? }
  347. foundslot:=nil;
  348. tl:=templist;
  349. while assigned(tl) do
  350. begin
  351. if tl^.temptype=freetype then
  352. begin
  353. foundslot:=tl;
  354. {$ifdef EXTDEBUG}
  355. tl^.posinfo:=aktfilepos;
  356. {$endif}
  357. break;
  358. end;
  359. tl:=tl^.next;
  360. end;
  361. if assigned(foundslot) then
  362. begin
  363. foundslot^.temptype:=usedtype;
  364. ref.offset:=foundslot^.pos;
  365. end
  366. else
  367. begin
  368. ref.offset:=newtempofsize(target_info.size_of_pointer);
  369. {$ifdef EXTDEBUG}
  370. templist^.posinfo:=aktfilepos;
  371. {$endif}
  372. templist^.temptype:=usedtype;
  373. end;
  374. list.concat(Taitempalloc.alloc(ref.offset,target_info.size_of_pointer));
  375. end;
  376. function ttgobj.ungettemppointeriftype(list: taasmoutput; const ref : treference; const usedtype, freetype: ttemptype) : boolean;
  377. var
  378. tl : ptemprecord;
  379. begin
  380. ungettemppointeriftype:=false;
  381. tl:=templist;
  382. while assigned(tl) do
  383. begin
  384. if tl^.pos=ref.offset then
  385. begin
  386. if tl^.temptype=usedtype then
  387. begin
  388. tl^.temptype:=freetype;
  389. ungettemppointeriftype:=true;
  390. list.concat(Taitempalloc.dealloc(tl^.pos,tl^.size));
  391. exit;
  392. {$ifdef EXTDEBUG}
  393. end
  394. else if (tl^.temptype=freetype) then
  395. begin
  396. Comment(V_Debug,'temp managment problem : ungettemppointeriftype()'+
  397. ' at pos '+tostr(ref.offset)+ ' already free !');
  398. {$endif}
  399. end;
  400. end;
  401. tl:=tl^.next;
  402. end;
  403. end;
  404. procedure ttgobj.gettempansistringreference(list: taasmoutput; var ref : treference);
  405. begin
  406. gettemppointerreferencefortype(list,ref,tt_ansistring,tt_freeansistring);
  407. end;
  408. procedure ttgobj.gettempwidestringreference(list: taasmoutput; var ref : treference);
  409. begin
  410. gettemppointerreferencefortype(list,ref,tt_widestring,tt_freewidestring);
  411. end;
  412. function ttgobj.ungetiftempansi(list: taasmoutput; const ref : treference) : boolean;
  413. begin
  414. ungetiftempansi:=ungettemppointeriftype(list,ref,tt_ansistring,tt_freeansistring);
  415. end;
  416. function ttgobj.ungetiftempwidestr(list: taasmoutput; const ref : treference) : boolean;
  417. begin
  418. ungetiftempwidestr:=ungettemppointeriftype(list,ref,tt_widestring,tt_freewidestring);
  419. end;
  420. procedure ttgobj.gettempintfcomreference(list: taasmoutput; var ref : treference);
  421. begin
  422. gettemppointerreferencefortype(list,ref,tt_interfacecom,tt_freeinterfacecom);
  423. end;
  424. function ttgobj.ungetiftempintfcom(list: taasmoutput; const ref : treference) : boolean;
  425. begin
  426. ungetiftempintfcom:=ungettemppointeriftype(list,ref,tt_ansistring,tt_freeansistring);
  427. end;
  428. function ttgobj.istemp(const ref : treference) : boolean;
  429. begin
  430. { ref.index = R_NO was missing
  431. led to problems with local arrays
  432. with lower bound > 0 (PM) }
  433. istemp:=((ref.base=procinfo^.framepointer) and
  434. (ref.index=R_NO) and
  435. (ref.offset<firsttemp));
  436. end;
  437. procedure ttgobj.persistanttemptonormal(pos : longint);
  438. var
  439. hp : ptemprecord;
  440. begin
  441. hp:=templist;
  442. while assigned(hp) do
  443. if (hp^.pos=pos) and (hp^.temptype=tt_persistant) then
  444. begin
  445. {$ifdef EXTDEBUG}
  446. Comment(V_Debug,'temp managment : persistanttemptonormal()'+
  447. ' at pos '+tostr(pos)+ ' found !');
  448. {$endif}
  449. hp^.temptype:=tt_normal;
  450. exit;
  451. end
  452. else
  453. hp:=hp^.next;
  454. {$ifdef EXTDEBUG}
  455. Comment(V_Debug,'temp managment problem : persistanttemptonormal()'+
  456. ' at pos '+tostr(pos)+ ' not found !');
  457. {$endif}
  458. end;
  459. procedure ttgobj.normaltemptopersistant(pos : longint);
  460. var
  461. hp : ptemprecord;
  462. begin
  463. hp:=templist;
  464. while assigned(hp) do
  465. if (hp^.pos=pos) and (hp^.temptype=tt_normal) then
  466. begin
  467. {$ifdef EXTDEBUG}
  468. Comment(V_Debug,'temp managment : normaltemptopersistant()'+
  469. ' at pos '+tostr(pos)+ ' found !');
  470. {$endif}
  471. hp^.temptype:=tt_persistant;
  472. exit;
  473. end
  474. else
  475. hp:=hp^.next;
  476. {$ifdef EXTDEBUG}
  477. Comment(V_Debug,'temp managment problem : normaltemptopersistant()'+
  478. ' at pos '+tostr(pos)+ ' not found !');
  479. {$endif}
  480. end;
  481. function ttgobj.ungettemp(list: taasmoutput; pos:longint;allowtype:ttemptype):ttemptype;
  482. var
  483. hp,hnext,hprev,hprevfree : ptemprecord;
  484. begin
  485. ungettemp:=tt_none;
  486. hp:=templist;
  487. hprev:=nil;
  488. hprevfree:=nil;
  489. while assigned(hp) do
  490. begin
  491. if (hp^.pos=pos) then
  492. begin
  493. { check type }
  494. ungettemp:=hp^.temptype;
  495. if hp^.temptype<>allowtype then
  496. begin
  497. exit;
  498. end;
  499. list.concat(Taitempalloc.dealloc(hp^.pos,hp^.size));
  500. { set this block to free }
  501. hp^.temptype:=tt_free;
  502. { Update tempfreelist }
  503. if assigned(hprevfree) then
  504. begin
  505. { Connect with previous? }
  506. if assigned(hprev) and (hprev^.temptype=tt_free) then
  507. begin
  508. inc(hprev^.size,hp^.size);
  509. hprev^.next:=hp^.next;
  510. dispose(hp);
  511. hp:=hprev;
  512. end
  513. else
  514. hprevfree^.nextfree:=hp;
  515. end
  516. else
  517. begin
  518. hp^.nextfree:=tempfreelist;
  519. tempfreelist:=hp;
  520. end;
  521. { Next block free ? Yes, then concat }
  522. hnext:=hp^.next;
  523. if assigned(hnext) and (hnext^.temptype=tt_free) then
  524. begin
  525. inc(hp^.size,hnext^.size);
  526. hp^.nextfree:=hnext^.nextfree;
  527. hp^.next:=hnext^.next;
  528. dispose(hnext);
  529. end;
  530. exit;
  531. end;
  532. if (hp^.temptype=tt_free) then
  533. hprevfree:=hp;
  534. hprev:=hp;
  535. hp:=hp^.next;
  536. end;
  537. ungettemp:=tt_none;
  538. end;
  539. function ttgobj.getsizeoftemp(const ref: treference): longint;
  540. var
  541. hp : ptemprecord;
  542. begin
  543. hp:=templist;
  544. while assigned(hp) do
  545. begin
  546. if (hp^.pos=ref.offset) then
  547. begin
  548. getsizeoftemp := hp^.size;
  549. exit;
  550. end;
  551. hp := hp^.next;
  552. end;
  553. getsizeoftemp := -1;
  554. end;
  555. procedure ttgobj.ungetpersistanttemp(list: taasmoutput; pos : longint);
  556. begin
  557. {$ifdef EXTDEBUG}
  558. if ungettemp(list,pos,tt_persistant)<>tt_persistant then
  559. Comment(V_Warning,'temp managment problem : ungetpersistanttemp()'+
  560. ' at pos '+tostr(pos)+ ' not found !');
  561. {$else}
  562. ungettemp(list,pos,tt_persistant);
  563. {$endif}
  564. end;
  565. procedure ttgobj.ungetpersistanttempreference(list: taasmoutput; const ref : treference);
  566. begin
  567. ungetpersistanttemp(list, ref.offset);
  568. end;
  569. procedure ttgobj.ungetiftemp(list: taasmoutput; const ref : treference);
  570. {$ifdef EXTDEBUG}
  571. var
  572. tt : ttemptype;
  573. {$endif}
  574. begin
  575. if istemp(ref) then
  576. begin
  577. { first check if ansistring }
  578. if ungetiftempansi(list,ref) or
  579. ungetiftempwidestr(list,ref) or
  580. ungetiftempintfcom(list,ref) then
  581. exit;
  582. {$ifndef EXTDEBUG}
  583. ungettemp(list,ref.offset,tt_normal);
  584. {$else}
  585. tt:=ungettemp(list,ref.offset,tt_normal);
  586. if tt=tt_persistant then
  587. Comment(V_Debug,'temp at pos '+tostr(ref.offset)+ ' not released because persistant!');
  588. if tt=tt_none then
  589. Comment(V_Warning,'temp not found for release at offset '+tostr(ref.offset));
  590. {$endif}
  591. end;
  592. end;
  593. initialization
  594. tg := ttgobj.create;
  595. finalization
  596. tg.free;
  597. end.
  598. {
  599. $Log$
  600. Revision 1.4 2002-04-07 09:17:17 carl
  601. + documentation
  602. - clean-up
  603. Revision 1.3 2002/04/04 19:06:06 peter
  604. * removed unused units
  605. * use tlocation.size in cg.a_*loc*() routines
  606. Revision 1.2 2002/04/02 17:11:32 peter
  607. * tlocation,treference update
  608. * LOC_CONSTANT added for better constant handling
  609. * secondadd splitted in multiple routines
  610. * location_force_reg added for loading a location to a register
  611. of a specified size
  612. * secondassignment parses now first the right and then the left node
  613. (this is compatible with Kylix). This saves a lot of push/pop especially
  614. with string operations
  615. * adapted some routines to use the new cg methods
  616. Revision 1.1 2002/03/31 20:26:37 jonas
  617. + a_loadfpu_* and a_loadmm_* methods in tcg
  618. * register allocation is now handled by a class and is mostly processor
  619. independent (+rgobj.pas and i386/rgcpu.pas)
  620. * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  621. * some small improvements and fixes to the optimizer
  622. * some register allocation fixes
  623. * some fpuvaroffset fixes in the unary minus node
  624. * push/popusedregisters is now called rg.save/restoreusedregisters and
  625. (for i386) uses temps instead of push/pop's when using -Op3 (that code is
  626. also better optimizable)
  627. * fixed and optimized register saving/restoring for new/dispose nodes
  628. * LOC_FPU locations now also require their "register" field to be set to
  629. R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  630. - list field removed of the tnode class because it's not used currently
  631. and can cause hard-to-find bugs
  632. Revision 1.1 2000/07/13 06:30:09 michael
  633. + Initial import
  634. Revision 1.10 2000/02/17 14:48:36 florian
  635. * updated to use old firstpass
  636. Revision 1.9 2000/01/07 01:14:55 peter
  637. * updated copyright to 2000
  638. Revision 1.8 1999/10/14 14:57:54 florian
  639. - removed the hcodegen use in the new cg, use cgbase instead
  640. Revision 1.7 1999/10/12 21:20:47 florian
  641. * new codegenerator compiles again
  642. Revision 1.6 1999/09/10 18:48:11 florian
  643. * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
  644. * most things for stored properties fixed
  645. Revision 1.5 1999/08/06 16:04:06 michael
  646. + introduced tainstruction
  647. Revision 1.4 1999/08/03 00:33:23 michael
  648. + Added cpuasm for alpha
  649. Revision 1.3 1999/08/03 00:32:13 florian
  650. * reg_vars and reg_pushes is now in tgobj
  651. Revision 1.2 1999/08/02 23:13:22 florian
  652. * more changes to compile for the Alpha
  653. Revision 1.1 1999/08/02 17:14:12 florian
  654. + changed the temp. generator to an object
  655. }