Add dwarf cfa support

This commit is contained in:
Jinyang He 2022-11-05 09:48:02 +08:00 committed by FPK
parent 524589231f
commit cda8971baa
2 changed files with 30 additions and 0 deletions

View File

@ -173,6 +173,7 @@ interface
procedure outmost_frame(list:TAsmList);virtual;
procedure cfa_offset(list:TAsmList;reg:tregister;ofs:longint);virtual;
procedure cfa_restore(list:TAsmList;reg:tregister);virtual;
procedure cfa_def_cfa(list:TAsmList;reg:tregister;ofs:longint);virtual;
procedure cfa_def_cfa_register(list:TAsmList;reg:tregister);virtual;
procedure cfa_def_cfa_offset(list:TAsmList;ofs:longint);virtual;
function get_frame_start: TAsmLabel;virtual;
@ -315,6 +316,11 @@ implementation
end;
procedure TAsmCFI.cfa_def_cfa(list:TAsmList;reg:tregister;ofs:longint);
begin
end;
procedure TAsmCFI.cfa_def_cfa_register(list:TAsmList;reg:tregister);
begin
end;

View File

@ -100,6 +100,7 @@ interface
procedure outmost_frame(list: TAsmList);override;
procedure cfa_offset(list:TAsmList;reg:tregister;ofs:longint);override;
procedure cfa_restore(list:TAsmList;reg:tregister);override;
procedure cfa_def_cfa(list:TAsmList;reg:tregister;ofs:longint);override;
procedure cfa_def_cfa_register(list:TAsmList;reg:tregister);override;
procedure cfa_def_cfa_offset(list:TAsmList;ofs:longint);override;
end;
@ -115,6 +116,7 @@ interface
procedure outmost_frame(list: TAsmList);override;
procedure cfa_offset(list:TAsmList;reg:tregister;ofs:longint);override;
procedure cfa_restore(list:TAsmList;reg:tregister);override;
procedure cfa_def_cfa(list:TAsmList;reg:tregister;ofs:longint);override;
procedure cfa_def_cfa_register(list:TAsmList;reg:tregister);override;
procedure cfa_def_cfa_offset(list:TAsmList;ofs:longint);override;
end;
@ -641,6 +643,15 @@ implementation
end;
procedure TDwarfAsmCFILowLevel.cfa_def_cfa(list:TAsmList;reg:tregister;ofs:longint);
begin
if datatype=dt_none then
exit;
cfa_advance_loc(list);
DwarfList.concat(tdwarfitem.create_reg_const(DW_CFA_def_cfa,doe_uleb,reg,doe_uleb,ofs));
end;
procedure TDwarfAsmCFILowLevel.cfa_def_cfa_register(list:TAsmList;reg:tregister);
begin
if datatype=dt_none then
@ -739,6 +750,19 @@ implementation
end;
procedure TDwarfAsmCFIHighLevel.cfa_def_cfa(list: TAsmList; reg: tregister; ofs: longint);
begin
if not(tf_use_hlcfi in target_info.flags) then
begin
inherited;
exit;
end;
if not(af_supports_hlcfi in target_asm.flags) then
exit;
list.concat(tai_cfi_op_reg_val.create(cfi_def_cfa,reg,ofs));
end;
procedure TDwarfAsmCFIHighLevel.cfa_def_cfa_register(list: TAsmList; reg: tregister);
begin
if not(tf_use_hlcfi in target_info.flags) then