ncgld.pas 54 KB

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