2
0
Эх сурвалжийг харах

* ag386bin finally make cycles correct
* prefixes are now also normal opcodes

peter 26 жил өмнө
parent
commit
03bdf07fe0

+ 28 - 3
compiler/ag386int.pas

@@ -553,8 +553,29 @@ ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^.opcode]
                        prefix:= '';
 {$ifdef AG386BIN}
                      { added prefix instructions, must be on same line as opcode }
-                       for i:=1to pai386(hp)^.nprefixes do
-                        prefix:=int_prefix2str[pai386(hp)^.prefixes[i-1]]+#9;
+                       if (pai386(hp)^.ops = 0) and
+                          ((pai386(hp)^.opcode = A_REP) or
+                           (pai386(hp)^.opcode = A_LOCK) or
+                           (pai386(hp)^.opcode =  A_REPE) or
+                           (pai386(hp)^.opcode =  A_REPNZ) or
+                           (pai386(hp)^.opcode =  A_REPZ) or
+                           (pai386(hp)^.opcode = A_REPNE)) then
+                        Begin
+                          prefix:=int_op2str[pai386(hp)^.opcode]+#9;
+                          hp:=Pai(hp^.next);
+                        { this is theorically impossible... }
+                          if hp=nil then
+                           begin
+                             s:=#9#9+prefix;
+                             AsmWriteLn(s);
+                             break;
+                           end;
+                          { nasm prefers prefix on a line alone }
+                          AsmWriteln(#9#9+prefix);
+                          prefix:='';
+                        end
+                       else
+                        prefix:= '';
                        if pai386(hp)^.ops<>0 then
                         begin
                           if pai386(hp)^.opcode=A_CALL then
@@ -765,7 +786,11 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.27  1999-02-26 00:48:13  peter
+  Revision 1.28  1999-03-01 15:46:16  peter
+    * ag386bin finally make cycles correct
+    * prefixes are now also normal opcodes
+
+  Revision 1.27  1999/02/26 00:48:13  peter
     * assembler writers fixed for ag386bin
 
   Revision 1.26  1999/02/25 21:02:18  peter

+ 7 - 4
compiler/ag386nsm.pas

@@ -550,8 +550,6 @@ ait_labeled_instruction :
                        suffix:='';
                        prefix:='';
 {$ifdef AG386BIN}
-                       for i:=1to pai386(hp)^.nprefixes do
-                        AsmWriteln(int_prefix2str[pai386(hp)^.prefixes[i-1]]);
                        if pai386(hp)^.ops<>0 then
                         begin
                           if pai386(hp)^.opcode=A_CALL then
@@ -596,7 +594,8 @@ ait_labeled_instruction :
                        if pai386(hp)^.opcode=A_FWAIT then
                         AsmWriteln(#9#9'DB'#9'09bh')
                        else
-                        AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^.opcode]+cond2str[pai386_labeled(hp)^.condition]+suffix+s);
+                        AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^.opcode]+
+                          cond2str[pai386_labeled(hp)^.condition]+suffix+s);
 {$else}
                      { added prefix instructions, must be on same line as opcode }
                        if (pai386(hp)^.op1t = top_none) and
@@ -749,7 +748,11 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.20  1999-02-26 00:48:14  peter
+  Revision 1.21  1999-03-01 15:46:17  peter
+    * ag386bin finally make cycles correct
+    * prefixes are now also normal opcodes
+
+  Revision 1.20  1999/02/26 00:48:14  peter
     * assembler writers fixed for ag386bin
 
   Revision 1.19  1999/02/25 21:02:19  peter

+ 10 - 2
compiler/cg386cnv.pas

@@ -1268,6 +1268,11 @@ implementation
                 exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,
                   newreference(pfrom^.location.reference),hregister)));
               end;
+            LOC_FLAGS :
+              begin
+                hregister:=getregister32;
+                emit_flag2reg(pfrom^.location.resflags,hregister);
+              end;
             LOC_REGISTER,LOC_CREGISTER :
               begin
                 hregister:=pfrom^.location.register;
@@ -1277,7 +1282,6 @@ implementation
           end;
          exprasmlist^.concat(new(pai386,op_reg_reg(A_OR,S_L,hregister,hregister)));
          hregister:=reg32toreg8(hregister);
-         emit_flag2reg(pfrom^.location.resflags,hregister);
          case pto^.resulttype^.size of
           1 : pto^.location.register:=hregister;
           2 : begin
@@ -1620,7 +1624,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.58  1999-02-25 21:02:23  peter
+  Revision 1.59  1999-03-01 15:46:18  peter
+    * ag386bin finally make cycles correct
+    * prefixes are now also normal opcodes
+
+  Revision 1.58  1999/02/25 21:02:23  peter
     * ag386bin updates
     + coff writer