ncgld.pas 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Generate assembler for nodes that handle loads and assignments which
  5. are the same for all (most) processors
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit ncgld;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. node,nld;
  24. type
  25. tcgloadnode = class(tloadnode)
  26. procedure pass_2;override;
  27. end;
  28. tcgassignmentnode = class(tassignmentnode)
  29. procedure pass_2;override;
  30. end;
  31. tcgarrayconstructornode = class(tarrayconstructornode)
  32. procedure pass_2;override;
  33. end;
  34. implementation
  35. uses
  36. cutils,
  37. systems,
  38. verbose,globtype,globals,
  39. symconst,symtype,symdef,symsym,defutil,paramgr,
  40. ncnv,ncon,nmem,nbas,
  41. aasmbase,aasmtai,
  42. cgbase,pass_2,
  43. procinfo,
  44. cpubase,cpuinfo,
  45. tgobj,ncgutil,cgobj,ncgbas;
  46. {*****************************************************************************
  47. SecondLoad
  48. *****************************************************************************}
  49. procedure tcgloadnode.pass_2;
  50. var
  51. hregister : tregister;
  52. supreg:Tsuperregister;
  53. symtabletype : tsymtabletype;
  54. href : treference;
  55. newsize : tcgsize;
  56. endrelocatelab,
  57. norelocatelab : tasmlabel;
  58. paraloc1 : tparalocation;
  59. begin
  60. { we don't know the size of all arrays }
  61. newsize:=def_cgsize(resulttype.def);
  62. location_reset(location,LOC_REFERENCE,newsize);
  63. case symtableentry.typ of
  64. absolutesym :
  65. begin
  66. { this is only for toasm and toaddr }
  67. case tabsolutesym(symtableentry).abstyp of
  68. toaddr :
  69. begin
  70. {$ifdef i386}
  71. if tabsolutesym(symtableentry).absseg then
  72. location.reference.segment:=NR_FS;
  73. {$endif i386}
  74. location.reference.offset:=tabsolutesym(symtableentry).fieldoffset;
  75. end;
  76. toasm :
  77. location.reference.symbol:=objectlibrary.newasmsymboldata(tabsolutesym(symtableentry).mangledname);
  78. else
  79. internalerror(200310283);
  80. end;
  81. end;
  82. constsym:
  83. begin
  84. if tconstsym(symtableentry).consttyp=constresourcestring then
  85. begin
  86. location_reset(location,LOC_CREFERENCE,OS_ADDR);
  87. location.reference.symbol:=objectlibrary.newasmsymboldata(make_mangledname('RESOURCESTRINGLIST',tconstsym(symtableentry).owner,''));
  88. location.reference.offset:=tconstsym(symtableentry).resstrindex*16+8;
  89. end
  90. else
  91. internalerror(22798);
  92. end;
  93. varsym :
  94. begin
  95. if (tvarsym(symtableentry).varspez=vs_const) then
  96. location_reset(location,LOC_CREFERENCE,newsize);
  97. symtabletype:=symtable.symtabletype;
  98. hregister:=NR_NO;
  99. { C variable }
  100. if (vo_is_C_var in tvarsym(symtableentry).varoptions) then
  101. begin
  102. location.reference.symbol:=objectlibrary.newasmsymboldata(tvarsym(symtableentry).mangledname);
  103. end
  104. { DLL variable }
  105. else if (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
  106. begin
  107. hregister:=cg.getaddressregister(exprasmlist);
  108. location.reference.symbol:=objectlibrary.newasmsymboldata(tvarsym(symtableentry).mangledname);
  109. cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,location.reference,hregister);
  110. reference_reset_base(location.reference,hregister,0);
  111. end
  112. { external variable }
  113. else if (vo_is_external in tvarsym(symtableentry).varoptions) then
  114. begin
  115. location.reference.symbol:=objectlibrary.newasmsymboldata(tvarsym(symtableentry).mangledname);
  116. end
  117. { thread variable }
  118. else if (vo_is_thread_var in tvarsym(symtableentry).varoptions) then
  119. begin
  120. {
  121. Thread var loading is optimized to first check if
  122. a relocate function is available. When the function
  123. is available it is called to retrieve the address.
  124. Otherwise the address is loaded with the symbol
  125. The code needs to be in the order to first handle the
  126. call and then the address load to be sure that the
  127. register that is used for returning is the same (PFV)
  128. }
  129. objectlibrary.getlabel(norelocatelab);
  130. objectlibrary.getlabel(endrelocatelab);
  131. { make sure hregister can't allocate the register necessary for the parameter }
  132. paraloc1:=paramanager.getintparaloc(pocall_default,1);
  133. hregister:=cg.getaddressregister(exprasmlist);
  134. reference_reset_symbol(href,objectlibrary.newasmsymboldata('FPC_THREADVAR_RELOCATE'),0);
  135. cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister);
  136. cg.ungetregister(exprasmlist,hregister);
  137. cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,hregister,norelocatelab);
  138. { don't save the allocated register else the result will be destroyed later }
  139. reference_reset_symbol(href,objectlibrary.newasmsymboldata(tvarsym(symtableentry).mangledname),0);
  140. paramanager.allocparaloc(exprasmlist,paraloc1);
  141. cg.a_param_ref(exprasmlist,OS_ADDR,href,paraloc1);
  142. paramanager.freeparaloc(exprasmlist,paraloc1);
  143. cg.allocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  144. cg.a_call_reg(exprasmlist,hregister);
  145. cg.deallocexplicitregisters(exprasmlist,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default));
  146. cg.getexplicitregister(exprasmlist,NR_FUNCTION_RESULT_REG);
  147. cg.ungetregister(exprasmlist,NR_FUNCTION_RESULT_REG);
  148. hregister:=cg.getaddressregister(exprasmlist);
  149. cg.a_load_reg_reg(exprasmlist,OS_INT,OS_ADDR,NR_FUNCTION_RESULT_REG,hregister);
  150. cg.a_jmp_always(exprasmlist,endrelocatelab);
  151. cg.a_label(exprasmlist,norelocatelab);
  152. { no relocation needed, load the address of the variable only, the
  153. layout of a threadvar is (4 bytes pointer):
  154. 0 - Threadvar index
  155. 4 - Threadvar value in single threading }
  156. reference_reset_symbol(href,objectlibrary.newasmsymboldata(tvarsym(symtableentry).mangledname),POINTER_SIZE);
  157. cg.a_loadaddr_ref_reg(exprasmlist,href,hregister);
  158. cg.a_label(exprasmlist,endrelocatelab);
  159. location.reference.base:=hregister;
  160. end
  161. { nested variable }
  162. else if assigned(left) then
  163. begin
  164. if not(symtabletype in [localsymtable,parasymtable]) then
  165. internalerror(200309285);
  166. secondpass(left);
  167. if left.location.loc<>LOC_REGISTER then
  168. internalerror(200309286);
  169. hregister:=left.location.register;
  170. location.reference.base:=hregister;
  171. location.reference.offset:=tvarsym(symtableentry).localloc.reference.offset;
  172. end
  173. { normal variable }
  174. else
  175. begin
  176. {$warning fixme regvars}
  177. { in case it is a register variable: }
  178. { if tvarsym(symtableentry).localloc.loc=LOC_REGISTER then
  179. begin
  180. case getregtype(tvarsym(symtableentry).localloc.register) of
  181. R_FPUREGISTER :
  182. begin
  183. location_reset(location,LOC_CFPUREGISTER,def_cgsize(resulttype.def));
  184. location.register:=tvarsym(symtableentry).localloc.register;
  185. end;
  186. R_INTREGISTER :
  187. begin
  188. supreg:=getsupreg(Tvarsym(symtableentry).localloc.register);
  189. if (supreg in general_superregisters) and
  190. not (supreg in rg.regvar_loaded_int) then
  191. load_regvar(exprasmlist,tvarsym(symtableentry));
  192. location_reset(location,LOC_CREGISTER,def_cgsize(resulttype.def));
  193. location.register:=tvarsym(symtableentry).localloc.register;
  194. exclude(rg.unusedregsint,supreg);
  195. hregister := location.register;
  196. end;
  197. else
  198. internalerror(200301172);
  199. end;
  200. end
  201. else}
  202. begin
  203. case symtabletype of
  204. localsymtable,
  205. parasymtable :
  206. begin
  207. if tvarsym(symtableentry).localloc.loc<>LOC_REFERENCE then
  208. internalerror(2003091816);
  209. location.reference.base:=tvarsym(symtableentry).localloc.reference.index;
  210. location.reference.offset:=tvarsym(symtableentry).localloc.reference.offset;
  211. end;
  212. globalsymtable,
  213. staticsymtable :
  214. begin
  215. if cs_create_pic in aktmoduleswitches then
  216. begin
  217. location.reference.base:=current_procinfo.got;
  218. location.reference.symbol:=objectlibrary.newasmsymboldata(tvarsym(symtableentry).mangledname+'@GOT');
  219. end
  220. else
  221. location.reference.symbol:=objectlibrary.newasmsymboldata(tvarsym(symtableentry).mangledname);
  222. end;
  223. stt_exceptsymtable:
  224. begin
  225. if tvarsym(symtableentry).localloc.loc<>LOC_REFERENCE then
  226. internalerror(2003091817);
  227. location.reference.base:=tvarsym(symtableentry).localloc.reference.index;
  228. location.reference.offset:=tvarsym(symtableentry).localloc.reference.offset;
  229. end;
  230. else
  231. internalerror(200305102);
  232. end;
  233. end;
  234. end;
  235. { handle call by reference variables when they are not
  236. alreayd copied to local copies. Also ignore the reference
  237. when we need to load the self pointer for objects }
  238. if (symtabletype=parasymtable) and
  239. not(vo_has_local_copy in tvarsym(symtableentry).varoptions) and
  240. not(nf_load_self_pointer in flags) and
  241. paramanager.push_addr_param(tvarsym(symtableentry).varspez,tvarsym(symtableentry).vartype.def,tprocdef(symtable.defowner).proccalloption) then
  242. begin
  243. if hregister=NR_NO then
  244. hregister:=cg.getaddressregister(exprasmlist);
  245. { we need to load only an address }
  246. location.size:=OS_ADDR;
  247. cg.a_load_loc_reg(exprasmlist,location.size,location,hregister);
  248. if tvarsym(symtableentry).varspez=vs_const then
  249. location_reset(location,LOC_CREFERENCE,newsize)
  250. else
  251. location_reset(location,LOC_REFERENCE,newsize);
  252. location.reference.base:=hregister;
  253. end;
  254. end;
  255. procsym:
  256. begin
  257. if not assigned(procdef) then
  258. internalerror(200312011);
  259. if assigned(left) then
  260. begin
  261. {
  262. THIS IS A TERRIBLE HACK!!!!!! WHICH WILL NOT WORK
  263. ON 64-BIT SYSTEMS: SINCE PROCSYM FOR METHODS
  264. CONSISTS OF TWO OS_ADDR, so you cannot set it
  265. to OS_64 - how to solve?? Carl
  266. }
  267. if (sizeof(aword) = 4) then
  268. location_reset(location,LOC_CREFERENCE,OS_64)
  269. else
  270. internalerror(20020520);
  271. tg.GetTemp(exprasmlist,2*POINTER_SIZE,tt_normal,location.reference);
  272. secondpass(left);
  273. { load class instance address }
  274. case left.location.loc of
  275. LOC_CREGISTER,
  276. LOC_REGISTER:
  277. begin
  278. { this is not possible for objects }
  279. if is_object(left.resulttype.def) then
  280. internalerror(200304234);
  281. hregister:=left.location.register;
  282. end;
  283. LOC_CREFERENCE,
  284. LOC_REFERENCE:
  285. begin
  286. location_release(exprasmlist,left.location);
  287. hregister:=cg.getaddressregister(exprasmlist);
  288. if is_class_or_interface(left.resulttype.def) then
  289. cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,hregister)
  290. else
  291. cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,hregister);
  292. location_freetemp(exprasmlist,left.location);
  293. end;
  294. else
  295. internalerror(26019);
  296. end;
  297. { store the class instance address }
  298. href:=location.reference;
  299. inc(href.offset,POINTER_SIZE);
  300. cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,href);
  301. { virtual method ? }
  302. if (po_virtualmethod in procdef.procoptions) then
  303. begin
  304. { load vmt pointer }
  305. reference_reset_base(href,hregister,0);
  306. reference_release(exprasmlist,href);
  307. hregister:=cg.getaddressregister(exprasmlist);
  308. cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister);
  309. reference_reset_base(href,hregister,
  310. procdef._class.vmtmethodoffset(procdef.extnumber));
  311. reference_release(exprasmlist,href);
  312. { load method address }
  313. hregister:=cg.getaddressregister(exprasmlist);
  314. cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister);
  315. { ... and store it }
  316. cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference);
  317. cg.ungetregister(exprasmlist,hregister);
  318. end
  319. else
  320. begin
  321. { we don't use the hregister }
  322. cg.ungetregister(exprasmlist,hregister);
  323. { load address of the function }
  324. reference_reset_symbol(href,objectlibrary.newasmsymbol(procdef.mangledname),0);
  325. hregister:=cg.getaddressregister(exprasmlist);
  326. cg.a_loadaddr_ref_reg(exprasmlist,href,hregister);
  327. cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference);
  328. cg.ungetregister(exprasmlist,hregister);
  329. end;
  330. end
  331. else
  332. begin
  333. {!!!!! Be aware, work on virtual methods too }
  334. location.reference.symbol:=objectlibrary.newasmsymbol(procdef.mangledname);
  335. end;
  336. end;
  337. typedconstsym :
  338. begin
  339. location.reference.symbol:=objectlibrary.newasmsymboldata(ttypedconstsym(symtableentry).mangledname);
  340. end;
  341. else internalerror(4);
  342. end;
  343. end;
  344. {*****************************************************************************
  345. SecondAssignment
  346. *****************************************************************************}
  347. procedure tcgassignmentnode.pass_2;
  348. var
  349. otlabel,hlabel,oflabel : tasmlabel;
  350. fputyp : tfloattype;
  351. href : treference;
  352. old_allow_multi_pass2,
  353. releaseright : boolean;
  354. cgsize : tcgsize;
  355. r:Tregister;
  356. begin
  357. location_reset(location,LOC_VOID,OS_NO);
  358. otlabel:=truelabel;
  359. oflabel:=falselabel;
  360. objectlibrary.getlabel(truelabel);
  361. objectlibrary.getlabel(falselabel);
  362. {
  363. in most cases we can process first the right node which contains
  364. the most complex code. But not when the result is in the flags, then
  365. loading the left node afterwards can destroy the flags.
  366. when the right node returns as LOC_JUMP then we will generate
  367. the following code:
  368. rightnode
  369. true:
  370. leftnode
  371. assign 1
  372. false:
  373. leftnode
  374. assign 0
  375. }
  376. { Try to determine which side to calculate first, }
  377. if (right.expectloc<>LOC_FLAGS) and
  378. ((right.expectloc=LOC_JUMP) or
  379. (right.nodetype=calln) or
  380. (right.registers32>=left.registers32)) then
  381. begin
  382. secondpass(right);
  383. { increment source reference counter, this is
  384. useless for string constants}
  385. if (right.resulttype.def.needs_inittable) and
  386. (right.nodetype<>stringconstn) then
  387. cg.g_incrrefcount(exprasmlist,right.resulttype.def,right.location.reference,false);
  388. if codegenerror then
  389. exit;
  390. { We skip the generation of the left node when it's a jump, see
  391. explanation above }
  392. if (right.location.loc<>LOC_JUMP) and
  393. not(nf_concat_string in flags) then
  394. begin
  395. { left can't be never a 64 bit LOC_REGISTER, so the 3. arg }
  396. { can be false }
  397. secondpass(left);
  398. { decrement destination reference counter }
  399. if (left.resulttype.def.needs_inittable) then
  400. cg.g_decrrefcount(exprasmlist,left.resulttype.def,left.location.reference,false);
  401. if codegenerror then
  402. exit;
  403. end;
  404. end
  405. else
  406. begin
  407. { calculate left sides }
  408. { don't do it yet if it's a crgister (JM) }
  409. if not(nf_concat_string in flags) then
  410. begin
  411. secondpass(left);
  412. { decrement destination reference counter }
  413. if (left.resulttype.def.needs_inittable) then
  414. cg.g_decrrefcount(exprasmlist,left.resulttype.def,left.location.reference,false);
  415. if codegenerror then
  416. exit;
  417. end;
  418. { left can't be never a 64 bit LOC_REGISTER, so the 3. arg }
  419. { can be false }
  420. secondpass(right);
  421. { increment source reference counter, this is
  422. useless for string constants}
  423. if (right.resulttype.def.needs_inittable) and
  424. (right.nodetype<>stringconstn) then
  425. cg.g_incrrefcount(exprasmlist,right.resulttype.def,right.location.reference,false);
  426. if codegenerror then
  427. exit;
  428. end;
  429. releaseright:=true;
  430. { optimize temp to temp copies }
  431. if (left.nodetype = temprefn) and
  432. { we may store certain temps in registers in the future, then this }
  433. { optimization will have to be adapted }
  434. (left.location.loc = LOC_REFERENCE) and
  435. (right.location.loc = LOC_REFERENCE) and
  436. tg.istemp(right.location.reference) and
  437. (tg.sizeoftemp(exprasmlist,right.location.reference) = tg.sizeoftemp(exprasmlist,left.location.reference)) then
  438. begin
  439. { in theory, we should also make sure the left temp type is }
  440. { already more or less of the same kind (ie. we must not }
  441. { assign an ansistring to a normaltemp). In practice, the }
  442. { assignment node will have already taken care of this for us }
  443. tcgtemprefnode(left).changelocation(right.location.reference);
  444. end
  445. { shortstring assignments are handled separately }
  446. else if is_shortstring(left.resulttype.def) then
  447. begin
  448. {
  449. we can get here only in the following situations
  450. for the right node:
  451. - empty constant string
  452. - char
  453. }
  454. { empty constant string }
  455. if (right.nodetype=stringconstn) and
  456. (tstringconstnode(right).len=0) then
  457. begin
  458. cg.a_load_const_ref(exprasmlist,OS_8,0,left.location.reference);
  459. end
  460. { char loading }
  461. else if is_char(right.resulttype.def) then
  462. begin
  463. if right.nodetype=ordconstn then
  464. begin
  465. if (target_info.endian = endian_little) then
  466. cg.a_load_const_ref(exprasmlist,OS_16,(tordconstnode(right).value shl 8) or 1,
  467. left.location.reference)
  468. else
  469. cg.a_load_const_ref(exprasmlist,OS_16,tordconstnode(right).value or (1 shl 8),
  470. left.location.reference);
  471. end
  472. else
  473. begin
  474. href:=left.location.reference;
  475. cg.a_load_const_ref(exprasmlist,OS_8,1,href);
  476. inc(href.offset,1);
  477. case right.location.loc of
  478. LOC_REGISTER,
  479. LOC_CREGISTER :
  480. begin
  481. r:=cg.makeregsize(right.location.register,OS_8);
  482. cg.a_load_reg_ref(exprasmlist,OS_8,OS_8,r,href);
  483. end;
  484. LOC_REFERENCE,
  485. LOC_CREFERENCE :
  486. cg.a_load_ref_ref(exprasmlist,OS_8,OS_8,right.location.reference,href);
  487. else
  488. internalerror(200205111);
  489. end;
  490. end;
  491. end
  492. else
  493. internalerror(200204249);
  494. end
  495. else
  496. begin
  497. case right.location.loc of
  498. LOC_CONSTANT :
  499. begin
  500. if right.location.size in [OS_64,OS_S64] then
  501. cg64.a_load64_const_loc(exprasmlist,
  502. right.location.valueqword,left.location)
  503. else
  504. cg.a_load_const_loc(exprasmlist,right.location.value,left.location);
  505. end;
  506. LOC_REFERENCE,
  507. LOC_CREFERENCE :
  508. begin
  509. case left.location.loc of
  510. LOC_CREGISTER :
  511. begin
  512. cgsize:=def_cgsize(left.resulttype.def);
  513. if cgsize in [OS_64,OS_S64] then
  514. begin
  515. cg64.a_load64_ref_reg(exprasmlist,
  516. right.location.reference,left.location.register64,false);
  517. location_release(exprasmlist,right.location);
  518. end
  519. else
  520. begin
  521. location_release(exprasmlist,right.location);
  522. cg.a_load_ref_reg(exprasmlist,cgsize,cgsize,
  523. right.location.reference,left.location.register);
  524. end;
  525. end;
  526. LOC_CFPUREGISTER :
  527. begin
  528. cg.a_loadfpu_ref_reg(exprasmlist,
  529. def_cgsize(right.resulttype.def),
  530. right.location.reference,
  531. left.location.register);
  532. end;
  533. LOC_REFERENCE,
  534. LOC_CREFERENCE :
  535. begin
  536. cg.g_concatcopy(exprasmlist,right.location.reference,
  537. left.location.reference,left.resulttype.def.size,true,false);
  538. { right.location is already released by concatcopy }
  539. releaseright:=false;
  540. end;
  541. else
  542. internalerror(200203284);
  543. end;
  544. end;
  545. {$ifdef SUPPORT_MMX}
  546. LOC_CMMXREGISTER,
  547. LOC_MMXREGISTER:
  548. begin
  549. if left.location.loc=LOC_CMMXREGISTER then
  550. cg.a_loadmm_reg_reg(exprasmlist,right.location.register,left.location.register)
  551. else
  552. cg.a_loadmm_reg_ref(exprasmlist,right.location.register,left.location.reference);
  553. end;
  554. {$endif SUPPORT_MMX}
  555. LOC_REGISTER,
  556. LOC_CREGISTER :
  557. begin
  558. cgsize:=def_cgsize(left.resulttype.def);
  559. if cgsize in [OS_64,OS_S64] then
  560. cg64.a_load64_reg_loc(exprasmlist,
  561. right.location.register64,left.location)
  562. else
  563. cg.a_load_reg_loc(exprasmlist,right.location.size,right.location.register,left.location);
  564. end;
  565. LOC_FPUREGISTER,LOC_CFPUREGISTER :
  566. begin
  567. if (left.resulttype.def.deftype=floatdef) then
  568. fputyp:=tfloatdef(left.resulttype.def).typ
  569. else
  570. if (right.resulttype.def.deftype=floatdef) then
  571. fputyp:=tfloatdef(right.resulttype.def).typ
  572. else
  573. if (right.nodetype=typeconvn) and
  574. (ttypeconvnode(right).left.resulttype.def.deftype=floatdef) then
  575. fputyp:=tfloatdef(ttypeconvnode(right).left.resulttype.def).typ
  576. else
  577. fputyp:=s32real;
  578. cg.a_loadfpu_reg_loc(exprasmlist,
  579. tfloat2tcgsize[fputyp],
  580. right.location.register,left.location);
  581. end;
  582. LOC_JUMP :
  583. begin
  584. cgsize:=def_cgsize(left.resulttype.def);
  585. objectlibrary.getlabel(hlabel);
  586. { generate the leftnode for the true case, and
  587. release the location }
  588. cg.a_label(exprasmlist,truelabel);
  589. secondpass(left);
  590. if codegenerror then
  591. exit;
  592. cg.a_load_const_loc(exprasmlist,1,left.location);
  593. location_release(exprasmlist,left.location);
  594. cg.a_jmp_always(exprasmlist,hlabel);
  595. { generate the leftnode for the false case }
  596. cg.a_label(exprasmlist,falselabel);
  597. old_allow_multi_pass2:=allow_multi_pass2;
  598. allow_multi_pass2:=true;
  599. secondpass(left);
  600. allow_multi_pass2:=old_allow_multi_pass2;
  601. if codegenerror then
  602. exit;
  603. cg.a_load_const_loc(exprasmlist,0,left.location);
  604. cg.a_label(exprasmlist,hlabel);
  605. end;
  606. {$ifdef cpuflags}
  607. LOC_FLAGS :
  608. begin
  609. {This can be a wordbool or longbool too, no?}
  610. if left.location.loc=LOC_CREGISTER then
  611. cg.g_flags2reg(exprasmlist,def_cgsize(left.resulttype.def),right.location.resflags,left.location.register)
  612. else
  613. begin
  614. if not(left.location.loc = LOC_REFERENCE) then
  615. internalerror(200203273);
  616. cg.g_flags2ref(exprasmlist,def_cgsize(left.resulttype.def),right.location.resflags,left.location.reference);
  617. end;
  618. end;
  619. {$endif cpuflags}
  620. end;
  621. end;
  622. if releaseright then
  623. location_release(exprasmlist,right.location);
  624. location_release(exprasmlist,left.location);
  625. truelabel:=otlabel;
  626. falselabel:=oflabel;
  627. end;
  628. {*****************************************************************************
  629. SecondArrayConstruct
  630. *****************************************************************************}
  631. const
  632. vtInteger = 0;
  633. vtBoolean = 1;
  634. vtChar = 2;
  635. vtExtended = 3;
  636. vtString = 4;
  637. vtPointer = 5;
  638. vtPChar = 6;
  639. vtObject = 7;
  640. vtClass = 8;
  641. vtWideChar = 9;
  642. vtPWideChar = 10;
  643. vtAnsiString = 11;
  644. vtCurrency = 12;
  645. vtVariant = 13;
  646. vtInterface = 14;
  647. vtWideString = 15;
  648. vtInt64 = 16;
  649. vtQWord = 17;
  650. procedure tcgarrayconstructornode.pass_2;
  651. var
  652. hp : tarrayconstructornode;
  653. href : treference;
  654. lt : tdef;
  655. vaddr : boolean;
  656. vtype : longint;
  657. freetemp,
  658. dovariant : boolean;
  659. elesize : longint;
  660. tmpreg : tregister;
  661. paraloc : tparalocation;
  662. begin
  663. dovariant:=(nf_forcevaria in flags) or tarraydef(resulttype.def).isvariant;
  664. if dovariant then
  665. elesize:=8
  666. else
  667. elesize:=tarraydef(resulttype.def).elesize;
  668. location_reset(location,LOC_CREFERENCE,OS_NO);
  669. fillchar(paraloc,sizeof(paraloc),0);
  670. { Allocate always a temp, also if no elements are required, to
  671. be sure that location is valid (PFV) }
  672. if tarraydef(resulttype.def).highrange=-1 then
  673. tg.GetTemp(exprasmlist,elesize,tt_normal,location.reference)
  674. else
  675. tg.GetTemp(exprasmlist,(tarraydef(resulttype.def).highrange+1)*elesize,tt_normal,location.reference);
  676. href:=location.reference;
  677. { Process nodes in array constructor }
  678. hp:=self;
  679. while assigned(hp) do
  680. begin
  681. if assigned(hp.left) then
  682. begin
  683. freetemp:=true;
  684. secondpass(hp.left);
  685. if codegenerror then
  686. exit;
  687. { Move flags and jump in register }
  688. if hp.left.location.loc in [LOC_FLAGS,LOC_JUMP] then
  689. location_force_reg(exprasmlist,hp.left.location,def_cgsize(hp.left.resulttype.def),false);
  690. if dovariant then
  691. begin
  692. { find the correct vtype value }
  693. vtype:=$ff;
  694. vaddr:=false;
  695. lt:=hp.left.resulttype.def;
  696. case lt.deftype of
  697. enumdef,
  698. orddef :
  699. begin
  700. if is_64bit(lt) then
  701. begin
  702. case torddef(lt).typ of
  703. s64bit:
  704. vtype:=vtInt64;
  705. u64bit:
  706. vtype:=vtQWord;
  707. end;
  708. freetemp:=false;
  709. vaddr:=true;
  710. end
  711. else if (lt.deftype=enumdef) or
  712. is_integer(lt) then
  713. vtype:=vtInteger
  714. else
  715. if is_boolean(lt) then
  716. vtype:=vtBoolean
  717. else
  718. if (lt.deftype=orddef) then
  719. begin
  720. case torddef(lt).typ of
  721. uchar:
  722. vtype:=vtChar;
  723. uwidechar:
  724. vtype:=vtWideChar;
  725. end;
  726. end;
  727. end;
  728. floatdef :
  729. begin
  730. vtype:=vtExtended;
  731. freetemp:=false;
  732. vaddr:=true;
  733. end;
  734. procvardef,
  735. pointerdef :
  736. begin
  737. if is_pchar(lt) then
  738. vtype:=vtPChar
  739. else
  740. vtype:=vtPointer;
  741. end;
  742. variantdef :
  743. begin
  744. vtype:=vtVariant;
  745. vaddr:=true;
  746. freetemp:=false;
  747. end;
  748. classrefdef :
  749. vtype:=vtClass;
  750. objectdef :
  751. vtype:=vtObject;
  752. stringdef :
  753. begin
  754. if is_shortstring(lt) then
  755. begin
  756. vtype:=vtString;
  757. vaddr:=true;
  758. freetemp:=false;
  759. end
  760. else
  761. if is_ansistring(lt) then
  762. begin
  763. vtype:=vtAnsiString;
  764. freetemp:=false;
  765. end
  766. else
  767. if is_widestring(lt) then
  768. begin
  769. vtype:=vtWideString;
  770. freetemp:=false;
  771. end;
  772. end;
  773. end;
  774. if vtype=$ff then
  775. internalerror(14357);
  776. { write changing field update href to the next element }
  777. inc(href.offset,4);
  778. if vaddr then
  779. begin
  780. location_force_mem(exprasmlist,hp.left.location);
  781. location_release(exprasmlist,hp.left.location);
  782. tmpreg:=cg.getaddressregister(exprasmlist);
  783. cg.a_loadaddr_ref_reg(exprasmlist,hp.left.location.reference,tmpreg);
  784. cg.ungetregister(exprasmlist,tmpreg);
  785. cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,tmpreg,href);
  786. if freetemp then
  787. location_freetemp(exprasmlist,hp.left.location);
  788. end
  789. else
  790. begin
  791. location_release(exprasmlist,hp.left.location);
  792. cg.a_load_loc_ref(exprasmlist,OS_ADDR,hp.left.location,href);
  793. end;
  794. { update href to the vtype field and write it }
  795. dec(href.offset,4);
  796. cg.a_load_const_ref(exprasmlist, OS_INT,vtype,href);
  797. { goto next array element }
  798. inc(href.offset,8);
  799. end
  800. else
  801. { normal array constructor of the same type }
  802. begin
  803. if is_ansistring(left.resulttype.def) or
  804. is_widestring(left.resulttype.def) or
  805. (left.resulttype.def.deftype=variantdef) then
  806. freetemp:=false;
  807. case hp.left.location.loc of
  808. LOC_FPUREGISTER,
  809. LOC_CFPUREGISTER :
  810. begin
  811. location_release(exprasmlist,hp.left.location);
  812. cg.a_loadfpu_reg_ref(exprasmlist,hp.left.location.size,hp.left.location.register,href);
  813. end;
  814. LOC_REFERENCE,
  815. LOC_CREFERENCE :
  816. begin
  817. location_release(exprasmlist,hp.left.location);
  818. cg.g_concatcopy(exprasmlist,hp.left.location.reference,href,elesize,freetemp,false);
  819. end;
  820. else
  821. begin
  822. if hp.left.location.size in [OS_64,OS_S64] then
  823. begin
  824. cg64.a_load64_loc_ref(exprasmlist,hp.left.location,href);
  825. location_release(exprasmlist,hp.left.location);
  826. end
  827. else
  828. begin
  829. location_release(exprasmlist,hp.left.location);
  830. cg.a_load_loc_ref(exprasmlist,hp.left.location.size,hp.left.location,href);
  831. end;
  832. end;
  833. end;
  834. inc(href.offset,elesize);
  835. end;
  836. end;
  837. { load next entry }
  838. hp:=tarrayconstructornode(hp.right);
  839. end;
  840. end;
  841. begin
  842. cloadnode:=tcgloadnode;
  843. cassignmentnode:=tcgassignmentnode;
  844. carrayconstructornode:=tcgarrayconstructornode;
  845. end.
  846. {
  847. $Log$
  848. Revision 1.100 2003-12-01 18:44:15 peter
  849. * fixed some crashes
  850. * fixed varargs and register calling probs
  851. Revision 1.99 2003/11/23 17:39:33 peter
  852. * removed obsolete nf_cargs flag
  853. Revision 1.98 2003/10/29 19:48:50 peter
  854. * renamed mangeldname_prefix to make_mangledname and made it more
  855. generic
  856. * make_mangledname is now also used for internal threadvar/resstring
  857. lists
  858. * Add P$ in front of program modulename to prevent duplicated symbols
  859. at assembler level, because the main program can have the same name
  860. as a unit, see webtbs/tw1251b
  861. Revision 1.97 2003/10/28 15:36:01 peter
  862. * absolute to object field supported, fixes tb0458
  863. Revision 1.96 2003/10/17 14:38:32 peter
  864. * 64k registers supported
  865. * fixed some memory leaks
  866. Revision 1.95 2003/10/14 00:30:48 florian
  867. + some code for PIC support added
  868. Revision 1.94 2003/10/11 16:06:42 florian
  869. * fixed some MMX<->SSE
  870. * started to fix ppc, needs an overhaul
  871. + stabs info improve for spilling, not sure if it works correctly/completly
  872. - MMX_SUPPORT removed from Makefile.fpc
  873. Revision 1.93 2003/10/10 17:48:13 peter
  874. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  875. * tregisteralloctor renamed to trgobj
  876. * removed rgobj from a lot of units
  877. * moved location_* and reference_* to cgobj
  878. * first things for mmx register allocation
  879. Revision 1.92 2003/10/09 21:31:37 daniel
  880. * Register allocator splitted, ans abstract now
  881. Revision 1.91 2003/10/07 15:17:07 peter
  882. * inline supported again, LOC_REFERENCEs are used to pass the
  883. parameters
  884. * inlineparasymtable,inlinelocalsymtable removed
  885. * exitlabel inserting fixed
  886. Revision 1.90 2003/10/05 21:21:52 peter
  887. * c style array of const generates callparanodes
  888. * varargs paraloc fixes
  889. Revision 1.89 2003/10/01 20:34:48 peter
  890. * procinfo unit contains tprocinfo
  891. * cginfo renamed to cgbase
  892. * moved cgmessage to verbose
  893. * fixed ppc and sparc compiles
  894. Revision 1.88 2003/09/29 20:58:56 peter
  895. * optimized releasing of registers
  896. Revision 1.87 2003/09/28 21:46:18 peter
  897. * fix allocation of threadvar parameter
  898. Revision 1.86 2003/09/28 17:55:03 peter
  899. * parent framepointer changed to hidden parameter
  900. * tloadparentfpnode added
  901. Revision 1.85 2003/09/28 13:39:38 peter
  902. * optimized releasing of registers
  903. Revision 1.84 2003/09/25 21:27:31 peter
  904. * rearranged threadvar code so the result register is the same
  905. for the relocated and address loaded variables
  906. Revision 1.83 2003/09/23 17:56:05 peter
  907. * locals and paras are allocated in the code generation
  908. * tvarsym.localloc contains the location of para/local when
  909. generating code for the current procedure
  910. Revision 1.82 2003/09/16 16:17:01 peter
  911. * varspez in calls to push_addr_param
  912. Revision 1.81 2003/09/14 12:57:10 peter
  913. * save destroyed registers when calling threadvar helper
  914. Revision 1.80 2003/09/10 08:31:47 marco
  915. * Patch from Peter for paraloc
  916. Revision 1.79 2003/09/03 15:55:00 peter
  917. * NEWRA branch merged
  918. Revision 1.78 2003/09/03 11:18:37 florian
  919. * fixed arm concatcopy
  920. + arm support in the common compiler sources added
  921. * moved some generic cg code around
  922. + tfputype added
  923. * ...
  924. Revision 1.77.2.2 2003/08/31 15:46:26 peter
  925. * more updates for tregister
  926. Revision 1.77.2.1 2003/08/29 17:28:59 peter
  927. * next batch of updates
  928. Revision 1.77 2003/08/20 20:13:08 daniel
  929. * Fixed the fixed trouble
  930. Revision 1.76 2003/08/20 20:11:24 daniel
  931. * Fixed some R_NO trouble
  932. Revision 1.75 2003/07/20 16:26:43 jonas
  933. * fix for threadvars with -dnewra
  934. Revision 1.74 2003/07/06 17:58:22 peter
  935. * framepointer fixes for sparc
  936. * parent framepointer code more generic
  937. Revision 1.73 2003/07/06 15:25:54 jonas
  938. * newra fix for threadvars
  939. Revision 1.72 2003/06/15 15:13:12 jonas
  940. * fixed register allocation for threadvar loads with newra
  941. Revision 1.71 2003/06/13 21:19:30 peter
  942. * current_procdef removed, use current_procinfo.procdef instead
  943. Revision 1.70 2003/06/12 16:43:07 peter
  944. * newra compiles for sparc
  945. Revision 1.69 2003/06/09 16:41:52 jonas
  946. * fixed regvar optimization for call_by_reference parameters (no need
  947. to load address in another register)
  948. Revision 1.68 2003/06/08 18:27:15 jonas
  949. + ability to change the location of a ttempref node with changelocation()
  950. method. Useful to use instead of copying the contents from one temp to
  951. another
  952. + some shortstring optimizations in tassignmentnode that avoid some
  953. copying (required some shortstring optimizations to be moved from
  954. resulttype to firstpass, because they work on callnodes and string
  955. addnodes are only changed to callnodes in the firstpass)
  956. * allow setting/changing the funcretnode of callnodes after the
  957. resulttypepass has been done, funcretnode is now a property
  958. (all of the above should have a quite big effect on callparatemp)
  959. Revision 1.67 2003/06/07 18:57:04 jonas
  960. + added freeintparaloc
  961. * ppc get/freeintparaloc now check whether the parameter regs are
  962. properly allocated/deallocated (and get an extra list para)
  963. * ppc a_call_* now internalerrors if pi_do_call is not yet set
  964. * fixed lot of missing pi_do_call's
  965. Revision 1.66 2003/06/03 21:11:09 peter
  966. * cg.a_load_* get a from and to size specifier
  967. * makeregsize only accepts newregister
  968. * i386 uses generic tcgnotnode,tcgunaryminus
  969. Revision 1.65 2003/06/03 13:01:59 daniel
  970. * Register allocator finished
  971. Revision 1.64 2003/05/30 23:57:08 peter
  972. * more sparc cleanup
  973. * accumulator removed, splitted in function_return_reg (called) and
  974. function_result_reg (caller)
  975. Revision 1.63 2003/05/30 23:54:08 jonas
  976. * forgot to commit, a_load_loc_reg change
  977. Revision 1.62 2003/05/26 19:38:28 peter
  978. * generic fpc_shorstr_concat
  979. + fpc_shortstr_append_shortstr optimization
  980. Revision 1.61 2003/05/24 11:47:27 jonas
  981. * fixed framepointer storage: it's now always stored at r1+12, which is
  982. a place in the link area reserved for compiler use.
  983. Revision 1.60 2003/05/23 14:27:35 peter
  984. * remove some unit dependencies
  985. * current_procinfo changes to store more info
  986. Revision 1.59 2003/05/15 18:58:53 peter
  987. * removed selfpointer_offset, vmtpointer_offset
  988. * tvarsym.adjusted_address
  989. * address in localsymtable is now in the real direction
  990. * removed some obsolete globals
  991. Revision 1.58 2003/05/12 17:22:00 jonas
  992. * fixed (last?) remaining -tvarsym(X).address to
  993. tg.direction*tvarsym(X).address...
  994. Revision 1.57 2003/05/11 21:37:03 peter
  995. * moved implicit exception frame from ncgutil to psub
  996. * constructor/destructor helpers moved from cobj/ncgutil to psub
  997. Revision 1.56 2003/05/11 14:45:12 peter
  998. * tloadnode does not support objectsymtable,withsymtable anymore
  999. * withnode cleanup
  1000. * direct with rewritten to use temprefnode
  1001. Revision 1.55 2003/04/29 07:29:14 michael
  1002. + Patch from peter to fix wrong pushing of ansistring function results in open array
  1003. Revision 1.54 2003/04/27 11:21:33 peter
  1004. * aktprocdef renamed to current_procinfo.procdef
  1005. * procinfo renamed to current_procinfo
  1006. * procinfo will now be stored in current_module so it can be
  1007. cleaned up properly
  1008. * gen_main_procsym changed to create_main_proc and release_main_proc
  1009. to also generate a tprocinfo structure
  1010. * fixed unit implicit initfinal
  1011. Revision 1.53 2003/04/27 07:29:50 peter
  1012. * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
  1013. a new procdef declaration
  1014. * aktprocsym removed
  1015. * lexlevel removed, use symtable.symtablelevel instead
  1016. * implicit init/final code uses the normal genentry/genexit
  1017. * funcret state checking updated for new funcret handling
  1018. Revision 1.52 2003/04/25 20:59:33 peter
  1019. * removed funcretn,funcretsym, function result is now in varsym
  1020. and aliases for result and function name are added using absolutesym
  1021. * vs_hidden parameter for funcret passed in parameter
  1022. * vs_hidden fixes
  1023. * writenode changed to printnode and released from extdebug
  1024. * -vp option added to generate a tree.log with the nodetree
  1025. * nicer printnode for statements, callnode
  1026. Revision 1.51 2003/04/23 20:16:04 peter
  1027. + added currency support based on int64
  1028. + is_64bit for use in cg units instead of is_64bitint
  1029. * removed cgmessage from n386add, replace with internalerrors
  1030. Revision 1.50 2003/04/23 10:12:14 peter
  1031. * allow multi pass2 changed to global boolean instead of node flag
  1032. Revision 1.49 2003/04/22 23:50:22 peter
  1033. * firstpass uses expectloc
  1034. * checks if there are differences between the expectloc and
  1035. location.loc from secondpass in EXTDEBUG
  1036. Revision 1.48 2003/04/22 10:09:35 daniel
  1037. + Implemented the actual register allocator
  1038. + Scratch registers unavailable when new register allocator used
  1039. + maybe_save/maybe_restore unavailable when new register allocator used
  1040. Revision 1.47 2003/04/06 21:11:23 olle
  1041. * changed newasmsymbol to newasmsymboldata for data symbols
  1042. Revision 1.46 2003/03/28 19:16:56 peter
  1043. * generic constructor working for i386
  1044. * remove fixed self register
  1045. * esi added as address register for i386
  1046. Revision 1.45 2003/02/19 22:00:14 daniel
  1047. * Code generator converted to new register notation
  1048. - Horribily outdated todo.txt removed
  1049. Revision 1.44 2003/01/08 18:43:56 daniel
  1050. * Tregister changed into a record
  1051. Revision 1.43 2003/01/05 22:44:14 peter
  1052. * remove a lot of code to support typen in loadn-procsym
  1053. Revision 1.42 2002/12/20 18:13:46 peter
  1054. * fixes for fpu values in arrayconstructor
  1055. Revision 1.41 2002/11/27 20:04:39 peter
  1056. * cdecl array of const fixes
  1057. Revision 1.40 2002/11/25 17:43:18 peter
  1058. * splitted defbase in defutil,symutil,defcmp
  1059. * merged isconvertable and is_equal into compare_defs(_ext)
  1060. * made operator search faster by walking the list only once
  1061. Revision 1.39 2002/11/22 16:22:45 jonas
  1062. * fixed error in my previous commit (the size of the location of the
  1063. funcretnode must be based on the current resulttype of the node and not
  1064. the resulttype defined by the function; these can be different in case
  1065. of "absolute" declarations)
  1066. Revision 1.38 2002/11/18 17:31:54 peter
  1067. * pass proccalloption to ret_in_xxx and push_xxx functions
  1068. Revision 1.37 2002/11/15 21:16:39 jonas
  1069. * proper fix for tw2110, also fixes tb0416 (funcretnode of parent
  1070. function was handled wrong inside nested functions/procedures)
  1071. Revision 1.36 2002/11/15 01:58:51 peter
  1072. * merged changes from 1.0.7 up to 04-11
  1073. - -V option for generating bug report tracing
  1074. - more tracing for option parsing
  1075. - errors for cdecl and high()
  1076. - win32 import stabs
  1077. - win32 records<=8 are returned in eax:edx (turned off by default)
  1078. - heaptrc update
  1079. - more info for temp management in .s file with EXTDEBUG
  1080. Revision 1.35 2002/10/14 19:44:13 peter
  1081. * (hacked) new threadvar relocate code
  1082. Revision 1.34 2002/10/13 11:22:06 florian
  1083. * fixed threadvars
  1084. Revision 1.33 2002/10/03 21:32:02 carl
  1085. * bugfix for 2110 (without -Or), wrong checking was done in returntype
  1086. Revision 1.32 2002/09/30 07:00:46 florian
  1087. * fixes to common code to get the alpha compiler compiled applied
  1088. Revision 1.31 2002/09/26 15:02:05 florian
  1089. + support of passing variants to "array of const"
  1090. Revision 1.30 2002/09/17 18:54:02 jonas
  1091. * a_load_reg_reg() now has two size parameters: source and dest. This
  1092. allows some optimizations on architectures that don't encode the
  1093. register size in the register name.
  1094. Revision 1.29 2002/09/07 15:25:03 peter
  1095. * old logs removed and tabs fixed
  1096. Revision 1.28 2002/09/01 19:26:32 peter
  1097. * fixed register variable loading from parasymtable, the call by
  1098. reference code was moved wrong
  1099. Revision 1.27 2002/09/01 12:15:40 peter
  1100. * fixed loading of procvar of object when the object is initialized
  1101. with 0
  1102. Revision 1.26 2002/08/25 19:25:18 peter
  1103. * sym.insert_in_data removed
  1104. * symtable.insertvardata/insertconstdata added
  1105. * removed insert_in_data call from symtable.insert, it needs to be
  1106. called separatly. This allows to deref the address calculation
  1107. * procedures now calculate the parast addresses after the procedure
  1108. directives are parsed. This fixes the cdecl parast problem
  1109. * push_addr_param has an extra argument that specifies if cdecl is used
  1110. or not
  1111. Revision 1.25 2002/08/23 16:14:48 peter
  1112. * tempgen cleanup
  1113. * tt_noreuse temp type added that will be used in genentrycode
  1114. Revision 1.24 2002/08/17 09:23:35 florian
  1115. * first part of procinfo rewrite
  1116. Revision 1.23 2002/08/14 18:13:28 jonas
  1117. * adapted previous fix to Peter's asmsymbol patch
  1118. Revision 1.22 2002/08/14 18:00:42 jonas
  1119. * fixed tb0403
  1120. Revision 1.21 2002/08/13 21:40:56 florian
  1121. * more fixes for ppc calling conventions
  1122. Revision 1.20 2002/08/11 14:32:26 peter
  1123. * renamed current_library to objectlibrary
  1124. Revision 1.19 2002/08/11 13:24:12 peter
  1125. * saving of asmsymbols in ppu supported
  1126. * asmsymbollist global is removed and moved into a new class
  1127. tasmlibrarydata that will hold the info of a .a file which
  1128. corresponds with a single module. Added librarydata to tmodule
  1129. to keep the library info stored for the module. In the future the
  1130. objectfiles will also be stored to the tasmlibrarydata class
  1131. * all getlabel/newasmsymbol and friends are moved to the new class
  1132. Revision 1.18 2002/08/06 20:55:21 florian
  1133. * first part of ppc calling conventions fix
  1134. Revision 1.17 2002/07/28 09:25:37 carl
  1135. + correct size of parameter (64-bit portability)
  1136. Revision 1.16 2002/07/27 19:53:51 jonas
  1137. + generic implementation of tcg.g_flags2ref()
  1138. * tcg.flags2xxx() now also needs a size parameter
  1139. Revision 1.15 2002/07/20 11:57:54 florian
  1140. * types.pas renamed to defbase.pas because D6 contains a types
  1141. unit so this would conflicts if D6 programms are compiled
  1142. + Willamette/SSE2 instructions to assembler added
  1143. Revision 1.14 2002/07/16 09:17:44 florian
  1144. * threadvar relocation result wasn't handled properly, it could cause
  1145. a crash
  1146. Revision 1.13 2002/07/11 14:41:28 florian
  1147. * start of the new generic parameter handling
  1148. Revision 1.12 2002/07/07 09:52:32 florian
  1149. * powerpc target fixed, very simple units can be compiled
  1150. * some basic stuff for better callparanode handling, far from being finished
  1151. Revision 1.11 2002/07/01 18:46:23 peter
  1152. * internal linker
  1153. * reorganized aasm layer
  1154. Revision 1.10 2002/07/01 16:23:53 peter
  1155. * cg64 patch
  1156. * basics for currency
  1157. * asnode updates for class and interface (not finished)
  1158. Revision 1.9 2002/05/20 13:30:40 carl
  1159. * bugfix of hdisponen (base must be set, not index)
  1160. * more portability fixes
  1161. }