Browse Source

* some improvemenst to cmov support
* disabled excpetion frame generation in cosntructors temporarily

florian 25 years ago
parent
commit
b2098c4de5
2 changed files with 64 additions and 30 deletions
  1. 17 13
      compiler/cgai386.pas
  2. 47 17
      compiler/popt386.pas

+ 17 - 13
compiler/cgai386.pas

@@ -77,7 +77,7 @@ unit cgai386;
     procedure release_qword_loc(const t : tlocation);
 
     { remove non regvar registers in loc from regs (in the format }
-    { pushusedregisters uses)                                     } 
+    { pushusedregisters uses)                                     }
     procedure remove_non_regvars_from_loc(const t: tlocation; var regs: byte);
     { releases the registers of a location }
     procedure release_loc(const t : tlocation);
@@ -616,7 +616,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
     begin
       case t.loc of
         LOC_REGISTER:
-          { can't be a regvar, since it would be LOC_CREGISTER then } 
+          { can't be a regvar, since it would be LOC_CREGISTER then }
           regs := regs and not($80 shr byte(t.register));
         LOC_MEM,LOC_REFERENCE:
           begin
@@ -3087,7 +3087,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
       { a constructor needs a help procedure }
       if (aktprocsym^.definition^.proctypeoption=potype_constructor) then
         begin
-          procinfo^.flags:=procinfo^.flags or pi_needs_implicit_finally;
+          {!!!! not yet procinfo^.flags:=procinfo^.flags or pi_needs_implicit_finally;}
           if procinfo^._class^.is_class then
             begin
               exprasmlist^.insert(new(paicpu,op_cond_sym(A_Jcc,C_Z,S_NO,faillabel)));
@@ -3489,14 +3489,14 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                           emit_reg(A_PUSH,S_L,R_ESI);
                           emit_sym(A_PUSH,S_L,newasmsymbol(procinfo._class^.vmt_mangledname);
                        end;
-                      if (po_virtualmethod in pd^.procoptions) then
-                        begin
-                           emit_ref_reg(A_MOV,S_L,ref,R_EDI)
-                           emit_ref(A_CALL,S_NO,ref);
-                        end
-                      else
-                        begin
-                        end;
+                     if (po_virtualmethod in pd^.procoptions) then
+                       begin
+                          emit_ref_reg(A_MOV,S_L,ref,R_EDI)
+                          emit_ref(A_CALL,S_NO,ref);
+                       end
+                     else
+                       begin
+                       end;
                   end
                 }
              end
@@ -3715,7 +3715,11 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 end.
 {
   $Log$
-  Revision 1.73  2000-01-23 21:29:14  florian
+  Revision 1.74  2000-01-24 12:17:22  florian
+    * some improvemenst to cmov support
+    * disabled excpetion frame generation in cosntructors temporarily
+
+  Revision 1.73  2000/01/23 21:29:14  florian
     * CMOV support in optimizer (in define USECMOV)
     + start of support of exceptions in constructors
 
@@ -3864,4 +3868,4 @@ end.
   Revision 1.37  1999/09/02 17:07:38  florian
     * problems with -Or fixed: tdef.isfpuregable was wrong!
 
-}
+}

+ 47 - 17
compiler/popt386.pas

@@ -1646,9 +1646,7 @@ Begin
                        CanBeCMOV(hp1) do
                        begin
                           inc(l);
-                          hp1:=pai(hp1^.next);
-                          while assigned(hp1) and (hp1^.typ in skipinstr) do
-                            hp1:=pai(hp1^.next);
+                          GetNextInstruction(hp1,hp1);
                        end;
                      if assigned(hp1) then
                        begin
@@ -1668,7 +1666,7 @@ Begin
                                     until not(assigned(hp1)) or
                                       not(CanBeCMOV(hp1));
                                     asml^.remove(hp1);
-                                    p:=hp1;
+                                    dispose(hp1,done);
                                     continue;
                                  end;
                             end
@@ -1682,23 +1680,51 @@ Begin
                                       <several movs>
                               yyy:
                                }
-                               {!!!!!!!!!!!1
-                               hp1:=hp1^.next;
-                               if assigned(hp3) and
-                                 (l<=3) and
-                                 (hp3^.typ=ait_instruction) and
-                                 (paicpu(hp3)^.is_jmp) and
-                                 (paicpu(hp3)^.condition=C_None) and
-                                 FindLabel(PAsmLabel(paicpu(p)^.oper[0].sym),hp1) then
+                              { hp2 points to jmp xxx }
+                              hp2:=hp1;
+                              { skip hp1 to xxx }
+                              GetNextInstruction(hp1, hp1);
+                              if assigned(hp2) and
+                                assigned(hp1) and
+                                (l<=3) and
+                                (hp2^.typ=ait_instruction) and
+                                (paicpu(hp2)^.is_jmp) and
+                                (paicpu(hp2)^.condition=C_None) and
+                                FindLabel(PAsmLabel(paicpu(p)^.oper[0].sym),hp1) then
                                  begin
-                                    while GetNextInstruction(p, hp1) And
+                                    l:=0;
+                                    while assigned(hp1) And
                                       CanBeCMOV(hp1) do
                                       begin
-                                         hp2:=hp1;
                                          inc(l);
+                                         GetNextInstruction(hp1, hp1);
                                       end;
                                  end;
-                               }
+                              {
+                              if assigned(hp1) and
+                                FindLabel(PAsmLabel(paicpu(hp2)^.oper[0].sym),hp1) then
+                                begin
+                                   condition:=inverse_cond[paicpu(p)^.condition];
+                                   GetNextInstruction(p,hp1);
+                                   asml^.remove(p);
+                                   dispose(p,done);
+                                   p:=hp1;
+                                   repeat
+                                     paicpu(hp1)^.opcode:=A_CMOVcc;
+                                     paicpu(hp1)^.condition:=condition;
+                                     GetNextInstruction(hp1,hp1);
+                                   until not(assigned(hp1)) or
+                                     not(CanBeCMOV(hp1));
+                                   hp2:=hp1^.next;
+                                   condition:=inverse_cond[condition];
+
+                                   asml^.remove(hp1^.next)
+                                   dispose(hp1^.next,done);
+                                   asml^.remove(hp1);
+                                   dispose(hp1,done);
+                                   continue;
+                                end;
+                              }
                             end;
                        end;
                   end;
@@ -1830,7 +1856,11 @@ End.
 
 {
  $Log$
- Revision 1.81  2000-01-23 21:29:17  florian
+ Revision 1.82  2000-01-24 12:17:24  florian
+   * some improvemenst to cmov support
+   * disabled excpetion frame generation in cosntructors temporarily
+
+ Revision 1.81  2000/01/23 21:29:17  florian
    * CMOV support in optimizer (in define USECMOV)
    + start of support of exceptions in constructors
 
@@ -1959,4 +1989,4 @@ End.
  Revision 1.49  1999/05/02 14:26:31  peter
    * fixed dec -> sub $1 opt which didn't set ops=2
 
-}
+}