Procházet zdrojové kódy

* arm thumb: do not cause bxx getting too long ranges when inserting constant blocks

git-svn-id: trunk@24437 -
florian před 12 roky
rodič
revize
ccdd4437d6
1 změnil soubory, kde provedl 14 přidání a 1 odebrání
  1. 14 1
      compiler/arm/aasmcpu.pas

+ 14 - 1
compiler/arm/aasmcpu.pas

@@ -1068,16 +1068,29 @@ implementation
                     (taicpu(curtai).oper[1]^.typ=top_reg) and
                     (taicpu(curtai).oper[1]^.typ=top_reg) and
                     (taicpu(curtai).oper[1]^.reg=NR_PC)
                     (taicpu(curtai).oper[1]^.reg=NR_PC)
                    )
                    )
+              ) and
+              (
+                { do not insert data after a B instruction due to their limited range }
+                not((current_settings.cputype in cpu_thumb) and
+                    (taicpu(curtai).opcode=A_B)
+                   )
               ) then
               ) then
               begin
               begin
                 lastinspos:=-1;
                 lastinspos:=-1;
                 extradataoffset:=0;
                 extradataoffset:=0;
 
 
                 if current_settings.cputype in cpu_thumb then
                 if current_settings.cputype in cpu_thumb then
-                  limit:=508
+                  limit:=502
                 else
                 else
                   limit:=1016;
                   limit:=1016;
 
 
+                { on arm thumb, insert the date always after all labels etc. following an instruction so it
+                  is prevent that a bxx yyy; bl xxx; yyyy: sequence gets separated ( we never insert on arm thumb after
+                  bxx) and the distance of bxx gets too long }
+                if current_settings.cputype in cpu_thumb then
+                  while assigned(tai(curtai.Next)) and (tai(curtai.Next).typ in SkipInstr+[ait_label]) do
+                    curtai:=tai(curtai.next);
+
                 doinsert:=false;
                 doinsert:=false;
                 hp:=tai(curtai.next);
                 hp:=tai(curtai.next);
                 current_asmdata.getjumplabel(l);
                 current_asmdata.getjumplabel(l);