cfidwarf.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  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. else
  185. internalerror(200404128);
  186. end;
  187. end;
  188. end;
  189. {****************************************************************************
  190. TDwarfAsmCFI
  191. ****************************************************************************}
  192. constructor TDwarfAsmCFI.create;
  193. begin
  194. inherited;
  195. if tf_use_psabieh in target_info.flags then
  196. use_eh_frame:=true;
  197. end;
  198. {****************************************************************************
  199. TDwarfAsmCFILowLevel
  200. ****************************************************************************}
  201. constructor TDwarfAsmCFILowLevel.create;
  202. begin
  203. inherited create;
  204. FFrameStartLabel:=nil;
  205. FFrameEndLabel:=nil;
  206. FLastLocLabel:=nil;
  207. code_alignment_factor:=1;
  208. data_alignment_factor:=-4;
  209. FDwarfList:=TLinkedList.Create;
  210. end;
  211. destructor TDwarfAsmCFILowLevel.destroy;
  212. begin
  213. FDwarfList.Free;
  214. end;
  215. {$ifdef i386}
  216. { if more cpu dependend stuff is implemented, this needs more refactoring }
  217. procedure TDwarfAsmCFILowLevel.generate_initial_instructions(list:TAsmList);
  218. begin
  219. list.concat(tai_const.create_8bit(DW_CFA_def_cfa));
  220. list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG)));
  221. list.concat(tai_const.create_uleb128bit(sizeof(aint)));
  222. list.concat(tai_const.create_8bit(DW_CFA_offset_extended));
  223. list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_RETURN_ADDRESS_REG)));
  224. list.concat(tai_const.create_uleb128bit((-sizeof(aint)) div data_alignment_factor));
  225. end;
  226. {$else i386}
  227. { if more cpu dependend stuff is implemented, this needs more refactoring }
  228. procedure TDwarfAsmCFILowLevel.generate_initial_instructions(list:TAsmList);
  229. begin
  230. list.concat(tai_const.create_8bit(DW_CFA_def_cfa));
  231. list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG)));
  232. list.concat(tai_const.create_uleb128bit(sizeof(aint)));
  233. list.concat(tai_const.create_8bit(DW_CFA_offset_extended));
  234. list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_RETURN_ADDRESS_REG)));
  235. list.concat(tai_const.create_uleb128bit((-sizeof(aint)) div data_alignment_factor));
  236. end;
  237. {$endif i386}
  238. procedure TDwarfAsmCFILowLevel.generate_code(list:TAsmList);
  239. var
  240. hp : tdwarfitem;
  241. CurrentLSDALabel,
  242. cielabel,
  243. lenstartlabel,
  244. lenendlabel,
  245. augendlabel,
  246. augstartlabel,
  247. fdeofslabel, curpos: tasmlabel;
  248. tc : tai_const;
  249. begin
  250. CurrentLSDALabel:=nil;
  251. if use_eh_frame then
  252. new_section(list,sec_eh_frame,'',0)
  253. else
  254. new_section(list,sec_debug_frame,'',0);
  255. { debug_frame:
  256. CIE
  257. DWORD length
  258. DWORD CIE_Id = 0xffffffff
  259. BYTE version = 1
  260. STRING augmentation = "" = BYTE 0
  261. ULEB128 code alignment factor = 1
  262. ULEB128 data alignment factor = -1
  263. BYTE return address register
  264. <...> augmentation
  265. <...> start sequence
  266. eh_frame:
  267. CIE
  268. DWORD length
  269. DWORD CIE_Id = 0
  270. BYTE version = 1
  271. STRING augmentation = 'zPLR'#0
  272. ULEB128 code alignment factor = 1
  273. ULEB128 data alignment factor = -1
  274. BYTE return address register
  275. <...> start sequence
  276. }
  277. current_asmdata.getlabel(cielabel,alt_dbgframe);
  278. list.concat(tai_label.create(cielabel));
  279. current_asmdata.getlabel(lenstartlabel,alt_dbgframe);
  280. current_asmdata.getlabel(lenendlabel,alt_dbgframe);
  281. list.concat(tai_const.create_rel_sym(aitconst_32bit,lenstartlabel,lenendlabel));
  282. list.concat(tai_label.create(lenstartlabel));
  283. if use_eh_frame then
  284. begin
  285. list.concat(tai_const.create_32bit(0));
  286. list.concat(tai_const.create_8bit(1));
  287. list.concat(tai_const.create_8bit(ord('z')));
  288. list.concat(tai_const.create_8bit(ord('P')));
  289. list.concat(tai_const.create_8bit(ord('L')));
  290. list.concat(tai_const.create_8bit(ord('R')));
  291. list.concat(tai_const.create_8bit(0));
  292. end
  293. else
  294. begin
  295. list.concat(tai_const.create_32bit(longint($ffffffff)));
  296. list.concat(tai_const.create_8bit(1));
  297. list.concat(tai_const.create_8bit(0)); { empty string }
  298. end;
  299. list.concat(tai_const.create_uleb128bit(code_alignment_factor));
  300. list.concat(tai_const.create_sleb128bit(data_alignment_factor));
  301. list.concat(tai_const.create_8bit(dwarf_reg(NR_RETURN_ADDRESS_REG)));
  302. { augmentation data }
  303. if use_eh_frame then
  304. begin
  305. current_asmdata.getlabel(augstartlabel,alt_dbgframe);
  306. current_asmdata.getlabel(augendlabel,alt_dbgframe);
  307. { size of augmentation data ('z') }
  308. list.concat(tai_const.create_rel_sym(aitconst_uleb128bit,augstartlabel,augendlabel));
  309. list.concat(tai_label.create(augstartlabel));
  310. { personality function ('P') }
  311. { encoding }
  312. list.concat(tai_const.create_8bit({DW_EH_PE_indirect or DW_EH_PE_pcrel or} DW_EH_PE_sdata4));
  313. { address of personality function }
  314. list.concat(tai_const.Createname('_FPC_psabieh_personality_v0',AT_FUNCTION,0));
  315. { LSDA encoding ('L')}
  316. list.concat(tai_const.create_8bit({DW_EH_PE_pcrel or }DW_EH_PE_sdata4));
  317. { FDE encoding ('R') }
  318. list.concat(tai_const.create_8bit({DW_EH_PE_pcrel or }DW_EH_PE_sdata4));
  319. list.concat(tai_label.create(augendlabel));
  320. end;
  321. { Generate standard code
  322. def_cfa(stackpointer,sizeof(aint))
  323. cfa_offset_extended(returnaddres,-sizeof(aint))
  324. }
  325. generate_initial_instructions(list);
  326. list.concat(cai_align.create_zeros(4));
  327. list.concat(tai_label.create(lenendlabel));
  328. lenstartlabel:=nil;
  329. lenendlabel:=nil;
  330. hp:=TDwarfItem(DwarfList.first);
  331. while assigned(hp) do
  332. begin
  333. case hp.op of
  334. DW_CFA_Start_Frame :
  335. begin
  336. if assigned(lenstartlabel) then
  337. internalerror(200404125);
  338. if (hp.ops<>1) or
  339. (hp.oper[0].typ<>dop_reloffset) then
  340. internalerror(200404126);
  341. current_asmdata.getlabel(lenstartlabel,alt_dbgframe);
  342. current_asmdata.getlabel(lenendlabel,alt_dbgframe);
  343. { FDE
  344. DWORD length
  345. DWORD CIE-pointer = cielabel relative to section start
  346. PTRSIZE initial location = oper[0]
  347. PTRSIZE function size = oper[1]
  348. }
  349. list.concat(tai_const.create_rel_sym(aitconst_32bit,lenstartlabel,lenendlabel));
  350. list.concat(tai_label.create(lenstartlabel));
  351. if use_eh_frame then
  352. begin
  353. { relative offset to the CIE }
  354. current_asmdata.getlabel(fdeofslabel,alt_dbgframe);
  355. list.concat(tai_label.create(fdeofslabel));
  356. list.concat(tai_const.create_rel_sym(aitconst_32bit,cielabel,fdeofslabel));
  357. end
  358. else
  359. begin
  360. tc:=tai_const.create_sym(cielabel);
  361. { force label offset to secrel32 for windows systems }
  362. if (target_info.system in systems_windows+systems_wince) then
  363. tc.consttype:=aitconst_secrel32_symbol;
  364. list.concat(tc);
  365. end;
  366. current_asmdata.getlabel(curpos,alt_dbgframe);
  367. list.concat(tai_label.create(curpos));
  368. list.concat(tai_const.Create_sym(hp.oper[0].beginsym));
  369. list.concat(tai_const.create_rel_sym(aitconst_ptr,hp.oper[0].beginsym,hp.oper[0].endsym));
  370. { we wrote a 'z' into the CIE augmentation data }
  371. if use_eh_frame then
  372. begin
  373. { size of augmentation }
  374. list.concat(tai_const.create_8bit(4));
  375. {$ifdef debug_eh}
  376. list.concat(tai_comment.Create(strpnew('LSDA')));
  377. {$endif debug_eh}
  378. { address of LSDA}
  379. list.concat(tai_const.Create_sym(CurrentLSDALabel));
  380. { do not reuse LSDA label }
  381. CurrentLSDALabel:=nil;
  382. end;
  383. end;
  384. DW_CFA_End_Frame :
  385. begin
  386. list.concat(cai_align.create_zeros(4));
  387. list.concat(tai_label.create(lenendlabel));
  388. lenstartlabel:=nil;
  389. lenendlabel:=nil;
  390. end;
  391. DW_Set_LSDALabel:
  392. CurrentLSDALabel:=hp.oper[0].sym as TAsmLabel;
  393. else
  394. hp.generate_code(list);
  395. end;
  396. hp:=TDwarfItem(hp.next);
  397. end;
  398. { Check for open frames }
  399. if assigned(lenstartlabel) then
  400. internalerror(2004041210);
  401. { DwarfList is processed, remove items }
  402. DwarfList.Clear;
  403. end;
  404. procedure TDwarfAsmCFILowLevel.start_frame(list:TAsmList);
  405. begin
  406. current_asmdata.getlabel(FFrameEndLabel,alt_dbgframe);
  407. FLastloclabel:=get_frame_start;
  408. list.concat(tai_label.create(get_frame_start));
  409. DwarfList.concat(tdwarfitem.create_reloffset(DW_CFA_start_frame,doe_32bit,get_frame_start,FFrameEndLabel));
  410. end;
  411. function TDwarfAsmCFILowLevel.get_frame_start : TAsmLabel;
  412. begin
  413. if not(assigned(FFrameStartLabel)) then
  414. current_asmdata.getlabel(FFrameStartLabel,alt_dbgframe);
  415. Result:=FFrameStartLabel;
  416. end;
  417. function TDwarfAsmCFILowLevel.get_cfa_list: TAsmList;
  418. begin
  419. Result:=TAsmList(DwarfList);
  420. end;
  421. procedure TDwarfAsmCFILowLevel.outmost_frame(list: TAsmList);
  422. begin
  423. cfa_advance_loc(list);
  424. DwarfList.concat(tdwarfitem.create_reg(DW_CFA_undefined,doe_uleb,NR_RETURN_ADDRESS_REG));
  425. end;
  426. procedure TDwarfAsmCFILowLevel.end_frame(list:TAsmList);
  427. begin
  428. if not assigned(FFrameStartLabel) then
  429. internalerror(2004041213);
  430. DwarfList.concat(tdwarfitem.create(DW_CFA_end_frame));
  431. list.concat(tai_label.create(FFrameEndLabel));
  432. FFrameStartLabel:=nil;
  433. FFrameEndLabel:=nil;
  434. FLastLocLabel:=nil;
  435. end;
  436. procedure TDwarfAsmCFILowLevel.cfa_advance_loc(list:TAsmList);
  437. var
  438. currloclabel : tasmlabel;
  439. begin
  440. if FLastloclabel=nil then
  441. internalerror(200404082);
  442. current_asmdata.getlabel(currloclabel,alt_dbgframe);
  443. list.concat(tai_label.create(currloclabel));
  444. DwarfList.concat(tdwarfitem.create_reloffset(DW_CFA_advance_loc4,doe_32bit,FLastloclabel,currloclabel));
  445. FLastloclabel:=currloclabel;
  446. end;
  447. procedure TDwarfAsmCFILowLevel.cfa_offset(list:TAsmList;reg:tregister;ofs:longint);
  448. begin
  449. cfa_advance_loc(list);
  450. { TODO: check if ref is a temp}
  451. { offset must be positive }
  452. DwarfList.concat(tdwarfitem.create_reg_const(DW_CFA_offset_extended,doe_uleb,reg,doe_uleb,ofs div data_alignment_factor));
  453. end;
  454. procedure TDwarfAsmCFILowLevel.cfa_restore(list:TAsmList;reg:tregister);
  455. begin
  456. cfa_advance_loc(list);
  457. DwarfList.concat(tdwarfitem.create_reg(DW_CFA_restore_extended,doe_uleb,reg));
  458. end;
  459. procedure TDwarfAsmCFILowLevel.cfa_def_cfa_register(list:TAsmList;reg:tregister);
  460. begin
  461. cfa_advance_loc(list);
  462. DwarfList.concat(tdwarfitem.create_reg(DW_CFA_def_cfa_register,doe_uleb,reg));
  463. end;
  464. procedure TDwarfAsmCFILowLevel.cfa_def_cfa_offset(list:TAsmList;ofs:longint);
  465. begin
  466. cfa_advance_loc(list);
  467. DwarfList.concat(tdwarfitem.create_const(DW_CFA_def_cfa_offset,doe_uleb,ofs));
  468. end;
  469. {****************************************************************************
  470. TDwarfAsmCFILowLevel
  471. ****************************************************************************}
  472. procedure TDwarfAsmCFIHighLevel.generate_code(list: TAsmList);
  473. begin
  474. if not(tf_use_hlcfi in target_info.flags) then
  475. begin
  476. inherited;
  477. exit;
  478. end;
  479. end;
  480. procedure TDwarfAsmCFIHighLevel.start_frame(list: TAsmList);
  481. begin
  482. if not(tf_use_hlcfi in target_info.flags) then
  483. begin
  484. inherited;
  485. exit;
  486. end;
  487. list.concat(tai_cfi_op_none.create(cfi_startproc));
  488. end;
  489. procedure TDwarfAsmCFIHighLevel.end_frame(list: TAsmList);
  490. begin
  491. if not(tf_use_hlcfi in target_info.flags) then
  492. begin
  493. inherited;
  494. exit;
  495. end;
  496. list.concat(tai_cfi_op_none.create(cfi_endproc));
  497. end;
  498. procedure TDwarfAsmCFIHighLevel.outmost_frame(list: TAsmList);
  499. begin
  500. if not(tf_use_hlcfi in target_info.flags) then
  501. begin
  502. inherited;
  503. exit;
  504. end;
  505. list.concat(tai_cfi_op_reg.create(cfi_undefined,NR_RETURN_ADDRESS_REG));
  506. end;
  507. procedure TDwarfAsmCFIHighLevel.cfa_offset(list: TAsmList; reg: tregister; ofs: longint);
  508. begin
  509. if not(tf_use_hlcfi in target_info.flags) then
  510. begin
  511. inherited;
  512. exit;
  513. end;
  514. list.concat(tai_cfi_op_reg_val.create(cfi_offset,reg,ofs));
  515. end;
  516. procedure TDwarfAsmCFIHighLevel.cfa_restore(list: TAsmList; reg: tregister);
  517. begin
  518. if not(tf_use_hlcfi in target_info.flags) then
  519. begin
  520. inherited;
  521. exit;
  522. end;
  523. list.concat(tai_cfi_op_reg.create(cfi_restore,reg));
  524. end;
  525. procedure TDwarfAsmCFIHighLevel.cfa_def_cfa_register(list: TAsmList; reg: tregister);
  526. begin
  527. if not(tf_use_hlcfi in target_info.flags) then
  528. begin
  529. inherited;
  530. exit;
  531. end;
  532. list.concat(tai_cfi_op_reg.create(cfi_def_cfa_register,reg));
  533. end;
  534. procedure TDwarfAsmCFIHighLevel.cfa_def_cfa_offset(list: TAsmList; ofs: longint);
  535. begin
  536. if not(tf_use_hlcfi in target_info.flags) then
  537. begin
  538. inherited;
  539. exit;
  540. end;
  541. list.concat(tai_cfi_op_val.create(cfi_def_cfa_offset,ofs));
  542. end;
  543. begin
  544. CAsmCFI:=TDwarfAsmCFIHighLevel;
  545. end.