Browse Source

* the improved arm optimizer might move instructions around so the old hacky test if a label with its data has been already embedded into the code by checking if the offset is 0 does not work anymore so a new field for tai_label has been introduced for this purpose

git-svn-id: trunk@22345 -
florian 13 years ago
parent
commit
7840b4657a
2 changed files with 12 additions and 5 deletions
  1. 9 4
      compiler/aasmtai.pas
  2. 3 1
      compiler/arm/aasmcpu.pas

+ 9 - 4
compiler/aasmtai.pas

@@ -426,13 +426,13 @@ interface
           procedure derefimpl;override;
        end;
 
-	   tai_ent = class(tai)
-	      Name : string;
+       tai_ent = class(tai)
+          Name : string;
           Constructor Create (const ProcName : String);
        end;
 
        tai_ent_end = class(tai)
-	      Name : string;
+          Name : string;
           Constructor Create (const ProcName : String);
        end;
 
@@ -446,8 +446,13 @@ interface
 
        { Generates an assembler label }
        tai_label = class(tai)
-          is_global : boolean;
           labsym    : tasmlabel;
+          is_global : boolean;
+{$ifdef arm}
+          { set to true when the label has been moved by insertpcrelativedata to the correct location
+            so one label can be used multiple times }
+          moved     : boolean;
+{$endif arm}
           constructor Create(_labsym : tasmlabel);
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;

+ 3 - 1
compiler/arm/aasmcpu.pas

@@ -818,6 +818,7 @@ implementation
         penalty,
         lastinspos,
         { increased for every data element > 4 bytes inserted }
+        currentsize,
         extradataoffset,
         limit: longint;
         curop : longint;
@@ -851,8 +852,9 @@ implementation
                           curdatatai:=tai(taicpu(curtai).oper[curop]^.ref^.symboldata);
                           if assigned(curdatatai) and
                             { move only if we're at the first reference of a label }
-                            (taicpu(curtai).oper[curop]^.ref^.offset=0) then
+                            not(tai_label(curdatatai).moved) then
                             begin
+                              tai_label(curdatatai).moved:=true;
                               { check if symbol already used. }
                               { if yes, reuse the symbol }
                               hp:=tai(curdatatai.next);