Browse Source

* fixed bug in call/jmp optimization with -Op1 and -Op2

Jonas Maebe 24 years ago
parent
commit
b503c3e3b8
1 changed files with 11 additions and 3 deletions
  1. 11 3
      compiler/i386/popt386.pas

+ 11 - 3
compiler/i386/popt386.pas

@@ -1926,10 +1926,15 @@ Begin
                    (hp1.typ = ait_instruction) And
                    (hp1.typ = ait_instruction) And
                    (Taicpu(hp1).opcode = A_JMP) Then
                    (Taicpu(hp1).opcode = A_JMP) Then
                   Begin
                   Begin
-                    Inc(Taicpu(hp1).oper[0].sym^.refs);
-                    hp2 := Taicpu.Op_sym(A_PUSH,S_L,Taicpu(hp1).oper[0].sym);
+                    case Taicpu(hp1).oper[0].typ of
+                      top_symbol:
+                        hp2 := Taicpu.Op_sym(A_PUSH,S_L,Taicpu(hp1).oper[0].sym);
+                      top_ref:
+                        hp2 := Taicpu.Op_ref(A_PUSH,S_L,newreference(Taicpu(hp1).oper[0].ref^));
+                    end;
                     InsertLLItem(AsmL, p.previous, p, hp2);
                     InsertLLItem(AsmL, p.previous, p, hp2);
                     Taicpu(p).opcode := A_JMP;
                     Taicpu(p).opcode := A_JMP;
+                    Taicpu(p).is_jmp := true;
                     asml.Remove(hp1);
                     asml.Remove(hp1);
                     hp1.free;
                     hp1.free;
                   End;
                   End;
@@ -2000,7 +2005,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2000-12-25 00:07:33  peter
+  Revision 1.7  2001-01-07 15:49:49  jonas
+    * fixed bug in call/jmp optimization with -Op1 and -Op2
+
+  Revision 1.6  2000/12/25 00:07:33  peter
     + new tlinkedlist class (merge of old tstringqueue,tcontainer and
     + new tlinkedlist class (merge of old tstringqueue,tcontainer and
       tlinkedlist objects)
       tlinkedlist objects)