Parcourir la source

* get rid of current_asmdata.AsmCFI as TDwarfAsmCFI casts

git-svn-id: branches/debug_eh@41574 -
florian il y a 6 ans
Parent
commit
c03e4ca4e7
3 fichiers modifiés avec 34 ajouts et 14 suppressions
  1. 14 0
      compiler/aasmdata.pas
  2. 8 4
      compiler/cfidwarf.pas
  3. 12 10
      compiler/psabiehpi.pas

+ 14 - 0
compiler/aasmdata.pas

@@ -165,6 +165,8 @@ interface
         procedure cfa_restore(list:TAsmList;reg:tregister);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;
+        function get_cfa_list : TAsmList;virtual;
       end;
       TAsmCFIClass=class of TAsmCFI;
 
@@ -310,6 +312,18 @@ implementation
       begin
       end;
 
+
+    function TAsmCFI.get_frame_start: TAsmLabel;
+      begin
+        Result:=nil;
+      end;
+
+
+    function TAsmCFI.get_cfa_list: TAsmList;
+      begin
+        Result:=nil;
+      end;
+
 {*****************************************************************************
                                  TTCInitItem
 *****************************************************************************}

+ 8 - 4
compiler/cfidwarf.pas

@@ -75,13 +75,13 @@ interface
         data_alignment_factor : shortint;
         property DwarfList:TlinkedList read FDwarfList;
       public
-        LSDALabel : TAsmLabel;
         use_eh_frame : boolean;
         constructor create;override;
         destructor destroy;override;
         procedure generate_code(list:TAsmList);override;
 
-        function get_frame_start: TAsmLabel;
+        function get_frame_start: TAsmLabel;override;
+        function get_cfa_list : TAsmList;override;
 
         { operations }
         procedure start_frame(list:TAsmList);override;
@@ -436,8 +436,6 @@ implementation
         current_asmdata.getlabel(FFrameEndLabel,alt_dbgframe);
         FLastloclabel:=get_frame_start;
         list.concat(tai_label.create(get_frame_start));
-        if assigned(LSDALabel) then
-          DwarfList.concat(tdwarfitem.create_sym(DW_Set_LSDALabel,doe_32bit,LSDALabel));
         DwarfList.concat(tdwarfitem.create_reloffset(DW_CFA_start_frame,doe_32bit,get_frame_start,FFrameEndLabel));
       end;
 
@@ -450,6 +448,12 @@ implementation
       end;
 
 
+    function TDwarfAsmCFI.get_cfa_list: TAsmList;
+      begin
+       Result:=TAsmList(DwarfList);
+      end;
+
+
     procedure TDwarfAsmCFI.outmost_frame(list: TAsmList);
       begin
         cfa_advance_loc(list);

+ 12 - 10
compiler/psabiehpi.pas

@@ -67,6 +67,8 @@ unit psabiehpi;
          { This is a "no action" action for re-use, normally equal to OutmostLandingPad }
          NoAction: TPSABIEHAction;
 
+         { label to language specific data }
+         LSDALabel : TAsmLabel;
          callsite_table_data,
          action_table_data,
          gcc_except_table_data : TAsmList;
@@ -307,13 +309,13 @@ implementation
             else
               callsite_table_data.concat(tai_comment.Create(strpnew('Call site '+tostr(CurrentCallSiteNumber)+', no action')));
 {$endif debug_eh}
-            callsite_table_data.concat(tai_const.create_rel_sym(aitconst_uleb128bit,TDwarfAsmCFI(current_asmdata.AsmCFI).get_frame_start,callsitelaststart));
+            callsite_table_data.concat(tai_const.create_rel_sym(aitconst_uleb128bit,current_asmdata.AsmCFI.get_frame_start,callsitelaststart));
             current_asmdata.getlabel(callsiteend,alt_eh_end);
             list.concat(tai_label.create(callsiteend));
             callsite_table_data.concat(tai_const.create_rel_sym(aitconst_uleb128bit,callsitelaststart,callsiteend));
             { landing pad? }
             if assigned(CurrentLandingPad.landingpad) then
-              callsite_table_data.concat(tai_const.create_rel_sym(aitconst_uleb128bit,TDwarfAsmCFI(current_asmdata.AsmCFI).get_frame_start,CurrentLandingPad.landingpad))
+              callsite_table_data.concat(tai_const.create_rel_sym(aitconst_uleb128bit,current_asmdata.AsmCFI.get_frame_start,CurrentLandingPad.landingpad))
             else
               callsite_table_data.concat(tai_const.Create_uleb128bit(0));
             { action number set? if yes, concat }
@@ -364,7 +366,9 @@ implementation
       begin
         inherited set_eh_info;
         if (tf_use_psabieh in target_info.flags) and not(pi_has_except_table_data in flags) then
-          (current_asmdata.AsmCFI as TDwarfAsmCFI).LSDALabel:=nil;
+          LSDALabel:=nil
+        else
+          current_asmdata.AsmCFI.get_cfa_list.concat(tdwarfitem.create_sym(DW_Set_LSDALabel,doe_32bit,LSDALabel));
       end;
 
 
@@ -400,12 +404,10 @@ implementation
             gcc_except_table:=new_section(gcc_except_table_data,sec_gcc_except_table,'',0);
             gcc_except_table.secflags:=SF_A;
             gcc_except_table.secprogbits:=SPB_PROGBITS;
-            if not(current_asmdata.AsmCFI is TDwarfAsmCFI) then
-              internalerror(2019021003);
 {$ifdef debug_eh}
             gcc_except_table_data.concat(tai_comment.Create(strpnew('gcc_except_table for '+procdef.fullprocname(true))));
  {$endif debug_eh}
-            current_asmdata.getlabel(TDwarfAsmCFI(current_asmdata.AsmCFI).LSDALabel,alt_data);
+            current_asmdata.getlabel(LSDALabel,alt_data);
 
             current_asmdata.getlabel(callsitetablestart,alt_data);
             current_asmdata.getlabel(callsitetableend,alt_data);
@@ -435,7 +437,7 @@ implementation
           begin
             if pi_has_except_table_data in flags then
               begin
-                gcc_except_table_data.concat(tai_label.create(TDwarfAsmCFI(current_asmdata.AsmCFI).LSDALabel));
+                gcc_except_table_data.concat(tai_label.create(LSDALabel));
                 { landing pad base is relative to procedure start, so write an omit }
                 gcc_except_table_data.concat(tai_const.create_8bit(DW_EH_PE_omit));
 
@@ -500,9 +502,9 @@ implementation
 
     procedure tpsabiehprocinfo.start_eh(list: TAsmList);
       begin
-       inherited start_eh(list);
-       if CreateExceptionTable then
-         list.insert(tai_label.create(entrycallsitestart));
+        inherited start_eh(list);
+        if CreateExceptionTable then
+          list.insert(tai_label.create(entrycallsitestart));
       end;