aasmdata.pas 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. {
  2. Copyright (c) 1998-2006 by Florian Klaempfl
  3. This unit implements an abstract asmoutput class for all processor types
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. { @abstract(This unit implements an abstract asm output class for all processor types)
  18. This unit implements an abstract assembler output class for all processors, these
  19. are then overridden for each assembler writer to actually write the data in these
  20. classes to an assembler file.
  21. }
  22. unit aasmdata;
  23. {$i fpcdefs.inc}
  24. interface
  25. uses
  26. cutils,cclasses,
  27. globtype,systems,
  28. cgbase,
  29. symtype,
  30. aasmbase;
  31. type
  32. { Type of AsmLists. The order is important for the layout of the
  33. information in the .o file. The stabs for the types must be defined
  34. before they can be referenced and therefor they need to be written
  35. first (PFV) }
  36. TAsmListType=(
  37. al_start,
  38. al_stabs,
  39. { pure assembler routines }
  40. al_pure_assembler,
  41. al_procedures,
  42. al_globals,
  43. al_const,
  44. al_typedconsts,
  45. al_rotypedconsts,
  46. al_threadvars,
  47. al_imports,
  48. al_exports,
  49. al_resources,
  50. al_rtti,
  51. { all symbols with indirect suffix }
  52. al_indirectglobals,
  53. al_dwarf_frame,
  54. al_dwarf_info,
  55. al_dwarf_abbrev,
  56. al_dwarf_line,
  57. al_dwarf_aranges,
  58. al_dwarf_ranges,
  59. al_picdata,
  60. al_indirectpicdata,
  61. al_resourcestrings,
  62. { Objective-C related sections }
  63. al_objc_data,
  64. { keep pool data separate, so we can generate new pool entries
  65. while emitting other data }
  66. al_objc_pools,
  67. al_end
  68. );
  69. { Type of constant 'pools'. Mostly for string types, but usable for
  70. floating point and large set constants, too. }
  71. TConstPoolType = (
  72. sp_invalid,
  73. sp_conststr,
  74. sp_shortstr,
  75. sp_longstr,
  76. sp_ansistr,
  77. sp_widestr,
  78. sp_unicodestr,
  79. sp_objcclassnamerefs,
  80. sp_varnamerefs,
  81. sp_objcclassnames,
  82. sp_objcvarnames,
  83. sp_objcvartypes,
  84. sp_objcprotocolrefs,
  85. sp_varsets,
  86. sp_floats,
  87. sp_guids,
  88. sp_paraloc
  89. );
  90. const
  91. AsmListTypeStr : array[TAsmListType] of string[24] =(
  92. 'al_begin',
  93. 'al_stabs',
  94. 'al_pure_assembler',
  95. 'al_procedures',
  96. 'al_globals',
  97. 'al_const',
  98. 'al_typedconsts',
  99. 'al_rotypedconsts',
  100. 'al_threadvars',
  101. 'al_imports',
  102. 'al_exports',
  103. 'al_resources',
  104. 'al_rtti',
  105. 'al_indirectglobals',
  106. 'al_dwarf_frame',
  107. 'al_dwarf_info',
  108. 'al_dwarf_abbrev',
  109. 'al_dwarf_line',
  110. 'al_dwarf_aranges',
  111. 'al_dwarf_ranges',
  112. 'al_picdata',
  113. 'al_indirectpicdata',
  114. 'al_resourcestrings',
  115. 'al_objc_data',
  116. 'al_objc_pools',
  117. 'al_end'
  118. );
  119. type
  120. TAsmList = class(tlinkedlist)
  121. section_count : longint;
  122. constructor create;
  123. function getlasttaifilepos : pfileposinfo;
  124. { inserts another List at the begin and make this List empty }
  125. procedure insertList(p : TLinkedList); override;
  126. { inserts another List before the provided item and make this List empty }
  127. procedure insertListBefore(Item:TLinkedListItem;p : TLinkedList); override;
  128. { inserts another List after the provided item and make this List empty }
  129. procedure insertListAfter(Item:TLinkedListItem;p : TLinkedList); override;
  130. { concats another List at the end and make this List empty }
  131. procedure concatList(p : TLinkedList); override;
  132. { concats another List at the start and makes a copy
  133. the list is ordered in reverse.
  134. }
  135. procedure insertListcopy(p : TLinkedList); override;
  136. { concats another List at the end and makes a copy }
  137. procedure concatListcopy(p : TLinkedList); override;
  138. { removes all items from the list, the items are not freed }
  139. procedure RemoveAll; override;
  140. end;
  141. TAsmCFI=class
  142. public
  143. constructor create;virtual;
  144. destructor destroy;override;
  145. procedure generate_code(list:TAsmList);virtual;
  146. procedure start_frame(list:TAsmList);virtual;
  147. procedure end_frame(list:TAsmList);virtual;
  148. procedure cfa_offset(list:TAsmList;reg:tregister;ofs:longint);virtual;
  149. procedure cfa_restore(list:TAsmList;reg:tregister);virtual;
  150. procedure cfa_def_cfa_register(list:TAsmList;reg:tregister);virtual;
  151. procedure cfa_def_cfa_offset(list:TAsmList;ofs:longint);virtual;
  152. end;
  153. TAsmCFIClass=class of TAsmCFI;
  154. { TAsmData }
  155. TAsmData = class
  156. private
  157. { Symbols }
  158. FAsmSymbolDict : TFPHashObjectList;
  159. FAltSymbolList : TFPObjectList;
  160. FNextAltNr : longint;
  161. FNextLabelNr : array[TAsmLabeltype] of longint;
  162. { Call Frame Information for stack unwinding}
  163. FAsmCFI : TAsmCFI;
  164. FConstPools : array[TConstPoolType] of THashSet;
  165. function GetConstPools(APoolType: TConstPoolType): THashSet;
  166. protected
  167. function DefineAsmSymbolByClassBase(symclass: TAsmSymbolClass; const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype; def: tdef; out wasdefined: boolean) : TAsmSymbol;
  168. public
  169. name : pshortstring; { owned by tmodule }
  170. NextVTEntryNr : longint;
  171. { Assembler lists }
  172. AsmLists : array[TAsmListType] of TAsmList;
  173. CurrAsmList : TAsmList;
  174. WideInits : TLinkedList;
  175. ResStrInits : TLinkedList;
  176. constructor create(n: pshortstring);
  177. destructor destroy;override;
  178. { asmsymbol }
  179. function DefineAsmSymbolByClass(symclass: TAsmSymbolClass; const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype; def: tdef) : TAsmSymbol; virtual;
  180. function DefineAsmSymbol(const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype; def: tdef) : TAsmSymbol;
  181. function WeakRefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype) : TAsmSymbol;
  182. function RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype;indirect:boolean=false) : TAsmSymbol;
  183. function GetAsmSymbol(const s : TSymStr) : TAsmSymbol;
  184. { create new assembler label }
  185. procedure getlabel(out l : TAsmLabel;alt:TAsmLabeltype);
  186. procedure getjumplabel(out l : TAsmLabel);
  187. procedure getglobaljumplabel(out l : TAsmLabel);
  188. procedure getaddrlabel(out l : TAsmLabel);
  189. { visible from outside current object }
  190. procedure getglobaldatalabel(out l : TAsmLabel);
  191. { visible only inside current object, but doesn't start with
  192. target_asm.label_prefix (treated the Darwin linker as the start of a
  193. dead-strippable data block) }
  194. procedure getstaticdatalabel(out l : TAsmLabel);
  195. { visible only inside the current object and does start with
  196. target_asm.label_prefix (not treated by the Darwin linker as the start
  197. of a dead-strippable data block, and references to such labels are
  198. also ignored to determine whether a data block should be live) }
  199. procedure getlocaldatalabel(out l : TAsmLabel);
  200. { generate an alternative (duplicate) symbol }
  201. procedure GenerateAltSymbol(p:TAsmSymbol);
  202. procedure ResetAltSymbols;
  203. property AsmSymbolDict:TFPHashObjectList read FAsmSymbolDict;
  204. property AsmCFI:TAsmCFI read FAsmCFI;
  205. { hash tables for reusing constant storage }
  206. property ConstPools[APoolType:TConstPoolType]: THashSet read GetConstPools;
  207. end;
  208. TAsmDataClass = class of TAsmData;
  209. TTCInitItem = class(TLinkedListItem)
  210. sym: tsym;
  211. offset: aint;
  212. datalabel: TAsmSymbol;
  213. datadef: TDef;
  214. constructor Create(asym: tsym; aoffset: aint; alabel: TAsmSymbol; alabeldef: tdef);
  215. end;
  216. var
  217. casmdata: TAsmDataClass;
  218. var
  219. CAsmCFI : TAsmCFIClass;
  220. current_asmdata : TAsmData;
  221. implementation
  222. uses
  223. verbose,
  224. symconst,
  225. aasmtai;
  226. {$ifdef MEMDEBUG}
  227. var
  228. memasmsymbols,
  229. memasmcfi,
  230. memasmlists : TMemDebug;
  231. {$endif MEMDEBUG}
  232. {*****************************************************************************
  233. TAsmCFI
  234. *****************************************************************************}
  235. constructor TAsmCFI.create;
  236. begin
  237. end;
  238. destructor TAsmCFI.destroy;
  239. begin
  240. end;
  241. procedure TAsmCFI.generate_code(list:TAsmList);
  242. begin
  243. end;
  244. procedure TAsmCFI.start_frame(list:TAsmList);
  245. begin
  246. end;
  247. procedure TAsmCFI.end_frame(list:TAsmList);
  248. begin
  249. end;
  250. procedure TAsmCFI.cfa_offset(list:TAsmList;reg:tregister;ofs:longint);
  251. begin
  252. end;
  253. procedure TAsmCFI.cfa_restore(list:TAsmList;reg:tregister);
  254. begin
  255. end;
  256. procedure TAsmCFI.cfa_def_cfa_register(list:TAsmList;reg:tregister);
  257. begin
  258. end;
  259. procedure TAsmCFI.cfa_def_cfa_offset(list:TAsmList;ofs:longint);
  260. begin
  261. end;
  262. {*****************************************************************************
  263. TTCInitItem
  264. *****************************************************************************}
  265. constructor TTCInitItem.Create(asym: tsym; aoffset: aint; alabel: TAsmSymbol; alabeldef: tdef);
  266. begin
  267. inherited Create;
  268. sym:=asym;
  269. offset:=aoffset;
  270. datalabel:=alabel;
  271. datadef:=alabeldef;
  272. end;
  273. {*****************************************************************************
  274. TAsmList
  275. *****************************************************************************}
  276. constructor TAsmList.create;
  277. begin
  278. inherited create;
  279. end;
  280. function TAsmList.getlasttaifilepos : pfileposinfo;
  281. var
  282. hp : tlinkedlistitem;
  283. begin
  284. getlasttaifilepos := nil;
  285. if assigned(last) then
  286. begin
  287. { find the last file information record }
  288. if not (tai(last).typ in SkipLineInfo) then
  289. getlasttaifilepos:=@tailineinfo(last).fileinfo
  290. else
  291. { go through list backwards to find the first entry
  292. with line information
  293. }
  294. begin
  295. hp:=tai(last);
  296. while assigned(hp) and (tai(hp).typ in SkipLineInfo) do
  297. hp:=hp.Previous;
  298. { found entry }
  299. if assigned(hp) then
  300. getlasttaifilepos:=@tailineinfo(hp).fileinfo
  301. end;
  302. end;
  303. end;
  304. procedure TAsmList.insertList(p : TLinkedList);
  305. begin
  306. inherited insertList(p);
  307. inc(section_count,TAsmList(p).section_count);
  308. TAsmList(p).section_count:=0;
  309. end;
  310. procedure TAsmList.insertListBefore(Item : TLinkedListItem; p : TLinkedList);
  311. begin
  312. inherited insertListBefore(Item,p);
  313. inc(section_count,TAsmList(p).section_count);
  314. TAsmList(p).section_count:=0;
  315. end;
  316. procedure TAsmList.insertListAfter(Item : TLinkedListItem; p : TLinkedList);
  317. begin
  318. inherited insertListAfter(Item,p);
  319. inc(section_count,TAsmList(p).section_count);
  320. TAsmList(p).section_count:=0;
  321. end;
  322. procedure TAsmList.concatList(p : TLinkedList);
  323. begin
  324. inherited concatList(p);
  325. inc(section_count,TAsmList(p).section_count);
  326. TAsmList(p).section_count:=0;
  327. end;
  328. procedure TAsmList.insertListcopy(p : TLinkedList);
  329. begin
  330. inherited insertListcopy(p);
  331. inc(section_count,TAsmList(p).section_count);
  332. end;
  333. procedure TAsmList.concatListcopy(p : TLinkedList);
  334. begin
  335. inherited concatListcopy(p);
  336. inc(section_count,TAsmList(p).section_count);
  337. end;
  338. procedure TAsmList.RemoveAll;
  339. begin
  340. inherited RemoveAll;
  341. section_count:=0;
  342. end;
  343. {****************************************************************************
  344. TAsmData
  345. ****************************************************************************}
  346. function TAsmData.GetConstPools(APoolType: TConstPoolType): THashSet;
  347. begin
  348. if FConstPools[APoolType] = nil then
  349. case APoolType of
  350. sp_ansistr: FConstPools[APoolType] := TTagHashSet.Create(64, True, False);
  351. else
  352. FConstPools[APoolType] := THashSet.Create(64, True, False);
  353. end;
  354. Result := FConstPools[APoolType];
  355. end;
  356. function TAsmData.DefineAsmSymbolByClassBase(symclass: TAsmSymbolClass; const s: TSymStr; _bind: TAsmSymBind; _typ: Tasmsymtype; def: tdef; out wasdefined: boolean): TAsmSymbol;
  357. var
  358. hp : TAsmSymbol;
  359. namestr : TSymStr;
  360. begin
  361. { this difference is only necessary to determine whether we always need
  362. indirect references or not }
  363. if _typ in [AT_DATA_FORCEINDIRECT,AT_DATA_NOINDIRECT] then
  364. _typ:=AT_DATA;
  365. namestr:=s;
  366. if _bind in asmsymbindindirect then
  367. namestr:=namestr+suffix_indirect;
  368. hp:=TAsmSymbol(FAsmSymbolDict.Find(namestr));
  369. if assigned(hp) then
  370. begin
  371. { Redefine is allowed, but the types must be the same. The redefine
  372. is needed for Darwin where the labels are first allocated }
  373. wasdefined:=not(hp.bind in [AB_EXTERNAL,AB_WEAK_EXTERNAL]);
  374. if wasdefined then
  375. begin
  376. if (hp.bind<>_bind) and
  377. (hp.typ<>_typ) then
  378. internalerror(200603261);
  379. end;
  380. hp.typ:=_typ;
  381. { Changing bind from AB_GLOBAL to AB_LOCAL is wrong
  382. if bind is already AB_GLOBAL or AB_EXTERNAL,
  383. GOT might have been used, so change might be harmful. }
  384. if (_bind<>hp.bind) and (hp.getrefs>0) then
  385. begin
  386. {$ifdef extdebug}
  387. { the changes that matter must become internalerrors, the rest
  388. should be ignored; a used cannot change anything about this,
  389. so printing a warning/hint is not useful }
  390. if (_bind=AB_LOCAL) then
  391. Message3(asmw_w_changing_bind_type,namestr,asmsymbindname[hp.bind],asmsymbindname[_bind])
  392. else
  393. Message3(asmw_h_changing_bind_type,namestr,asmsymbindname[hp.bind],asmsymbindname[_bind]);
  394. {$endif extdebug}
  395. end;
  396. hp.bind:=_bind;
  397. end
  398. else
  399. begin
  400. wasdefined:=false;
  401. { Not found, insert it. }
  402. hp:=symclass.create(AsmSymbolDict,namestr,_bind,_typ);
  403. end;
  404. result:=hp;
  405. end;
  406. constructor TAsmData.create(n:pshortstring);
  407. var
  408. alt : TAsmLabelType;
  409. hal : TAsmListType;
  410. begin
  411. inherited create;
  412. name:=n;
  413. { symbols }
  414. FAsmSymbolDict:=TFPHashObjectList.create(true);
  415. FAltSymbolList:=TFPObjectList.Create(false);
  416. { labels }
  417. FNextAltNr:=1;
  418. for alt:=low(TAsmLabelType) to high(TAsmLabelType) do
  419. FNextLabelNr[alt]:=1;
  420. { AsmLists }
  421. CurrAsmList:=TAsmList.create;
  422. for hal:=low(TAsmListType) to high(TAsmListType) do
  423. AsmLists[hal]:=TAsmList.create;
  424. WideInits :=TAsmList.create;
  425. ResStrInits:=TAsmList.create;
  426. { CFI }
  427. FAsmCFI:=CAsmCFI.Create;
  428. end;
  429. destructor TAsmData.destroy;
  430. var
  431. hal : TAsmListType;
  432. hp : TConstPoolType;
  433. begin
  434. { Symbols }
  435. {$ifdef MEMDEBUG}
  436. memasmsymbols.start;
  437. {$endif}
  438. FAltSymbolList.free;
  439. FAsmSymbolDict.free;
  440. {$ifdef MEMDEBUG}
  441. memasmsymbols.stop;
  442. {$endif}
  443. { CFI }
  444. {$ifdef MEMDEBUG}
  445. memasmcfi.start;
  446. {$endif}
  447. FAsmCFI.free;
  448. {$ifdef MEMDEBUG}
  449. memasmcfi.stop;
  450. {$endif}
  451. { Lists }
  452. {$ifdef MEMDEBUG}
  453. memasmlists.start;
  454. {$endif}
  455. ResStrInits.free;
  456. WideInits.free;
  457. for hal:=low(TAsmListType) to high(TAsmListType) do
  458. AsmLists[hal].free;
  459. CurrAsmList.free;
  460. {$ifdef MEMDEBUG}
  461. memasmlists.stop;
  462. {$endif}
  463. for hp := low(TConstPoolType) to high(TConstPoolType) do
  464. FConstPools[hp].Free;
  465. end;
  466. function TAsmData.DefineAsmSymbolByClass(symclass: TAsmSymbolClass; const s: TSymStr; _bind: TAsmSymBind; _typ: Tasmsymtype; def: tdef): TAsmSymbol;
  467. var
  468. wasdefined: boolean;
  469. begin
  470. result:=DefineAsmSymbolByClassBase(symclass,s,_bind,_typ,def,wasdefined);
  471. end;
  472. function TAsmData.DefineAsmSymbol(const s: TSymStr; _bind: TAsmSymBind; _typ: Tasmsymtype; def: tdef): TAsmSymbol;
  473. begin
  474. result:=DefineAsmSymbolByClass(TAsmSymbol,s,_bind,_typ,def);
  475. end;
  476. function TAsmData.RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype;indirect:boolean) : TAsmSymbol;
  477. var
  478. namestr : TSymStr;
  479. bind : tasmsymbind;
  480. begin
  481. namestr:=s;
  482. if indirect then
  483. begin
  484. namestr:=namestr+suffix_indirect;
  485. bind:=AB_EXTERNAL_INDIRECT;
  486. end
  487. else
  488. begin
  489. bind:=AB_EXTERNAL;
  490. end;
  491. result:=TAsmSymbol(FAsmSymbolDict.Find(namestr));
  492. if not assigned(result) then
  493. result:=TAsmSymbol.create(AsmSymbolDict,namestr,bind,_typ)
  494. { one normal reference removes the "weak" character of a symbol }
  495. else if (result.bind=AB_WEAK_EXTERNAL) then
  496. result.bind:=bind;
  497. end;
  498. function TAsmData.WeakRefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype) : TAsmSymbol;
  499. begin
  500. result:=TAsmSymbol(FAsmSymbolDict.Find(s));
  501. if not assigned(result) then
  502. result:=TAsmSymbol.create(AsmSymbolDict,s,AB_WEAK_EXTERNAL,_typ);
  503. end;
  504. function TAsmData.GetAsmSymbol(const s : TSymStr) : TAsmSymbol;
  505. begin
  506. result:=TAsmSymbol(FAsmSymbolDict.Find(s));
  507. end;
  508. procedure TAsmData.GenerateAltSymbol(p:TAsmSymbol);
  509. begin
  510. if not assigned(p.altsymbol) then
  511. begin
  512. p.altsymbol:=p.getaltcopy(AsmSymbolDict,FNextAltNr);
  513. FAltSymbolList.Add(p);
  514. end;
  515. end;
  516. procedure TAsmData.ResetAltSymbols;
  517. var
  518. i : longint;
  519. begin
  520. for i:=0 to FAltSymbolList.Count-1 do
  521. TAsmSymbol(FAltSymbolList[i]).altsymbol:=nil;
  522. FAltSymbolList.Clear;
  523. end;
  524. procedure TAsmData.getlabel(out l : TAsmLabel;alt:TAsmLabeltype);
  525. begin
  526. if (target_info.system in (systems_linux + systems_bsd + systems_android)) and
  527. { the next condition was
  528. (cs_create_smart in current_settings.moduleswitches) and
  529. but if we create_smartlink_sections, this is useless }
  530. (create_smartlink_library) and
  531. (alt = alt_dbgline) then
  532. l:=TAsmLabel.createglobal(AsmSymbolDict,name^,FNextLabelNr[alt],alt)
  533. else
  534. l:=TAsmLabel.createlocal(AsmSymbolDict,FNextLabelNr[alt],alt);
  535. inc(FNextLabelNr[alt]);
  536. end;
  537. procedure TAsmData.getjumplabel(out l : TAsmLabel);
  538. begin
  539. l:=TAsmLabel.createlocal(AsmSymbolDict,FNextLabelNr[alt_jump],alt_jump);
  540. inc(FNextLabelNr[alt_jump]);
  541. end;
  542. procedure TAsmData.getglobaljumplabel(out l : TAsmLabel);
  543. begin
  544. l:=TAsmLabel.createglobal(AsmSymbolDict,name^,FNextLabelNr[alt_jump],alt_jump);
  545. inc(FNextLabelNr[alt_jump]);
  546. end;
  547. procedure TAsmData.getglobaldatalabel(out l : TAsmLabel);
  548. begin
  549. l:=TAsmLabel.createglobal(AsmSymbolDict,name^,FNextLabelNr[alt_data],alt_data);
  550. inc(FNextLabelNr[alt_data]);
  551. end;
  552. procedure TAsmData.getstaticdatalabel(out l : TAsmLabel);
  553. begin
  554. l:=TAsmLabel.createstatic(AsmSymbolDict,FNextLabelNr[alt_data],alt_data);
  555. inc(FNextLabelNr[alt_data]);
  556. end;
  557. procedure TAsmData.getlocaldatalabel(out l: TAsmLabel);
  558. begin
  559. l:=TAsmLabel.createlocal(AsmSymbolDict,FNextLabelNr[alt_data],alt_data);
  560. inc(FNextLabelNr[alt_data]);
  561. end;
  562. procedure TAsmData.getaddrlabel(out l : TAsmLabel);
  563. begin
  564. l:=TAsmLabel.createlocal(AsmSymbolDict,FNextLabelNr[alt_addr],alt_addr);
  565. inc(FNextLabelNr[alt_addr]);
  566. end;
  567. initialization
  568. {$ifdef MEMDEBUG}
  569. memasmsymbols:=TMemDebug.create('AsmSymbols');
  570. memasmsymbols.stop;
  571. memasmcfi:=TMemDebug.create('AsmCFI');
  572. memasmcfi.stop;
  573. memasmlists:=TMemDebug.create('AsmLists');
  574. memasmlists.stop;
  575. {$endif MEMDEBUG}
  576. CAsmCFI:=TAsmCFI;
  577. finalization
  578. {$ifdef MEMDEBUG}
  579. memasmsymbols.free;
  580. memasmcfi.free;
  581. memasmlists.free;
  582. {$endif MEMDEBUG}
  583. end.