ncgld.pas 57 KB

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