Parcourir la source

* Added virtual method tprocinfo.postprocess_code and moved target-specific processing from base class into target-specific descendant classes (ARM and AVR, other targets still to do).

git-svn-id: trunk@27449 -
sergei il y a 11 ans
Parent
commit
eeb15fc445
4 fichiers modifiés avec 28 ajouts et 13 suppressions
  1. 9 1
      compiler/arm/cpupi.pas
  2. 10 1
      compiler/avr/cpupi.pas
  3. 7 0
      compiler/procinfo.pas
  4. 2 11
      compiler/psub.pas

+ 9 - 1
compiler/arm/cpupi.pas

@@ -48,6 +48,7 @@ unit cpupi;
           procedure init_framepointer; override;
           procedure init_framepointer; override;
           procedure generate_parameter_info;override;
           procedure generate_parameter_info;override;
           procedure allocate_got_register(list : TAsmList);override;
           procedure allocate_got_register(list : TAsmList);override;
+          procedure postprocess_code;override;
        end;
        end;
 
 
 
 
@@ -60,7 +61,8 @@ unit cpupi;
        symconst,symtype,symsym,symcpu,paramgr,
        symconst,symtype,symsym,symcpu,paramgr,
        cgutils,
        cgutils,
        cgobj,
        cgobj,
-       defutil;
+       defutil,
+       aasmcpu;
 
 
     procedure tarmprocinfo.set_first_temp_offset;
     procedure tarmprocinfo.set_first_temp_offset;
       var
       var
@@ -267,6 +269,12 @@ unit cpupi;
       end;
       end;
 
 
 
 
+    procedure tarmprocinfo.postprocess_code;
+      begin
+        { because of the limited constant size of the arm, all data access is done pc relative }
+        finalizearmcode(aktproccode,aktlocaldata);
+      end;
+
 begin
 begin
    cprocinfo:=tarmprocinfo;
    cprocinfo:=tarmprocinfo;
 end.
 end.

+ 10 - 1
compiler/avr/cpupi.pas

@@ -37,6 +37,7 @@ unit cpupi;
           // procedure after_pass1;override;
           // procedure after_pass1;override;
           procedure set_first_temp_offset;override;
           procedure set_first_temp_offset;override;
           function calc_stackframe_size:longint;override;
           function calc_stackframe_size:longint;override;
+          procedure postprocess_code;override;
        end;
        end;
 
 
 
 
@@ -49,7 +50,8 @@ unit cpupi;
        tgobj,
        tgobj,
        symconst,symsym,paramgr,
        symconst,symsym,paramgr,
        cgbase,
        cgbase,
-       cgobj;
+       cgobj,
+       aasmcpu;
 
 
     procedure tavrprocinfo.set_first_temp_offset;
     procedure tavrprocinfo.set_first_temp_offset;
       begin
       begin
@@ -67,6 +69,13 @@ unit cpupi;
       end;
       end;
 
 
 
 
+    procedure tavrprocinfo.postprocess_code;
+      begin
+        { because of the limited branch distance of cond. branches, they must be replaced
+          sometimes by normal jmps and an inverse branch }
+        finalizeavrcode(aktproccode);
+      end;
+
 begin
 begin
    cprocinfo:=tavrprocinfo;
    cprocinfo:=tavrprocinfo;
 end.
 end.

+ 7 - 0
compiler/procinfo.pas

@@ -178,6 +178,8 @@ unit procinfo;
           { Update the resuired alignment for the current stack frame based
           { Update the resuired alignment for the current stack frame based
             on the current value and the new required alignment }
             on the current value and the new required alignment }
           procedure updatestackalignment(alignment: longint);
           procedure updatestackalignment(alignment: longint);
+          { Specific actions after the code has been generated }
+          procedure postprocess_code; virtual;
        end;
        end;
        tcprocinfo = class of tprocinfo;
        tcprocinfo = class of tprocinfo;
 
 
@@ -333,4 +335,9 @@ implementation
       end;
       end;
 
 
 
 
+    procedure tprocinfo.postprocess_code;
+      begin
+        { no action by default }
+      end;
+
 end.
 end.

+ 2 - 11
compiler/psub.pas

@@ -1602,17 +1602,8 @@ implementation
               end;
               end;
 {$endif NoOpt}
 {$endif NoOpt}
 
 
-
-{$ifdef ARM}
-            { because of the limited constant size of the arm, all data access is done pc relative }
-            finalizearmcode(aktproccode,aktlocaldata);
-{$endif ARM}
-
-{$ifdef AVR}
-            { because of the limited branch distance of cond. branches, they must be replaced
-              sometimes by normal jmps and an inverse branch }
-            finalizeavrcode(aktproccode);
-{$endif AVR}
+            { Perform target-specific processing if necessary }
+            postprocess_code;
 
 
             { Add end symbol and debug info }
             { Add end symbol and debug info }
             { this must be done after the pcrelativedata is appended else the distance calculation of
             { this must be done after the pcrelativedata is appended else the distance calculation of