ncgld.pas 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335
  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,aasmcpu,
  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);
  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_MMREGISTER,
  556. LOC_CMMREGISTER:
  557. begin
  558. if left.resulttype.def.deftype=arraydef then
  559. begin
  560. end
  561. else
  562. begin
  563. cgsize:=def_cgsize(left.resulttype.def);
  564. if left.location.loc=LOC_CMMREGISTER then
  565. cg.a_loadmm_reg_reg(exprasmlist,right.location.size,left.location.size,right.location.register,left.location.register,mms_movescalar)
  566. else
  567. cg.a_loadmm_reg_ref(exprasmlist,right.location.size,left.location.size,right.location.register,left.location.reference,mms_movescalar);
  568. end;
  569. end;
  570. LOC_REGISTER,
  571. LOC_CREGISTER :
  572. begin
  573. cgsize:=def_cgsize(left.resulttype.def);
  574. if cgsize in [OS_64,OS_S64] then
  575. cg64.a_load64_reg_loc(exprasmlist,
  576. right.location.register64,left.location)
  577. else
  578. cg.a_load_reg_loc(exprasmlist,right.location.size,right.location.register,left.location);
  579. end;
  580. LOC_FPUREGISTER,LOC_CFPUREGISTER :
  581. begin
  582. if (left.resulttype.def.deftype=floatdef) then
  583. fputyp:=tfloatdef(left.resulttype.def).typ
  584. else
  585. if (right.resulttype.def.deftype=floatdef) then
  586. fputyp:=tfloatdef(right.resulttype.def).typ
  587. else
  588. if (right.nodetype=typeconvn) and
  589. (ttypeconvnode(right).left.resulttype.def.deftype=floatdef) then
  590. fputyp:=tfloatdef(ttypeconvnode(right).left.resulttype.def).typ
  591. else
  592. fputyp:=s32real;
  593. cg.a_loadfpu_reg_loc(exprasmlist,
  594. tfloat2tcgsize[fputyp],
  595. right.location.register,left.location);
  596. end;
  597. LOC_JUMP :
  598. begin
  599. cgsize:=def_cgsize(left.resulttype.def);
  600. objectlibrary.getlabel(hlabel);
  601. { generate the leftnode for the true case, and
  602. release the location }
  603. cg.a_label(exprasmlist,truelabel);
  604. secondpass(left);
  605. if codegenerror then
  606. exit;
  607. cg.a_load_const_loc(exprasmlist,1,left.location);
  608. location_release(exprasmlist,left.location);
  609. cg.a_jmp_always(exprasmlist,hlabel);
  610. { generate the leftnode for the false case }
  611. cg.a_label(exprasmlist,falselabel);
  612. old_allow_multi_pass2:=allow_multi_pass2;
  613. allow_multi_pass2:=true;
  614. secondpass(left);
  615. allow_multi_pass2:=old_allow_multi_pass2;
  616. if codegenerror then
  617. exit;
  618. cg.a_load_const_loc(exprasmlist,0,left.location);
  619. cg.a_label(exprasmlist,hlabel);
  620. end;
  621. {$ifdef cpuflags}
  622. LOC_FLAGS :
  623. begin
  624. {This can be a wordbool or longbool too, no?}
  625. if left.location.loc=LOC_CREGISTER then
  626. cg.g_flags2reg(exprasmlist,def_cgsize(left.resulttype.def),right.location.resflags,left.location.register)
  627. else
  628. begin
  629. if not(left.location.loc = LOC_REFERENCE) then
  630. internalerror(200203273);
  631. cg.g_flags2ref(exprasmlist,def_cgsize(left.resulttype.def),right.location.resflags,left.location.reference);
  632. end;
  633. end;
  634. {$endif cpuflags}
  635. end;
  636. end;
  637. if releaseright then
  638. location_release(exprasmlist,right.location);
  639. location_release(exprasmlist,left.location);
  640. truelabel:=otlabel;
  641. falselabel:=oflabel;
  642. end;
  643. {*****************************************************************************
  644. SecondArrayConstruct
  645. *****************************************************************************}
  646. const
  647. vtInteger = 0;
  648. vtBoolean = 1;
  649. vtChar = 2;
  650. vtExtended = 3;
  651. vtString = 4;
  652. vtPointer = 5;
  653. vtPChar = 6;
  654. vtObject = 7;
  655. vtClass = 8;
  656. vtWideChar = 9;
  657. vtPWideChar = 10;
  658. vtAnsiString = 11;
  659. vtCurrency = 12;
  660. vtVariant = 13;
  661. vtInterface = 14;
  662. vtWideString = 15;
  663. vtInt64 = 16;
  664. vtQWord = 17;
  665. procedure tcgarrayconstructornode.pass_2;
  666. var
  667. hp : tarrayconstructornode;
  668. href : treference;
  669. lt : tdef;
  670. vaddr : boolean;
  671. vtype : longint;
  672. freetemp,
  673. dovariant : boolean;
  674. elesize : longint;
  675. tmpreg : tregister;
  676. paraloc : tparalocation;
  677. begin
  678. dovariant:=(nf_forcevaria in flags) or tarraydef(resulttype.def).isvariant;
  679. if dovariant then
  680. elesize:=8
  681. else
  682. elesize:=tarraydef(resulttype.def).elesize;
  683. location_reset(location,LOC_CREFERENCE,OS_NO);
  684. fillchar(paraloc,sizeof(paraloc),0);
  685. { Allocate always a temp, also if no elements are required, to
  686. be sure that location is valid (PFV) }
  687. if tarraydef(resulttype.def).highrange=-1 then
  688. tg.GetTemp(exprasmlist,elesize,tt_normal,location.reference)
  689. else
  690. tg.GetTemp(exprasmlist,(tarraydef(resulttype.def).highrange+1)*elesize,tt_normal,location.reference);
  691. href:=location.reference;
  692. { Process nodes in array constructor }
  693. hp:=self;
  694. while assigned(hp) do
  695. begin
  696. if assigned(hp.left) then
  697. begin
  698. freetemp:=true;
  699. secondpass(hp.left);
  700. if codegenerror then
  701. exit;
  702. { Move flags and jump in register }
  703. if hp.left.location.loc in [LOC_FLAGS,LOC_JUMP] then
  704. location_force_reg(exprasmlist,hp.left.location,def_cgsize(hp.left.resulttype.def),false);
  705. if dovariant then
  706. begin
  707. { find the correct vtype value }
  708. vtype:=$ff;
  709. vaddr:=false;
  710. lt:=hp.left.resulttype.def;
  711. case lt.deftype of
  712. enumdef,
  713. orddef :
  714. begin
  715. if is_64bit(lt) then
  716. begin
  717. case torddef(lt).typ of
  718. s64bit:
  719. vtype:=vtInt64;
  720. u64bit:
  721. vtype:=vtQWord;
  722. end;
  723. freetemp:=false;
  724. vaddr:=true;
  725. end
  726. else if (lt.deftype=enumdef) or
  727. is_integer(lt) then
  728. vtype:=vtInteger
  729. else
  730. if is_boolean(lt) then
  731. vtype:=vtBoolean
  732. else
  733. if (lt.deftype=orddef) then
  734. begin
  735. case torddef(lt).typ of
  736. uchar:
  737. vtype:=vtChar;
  738. uwidechar:
  739. vtype:=vtWideChar;
  740. end;
  741. end;
  742. end;
  743. floatdef :
  744. begin
  745. vtype:=vtExtended;
  746. freetemp:=false;
  747. vaddr:=true;
  748. end;
  749. procvardef,
  750. pointerdef :
  751. begin
  752. if is_pchar(lt) then
  753. vtype:=vtPChar
  754. else
  755. vtype:=vtPointer;
  756. end;
  757. variantdef :
  758. begin
  759. vtype:=vtVariant;
  760. vaddr:=true;
  761. freetemp:=false;
  762. end;
  763. classrefdef :
  764. vtype:=vtClass;
  765. objectdef :
  766. vtype:=vtObject;
  767. stringdef :
  768. begin
  769. if is_shortstring(lt) then
  770. begin
  771. vtype:=vtString;
  772. vaddr:=true;
  773. freetemp:=false;
  774. end
  775. else
  776. if is_ansistring(lt) then
  777. begin
  778. vtype:=vtAnsiString;
  779. freetemp:=false;
  780. end
  781. else
  782. if is_widestring(lt) then
  783. begin
  784. vtype:=vtWideString;
  785. freetemp:=false;
  786. end;
  787. end;
  788. end;
  789. if vtype=$ff then
  790. internalerror(14357);
  791. { write changing field update href to the next element }
  792. inc(href.offset,4);
  793. if vaddr then
  794. begin
  795. location_force_mem(exprasmlist,hp.left.location);
  796. location_release(exprasmlist,hp.left.location);
  797. tmpreg:=cg.getaddressregister(exprasmlist);
  798. cg.a_loadaddr_ref_reg(exprasmlist,hp.left.location.reference,tmpreg);
  799. cg.ungetregister(exprasmlist,tmpreg);
  800. cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,tmpreg,href);
  801. if freetemp then
  802. location_freetemp(exprasmlist,hp.left.location);
  803. end
  804. else
  805. begin
  806. location_release(exprasmlist,hp.left.location);
  807. cg.a_load_loc_ref(exprasmlist,OS_ADDR,hp.left.location,href);
  808. end;
  809. { update href to the vtype field and write it }
  810. dec(href.offset,4);
  811. cg.a_load_const_ref(exprasmlist, OS_INT,vtype,href);
  812. { goto next array element }
  813. inc(href.offset,8);
  814. end
  815. else
  816. { normal array constructor of the same type }
  817. begin
  818. if is_ansistring(left.resulttype.def) or
  819. is_widestring(left.resulttype.def) or
  820. (left.resulttype.def.deftype=variantdef) then
  821. freetemp:=false;
  822. case hp.left.location.loc of
  823. LOC_FPUREGISTER,
  824. LOC_CFPUREGISTER :
  825. begin
  826. location_release(exprasmlist,hp.left.location);
  827. cg.a_loadfpu_reg_ref(exprasmlist,hp.left.location.size,hp.left.location.register,href);
  828. end;
  829. LOC_REFERENCE,
  830. LOC_CREFERENCE :
  831. begin
  832. location_release(exprasmlist,hp.left.location);
  833. cg.g_concatcopy(exprasmlist,hp.left.location.reference,href,elesize,freetemp,false);
  834. end;
  835. else
  836. begin
  837. if hp.left.location.size in [OS_64,OS_S64] then
  838. begin
  839. cg64.a_load64_loc_ref(exprasmlist,hp.left.location,href);
  840. location_release(exprasmlist,hp.left.location);
  841. end
  842. else
  843. begin
  844. location_release(exprasmlist,hp.left.location);
  845. cg.a_load_loc_ref(exprasmlist,hp.left.location.size,hp.left.location,href);
  846. end;
  847. end;
  848. end;
  849. inc(href.offset,elesize);
  850. end;
  851. end;
  852. { load next entry }
  853. hp:=tarrayconstructornode(hp.right);
  854. end;
  855. end;
  856. begin
  857. cloadnode:=tcgloadnode;
  858. cassignmentnode:=tcgassignmentnode;
  859. carrayconstructornode:=tcgarrayconstructornode;
  860. end.
  861. {
  862. $Log$
  863. Revision 1.105 2004-02-02 20:41:59 florian
  864. + added prefetch(const mem) support
  865. Revision 1.104 2003/12/25 01:07:09 florian
  866. + $fputype directive support
  867. + single data type operations with sse unit
  868. * fixed more x86-64 stuff
  869. Revision 1.103 2003/12/24 00:10:02 florian
  870. - delete parameter in cg64 methods removed
  871. Revision 1.102 2003/12/06 01:15:22 florian
  872. * reverted Peter's alloctemp patch; hopefully properly
  873. Revision 1.101 2003/12/03 23:13:20 peter
  874. * delayed paraloc allocation, a_param_*() gets extra parameter
  875. if it needs to allocate temp or real paralocation
  876. * optimized/simplified int-real loading
  877. Revision 1.100 2003/12/01 18:44:15 peter
  878. * fixed some crashes
  879. * fixed varargs and register calling probs
  880. Revision 1.99 2003/11/23 17:39:33 peter
  881. * removed obsolete nf_cargs flag
  882. Revision 1.98 2003/10/29 19:48:50 peter
  883. * renamed mangeldname_prefix to make_mangledname and made it more
  884. generic
  885. * make_mangledname is now also used for internal threadvar/resstring
  886. lists
  887. * Add P$ in front of program modulename to prevent duplicated symbols
  888. at assembler level, because the main program can have the same name
  889. as a unit, see webtbs/tw1251b
  890. Revision 1.97 2003/10/28 15:36:01 peter
  891. * absolute to object field supported, fixes tb0458
  892. Revision 1.96 2003/10/17 14:38:32 peter
  893. * 64k registers supported
  894. * fixed some memory leaks
  895. Revision 1.95 2003/10/14 00:30:48 florian
  896. + some code for PIC support added
  897. Revision 1.94 2003/10/11 16:06:42 florian
  898. * fixed some MMX<->SSE
  899. * started to fix ppc, needs an overhaul
  900. + stabs info improve for spilling, not sure if it works correctly/completly
  901. - MMX_SUPPORT removed from Makefile.fpc
  902. Revision 1.93 2003/10/10 17:48:13 peter
  903. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  904. * tregisteralloctor renamed to trgobj
  905. * removed rgobj from a lot of units
  906. * moved location_* and reference_* to cgobj
  907. * first things for mmx register allocation
  908. Revision 1.92 2003/10/09 21:31:37 daniel
  909. * Register allocator splitted, ans abstract now
  910. Revision 1.91 2003/10/07 15:17:07 peter
  911. * inline supported again, LOC_REFERENCEs are used to pass the
  912. parameters
  913. * inlineparasymtable,inlinelocalsymtable removed
  914. * exitlabel inserting fixed
  915. Revision 1.90 2003/10/05 21:21:52 peter
  916. * c style array of const generates callparanodes
  917. * varargs paraloc fixes
  918. Revision 1.89 2003/10/01 20:34:48 peter
  919. * procinfo unit contains tprocinfo
  920. * cginfo renamed to cgbase
  921. * moved cgmessage to verbose
  922. * fixed ppc and sparc compiles
  923. Revision 1.88 2003/09/29 20:58:56 peter
  924. * optimized releasing of registers
  925. Revision 1.87 2003/09/28 21:46:18 peter
  926. * fix allocation of threadvar parameter
  927. Revision 1.86 2003/09/28 17:55:03 peter
  928. * parent framepointer changed to hidden parameter
  929. * tloadparentfpnode added
  930. Revision 1.85 2003/09/28 13:39:38 peter
  931. * optimized releasing of registers
  932. Revision 1.84 2003/09/25 21:27:31 peter
  933. * rearranged threadvar code so the result register is the same
  934. for the relocated and address loaded variables
  935. Revision 1.83 2003/09/23 17:56:05 peter
  936. * locals and paras are allocated in the code generation
  937. * tvarsym.localloc contains the location of para/local when
  938. generating code for the current procedure
  939. Revision 1.82 2003/09/16 16:17:01 peter
  940. * varspez in calls to push_addr_param
  941. Revision 1.81 2003/09/14 12:57:10 peter
  942. * save destroyed registers when calling threadvar helper
  943. Revision 1.80 2003/09/10 08:31:47 marco
  944. * Patch from Peter for paraloc
  945. Revision 1.79 2003/09/03 15:55:00 peter
  946. * NEWRA branch merged
  947. Revision 1.78 2003/09/03 11:18:37 florian
  948. * fixed arm concatcopy
  949. + arm support in the common compiler sources added
  950. * moved some generic cg code around
  951. + tfputype added
  952. * ...
  953. Revision 1.77.2.2 2003/08/31 15:46:26 peter
  954. * more updates for tregister
  955. Revision 1.77.2.1 2003/08/29 17:28:59 peter
  956. * next batch of updates
  957. Revision 1.77 2003/08/20 20:13:08 daniel
  958. * Fixed the fixed trouble
  959. Revision 1.76 2003/08/20 20:11:24 daniel
  960. * Fixed some R_NO trouble
  961. Revision 1.75 2003/07/20 16:26:43 jonas
  962. * fix for threadvars with -dnewra
  963. Revision 1.74 2003/07/06 17:58:22 peter
  964. * framepointer fixes for sparc
  965. * parent framepointer code more generic
  966. Revision 1.73 2003/07/06 15:25:54 jonas
  967. * newra fix for threadvars
  968. Revision 1.72 2003/06/15 15:13:12 jonas
  969. * fixed register allocation for threadvar loads with newra
  970. Revision 1.71 2003/06/13 21:19:30 peter
  971. * current_procdef removed, use current_procinfo.procdef instead
  972. Revision 1.70 2003/06/12 16:43:07 peter
  973. * newra compiles for sparc
  974. Revision 1.69 2003/06/09 16:41:52 jonas
  975. * fixed regvar optimization for call_by_reference parameters (no need
  976. to load address in another register)
  977. Revision 1.68 2003/06/08 18:27:15 jonas
  978. + ability to change the location of a ttempref node with changelocation()
  979. method. Useful to use instead of copying the contents from one temp to
  980. another
  981. + some shortstring optimizations in tassignmentnode that avoid some
  982. copying (required some shortstring optimizations to be moved from
  983. resulttype to firstpass, because they work on callnodes and string
  984. addnodes are only changed to callnodes in the firstpass)
  985. * allow setting/changing the funcretnode of callnodes after the
  986. resulttypepass has been done, funcretnode is now a property
  987. (all of the above should have a quite big effect on callparatemp)
  988. Revision 1.67 2003/06/07 18:57:04 jonas
  989. + added freeintparaloc
  990. * ppc get/freeintparaloc now check whether the parameter regs are
  991. properly allocated/deallocated (and get an extra list para)
  992. * ppc a_call_* now internalerrors if pi_do_call is not yet set
  993. * fixed lot of missing pi_do_call's
  994. Revision 1.66 2003/06/03 21:11:09 peter
  995. * cg.a_load_* get a from and to size specifier
  996. * makeregsize only accepts newregister
  997. * i386 uses generic tcgnotnode,tcgunaryminus
  998. Revision 1.65 2003/06/03 13:01:59 daniel
  999. * Register allocator finished
  1000. Revision 1.64 2003/05/30 23:57:08 peter
  1001. * more sparc cleanup
  1002. * accumulator removed, splitted in function_return_reg (called) and
  1003. function_result_reg (caller)
  1004. Revision 1.63 2003/05/30 23:54:08 jonas
  1005. * forgot to commit, a_load_loc_reg change
  1006. Revision 1.62 2003/05/26 19:38:28 peter
  1007. * generic fpc_shorstr_concat
  1008. + fpc_shortstr_append_shortstr optimization
  1009. Revision 1.61 2003/05/24 11:47:27 jonas
  1010. * fixed framepointer storage: it's now always stored at r1+12, which is
  1011. a place in the link area reserved for compiler use.
  1012. Revision 1.60 2003/05/23 14:27:35 peter
  1013. * remove some unit dependencies
  1014. * current_procinfo changes to store more info
  1015. Revision 1.59 2003/05/15 18:58:53 peter
  1016. * removed selfpointer_offset, vmtpointer_offset
  1017. * tvarsym.adjusted_address
  1018. * address in localsymtable is now in the real direction
  1019. * removed some obsolete globals
  1020. Revision 1.58 2003/05/12 17:22:00 jonas
  1021. * fixed (last?) remaining -tvarsym(X).address to
  1022. tg.direction*tvarsym(X).address...
  1023. Revision 1.57 2003/05/11 21:37:03 peter
  1024. * moved implicit exception frame from ncgutil to psub
  1025. * constructor/destructor helpers moved from cobj/ncgutil to psub
  1026. Revision 1.56 2003/05/11 14:45:12 peter
  1027. * tloadnode does not support objectsymtable,withsymtable anymore
  1028. * withnode cleanup
  1029. * direct with rewritten to use temprefnode
  1030. Revision 1.55 2003/04/29 07:29:14 michael
  1031. + Patch from peter to fix wrong pushing of ansistring function results in open array
  1032. Revision 1.54 2003/04/27 11:21:33 peter
  1033. * aktprocdef renamed to current_procinfo.procdef
  1034. * procinfo renamed to current_procinfo
  1035. * procinfo will now be stored in current_module so it can be
  1036. cleaned up properly
  1037. * gen_main_procsym changed to create_main_proc and release_main_proc
  1038. to also generate a tprocinfo structure
  1039. * fixed unit implicit initfinal
  1040. Revision 1.53 2003/04/27 07:29:50 peter
  1041. * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
  1042. a new procdef declaration
  1043. * aktprocsym removed
  1044. * lexlevel removed, use symtable.symtablelevel instead
  1045. * implicit init/final code uses the normal genentry/genexit
  1046. * funcret state checking updated for new funcret handling
  1047. Revision 1.52 2003/04/25 20:59:33 peter
  1048. * removed funcretn,funcretsym, function result is now in varsym
  1049. and aliases for result and function name are added using absolutesym
  1050. * vs_hidden parameter for funcret passed in parameter
  1051. * vs_hidden fixes
  1052. * writenode changed to printnode and released from extdebug
  1053. * -vp option added to generate a tree.log with the nodetree
  1054. * nicer printnode for statements, callnode
  1055. Revision 1.51 2003/04/23 20:16:04 peter
  1056. + added currency support based on int64
  1057. + is_64bit for use in cg units instead of is_64bitint
  1058. * removed cgmessage from n386add, replace with internalerrors
  1059. Revision 1.50 2003/04/23 10:12:14 peter
  1060. * allow multi pass2 changed to global boolean instead of node flag
  1061. Revision 1.49 2003/04/22 23:50:22 peter
  1062. * firstpass uses expectloc
  1063. * checks if there are differences between the expectloc and
  1064. location.loc from secondpass in EXTDEBUG
  1065. Revision 1.48 2003/04/22 10:09:35 daniel
  1066. + Implemented the actual register allocator
  1067. + Scratch registers unavailable when new register allocator used
  1068. + maybe_save/maybe_restore unavailable when new register allocator used
  1069. Revision 1.47 2003/04/06 21:11:23 olle
  1070. * changed newasmsymbol to newasmsymboldata for data symbols
  1071. Revision 1.46 2003/03/28 19:16:56 peter
  1072. * generic constructor working for i386
  1073. * remove fixed self register
  1074. * esi added as address register for i386
  1075. Revision 1.45 2003/02/19 22:00:14 daniel
  1076. * Code generator converted to new register notation
  1077. - Horribily outdated todo.txt removed
  1078. Revision 1.44 2003/01/08 18:43:56 daniel
  1079. * Tregister changed into a record
  1080. Revision 1.43 2003/01/05 22:44:14 peter
  1081. * remove a lot of code to support typen in loadn-procsym
  1082. Revision 1.42 2002/12/20 18:13:46 peter
  1083. * fixes for fpu values in arrayconstructor
  1084. Revision 1.41 2002/11/27 20:04:39 peter
  1085. * cdecl array of const fixes
  1086. Revision 1.40 2002/11/25 17:43:18 peter
  1087. * splitted defbase in defutil,symutil,defcmp
  1088. * merged isconvertable and is_equal into compare_defs(_ext)
  1089. * made operator search faster by walking the list only once
  1090. Revision 1.39 2002/11/22 16:22:45 jonas
  1091. * fixed error in my previous commit (the size of the location of the
  1092. funcretnode must be based on the current resulttype of the node and not
  1093. the resulttype defined by the function; these can be different in case
  1094. of "absolute" declarations)
  1095. Revision 1.38 2002/11/18 17:31:54 peter
  1096. * pass proccalloption to ret_in_xxx and push_xxx functions
  1097. Revision 1.37 2002/11/15 21:16:39 jonas
  1098. * proper fix for tw2110, also fixes tb0416 (funcretnode of parent
  1099. function was handled wrong inside nested functions/procedures)
  1100. Revision 1.36 2002/11/15 01:58:51 peter
  1101. * merged changes from 1.0.7 up to 04-11
  1102. - -V option for generating bug report tracing
  1103. - more tracing for option parsing
  1104. - errors for cdecl and high()
  1105. - win32 import stabs
  1106. - win32 records<=8 are returned in eax:edx (turned off by default)
  1107. - heaptrc update
  1108. - more info for temp management in .s file with EXTDEBUG
  1109. Revision 1.35 2002/10/14 19:44:13 peter
  1110. * (hacked) new threadvar relocate code
  1111. Revision 1.34 2002/10/13 11:22:06 florian
  1112. * fixed threadvars
  1113. Revision 1.33 2002/10/03 21:32:02 carl
  1114. * bugfix for 2110 (without -Or), wrong checking was done in returntype
  1115. Revision 1.32 2002/09/30 07:00:46 florian
  1116. * fixes to common code to get the alpha compiler compiled applied
  1117. Revision 1.31 2002/09/26 15:02:05 florian
  1118. + support of passing variants to "array of const"
  1119. Revision 1.30 2002/09/17 18:54:02 jonas
  1120. * a_load_reg_reg() now has two size parameters: source and dest. This
  1121. allows some optimizations on architectures that don't encode the
  1122. register size in the register name.
  1123. Revision 1.29 2002/09/07 15:25:03 peter
  1124. * old logs removed and tabs fixed
  1125. Revision 1.28 2002/09/01 19:26:32 peter
  1126. * fixed register variable loading from parasymtable, the call by
  1127. reference code was moved wrong
  1128. Revision 1.27 2002/09/01 12:15:40 peter
  1129. * fixed loading of procvar of object when the object is initialized
  1130. with 0
  1131. Revision 1.26 2002/08/25 19:25:18 peter
  1132. * sym.insert_in_data removed
  1133. * symtable.insertvardata/insertconstdata added
  1134. * removed insert_in_data call from symtable.insert, it needs to be
  1135. called separatly. This allows to deref the address calculation
  1136. * procedures now calculate the parast addresses after the procedure
  1137. directives are parsed. This fixes the cdecl parast problem
  1138. * push_addr_param has an extra argument that specifies if cdecl is used
  1139. or not
  1140. Revision 1.25 2002/08/23 16:14:48 peter
  1141. * tempgen cleanup
  1142. * tt_noreuse temp type added that will be used in genentrycode
  1143. Revision 1.24 2002/08/17 09:23:35 florian
  1144. * first part of procinfo rewrite
  1145. Revision 1.23 2002/08/14 18:13:28 jonas
  1146. * adapted previous fix to Peter's asmsymbol patch
  1147. Revision 1.22 2002/08/14 18:00:42 jonas
  1148. * fixed tb0403
  1149. Revision 1.21 2002/08/13 21:40:56 florian
  1150. * more fixes for ppc calling conventions
  1151. Revision 1.20 2002/08/11 14:32:26 peter
  1152. * renamed current_library to objectlibrary
  1153. Revision 1.19 2002/08/11 13:24:12 peter
  1154. * saving of asmsymbols in ppu supported
  1155. * asmsymbollist global is removed and moved into a new class
  1156. tasmlibrarydata that will hold the info of a .a file which
  1157. corresponds with a single module. Added librarydata to tmodule
  1158. to keep the library info stored for the module. In the future the
  1159. objectfiles will also be stored to the tasmlibrarydata class
  1160. * all getlabel/newasmsymbol and friends are moved to the new class
  1161. Revision 1.18 2002/08/06 20:55:21 florian
  1162. * first part of ppc calling conventions fix
  1163. Revision 1.17 2002/07/28 09:25:37 carl
  1164. + correct size of parameter (64-bit portability)
  1165. Revision 1.16 2002/07/27 19:53:51 jonas
  1166. + generic implementation of tcg.g_flags2ref()
  1167. * tcg.flags2xxx() now also needs a size parameter
  1168. Revision 1.15 2002/07/20 11:57:54 florian
  1169. * types.pas renamed to defbase.pas because D6 contains a types
  1170. unit so this would conflicts if D6 programms are compiled
  1171. + Willamette/SSE2 instructions to assembler added
  1172. Revision 1.14 2002/07/16 09:17:44 florian
  1173. * threadvar relocation result wasn't handled properly, it could cause
  1174. a crash
  1175. Revision 1.13 2002/07/11 14:41:28 florian
  1176. * start of the new generic parameter handling
  1177. Revision 1.12 2002/07/07 09:52:32 florian
  1178. * powerpc target fixed, very simple units can be compiled
  1179. * some basic stuff for better callparanode handling, far from being finished
  1180. Revision 1.11 2002/07/01 18:46:23 peter
  1181. * internal linker
  1182. * reorganized aasm layer
  1183. Revision 1.10 2002/07/01 16:23:53 peter
  1184. * cg64 patch
  1185. * basics for currency
  1186. * asnode updates for class and interface (not finished)
  1187. Revision 1.9 2002/05/20 13:30:40 carl
  1188. * bugfix of hdisponen (base must be set, not index)
  1189. * more portability fixes
  1190. }