ncgld.pas 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343
  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.registersint>=left.registersint)) 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.107 2004-02-05 01:24:08 florian
  864. * several fixes to compile x86-64 system
  865. Revision 1.106 2004/02/03 22:32:54 peter
  866. * renamed xNNbittype to xNNinttype
  867. * renamed registers32 to registersint
  868. * replace some s32bit,u32bit with torddef([su]inttype).def.typ
  869. Revision 1.105 2004/02/02 20:41:59 florian
  870. + added prefetch(const mem) support
  871. Revision 1.104 2003/12/25 01:07:09 florian
  872. + $fputype directive support
  873. + single data type operations with sse unit
  874. * fixed more x86-64 stuff
  875. Revision 1.103 2003/12/24 00:10:02 florian
  876. - delete parameter in cg64 methods removed
  877. Revision 1.102 2003/12/06 01:15:22 florian
  878. * reverted Peter's alloctemp patch; hopefully properly
  879. Revision 1.101 2003/12/03 23:13:20 peter
  880. * delayed paraloc allocation, a_param_*() gets extra parameter
  881. if it needs to allocate temp or real paralocation
  882. * optimized/simplified int-real loading
  883. Revision 1.100 2003/12/01 18:44:15 peter
  884. * fixed some crashes
  885. * fixed varargs and register calling probs
  886. Revision 1.99 2003/11/23 17:39:33 peter
  887. * removed obsolete nf_cargs flag
  888. Revision 1.98 2003/10/29 19:48:50 peter
  889. * renamed mangeldname_prefix to make_mangledname and made it more
  890. generic
  891. * make_mangledname is now also used for internal threadvar/resstring
  892. lists
  893. * Add P$ in front of program modulename to prevent duplicated symbols
  894. at assembler level, because the main program can have the same name
  895. as a unit, see webtbs/tw1251b
  896. Revision 1.97 2003/10/28 15:36:01 peter
  897. * absolute to object field supported, fixes tb0458
  898. Revision 1.96 2003/10/17 14:38:32 peter
  899. * 64k registers supported
  900. * fixed some memory leaks
  901. Revision 1.95 2003/10/14 00:30:48 florian
  902. + some code for PIC support added
  903. Revision 1.94 2003/10/11 16:06:42 florian
  904. * fixed some MMX<->SSE
  905. * started to fix ppc, needs an overhaul
  906. + stabs info improve for spilling, not sure if it works correctly/completly
  907. - MMX_SUPPORT removed from Makefile.fpc
  908. Revision 1.93 2003/10/10 17:48:13 peter
  909. * old trgobj moved to x86/rgcpu and renamed to trgx86fpu
  910. * tregisteralloctor renamed to trgobj
  911. * removed rgobj from a lot of units
  912. * moved location_* and reference_* to cgobj
  913. * first things for mmx register allocation
  914. Revision 1.92 2003/10/09 21:31:37 daniel
  915. * Register allocator splitted, ans abstract now
  916. Revision 1.91 2003/10/07 15:17:07 peter
  917. * inline supported again, LOC_REFERENCEs are used to pass the
  918. parameters
  919. * inlineparasymtable,inlinelocalsymtable removed
  920. * exitlabel inserting fixed
  921. Revision 1.90 2003/10/05 21:21:52 peter
  922. * c style array of const generates callparanodes
  923. * varargs paraloc fixes
  924. Revision 1.89 2003/10/01 20:34:48 peter
  925. * procinfo unit contains tprocinfo
  926. * cginfo renamed to cgbase
  927. * moved cgmessage to verbose
  928. * fixed ppc and sparc compiles
  929. Revision 1.88 2003/09/29 20:58:56 peter
  930. * optimized releasing of registers
  931. Revision 1.87 2003/09/28 21:46:18 peter
  932. * fix allocation of threadvar parameter
  933. Revision 1.86 2003/09/28 17:55:03 peter
  934. * parent framepointer changed to hidden parameter
  935. * tloadparentfpnode added
  936. Revision 1.85 2003/09/28 13:39:38 peter
  937. * optimized releasing of registers
  938. Revision 1.84 2003/09/25 21:27:31 peter
  939. * rearranged threadvar code so the result register is the same
  940. for the relocated and address loaded variables
  941. Revision 1.83 2003/09/23 17:56:05 peter
  942. * locals and paras are allocated in the code generation
  943. * tvarsym.localloc contains the location of para/local when
  944. generating code for the current procedure
  945. Revision 1.82 2003/09/16 16:17:01 peter
  946. * varspez in calls to push_addr_param
  947. Revision 1.81 2003/09/14 12:57:10 peter
  948. * save destroyed registers when calling threadvar helper
  949. Revision 1.80 2003/09/10 08:31:47 marco
  950. * Patch from Peter for paraloc
  951. Revision 1.79 2003/09/03 15:55:00 peter
  952. * NEWRA branch merged
  953. Revision 1.78 2003/09/03 11:18:37 florian
  954. * fixed arm concatcopy
  955. + arm support in the common compiler sources added
  956. * moved some generic cg code around
  957. + tfputype added
  958. * ...
  959. Revision 1.77.2.2 2003/08/31 15:46:26 peter
  960. * more updates for tregister
  961. Revision 1.77.2.1 2003/08/29 17:28:59 peter
  962. * next batch of updates
  963. Revision 1.77 2003/08/20 20:13:08 daniel
  964. * Fixed the fixed trouble
  965. Revision 1.76 2003/08/20 20:11:24 daniel
  966. * Fixed some R_NO trouble
  967. Revision 1.75 2003/07/20 16:26:43 jonas
  968. * fix for threadvars with -dnewra
  969. Revision 1.74 2003/07/06 17:58:22 peter
  970. * framepointer fixes for sparc
  971. * parent framepointer code more generic
  972. Revision 1.73 2003/07/06 15:25:54 jonas
  973. * newra fix for threadvars
  974. Revision 1.72 2003/06/15 15:13:12 jonas
  975. * fixed register allocation for threadvar loads with newra
  976. Revision 1.71 2003/06/13 21:19:30 peter
  977. * current_procdef removed, use current_procinfo.procdef instead
  978. Revision 1.70 2003/06/12 16:43:07 peter
  979. * newra compiles for sparc
  980. Revision 1.69 2003/06/09 16:41:52 jonas
  981. * fixed regvar optimization for call_by_reference parameters (no need
  982. to load address in another register)
  983. Revision 1.68 2003/06/08 18:27:15 jonas
  984. + ability to change the location of a ttempref node with changelocation()
  985. method. Useful to use instead of copying the contents from one temp to
  986. another
  987. + some shortstring optimizations in tassignmentnode that avoid some
  988. copying (required some shortstring optimizations to be moved from
  989. resulttype to firstpass, because they work on callnodes and string
  990. addnodes are only changed to callnodes in the firstpass)
  991. * allow setting/changing the funcretnode of callnodes after the
  992. resulttypepass has been done, funcretnode is now a property
  993. (all of the above should have a quite big effect on callparatemp)
  994. Revision 1.67 2003/06/07 18:57:04 jonas
  995. + added freeintparaloc
  996. * ppc get/freeintparaloc now check whether the parameter regs are
  997. properly allocated/deallocated (and get an extra list para)
  998. * ppc a_call_* now internalerrors if pi_do_call is not yet set
  999. * fixed lot of missing pi_do_call's
  1000. Revision 1.66 2003/06/03 21:11:09 peter
  1001. * cg.a_load_* get a from and to size specifier
  1002. * makeregsize only accepts newregister
  1003. * i386 uses generic tcgnotnode,tcgunaryminus
  1004. Revision 1.65 2003/06/03 13:01:59 daniel
  1005. * Register allocator finished
  1006. Revision 1.64 2003/05/30 23:57:08 peter
  1007. * more sparc cleanup
  1008. * accumulator removed, splitted in function_return_reg (called) and
  1009. function_result_reg (caller)
  1010. Revision 1.63 2003/05/30 23:54:08 jonas
  1011. * forgot to commit, a_load_loc_reg change
  1012. Revision 1.62 2003/05/26 19:38:28 peter
  1013. * generic fpc_shorstr_concat
  1014. + fpc_shortstr_append_shortstr optimization
  1015. Revision 1.61 2003/05/24 11:47:27 jonas
  1016. * fixed framepointer storage: it's now always stored at r1+12, which is
  1017. a place in the link area reserved for compiler use.
  1018. Revision 1.60 2003/05/23 14:27:35 peter
  1019. * remove some unit dependencies
  1020. * current_procinfo changes to store more info
  1021. Revision 1.59 2003/05/15 18:58:53 peter
  1022. * removed selfpointer_offset, vmtpointer_offset
  1023. * tvarsym.adjusted_address
  1024. * address in localsymtable is now in the real direction
  1025. * removed some obsolete globals
  1026. Revision 1.58 2003/05/12 17:22:00 jonas
  1027. * fixed (last?) remaining -tvarsym(X).address to
  1028. tg.direction*tvarsym(X).address...
  1029. Revision 1.57 2003/05/11 21:37:03 peter
  1030. * moved implicit exception frame from ncgutil to psub
  1031. * constructor/destructor helpers moved from cobj/ncgutil to psub
  1032. Revision 1.56 2003/05/11 14:45:12 peter
  1033. * tloadnode does not support objectsymtable,withsymtable anymore
  1034. * withnode cleanup
  1035. * direct with rewritten to use temprefnode
  1036. Revision 1.55 2003/04/29 07:29:14 michael
  1037. + Patch from peter to fix wrong pushing of ansistring function results in open array
  1038. Revision 1.54 2003/04/27 11:21:33 peter
  1039. * aktprocdef renamed to current_procinfo.procdef
  1040. * procinfo renamed to current_procinfo
  1041. * procinfo will now be stored in current_module so it can be
  1042. cleaned up properly
  1043. * gen_main_procsym changed to create_main_proc and release_main_proc
  1044. to also generate a tprocinfo structure
  1045. * fixed unit implicit initfinal
  1046. Revision 1.53 2003/04/27 07:29:50 peter
  1047. * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
  1048. a new procdef declaration
  1049. * aktprocsym removed
  1050. * lexlevel removed, use symtable.symtablelevel instead
  1051. * implicit init/final code uses the normal genentry/genexit
  1052. * funcret state checking updated for new funcret handling
  1053. Revision 1.52 2003/04/25 20:59:33 peter
  1054. * removed funcretn,funcretsym, function result is now in varsym
  1055. and aliases for result and function name are added using absolutesym
  1056. * vs_hidden parameter for funcret passed in parameter
  1057. * vs_hidden fixes
  1058. * writenode changed to printnode and released from extdebug
  1059. * -vp option added to generate a tree.log with the nodetree
  1060. * nicer printnode for statements, callnode
  1061. Revision 1.51 2003/04/23 20:16:04 peter
  1062. + added currency support based on int64
  1063. + is_64bit for use in cg units instead of is_64bitint
  1064. * removed cgmessage from n386add, replace with internalerrors
  1065. Revision 1.50 2003/04/23 10:12:14 peter
  1066. * allow multi pass2 changed to global boolean instead of node flag
  1067. Revision 1.49 2003/04/22 23:50:22 peter
  1068. * firstpass uses expectloc
  1069. * checks if there are differences between the expectloc and
  1070. location.loc from secondpass in EXTDEBUG
  1071. Revision 1.48 2003/04/22 10:09:35 daniel
  1072. + Implemented the actual register allocator
  1073. + Scratch registers unavailable when new register allocator used
  1074. + maybe_save/maybe_restore unavailable when new register allocator used
  1075. Revision 1.47 2003/04/06 21:11:23 olle
  1076. * changed newasmsymbol to newasmsymboldata for data symbols
  1077. Revision 1.46 2003/03/28 19:16:56 peter
  1078. * generic constructor working for i386
  1079. * remove fixed self register
  1080. * esi added as address register for i386
  1081. Revision 1.45 2003/02/19 22:00:14 daniel
  1082. * Code generator converted to new register notation
  1083. - Horribily outdated todo.txt removed
  1084. Revision 1.44 2003/01/08 18:43:56 daniel
  1085. * Tregister changed into a record
  1086. Revision 1.43 2003/01/05 22:44:14 peter
  1087. * remove a lot of code to support typen in loadn-procsym
  1088. Revision 1.42 2002/12/20 18:13:46 peter
  1089. * fixes for fpu values in arrayconstructor
  1090. Revision 1.41 2002/11/27 20:04:39 peter
  1091. * cdecl array of const fixes
  1092. Revision 1.40 2002/11/25 17:43:18 peter
  1093. * splitted defbase in defutil,symutil,defcmp
  1094. * merged isconvertable and is_equal into compare_defs(_ext)
  1095. * made operator search faster by walking the list only once
  1096. Revision 1.39 2002/11/22 16:22:45 jonas
  1097. * fixed error in my previous commit (the size of the location of the
  1098. funcretnode must be based on the current resulttype of the node and not
  1099. the resulttype defined by the function; these can be different in case
  1100. of "absolute" declarations)
  1101. Revision 1.38 2002/11/18 17:31:54 peter
  1102. * pass proccalloption to ret_in_xxx and push_xxx functions
  1103. Revision 1.37 2002/11/15 21:16:39 jonas
  1104. * proper fix for tw2110, also fixes tb0416 (funcretnode of parent
  1105. function was handled wrong inside nested functions/procedures)
  1106. Revision 1.36 2002/11/15 01:58:51 peter
  1107. * merged changes from 1.0.7 up to 04-11
  1108. - -V option for generating bug report tracing
  1109. - more tracing for option parsing
  1110. - errors for cdecl and high()
  1111. - win32 import stabs
  1112. - win32 records<=8 are returned in eax:edx (turned off by default)
  1113. - heaptrc update
  1114. - more info for temp management in .s file with EXTDEBUG
  1115. Revision 1.35 2002/10/14 19:44:13 peter
  1116. * (hacked) new threadvar relocate code
  1117. Revision 1.34 2002/10/13 11:22:06 florian
  1118. * fixed threadvars
  1119. Revision 1.33 2002/10/03 21:32:02 carl
  1120. * bugfix for 2110 (without -Or), wrong checking was done in returntype
  1121. Revision 1.32 2002/09/30 07:00:46 florian
  1122. * fixes to common code to get the alpha compiler compiled applied
  1123. Revision 1.31 2002/09/26 15:02:05 florian
  1124. + support of passing variants to "array of const"
  1125. Revision 1.30 2002/09/17 18:54:02 jonas
  1126. * a_load_reg_reg() now has two size parameters: source and dest. This
  1127. allows some optimizations on architectures that don't encode the
  1128. register size in the register name.
  1129. Revision 1.29 2002/09/07 15:25:03 peter
  1130. * old logs removed and tabs fixed
  1131. Revision 1.28 2002/09/01 19:26:32 peter
  1132. * fixed register variable loading from parasymtable, the call by
  1133. reference code was moved wrong
  1134. Revision 1.27 2002/09/01 12:15:40 peter
  1135. * fixed loading of procvar of object when the object is initialized
  1136. with 0
  1137. Revision 1.26 2002/08/25 19:25:18 peter
  1138. * sym.insert_in_data removed
  1139. * symtable.insertvardata/insertconstdata added
  1140. * removed insert_in_data call from symtable.insert, it needs to be
  1141. called separatly. This allows to deref the address calculation
  1142. * procedures now calculate the parast addresses after the procedure
  1143. directives are parsed. This fixes the cdecl parast problem
  1144. * push_addr_param has an extra argument that specifies if cdecl is used
  1145. or not
  1146. Revision 1.25 2002/08/23 16:14:48 peter
  1147. * tempgen cleanup
  1148. * tt_noreuse temp type added that will be used in genentrycode
  1149. Revision 1.24 2002/08/17 09:23:35 florian
  1150. * first part of procinfo rewrite
  1151. Revision 1.23 2002/08/14 18:13:28 jonas
  1152. * adapted previous fix to Peter's asmsymbol patch
  1153. Revision 1.22 2002/08/14 18:00:42 jonas
  1154. * fixed tb0403
  1155. Revision 1.21 2002/08/13 21:40:56 florian
  1156. * more fixes for ppc calling conventions
  1157. Revision 1.20 2002/08/11 14:32:26 peter
  1158. * renamed current_library to objectlibrary
  1159. Revision 1.19 2002/08/11 13:24:12 peter
  1160. * saving of asmsymbols in ppu supported
  1161. * asmsymbollist global is removed and moved into a new class
  1162. tasmlibrarydata that will hold the info of a .a file which
  1163. corresponds with a single module. Added librarydata to tmodule
  1164. to keep the library info stored for the module. In the future the
  1165. objectfiles will also be stored to the tasmlibrarydata class
  1166. * all getlabel/newasmsymbol and friends are moved to the new class
  1167. Revision 1.18 2002/08/06 20:55:21 florian
  1168. * first part of ppc calling conventions fix
  1169. Revision 1.17 2002/07/28 09:25:37 carl
  1170. + correct size of parameter (64-bit portability)
  1171. Revision 1.16 2002/07/27 19:53:51 jonas
  1172. + generic implementation of tcg.g_flags2ref()
  1173. * tcg.flags2xxx() now also needs a size parameter
  1174. Revision 1.15 2002/07/20 11:57:54 florian
  1175. * types.pas renamed to defbase.pas because D6 contains a types
  1176. unit so this would conflicts if D6 programms are compiled
  1177. + Willamette/SSE2 instructions to assembler added
  1178. Revision 1.14 2002/07/16 09:17:44 florian
  1179. * threadvar relocation result wasn't handled properly, it could cause
  1180. a crash
  1181. Revision 1.13 2002/07/11 14:41:28 florian
  1182. * start of the new generic parameter handling
  1183. Revision 1.12 2002/07/07 09:52:32 florian
  1184. * powerpc target fixed, very simple units can be compiled
  1185. * some basic stuff for better callparanode handling, far from being finished
  1186. Revision 1.11 2002/07/01 18:46:23 peter
  1187. * internal linker
  1188. * reorganized aasm layer
  1189. Revision 1.10 2002/07/01 16:23:53 peter
  1190. * cg64 patch
  1191. * basics for currency
  1192. * asnode updates for class and interface (not finished)
  1193. Revision 1.9 2002/05/20 13:30:40 carl
  1194. * bugfix of hdisponen (base must be set, not index)
  1195. * more portability fixes
  1196. }