cgbase.pas 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. This unit exports some help routines for the code generation
  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. {# Some helpers for the code generator.
  19. }
  20. unit cgbase;
  21. {$i fpcdefs.inc}
  22. interface
  23. uses
  24. { common }
  25. cclasses,
  26. { global }
  27. globals,verbose,
  28. { symtable }
  29. symconst,symtype,symdef,symsym,
  30. { aasm }
  31. cpubase,cpuinfo,cginfo,aasmbase,aasmtai
  32. ;
  33. const
  34. {# bitmask indicating if the procedure uses asm }
  35. pi_uses_asm = $1;
  36. {# bitmask indicating if the procedure is exported by an unit }
  37. pi_is_global = $2;
  38. {# bitmask indicating if the procedure does a call }
  39. pi_do_call = $4;
  40. {# bitmask indicating if the procedure is an operator }
  41. pi_operator = $8;
  42. {# bitmask indicating if the procedure is an external C function }
  43. pi_c_import = $10;
  44. {# bitmask indicating if the procedure has a try statement = no register optimization }
  45. pi_uses_exceptions = $20;
  46. {# bitmask indicating if the procedure is declared as @var(assembler), don't optimize}
  47. pi_is_assembler = $40;
  48. {# bitmask indicating if the procedure contains data which needs to be finalized }
  49. pi_needs_implicit_finally = $80;
  50. type
  51. {# This object gives information on the current routine being
  52. compiled.
  53. }
  54. tprocinfo = class
  55. { pointer to parent in nested procedures }
  56. parent : tprocinfo;
  57. {# current class, if we are in a method }
  58. _class : tobjectdef;
  59. {# the definition of the routine itself }
  60. procdef : tprocdef;
  61. {# offset from frame pointer to get parent frame pointer reference
  62. (used in nested routines only)
  63. On the PowerPC, this is used to store the offset where the
  64. frame pointer from the outer procedure is stored.
  65. }
  66. framepointer_offset : longint;
  67. {# offset from frame pointer to get self reference }
  68. selfpointer_offset : longint;
  69. {# offset from frame pointer to get vmt reference (constructors only) }
  70. inheritedflag_offset,
  71. vmtpointer_offset : longint;
  72. {# result value offset in stack (functions only) }
  73. return_offset : longint;
  74. {# firsttemp position }
  75. firsttemp_offset : longint;
  76. {# offset from frame pointer to parameters }
  77. para_offset : longint;
  78. {# some collected informations about the procedure
  79. see pi_xxxx constants above
  80. }
  81. flags : longint;
  82. {# register used as frame pointer }
  83. framepointer : tregister;
  84. {# true, if the procedure is exported by a unit }
  85. globalsymbol : boolean;
  86. {# true, if the procedure should be exported (only OS/2) }
  87. exported : boolean;
  88. {# true, if we can not use fast exit code }
  89. no_fast_exit : boolean;
  90. {# Holds the environment reference for default exceptions
  91. The exception reference is created when ansistrings
  92. or classes are used. It holds buffer for exception
  93. frames. It is allocted by g_new_exception.
  94. }
  95. exception_env_ref : treference;
  96. {# Holds the environment reference for default exceptions
  97. The exception reference is created when ansistrings
  98. or classes are used. It holds buffer for setjmp
  99. It is allocted by g_new_exception.
  100. }
  101. exception_jmp_ref :treference;
  102. {# Holds the environment reference for default exceptions
  103. The exception reference is created when ansistrings
  104. or classes are used. It holds the location where
  105. temporary storage of the setjmp result is stored.
  106. This reference can be unused, if the result is instead
  107. saved on the stack.
  108. }
  109. exception_result_ref :treference;
  110. {# Holds the reference used to store the original stackpointer
  111. after all registers are saved
  112. }
  113. save_stackptr_ref :treference;
  114. {# Holds the reference used to store alll saved registers.
  115. This is used on systems which do not have direct stack
  116. operations (such as the PowerPC), it is unused on other
  117. systems
  118. }
  119. save_regs_ref : treference;
  120. {# The code for the routine itself, excluding entry and
  121. exit code. This is a linked list of tai classes.
  122. }
  123. aktproccode : taasmoutput;
  124. {# The code for the routine entry code.
  125. }
  126. aktentrycode: taasmoutput;
  127. {# The code for the routine exit code.
  128. }
  129. aktexitcode: taasmoutput;
  130. aktlocaldata : taasmoutput;
  131. constructor create;virtual;
  132. destructor destroy;override;
  133. procedure allocate_interrupt_stackframe;virtual;
  134. { Does the necessary stuff before a procedure body is compiled }
  135. procedure handle_body_start;virtual;
  136. { This is called by parser, after the header of a subroutine is parsed.
  137. If the local symtable offset depends on the para symtable size, the
  138. necessary stuff must be done here.
  139. }
  140. procedure after_header;virtual;
  141. { This procedure is called after the pass 1 of the subroutine body is done.
  142. Here the address fix ups to generate code for the body must be done.
  143. }
  144. procedure after_pass1;virtual;
  145. { sets the offset for a temp used by the result }
  146. procedure set_result_offset;virtual;
  147. end;
  148. pregvarinfo = ^tregvarinfo;
  149. tregvarinfo = record
  150. regvars : array[1..maxvarregs] of tvarsym;
  151. regvars_para : array[1..maxvarregs] of boolean;
  152. regvars_refs : array[1..maxvarregs] of longint;
  153. fpuregvars : array[1..maxfpuvarregs] of tvarsym;
  154. fpuregvars_para : array[1..maxfpuvarregs] of boolean;
  155. fpuregvars_refs : array[1..maxfpuvarregs] of longint;
  156. end;
  157. tcprocinfo = class of tprocinfo;
  158. var
  159. {# information about the current sub routine being parsed (@var(pprocinfo))}
  160. procinfo : tprocinfo;
  161. cprocinfo : tcprocinfo;
  162. { labels for BREAK and CONTINUE }
  163. aktbreaklabel,aktcontinuelabel : tasmlabel;
  164. { label when the result is true or false }
  165. truelabel,falselabel : tasmlabel;
  166. { label to leave the sub routine }
  167. aktexitlabel : tasmlabel;
  168. { also an exit label, only used we need to clear only the stack }
  169. aktexit2label : tasmlabel;
  170. {# only used in constructor for fail keyword or if getmem fails }
  171. faillabel : tasmlabel;
  172. quickexitlabel : tasmlabel;
  173. {# true, if there was an error while code generation occurs }
  174. codegenerror : boolean;
  175. { save the size of pushed parameter, needed for aligning }
  176. pushedparasize : longint;
  177. { procinfo instance which is used in procedures created automatically by the compiler }
  178. voidprocpi : tprocinfo;
  179. { message calls with codegenerror support }
  180. procedure cgmessage(t : longint);
  181. procedure cgmessage1(t : longint;const s : string);
  182. procedure cgmessage2(t : longint;const s1,s2 : string);
  183. procedure cgmessage3(t : longint;const s1,s2,s3 : string);
  184. procedure CGMessagePos(const pos:tfileposinfo;t:longint);
  185. procedure CGMessagePos1(const pos:tfileposinfo;t:longint;const s1:string);
  186. procedure CGMessagePos2(const pos:tfileposinfo;t:longint;const s1,s2:string);
  187. procedure CGMessagePos3(const pos:tfileposinfo;t:longint;const s1,s2,s3:string);
  188. { initialize respectively terminates the code generator }
  189. { for a new module or procedure }
  190. procedure codegen_doneprocedure;
  191. procedure codegen_donemodule;
  192. procedure codegen_newmodule;
  193. procedure codegen_newprocedure;
  194. {# From a definition return the abstract code generator size enum. It is
  195. to note that the value returned can be @var(OS_NO) }
  196. function def_cgsize(def: tdef): tcgsize;
  197. {# From a constant numeric value, return the abstract code generator
  198. size.
  199. }
  200. function int_cgsize(const a: aword): tcgsize;
  201. {# return the inverse condition of opcmp }
  202. function inverse_opcmp(opcmp: topcmp): topcmp;
  203. {# return whether op is commutative }
  204. function commutativeop(op: topcg): boolean;
  205. implementation
  206. uses
  207. systems,
  208. cresstr,
  209. tgobj,rgobj,
  210. defutil,
  211. fmodule
  212. {$ifdef fixLeaksOnError}
  213. ,comphook
  214. {$endif fixLeaksOnError}
  215. ,symbase,paramgr
  216. ;
  217. {$ifdef fixLeaksOnError}
  218. var procinfoStack: TStack;
  219. hcodegen_old_do_stop: tstopprocedure;
  220. {$endif fixLeaksOnError}
  221. {*****************************************************************************
  222. override the message calls to set codegenerror
  223. *****************************************************************************}
  224. procedure cgmessage(t : longint);
  225. var
  226. olderrorcount : longint;
  227. begin
  228. if not(codegenerror) then
  229. begin
  230. olderrorcount:=Errorcount;
  231. verbose.Message(t);
  232. codegenerror:=olderrorcount<>Errorcount;
  233. end;
  234. end;
  235. procedure cgmessage1(t : longint;const s : string);
  236. var
  237. olderrorcount : longint;
  238. begin
  239. if not(codegenerror) then
  240. begin
  241. olderrorcount:=Errorcount;
  242. verbose.Message1(t,s);
  243. codegenerror:=olderrorcount<>Errorcount;
  244. end;
  245. end;
  246. procedure cgmessage2(t : longint;const s1,s2 : string);
  247. var
  248. olderrorcount : longint;
  249. begin
  250. if not(codegenerror) then
  251. begin
  252. olderrorcount:=Errorcount;
  253. verbose.Message2(t,s1,s2);
  254. codegenerror:=olderrorcount<>Errorcount;
  255. end;
  256. end;
  257. procedure cgmessage3(t : longint;const s1,s2,s3 : string);
  258. var
  259. olderrorcount : longint;
  260. begin
  261. if not(codegenerror) then
  262. begin
  263. olderrorcount:=Errorcount;
  264. verbose.Message3(t,s1,s2,s3);
  265. codegenerror:=olderrorcount<>Errorcount;
  266. end;
  267. end;
  268. procedure cgmessagepos(const pos:tfileposinfo;t : longint);
  269. var
  270. olderrorcount : longint;
  271. begin
  272. if not(codegenerror) then
  273. begin
  274. olderrorcount:=Errorcount;
  275. verbose.MessagePos(pos,t);
  276. codegenerror:=olderrorcount<>Errorcount;
  277. end;
  278. end;
  279. procedure cgmessagepos1(const pos:tfileposinfo;t : longint;const s1 : string);
  280. var
  281. olderrorcount : longint;
  282. begin
  283. if not(codegenerror) then
  284. begin
  285. olderrorcount:=Errorcount;
  286. verbose.MessagePos1(pos,t,s1);
  287. codegenerror:=olderrorcount<>Errorcount;
  288. end;
  289. end;
  290. procedure cgmessagepos2(const pos:tfileposinfo;t : longint;const s1,s2 : string);
  291. var
  292. olderrorcount : longint;
  293. begin
  294. if not(codegenerror) then
  295. begin
  296. olderrorcount:=Errorcount;
  297. verbose.MessagePos2(pos,t,s1,s2);
  298. codegenerror:=olderrorcount<>Errorcount;
  299. end;
  300. end;
  301. procedure cgmessagepos3(const pos:tfileposinfo;t : longint;const s1,s2,s3 : string);
  302. var
  303. olderrorcount : longint;
  304. begin
  305. if not(codegenerror) then
  306. begin
  307. olderrorcount:=Errorcount;
  308. verbose.MessagePos3(pos,t,s1,s2,s3);
  309. codegenerror:=olderrorcount<>Errorcount;
  310. end;
  311. end;
  312. {****************************************************************************
  313. TProcInfo
  314. ****************************************************************************}
  315. constructor tprocinfo.create;
  316. begin
  317. parent:=nil;
  318. _class:=nil;
  319. procdef:=nil;
  320. framepointer_offset:=0;
  321. selfpointer_offset:=0;
  322. vmtpointer_offset:=0;
  323. inheritedflag_offset:=0;
  324. return_offset:=0;
  325. firsttemp_offset:=0;
  326. para_offset:=0;
  327. flags:=0;
  328. framepointer.enum:=R_NO;
  329. framepointer.number:=NR_NO;
  330. globalsymbol:=false;
  331. exported:=false;
  332. no_fast_exit:=false;
  333. aktentrycode:=Taasmoutput.Create;
  334. aktexitcode:=Taasmoutput.Create;
  335. aktproccode:=Taasmoutput.Create;
  336. aktlocaldata:=Taasmoutput.Create;
  337. reference_reset(exception_env_ref);
  338. reference_reset(exception_jmp_ref);
  339. reference_reset(exception_result_ref);
  340. reference_reset(save_stackptr_ref);
  341. end;
  342. destructor tprocinfo.destroy;
  343. begin
  344. aktentrycode.free;
  345. aktexitcode.free;
  346. aktproccode.free;
  347. aktlocaldata.free;
  348. end;
  349. procedure tprocinfo.allocate_interrupt_stackframe;
  350. begin
  351. end;
  352. procedure tprocinfo.handle_body_start;
  353. begin
  354. { temporary space is set, while the BEGIN of the procedure }
  355. if (symtablestack.symtabletype=localsymtable) then
  356. procinfo.firsttemp_offset := tg.direction*symtablestack.datasize
  357. else
  358. procinfo.firsttemp_offset := 0;
  359. { space for the return value }
  360. { !!!!! this means that we can not set the return value
  361. in a subfunction !!!!! }
  362. { because we don't know yet where the address is }
  363. if not is_void(procdef.rettype.def) then
  364. begin
  365. if paramanager.ret_in_reg(procdef.rettype.def,procdef.proccalloption) then
  366. begin
  367. rg.usedinproc := rg.usedinproc +
  368. getfuncretusedregisters(procdef.rettype.def,procdef.proccalloption);
  369. end;
  370. end;
  371. end;
  372. procedure tprocinfo.set_result_offset;
  373. begin
  374. if assigned(procdef.funcretsym) then
  375. begin
  376. procinfo.return_offset:=tvarsym(procdef.funcretsym).address+
  377. tvarsym(procdef.funcretsym).owner.address_fixup;
  378. if tvarsym(procdef.funcretsym).owner.symtabletype=localsymtable then
  379. procinfo.return_offset:=tg.direction*procinfo.return_offset;
  380. end;
  381. end;
  382. procedure tprocinfo.after_header;
  383. begin
  384. end;
  385. procedure tprocinfo.after_pass1;
  386. begin
  387. end;
  388. {*****************************************************************************
  389. initialize/terminate the codegen for procedure and modules
  390. *****************************************************************************}
  391. procedure codegen_newprocedure;
  392. begin
  393. aktbreaklabel:=nil;
  394. aktcontinuelabel:=nil;
  395. { aktexitlabel:=0; is store in oldaktexitlabel
  396. so it must not be reset to zero before this storage !}
  397. { new procinfo }
  398. procinfo:=cprocinfo.create;
  399. {$ifdef fixLeaksOnError}
  400. procinfoStack.push(procinfo);
  401. {$endif fixLeaksOnError}
  402. end;
  403. procedure codegen_doneprocedure;
  404. begin
  405. {$ifdef fixLeaksOnError}
  406. if procinfo <> procinfoStack.pop then
  407. writeln('problem with procinfoStack!');
  408. {$endif fixLeaksOnError}
  409. procinfo.free;
  410. procinfo:=nil;
  411. end;
  412. procedure codegen_newmodule;
  413. begin
  414. exprasmlist:=taasmoutput.create;
  415. datasegment:=taasmoutput.create;
  416. codesegment:=taasmoutput.create;
  417. bsssegment:=taasmoutput.create;
  418. debuglist:=taasmoutput.create;
  419. withdebuglist:=taasmoutput.create;
  420. consts:=taasmoutput.create;
  421. rttilist:=taasmoutput.create;
  422. ResourceStringList:=Nil;
  423. importssection:=nil;
  424. exportssection:=nil;
  425. resourcesection:=nil;
  426. { resourcestrings }
  427. ResourceStrings:=TResourceStrings.Create;
  428. { use the librarydata from current_module }
  429. objectlibrary:=current_module.librarydata;
  430. { for the implicitly generated init/final. procedures for global init. variables,
  431. a dummy procinfo is necessary }
  432. voidprocpi:=cprocinfo.create;
  433. with voidprocpi do
  434. begin
  435. framepointer.enum:=R_INTREGISTER;
  436. framepointer.number:=NR_FRAME_POINTER_REG;
  437. end;
  438. end;
  439. procedure codegen_donemodule;
  440. {$ifdef MEMDEBUG}
  441. var
  442. d : tmemdebug;
  443. {$endif}
  444. begin
  445. {$ifdef MEMDEBUG}
  446. d:=tmemdebug.create(current_module.modulename^+' - asmlists');
  447. {$endif}
  448. exprasmlist.free;
  449. codesegment.free;
  450. bsssegment.free;
  451. datasegment.free;
  452. debuglist.free;
  453. withdebuglist.free;
  454. consts.free;
  455. rttilist.free;
  456. if assigned(ResourceStringList) then
  457. ResourceStringList.free;
  458. if assigned(importssection) then
  459. importssection.free;
  460. if assigned(exportssection) then
  461. exportssection.free;
  462. if assigned(resourcesection) then
  463. resourcesection.free;
  464. {$ifdef MEMDEBUG}
  465. d.free;
  466. {$endif}
  467. { resource strings }
  468. ResourceStrings.free;
  469. objectlibrary:=nil;
  470. // voidprocpi.free;
  471. end;
  472. function def_cgsize(def: tdef): tcgsize;
  473. begin
  474. case def.deftype of
  475. orddef,
  476. enumdef,
  477. setdef:
  478. begin
  479. result := int_cgsize(def.size);
  480. if is_signed(def) then
  481. result := tcgsize(ord(result)+(ord(OS_S8)-ord(OS_8)));
  482. end;
  483. classrefdef,
  484. pointerdef,
  485. procvardef:
  486. result := OS_ADDR;
  487. stringdef :
  488. begin
  489. if is_ansistring(def) or is_widestring(def) then
  490. result := OS_ADDR
  491. else
  492. result := OS_NO;
  493. end;
  494. objectdef :
  495. begin
  496. if is_class_or_interface(def) then
  497. result := OS_ADDR
  498. else
  499. result := OS_NO;
  500. end;
  501. floatdef:
  502. result := tfloat2tcgsize[tfloatdef(def).typ];
  503. recorddef :
  504. result:=int_cgsize(def.size);
  505. arraydef :
  506. begin
  507. if not is_special_array(def) then
  508. result := int_cgsize(def.size)
  509. else
  510. begin
  511. if is_dynamic_array(def) then
  512. result := OS_ADDR
  513. else
  514. result := OS_NO;
  515. end;
  516. end;
  517. else
  518. begin
  519. { undefined size }
  520. result:=OS_NO;
  521. end;
  522. end;
  523. end;
  524. function int_cgsize(const a: aword): tcgsize;
  525. begin
  526. if a > 8 then
  527. begin
  528. int_cgsize := OS_NO;
  529. exit;
  530. end;
  531. case byte(a) of
  532. 1 :
  533. result := OS_8;
  534. 2 :
  535. result := OS_16;
  536. 3,4 :
  537. result := OS_32;
  538. 5..8 :
  539. result := OS_64;
  540. end;
  541. end;
  542. function inverse_opcmp(opcmp: topcmp): topcmp;
  543. const
  544. list: array[TOpCmp] of TOpCmp =
  545. (OC_NONE,OC_NE,OC_LTE,OC_GTE,OC_LT,OC_GT,OC_EQ,OC_A,OC_AE,
  546. OC_B,OC_BE);
  547. begin
  548. inverse_opcmp := list[opcmp];
  549. end;
  550. function commutativeop(op: topcg): boolean;
  551. const
  552. list: array[topcg] of boolean =
  553. (true,true,true,false,false,true,true,false,false,
  554. true,false,false,false,false,true);
  555. begin
  556. commutativeop := list[op];
  557. end;
  558. {$ifdef fixLeaksOnError}
  559. procedure hcodegen_do_stop;
  560. var p: pprocinfo;
  561. begin
  562. p := pprocinfo(procinfoStack.pop);
  563. while p <> nil Do
  564. begin
  565. if p<>voidprocpi then
  566. p.free;
  567. p := pprocinfo(procinfoStack.pop);
  568. end;
  569. procinfoStack.done;
  570. do_stop := hcodegen_old_do_stop;
  571. do_stop{$ifdef FPCPROCVAR}(){$endif};
  572. end;
  573. begin
  574. hcodegen_old_do_stop := do_stop;
  575. do_stop := {$ifdef FPCPROCVAR}@{$endif}hcodegen_do_stop;
  576. procinfoStack.init;
  577. {$endif fixLeaksOnError}
  578. end.
  579. {
  580. $Log$
  581. Revision 1.42 2003-04-25 20:59:33 peter
  582. * removed funcretn,funcretsym, function result is now in varsym
  583. and aliases for result and function name are added using absolutesym
  584. * vs_hidden parameter for funcret passed in parameter
  585. * vs_hidden fixes
  586. * writenode changed to printnode and released from extdebug
  587. * -vp option added to generate a tree.log with the nodetree
  588. * nicer printnode for statements, callnode
  589. Revision 1.41 2003/04/23 12:35:34 florian
  590. * fixed several issues with powerpc
  591. + applied a patch from Jonas for nested function calls (PowerPC only)
  592. * ...
  593. Revision 1.40 2003/04/22 13:47:08 peter
  594. * fixed C style array of const
  595. * fixed C array passing
  596. * fixed left to right with high parameters
  597. Revision 1.39 2003/04/05 21:09:31 jonas
  598. * several ppc/generic result offset related fixes. The "normal" result
  599. offset seems now to be calculated correctly and a lot of duplicate
  600. calculations have been removed. Nested functions accessing the parent's
  601. function result don't work at all though :(
  602. Revision 1.38 2003/03/28 19:16:56 peter
  603. * generic constructor working for i386
  604. * remove fixed self register
  605. * esi added as address register for i386
  606. Revision 1.37 2003/03/20 17:51:45 peter
  607. * dynamic arrays have size OS_ADDR
  608. Revision 1.36 2003/01/08 18:43:56 daniel
  609. * Tregister changed into a record
  610. Revision 1.35 2003/01/01 21:04:48 peter
  611. * removed unused method
  612. Revision 1.34 2002/11/25 17:43:16 peter
  613. * splitted defbase in defutil,symutil,defcmp
  614. * merged isconvertable and is_equal into compare_defs(_ext)
  615. * made operator search faster by walking the list only once
  616. Revision 1.33 2002/11/18 17:31:54 peter
  617. * pass proccalloption to ret_in_xxx and push_xxx functions
  618. Revision 1.32 2002/10/05 12:43:23 carl
  619. * fixes for Delphi 6 compilation
  620. (warning : Some features do not work under Delphi)
  621. Revision 1.31 2002/10/03 21:20:19 carl
  622. * range check error fix
  623. Revision 1.30 2002/09/30 07:00:44 florian
  624. * fixes to common code to get the alpha compiler compiled applied
  625. Revision 1.29 2002/09/07 19:35:45 florian
  626. + tcg.direction is used now
  627. Revision 1.28 2002/09/07 15:25:01 peter
  628. * old logs removed and tabs fixed
  629. Revision 1.27 2002/09/05 19:29:42 peter
  630. * memdebug enhancements
  631. Revision 1.26 2002/08/18 20:06:23 peter
  632. * inlining is now also allowed in interface
  633. * renamed write/load to ppuwrite/ppuload
  634. * tnode storing in ppu
  635. * nld,ncon,nbas are already updated for storing in ppu
  636. Revision 1.25 2002/08/17 09:23:33 florian
  637. * first part of procinfo rewrite
  638. Revision 1.24 2002/08/11 14:32:26 peter
  639. * renamed current_library to objectlibrary
  640. Revision 1.23 2002/08/11 13:24:11 peter
  641. * saving of asmsymbols in ppu supported
  642. * asmsymbollist global is removed and moved into a new class
  643. tasmlibrarydata that will hold the info of a .a file which
  644. corresponds with a single module. Added librarydata to tmodule
  645. to keep the library info stored for the module. In the future the
  646. objectfiles will also be stored to the tasmlibrarydata class
  647. * all getlabel/newasmsymbol and friends are moved to the new class
  648. Revision 1.22 2002/08/06 20:55:20 florian
  649. * first part of ppc calling conventions fix
  650. Revision 1.21 2002/08/05 18:27:48 carl
  651. + more more more documentation
  652. + first version include/exclude (can't test though, not enough scratch for i386 :()...
  653. Revision 1.20 2002/08/04 19:06:41 carl
  654. + added generic exception support (still does not work!)
  655. + more documentation
  656. Revision 1.19 2002/07/20 11:57:53 florian
  657. * types.pas renamed to defbase.pas because D6 contains a types
  658. unit so this would conflicts if D6 programms are compiled
  659. + Willamette/SSE2 instructions to assembler added
  660. Revision 1.18 2002/07/01 18:46:22 peter
  661. * internal linker
  662. * reorganized aasm layer
  663. Revision 1.17 2002/05/20 13:30:40 carl
  664. * bugfix of hdisponen (base must be set, not index)
  665. * more portability fixes
  666. Revision 1.16 2002/05/18 13:34:05 peter
  667. * readded missing revisions
  668. Revision 1.15 2002/05/16 19:46:35 carl
  669. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  670. + try to fix temp allocation (still in ifdef)
  671. + generic constructor calls
  672. + start of tassembler / tmodulebase class cleanup
  673. Revision 1.13 2002/04/25 20:16:38 peter
  674. * moved more routines from cga/n386util
  675. Revision 1.12 2002/04/21 15:28:06 carl
  676. - remove duplicate constants
  677. - move some constants to cginfo
  678. Revision 1.11 2002/04/20 21:32:23 carl
  679. + generic FPC_CHECKPOINTER
  680. + first parameter offset in stack now portable
  681. * rename some constants
  682. + move some cpu stuff to other units
  683. - remove unused constents
  684. * fix stacksize for some targets
  685. * fix generic size problems which depend now on EXTEND_SIZE constant
  686. Revision 1.10 2002/04/07 09:13:39 carl
  687. + documentation
  688. - remove unused variables
  689. Revision 1.9 2002/04/04 19:05:54 peter
  690. * removed unused units
  691. * use tlocation.size in cg.a_*loc*() routines
  692. Revision 1.8 2002/04/02 17:11:27 peter
  693. * tlocation,treference update
  694. * LOC_CONSTANT added for better constant handling
  695. * secondadd splitted in multiple routines
  696. * location_force_reg added for loading a location to a register
  697. of a specified size
  698. * secondassignment parses now first the right and then the left node
  699. (this is compatible with Kylix). This saves a lot of push/pop especially
  700. with string operations
  701. * adapted some routines to use the new cg methods
  702. Revision 1.7 2002/03/31 20:26:33 jonas
  703. + a_loadfpu_* and a_loadmm_* methods in tcg
  704. * register allocation is now handled by a class and is mostly processor
  705. independent (+rgobj.pas and i386/rgcpu.pas)
  706. * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
  707. * some small improvements and fixes to the optimizer
  708. * some register allocation fixes
  709. * some fpuvaroffset fixes in the unary minus node
  710. * push/popusedregisters is now called rg.save/restoreusedregisters and
  711. (for i386) uses temps instead of push/pop's when using -Op3 (that code is
  712. also better optimizable)
  713. * fixed and optimized register saving/restoring for new/dispose nodes
  714. * LOC_FPU locations now also require their "register" field to be set to
  715. R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
  716. - list field removed of the tnode class because it's not used currently
  717. and can cause hard-to-find bugs
  718. }