cfidwarf.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. {
  2. Copyright (c) 2003-2004 by Peter Vreman and Florian Klaempfl
  3. This units contains special support for DWARF debug info
  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. unit cfidwarf;
  18. {$i fpcdefs.inc}
  19. { $define debug_eh}
  20. interface
  21. uses
  22. cclasses,
  23. globtype,
  24. cgbase,cpubase,
  25. aasmbase,aasmcfi,aasmtai,aasmdata;
  26. const
  27. maxdwarfops = 2;
  28. type
  29. tdwarfoperenc=(doe_uleb,doe_sleb,doe_ptr,doe_32bit,doe_16bit,doe_8bit);
  30. tdwarfopertype=(dop_reg,dop_const,dop_sym,dop_reloffset);
  31. tdwarfoper=record
  32. enc : tdwarfoperenc;
  33. case typ:tdwarfopertype of
  34. dop_reg : (register:tregister);
  35. dop_const : (value:int64);
  36. dop_sym : (sym:tasmsymbol);
  37. dop_reloffset : (beginsym,endsym:tasmsymbol);
  38. end;
  39. tdwarfitem=class(TLinkedListItem)
  40. op : byte;
  41. ops : byte;
  42. oper : array[0..maxdwarfops-1] of tdwarfoper;
  43. constructor create(aop:byte);
  44. constructor create_reg(aop:byte;enc1:tdwarfoperenc;reg:tregister);
  45. constructor create_const(aop:byte;enc1:tdwarfoperenc;val:int64);
  46. constructor create_sym(aop: byte; enc1: tdwarfoperenc; sym: TAsmSymbol);
  47. constructor create_reloffset(aop:byte;enc1:tdwarfoperenc;beginlab,endlab:tasmsymbol);
  48. constructor create_reg_const(aop:byte;enc1:tdwarfoperenc;reg:tregister;enc2:tdwarfoperenc;val:longint);
  49. procedure generate_code(list:TAsmList);
  50. end;
  51. TDwarfAsmCFI=class(TAsmCFI)
  52. use_eh_frame : boolean;
  53. constructor create;override;
  54. end;
  55. TDwarfAsmCFILowLevel=class(TDwarfAsmCFI)
  56. private
  57. FDwarfList : TLinkedList;
  58. FFrameStartLabel,
  59. FFrameEndLabel,
  60. FLastloclabel : tasmlabel;
  61. procedure cfa_advance_loc(list:TAsmList);
  62. procedure generate_initial_instructions(list:TAsmList);virtual;
  63. protected
  64. code_alignment_factor,
  65. data_alignment_factor : shortint;
  66. property DwarfList:TlinkedList read FDwarfList;
  67. public
  68. constructor create;override;
  69. destructor destroy;override;
  70. procedure generate_code(list:TAsmList);override;
  71. function get_frame_start: TAsmLabel;override;
  72. function get_cfa_list : TAsmList;override;
  73. { operations }
  74. procedure start_frame(list:TAsmList);override;
  75. procedure end_frame(list:TAsmList);override;
  76. procedure outmost_frame(list: TAsmList);override;
  77. procedure cfa_offset(list:TAsmList;reg:tregister;ofs:longint);override;
  78. procedure cfa_restore(list:TAsmList;reg:tregister);override;
  79. procedure cfa_def_cfa_register(list:TAsmList;reg:tregister);override;
  80. procedure cfa_def_cfa_offset(list:TAsmList;ofs:longint);override;
  81. end;
  82. TDwarfAsmCFIHighLevel=class(TDwarfAsmCFILowLevel)
  83. public
  84. procedure generate_code(list:TAsmList);override;
  85. { operations }
  86. procedure start_frame(list:TAsmList);override;
  87. procedure end_frame(list:TAsmList);override;
  88. procedure outmost_frame(list: TAsmList);override;
  89. procedure cfa_offset(list:TAsmList;reg:tregister;ofs:longint);override;
  90. procedure cfa_restore(list:TAsmList;reg:tregister);override;
  91. procedure cfa_def_cfa_register(list:TAsmList;reg:tregister);override;
  92. procedure cfa_def_cfa_offset(list:TAsmList;ofs:longint);override;
  93. end;
  94. implementation
  95. uses
  96. systems,
  97. cutils,
  98. verbose,
  99. dwarfbase;
  100. {****************************************************************************
  101. TDWARFITEM
  102. ****************************************************************************}
  103. constructor tdwarfitem.create(aop:byte);
  104. begin
  105. inherited create;
  106. op:=aop;
  107. ops:=0;
  108. end;
  109. constructor tdwarfitem.create_reg(aop:byte;enc1:tdwarfoperenc;reg:tregister);
  110. begin
  111. inherited create;
  112. op:=aop;
  113. ops:=1;
  114. oper[0].typ:=dop_reg;
  115. oper[0].enc:=enc1;
  116. oper[0].register:=reg;
  117. end;
  118. constructor tdwarfitem.create_const(aop:byte;enc1:tdwarfoperenc;val:int64);
  119. begin
  120. inherited create;
  121. op:=aop;
  122. ops:=1;
  123. oper[0].typ:=dop_const;
  124. oper[0].enc:=enc1;
  125. oper[0].value:=val;
  126. end;
  127. constructor tdwarfitem.create_sym(aop:byte;enc1:tdwarfoperenc;sym:TAsmSymbol);
  128. begin
  129. inherited create;
  130. op:=aop;
  131. ops:=1;
  132. oper[0].typ:=dop_sym;
  133. oper[0].enc:=enc1;
  134. oper[0].sym:=sym;
  135. end;
  136. constructor tdwarfitem.create_reloffset(aop:byte;enc1:tdwarfoperenc;beginlab,endlab:tasmsymbol);
  137. begin
  138. inherited create;
  139. op:=aop;
  140. ops:=1;
  141. { relative offsets are passed }
  142. oper[0].typ:=dop_reloffset;
  143. oper[0].enc:=enc1;
  144. oper[0].beginsym:=beginlab;
  145. oper[0].endsym:=endlab;
  146. end;
  147. constructor tdwarfitem.create_reg_const(aop:byte;enc1:tdwarfoperenc;reg:tregister;enc2:tdwarfoperenc;val:longint);
  148. begin
  149. inherited create;
  150. op:=aop;
  151. ops:=2;
  152. oper[0].typ:=dop_reg;
  153. oper[0].enc:=enc1;
  154. oper[0].register:=reg;
  155. oper[1].typ:=dop_const;
  156. oper[1].enc:=enc2;
  157. oper[1].value:=val;
  158. end;
  159. procedure tdwarfitem.generate_code(list:TAsmList);
  160. const
  161. enc2ait_const : array[tdwarfoperenc] of taiconst_type = (
  162. aitconst_uleb128bit,aitconst_sleb128bit,aitconst_ptr,
  163. aitconst_32bit,aitconst_16bit,aitconst_8bit
  164. );
  165. var
  166. i : integer;
  167. begin
  168. list.concat(tai_const.create_8bit(op));
  169. for i:=0 to ops-1 do
  170. begin
  171. case oper[i].typ of
  172. dop_const :
  173. list.concat(tai_const.create(enc2ait_const[oper[i].enc],oper[i].value));
  174. dop_sym :
  175. begin
  176. if oper[i].enc<>doe_ptr then
  177. internalerror(200404127);
  178. list.concat(tai_const.create_sym(oper[i].sym));
  179. end;
  180. dop_reloffset :
  181. list.concat(tai_const.create_rel_sym(enc2ait_const[oper[i].enc],oper[i].beginsym,oper[i].endsym));
  182. dop_reg :
  183. list.concat(tai_const.create(enc2ait_const[oper[i].enc],dwarf_reg(oper[i].register)));
  184. end;
  185. end;
  186. end;
  187. {****************************************************************************
  188. TDwarfAsmCFI
  189. ****************************************************************************}
  190. constructor TDwarfAsmCFI.create;
  191. begin
  192. inherited;
  193. if tf_use_psabieh in target_info.flags then
  194. use_eh_frame:=true;
  195. end;
  196. {****************************************************************************
  197. TDwarfAsmCFILowLevel
  198. ****************************************************************************}
  199. constructor TDwarfAsmCFILowLevel.create;
  200. begin
  201. inherited create;
  202. FFrameStartLabel:=nil;
  203. FFrameEndLabel:=nil;
  204. FLastLocLabel:=nil;
  205. code_alignment_factor:=1;
  206. data_alignment_factor:=-4;
  207. FDwarfList:=TAsmList.Create;
  208. end;
  209. destructor TDwarfAsmCFILowLevel.destroy;
  210. begin
  211. FDwarfList.Free;
  212. end;
  213. {$ifdef i386}
  214. { if more cpu dependend stuff is implemented, this needs more refactoring }
  215. procedure TDwarfAsmCFILowLevel.generate_initial_instructions(list:TAsmList);
  216. begin
  217. list.concat(tai_const.create_8bit(DW_CFA_def_cfa));
  218. list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG)));
  219. list.concat(tai_const.create_uleb128bit(sizeof(aint)));
  220. list.concat(tai_const.create_8bit(DW_CFA_offset_extended));
  221. list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_RETURN_ADDRESS_REG)));
  222. list.concat(tai_const.create_uleb128bit((-sizeof(aint)) div data_alignment_factor));
  223. end;
  224. {$else i386}
  225. { if more cpu dependend stuff is implemented, this needs more refactoring }
  226. procedure TDwarfAsmCFILowLevel.generate_initial_instructions(list:TAsmList);
  227. begin
  228. list.concat(tai_const.create_8bit(DW_CFA_def_cfa));
  229. list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG)));
  230. list.concat(tai_const.create_uleb128bit(sizeof(aint)));
  231. list.concat(tai_const.create_8bit(DW_CFA_offset_extended));
  232. list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_RETURN_ADDRESS_REG)));
  233. list.concat(tai_const.create_uleb128bit((-sizeof(aint)) div data_alignment_factor));
  234. end;
  235. {$endif i386}
  236. procedure TDwarfAsmCFILowLevel.generate_code(list:TAsmList);
  237. var
  238. hp : tdwarfitem;
  239. CurrentLSDALabel,
  240. cielabel,
  241. lenstartlabel,
  242. lenendlabel,
  243. augendlabel,
  244. augstartlabel,
  245. fdeofslabel, curpos: tasmlabel;
  246. tc : tai_const;
  247. begin
  248. CurrentLSDALabel:=nil;
  249. if use_eh_frame then
  250. new_section(list,sec_eh_frame,'',0)
  251. else
  252. new_section(list,sec_debug_frame,'',0);
  253. { debug_frame:
  254. CIE
  255. DWORD length
  256. DWORD CIE_Id = 0xffffffff
  257. BYTE version = 1
  258. STRING augmentation = "" = BYTE 0
  259. ULEB128 code alignment factor = 1
  260. ULEB128 data alignment factor = -1
  261. BYTE return address register
  262. <...> augmentation
  263. <...> start sequence
  264. eh_frame:
  265. CIE
  266. DWORD length
  267. DWORD CIE_Id = 0
  268. BYTE version = 1
  269. STRING augmentation = 'zPLR'#0
  270. ULEB128 code alignment factor = 1
  271. ULEB128 data alignment factor = -1
  272. BYTE return address register
  273. <...> start sequence
  274. }
  275. current_asmdata.getlabel(cielabel,alt_dbgframe);
  276. list.concat(tai_label.create(cielabel));
  277. current_asmdata.getlabel(lenstartlabel,alt_dbgframe);
  278. current_asmdata.getlabel(lenendlabel,alt_dbgframe);
  279. list.concat(tai_const.create_rel_sym(aitconst_32bit,lenstartlabel,lenendlabel));
  280. list.concat(tai_label.create(lenstartlabel));
  281. if use_eh_frame then
  282. begin
  283. list.concat(tai_const.create_32bit(0));
  284. list.concat(tai_const.create_8bit(1));
  285. list.concat(tai_const.create_8bit(ord('z')));
  286. list.concat(tai_const.create_8bit(ord('P')));
  287. list.concat(tai_const.create_8bit(ord('L')));
  288. list.concat(tai_const.create_8bit(ord('R')));
  289. list.concat(tai_const.create_8bit(0));
  290. end
  291. else
  292. begin
  293. list.concat(tai_const.create_32bit(longint($ffffffff)));
  294. list.concat(tai_const.create_8bit(1));
  295. list.concat(tai_const.create_8bit(0)); { empty string }
  296. end;
  297. list.concat(tai_const.create_uleb128bit(code_alignment_factor));
  298. list.concat(tai_const.create_sleb128bit(data_alignment_factor));
  299. list.concat(tai_const.create_8bit(dwarf_reg(NR_RETURN_ADDRESS_REG)));
  300. { augmentation data }
  301. if use_eh_frame then
  302. begin
  303. current_asmdata.getlabel(augstartlabel,alt_dbgframe);
  304. current_asmdata.getlabel(augendlabel,alt_dbgframe);
  305. { size of augmentation data ('z') }
  306. list.concat(tai_const.create_rel_sym(aitconst_uleb128bit,augstartlabel,augendlabel));
  307. list.concat(tai_label.create(augstartlabel));
  308. { personality function ('P') }
  309. { encoding }
  310. list.concat(tai_const.create_8bit({DW_EH_PE_indirect or DW_EH_PE_pcrel or} DW_EH_PE_sdata4));
  311. { address of personality function }
  312. list.concat(tai_const.Createname('_FPC_psabieh_personality_v0',AT_FUNCTION,0));
  313. { LSDA encoding ('L')}
  314. list.concat(tai_const.create_8bit({DW_EH_PE_pcrel or }DW_EH_PE_sdata4));
  315. { FDE encoding ('R') }
  316. list.concat(tai_const.create_8bit({DW_EH_PE_pcrel or }DW_EH_PE_sdata4));
  317. list.concat(tai_label.create(augendlabel));
  318. end;
  319. { Generate standard code
  320. def_cfa(stackpointer,sizeof(aint))
  321. cfa_offset_extended(returnaddres,-sizeof(aint))
  322. }
  323. generate_initial_instructions(list);
  324. list.concat(cai_align.create_zeros(4));
  325. list.concat(tai_label.create(lenendlabel));
  326. lenstartlabel:=nil;
  327. lenendlabel:=nil;
  328. hp:=TDwarfItem(DwarfList.first);
  329. while assigned(hp) do
  330. begin
  331. case hp.op of
  332. DW_CFA_Start_Frame :
  333. begin
  334. if assigned(lenstartlabel) then
  335. internalerror(200404125);
  336. if (hp.ops<>1) or
  337. (hp.oper[0].typ<>dop_reloffset) then
  338. internalerror(200404126);
  339. current_asmdata.getlabel(lenstartlabel,alt_dbgframe);
  340. current_asmdata.getlabel(lenendlabel,alt_dbgframe);
  341. { FDE
  342. DWORD length
  343. DWORD CIE-pointer = cielabel relative to section start
  344. PTRSIZE initial location = oper[0]
  345. PTRSIZE function size = oper[1]
  346. }
  347. list.concat(tai_const.create_rel_sym(aitconst_32bit,lenstartlabel,lenendlabel));
  348. list.concat(tai_label.create(lenstartlabel));
  349. if use_eh_frame then
  350. begin
  351. { relative offset to the CIE }
  352. current_asmdata.getlabel(fdeofslabel,alt_dbgframe);
  353. list.concat(tai_label.create(fdeofslabel));
  354. list.concat(tai_const.create_rel_sym(aitconst_32bit,cielabel,fdeofslabel));
  355. end
  356. else
  357. begin
  358. tc:=tai_const.create_sym(cielabel);
  359. { force label offset to secrel32 for windows systems }
  360. if (target_info.system in systems_windows+systems_wince) then
  361. tc.consttype:=aitconst_secrel32_symbol;
  362. list.concat(tc);
  363. end;
  364. current_asmdata.getlabel(curpos,alt_dbgframe);
  365. list.concat(tai_label.create(curpos));
  366. list.concat(tai_const.Create_sym(hp.oper[0].beginsym));
  367. list.concat(tai_const.create_rel_sym(aitconst_ptr,hp.oper[0].beginsym,hp.oper[0].endsym));
  368. { we wrote a 'z' into the CIE augmentation data }
  369. if use_eh_frame then
  370. begin
  371. { size of augmentation }
  372. list.concat(tai_const.create_8bit(sizeof(pint)));
  373. {$ifdef debug_eh}
  374. list.concat(tai_comment.Create(strpnew('LSDA')));
  375. {$endif debug_eh}
  376. { address of LSDA}
  377. list.concat(tai_const.Create_sym(CurrentLSDALabel));
  378. { do not reuse LSDA label }
  379. CurrentLSDALabel:=nil;
  380. end;
  381. end;
  382. DW_CFA_End_Frame :
  383. begin
  384. list.concat(cai_align.create_zeros(4));
  385. list.concat(tai_label.create(lenendlabel));
  386. lenstartlabel:=nil;
  387. lenendlabel:=nil;
  388. end;
  389. DW_Set_LSDALabel:
  390. CurrentLSDALabel:=hp.oper[0].sym as TAsmLabel;
  391. else
  392. hp.generate_code(list);
  393. end;
  394. hp:=TDwarfItem(hp.next);
  395. end;
  396. { Check for open frames }
  397. if assigned(lenstartlabel) then
  398. internalerror(2004041210);
  399. { DwarfList is processed, remove items }
  400. DwarfList.Clear;
  401. end;
  402. procedure TDwarfAsmCFILowLevel.start_frame(list:TAsmList);
  403. begin
  404. current_asmdata.getlabel(FFrameEndLabel,alt_dbgframe);
  405. FLastloclabel:=get_frame_start;
  406. list.concat(tai_label.create(get_frame_start));
  407. DwarfList.concat(tdwarfitem.create_reloffset(DW_CFA_start_frame,doe_32bit,get_frame_start,FFrameEndLabel));
  408. end;
  409. function TDwarfAsmCFILowLevel.get_frame_start : TAsmLabel;
  410. begin
  411. if not(assigned(FFrameStartLabel)) then
  412. current_asmdata.getlabel(FFrameStartLabel,alt_dbgframe);
  413. Result:=FFrameStartLabel;
  414. end;
  415. function TDwarfAsmCFILowLevel.get_cfa_list: TAsmList;
  416. begin
  417. Result:=TAsmList(DwarfList);
  418. end;
  419. procedure TDwarfAsmCFILowLevel.outmost_frame(list: TAsmList);
  420. begin
  421. cfa_advance_loc(list);
  422. DwarfList.concat(tdwarfitem.create_reg(DW_CFA_undefined,doe_uleb,NR_RETURN_ADDRESS_REG));
  423. end;
  424. procedure TDwarfAsmCFILowLevel.end_frame(list:TAsmList);
  425. begin
  426. if not assigned(FFrameStartLabel) then
  427. internalerror(2004041213);
  428. DwarfList.concat(tdwarfitem.create(DW_CFA_end_frame));
  429. list.concat(tai_label.create(FFrameEndLabel));
  430. FFrameStartLabel:=nil;
  431. FFrameEndLabel:=nil;
  432. FLastLocLabel:=nil;
  433. end;
  434. procedure TDwarfAsmCFILowLevel.cfa_advance_loc(list:TAsmList);
  435. var
  436. currloclabel : tasmlabel;
  437. begin
  438. if FLastloclabel=nil then
  439. internalerror(200404082);
  440. current_asmdata.getlabel(currloclabel,alt_dbgframe);
  441. list.concat(tai_label.create(currloclabel));
  442. DwarfList.concat(tdwarfitem.create_reloffset(DW_CFA_advance_loc4,doe_32bit,FLastloclabel,currloclabel));
  443. FLastloclabel:=currloclabel;
  444. end;
  445. procedure TDwarfAsmCFILowLevel.cfa_offset(list:TAsmList;reg:tregister;ofs:longint);
  446. begin
  447. cfa_advance_loc(list);
  448. { TODO: check if ref is a temp}
  449. { offset must be positive }
  450. DwarfList.concat(tdwarfitem.create_reg_const(DW_CFA_offset_extended,doe_uleb,reg,doe_uleb,ofs div data_alignment_factor));
  451. end;
  452. procedure TDwarfAsmCFILowLevel.cfa_restore(list:TAsmList;reg:tregister);
  453. begin
  454. cfa_advance_loc(list);
  455. DwarfList.concat(tdwarfitem.create_reg(DW_CFA_restore_extended,doe_uleb,reg));
  456. end;
  457. procedure TDwarfAsmCFILowLevel.cfa_def_cfa_register(list:TAsmList;reg:tregister);
  458. begin
  459. cfa_advance_loc(list);
  460. DwarfList.concat(tdwarfitem.create_reg(DW_CFA_def_cfa_register,doe_uleb,reg));
  461. end;
  462. procedure TDwarfAsmCFILowLevel.cfa_def_cfa_offset(list:TAsmList;ofs:longint);
  463. begin
  464. cfa_advance_loc(list);
  465. DwarfList.concat(tdwarfitem.create_const(DW_CFA_def_cfa_offset,doe_uleb,ofs));
  466. end;
  467. {****************************************************************************
  468. TDwarfAsmCFILowLevel
  469. ****************************************************************************}
  470. procedure TDwarfAsmCFIHighLevel.generate_code(list: TAsmList);
  471. begin
  472. if not(tf_use_hlcfi in target_info.flags) then
  473. begin
  474. inherited;
  475. exit;
  476. end;
  477. end;
  478. procedure TDwarfAsmCFIHighLevel.start_frame(list: TAsmList);
  479. begin
  480. if not(tf_use_hlcfi in target_info.flags) then
  481. begin
  482. inherited;
  483. exit;
  484. end;
  485. list.concat(tai_cfi_op_none.create(cfi_startproc));
  486. end;
  487. procedure TDwarfAsmCFIHighLevel.end_frame(list: TAsmList);
  488. begin
  489. if not(tf_use_hlcfi in target_info.flags) then
  490. begin
  491. inherited;
  492. exit;
  493. end;
  494. list.concat(tai_cfi_op_none.create(cfi_endproc));
  495. end;
  496. procedure TDwarfAsmCFIHighLevel.outmost_frame(list: TAsmList);
  497. begin
  498. if not(tf_use_hlcfi in target_info.flags) then
  499. begin
  500. inherited;
  501. exit;
  502. end;
  503. list.concat(tai_cfi_op_reg.create(cfi_undefined,NR_RETURN_ADDRESS_REG));
  504. end;
  505. procedure TDwarfAsmCFIHighLevel.cfa_offset(list: TAsmList; reg: tregister; ofs: longint);
  506. begin
  507. if not(tf_use_hlcfi in target_info.flags) then
  508. begin
  509. inherited;
  510. exit;
  511. end;
  512. list.concat(tai_cfi_op_reg_val.create(cfi_offset,reg,ofs));
  513. end;
  514. procedure TDwarfAsmCFIHighLevel.cfa_restore(list: TAsmList; reg: tregister);
  515. begin
  516. if not(tf_use_hlcfi in target_info.flags) then
  517. begin
  518. inherited;
  519. exit;
  520. end;
  521. list.concat(tai_cfi_op_reg.create(cfi_restore,reg));
  522. end;
  523. procedure TDwarfAsmCFIHighLevel.cfa_def_cfa_register(list: TAsmList; reg: tregister);
  524. begin
  525. if not(tf_use_hlcfi in target_info.flags) then
  526. begin
  527. inherited;
  528. exit;
  529. end;
  530. list.concat(tai_cfi_op_reg.create(cfi_def_cfa_register,reg));
  531. end;
  532. procedure TDwarfAsmCFIHighLevel.cfa_def_cfa_offset(list: TAsmList; ofs: longint);
  533. begin
  534. if not(tf_use_hlcfi in target_info.flags) then
  535. begin
  536. inherited;
  537. exit;
  538. end;
  539. list.concat(tai_cfi_op_val.create(cfi_def_cfa_offset,ofs));
  540. end;
  541. begin
  542. CAsmCFI:=TDwarfAsmCFIHighLevel;
  543. end.