Browse Source

Merged revisions 1078-1080 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@1130 -

peter 20 years ago
parent
commit
19a812e5b7
3 changed files with 27 additions and 4 deletions
  1. 15 3
      compiler/aoptobj.pas
  2. 11 0
      compiler/ncgbas.pas
  3. 1 1
      compiler/powerpc/cgcpu.pas

+ 15 - 3
compiler/aoptobj.pas

@@ -918,7 +918,10 @@ Unit AoptObj;
                (taicpu(p1).is_jmp) then
               if { the next instruction after the label where the jump hp arrives}
                  { is unconditional or of the same type as hp, so continue       }
-                 ((taicpu(p1).opcode = aopt_uncondjmp) or
+                 (((taicpu(p1).opcode = aopt_uncondjmp) and
+                   (taicpu(p1).oper[0]^.typ = top_ref) and
+                   (assigned(taicpu(p1).oper[0]^.ref^.symbol)) and
+                   (taicpu(p1).oper[0]^.ref^.symbol is TAsmLabel)) or
                   conditions_equal(taicpu(p1).condition,hp.condition)) or
                  { the next instruction after the label where the jump hp arrives}
                  { is the opposite of hp (so this one is never taken), but after }
@@ -929,7 +932,10 @@ Unit AoptObj;
                   SkipLabels(p1,p2) and
                   (p2.typ = ait_instruction) and
                   (taicpu(p2).is_jmp) and
-                  ((taicpu(p2).opcode = aopt_uncondjmp) or
+                  (((taicpu(p2).opcode = aopt_uncondjmp) and
+                    (taicpu(p2).oper[0]^.typ = top_ref) and
+                    (assigned(taicpu(p2).oper[0]^.ref^.symbol)) and
+                    (taicpu(p2).oper[0]^.ref^.symbol is TAsmLabel)) or
                    (conditions_equal(taicpu(p2).condition,hp.condition))) and
                   SkipLabels(p1,p1)) then
                 begin
@@ -1000,7 +1006,10 @@ Unit AoptObj;
                       { the following if-block removes all code between a jmp and the next label,
                         because it can never be executed
                       }
-                      if (taicpu(p).opcode = aopt_uncondjmp) then
+                      if (taicpu(p).opcode = aopt_uncondjmp) and
+                         (taicpu(p).oper[0]^.typ = top_ref) and
+                         (assigned(taicpu(p).oper[0]^.ref^.symbol)) and
+                         (taicpu(p).oper[0]^.ref^.symbol is TAsmLabel) then
                         begin
                           while GetNextInstruction(p, hp1) and
                                 (hp1.typ <> ait_label) do
@@ -1030,6 +1039,9 @@ Unit AoptObj;
                                 SkipLabels(hp1,hp1);
                               if (tai(hp1).typ=ait_instruction) and
                                   (taicpu(hp1).opcode=aopt_uncondjmp) and
+                                  (taicpu(hp1).oper[0]^.typ = top_ref) and
+                                  (assigned(taicpu(hp1).oper[0]^.ref^.symbol)) and
+                                  (taicpu(hp1).oper[0]^.ref^.symbol is TAsmLabel) and
                                   GetNextInstruction(hp1, hp2) and
                                   FindLabel(tasmlabel(taicpu(p).oper[0]^.ref^.symbol), hp2) then
                                 begin

+ 11 - 0
compiler/ncgbas.pas

@@ -486,6 +486,17 @@ interface
               if release_to_normal then
                 tempinfo^.location.loc := LOC_REGISTER;
             end;
+          LOC_CFPUREGISTER,
+          LOC_FPUREGISTER:
+            begin
+              { make sure the register allocator doesn't reuse the }
+              { register e.g. in the middle of a loop              }
+              cg.a_reg_sync(exprasmlist,tempinfo^.location.register);
+              if release_to_normal then
+                tempinfo^.location.loc := LOC_FPUREGISTER;
+            end;
+          else
+            internalerror(200507161);
         end;
       end;
 

+ 1 - 1
compiler/powerpc/cgcpu.pas

@@ -2291,7 +2291,7 @@ const
         p: taicpu;
 
       begin
-        p := taicpu.op_sym(op,objectlibrary.newasmsymbol(l.name,AB_EXTERNAL,AT_FUNCTION));
+        p := taicpu.op_sym(op,l);
         if op <> A_B then
           create_cond_norm(c,crval,p.condition);
         p.is_jmp := true;