cgbase.pas 27 KB

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