cgbase.pas 27 KB

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