Browse Source

* updates for ag386bin

peter 26 years ago
parent
commit
bf9b5e3a54

+ 5 - 2
compiler/ag386int.pas

@@ -445,7 +445,7 @@ unit ag386int;
                        AsmWritePChar(pai_direct(hp)^.str);
                        AsmLn;
                      end;
-ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai_labeled(hp)^._operator]+#9+lab2str(pai_labeled(hp)^.lab));
+ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operator]+#9+lab2str(pai386_labeled(hp)^.lab));
         ait_symbol : begin
                        if pai_symbol(hp)^.is_global then
                          AsmWriteLn(#9'PUBLIC'#9+StrPas(pai_symbol(hp)^.name));
@@ -624,7 +624,10 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.24  1998-12-20 16:21:22  peter
+  Revision 1.25  1999-02-22 02:14:59  peter
+    * updates for ag386bin
+
+  Revision 1.24  1998/12/20 16:21:22  peter
     * smartlinking doesn't crash anymore
 
   Revision 1.23  1998/12/16 00:27:17  peter

+ 7 - 4
compiler/ag386nsm.pas

@@ -434,13 +434,13 @@ unit ag386nsm;
                      end;
 ait_labeled_instruction :
                      begin
-                       op:=pai_labeled(hp)^._operator;
+                       op:=pai386_labeled(hp)^._operator;
                        if not((op=A_JMP) or (op=A_LOOP) or (op=A_LOOPZ) or
                               (op=A_LOOPE) or (op=A_LOOPNZ) or (op=A_LOOPNE) or
                               (op=A_JCXZ) or (op=A_JECXZ)) then
-                        AsmWriteLn(#9#9+int_op2str[pai_labeled(hp)^._operator]+#9+'near '+lab2str(pai_labeled(hp)^.lab))
+                        AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operator]+#9+'near '+lab2str(pai386_labeled(hp)^.lab))
                        else
-                        AsmWriteLn(#9#9+int_op2str[pai_labeled(hp)^._operator]+#9+lab2str(pai_labeled(hp)^.lab));
+                        AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operator]+#9+lab2str(pai386_labeled(hp)^.lab));
                      end;
         ait_symbol : begin
                        if pai_symbol(hp)^.is_global then
@@ -607,7 +607,10 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.17  1998-12-20 16:21:23  peter
+  Revision 1.18  1999-02-22 02:15:00  peter
+    * updates for ag386bin
+
+  Revision 1.17  1998/12/20 16:21:23  peter
     * smartlinking doesn't crash anymore
 
   Revision 1.16  1998/12/16 00:27:18  peter

+ 9 - 2
compiler/assemble.pas

@@ -85,6 +85,9 @@ uses
 {$endif}
   ,strings
 {$ifdef i386}
+  {$ifdef Ag386Bin}
+    ,ag386bin
+  {$endif}
   {$ifndef NoAg386Att}
     ,ag386att
   {$endif NoAg386Att}
@@ -474,7 +477,7 @@ var
   a : PAsmList;
 {$ifdef i386}
   {$ifdef Ag386Bin}
-    b : Pi386binasmlist
+    b : Pi386binasmlist;
   {$endif}
 {$endif}
 begin
@@ -495,6 +498,7 @@ begin
          end;
          b^.WriteBin;
          dispose(b,done);
+         exit;
        end;
   {$endif Ag386Bin}
   {$ifndef NoAg386Att}
@@ -558,7 +562,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.35  1999-02-17 10:16:26  peter
+  Revision 1.36  1999-02-22 02:15:01  peter
+    * updates for ag386bin
+
+  Revision 1.35  1999/02/17 10:16:26  peter
     * small fixes for the binary writer
 
   Revision 1.34  1999/01/10 15:37:52  peter

+ 27 - 19
compiler/cg386add.pas

@@ -37,7 +37,12 @@ implementation
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      i386,cgai386,tgeni386;
+{$ifdef ag386bin}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
+      cgai386,tgeni386;
 
 {*****************************************************************************
                                 Helpers
@@ -593,7 +598,7 @@ implementation
                                   getlabel(truelabel);
                                   secondpass(p^.left);
                                   maketojumpbool(p^.left);
-                                  emitl(A_LABEL,truelabel);
+                                  emitlab(truelabel);
                                   truelabel:=otl;
                                end;
                         orn : begin
@@ -601,7 +606,7 @@ implementation
                                  getlabel(falselabel);
                                  secondpass(p^.left);
                                  maketojumpbool(p^.left);
-                                 emitl(A_LABEL,falselabel);
+                                 emitlab(falselabel);
                                  falselabel:=ofl;
                               end;
                        else
@@ -1091,11 +1096,11 @@ implementation
                        begin
                          getlabel(hl4);
                          if unsigned then
-                          emitl(A_JNB,hl4)
+                          emitjmp(C_NB,hl4)
                          else
-                          emitl(A_JNO,hl4);
+                          emitjmp(C_NO,hl4);
                          emitcall('FPC_OVERFLOW',true);
-                         emitl(A_LABEL,hl4);
+                         emitlab(hl4);
                        end;
                     end;
                 end
@@ -1362,13 +1367,13 @@ implementation
                                     begin
                                        emit_reg_reg(A_CMP,S_L,p^.right^.location.registerhigh,
                                           p^.location.registerhigh);
-                                       emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
+                                       emitjmp(flag_2_cond[getresflags(p,unsigned)],truelabel);
 
                                        emit_reg_reg(A_CMP,S_L,p^.right^.location.registerlow,
                                           p^.location.registerlow);
-                                       emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
+                                       emitjmp(flag_2_cond[getresflags(p,unsigned)],truelabel);
 
-                                       emitl(A_JMP,falselabel);
+                                       emitjmp(C_None,falselabel);
                                     end
                                   else
                                     begin
@@ -1376,13 +1381,13 @@ implementation
                                        inc(hr^.offset,4);
                                        exprasmlist^.concat(new(pai386,op_ref_reg(A_CMP,S_L,
                                          hr,p^.location.registerhigh)));
-                                       emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
+                                       emitjmp(flag_2_cond[getresflags(p,unsigned)],truelabel);
 
                                        exprasmlist^.concat(new(pai386,op_ref_reg(A_CMP,S_L,newreference(
                                          p^.right^.location.reference),p^.location.registerlow)));
-                                       emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
+                                       emitjmp(flag_2_cond[getresflags(p,unsigned)],truelabel);
 
-                                       emitl(A_JMP,falselabel);
+                                       emitjmp(C_None,falselabel);
 
                                        ungetiftemp(p^.right^.location.reference);
                                        del_reference(p^.right^.location.reference);
@@ -1446,12 +1451,12 @@ implementation
                                   exprasmlist^.concat(new(pai386,op_reg_reg(A_CMP,S_L,
                                     p^.right^.location.registerhigh,
                                     p^.location.registerhigh)));
-                                  emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
+                                  emitjmp(flag_2_cond[getresflags(p,unsigned)],truelabel);
                                   exprasmlist^.concat(new(pai386,op_reg_reg(A_CMP,S_L,
                                     p^.right^.location.registerlow,
                                     p^.location.registerlow)));
-                                  emitl(flag_2_jmp[getresflags(p,unsigned)],truelabel);
-                                  emitl(A_JMP,falselabel);
+                                  emitjmp(flag_2_cond[getresflags(p,unsigned)],truelabel);
+                                  emitjmp(C_None,falselabel);
                                end
                              else
                                begin
@@ -1482,11 +1487,11 @@ implementation
                             begin
                               getlabel(hl4);
                               if unsigned then
-                               emitl(A_JNB,hl4)
+                               emitjmp(C_NB,hl4)
                               else
-                               emitl(A_JNO,hl4);
+                               emitjmp(C_NO,hl4);
                               emitcall('FPC_OVERFLOW',true);
-                              emitl(A_LABEL,hl4);
+                              emitlab(hl4);
                             end;
                          end;
                         { we have LOC_JUMP as result }
@@ -1810,7 +1815,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.43  1999-02-16 00:46:30  peter
+  Revision 1.44  1999-02-22 02:15:02  peter
+    * updates for ag386bin
+
+  Revision 1.43  1999/02/16 00:46:30  peter
     * fixed bug 206
 
   Revision 1.42  1999/02/12 10:43:56  florian

+ 11 - 3
compiler/cg386cal.pas

@@ -42,7 +42,12 @@ implementation
       gdb,
 {$endif GDB}
       hcodegen,temp_gen,pass_2,
-      i386,cgai386,tgeni386,cg386ld;
+{$ifdef ag386bin}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
+      cgai386,tgeni386,cg386ld;
 
 {*****************************************************************************
                              SecondCallParaN
@@ -363,7 +368,7 @@ implementation
                  (cs_check_io in aktlocalswitches) then
                 begin
                    getlabel(iolabel);
-                   emitl(A_LABEL,iolabel);
+                   emitlab(iolabel);
                 end
               else
                 iolabel:=nil;
@@ -1304,7 +1309,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.67  1999-02-11 09:46:21  pierre
+  Revision 1.68  1999-02-22 02:15:04  peter
+    * updates for ag386bin
+
+  Revision 1.67  1999/02/11 09:46:21  pierre
     * fix for normal method calls inside static methods :
       WARNING there were both parser and codegen errors !!
       added static_call boolean to calln tree

+ 25 - 17
compiler/cg386cnv.pas

@@ -43,7 +43,12 @@ implementation
       cobjects,verbose,globals,systems,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,pass_1,
-      i386,cgai386,tgeni386;
+{$ifdef ag386bin}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
+      cgai386,tgeni386;
 
 
 
@@ -324,10 +329,10 @@ implementation
                    hp^.symbol:=stringdup(porddef(p1)^.getrangecheckstring);
                    { second part here !! }
                    hp^.offset:=8;
-                   emitl(A_JMP,poslabel);
-                   emitl(A_LABEL,neglabel);
+                   emitjmp(C_None,poslabel);
+                   emitlab(neglabel);
                    exprasmlist^.concat(new(pai386,op_reg_ref(A_BOUND,S_L,hregister,hp)));
-                   emitl(A_LABEL,poslabel);
+                   emitlab(poslabel);
                 end;
            end;
       end;
@@ -1022,7 +1027,7 @@ implementation
          emit_reg_reg(A_MOV,S_L,R_EAX,R_EBX);
          emit_reg_reg(A_SUB,S_L,R_EDX,R_EAX);
          getlabel(hl);
-         emitl(A_JZ,hl);
+         emitjmp(C_Z,hl);
          exprasmlist^.concat(new(pai386,op_const_reg(A_RCL,S_L,1,R_EBX)));
          emit_reg_reg(A_BSR,S_L,R_EAX,R_EDX);
          exprasmlist^.concat(new(pai386,op_const_reg(A_MOV,S_B,32,R_CL)));
@@ -1034,7 +1039,7 @@ implementation
          exprasmlist^.concat(new(pai386,op_const_reg_reg(A_SHLD,S_L,20,R_EAX,R_EBX)));
 
          exprasmlist^.concat(new(pai386,op_const_reg(A_SHL,S_L,20,R_EAX)));
-         emitl(A_LABEL,hl);
+         emitlab(hl);
          { better than an add on all processors }
          exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,R_EBX)));
          exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,R_EAX)));
@@ -1214,7 +1219,7 @@ implementation
                       end;
           LOC_FLAGS : begin
                         hregister:=reg32toreg8(hregister);
-                        exprasmlist^.concat(new(pai386,op_reg(flag_2_set[pfrom^.location.resflags],S_B,hregister)));
+                        emit_flag2reg(pfrom^.location.resflags,hregister);
                         case pto^.resulttype^.size of
                          2 : exprasmlist^.concat(new(pai386,op_reg_reg(A_MOVZX,S_BW,hregister,pto^.location.register)));
                          4 : exprasmlist^.concat(new(pai386,op_reg_reg(A_MOVZX,S_BL,hregister,pto^.location.register)));
@@ -1222,12 +1227,12 @@ implementation
                       end;
            LOC_JUMP : begin
                         getlabel(hlabel);
-                        emitl(A_LABEL,truelabel);
+                        emitlab(truelabel);
                         exprasmlist^.concat(new(pai386,op_const_reg(A_MOV,newsize,1,hregister)));
-                        emitl(A_JMP,hlabel);
-                        emitl(A_LABEL,falselabel);
+                        emitjmp(C_None,hlabel);
+                        emitlab(falselabel);
                         exprasmlist^.concat(new(pai386,op_reg_reg(A_XOR,newsize,hregister,hregister)));
-                        emitl(A_LABEL,hlabel);
+                        emitlab(hlabel);
                       end;
          else
            internalerror(10061);
@@ -1273,7 +1278,7 @@ implementation
           end;
          exprasmlist^.concat(new(pai386,op_reg_reg(A_OR,S_L,hregister,hregister)));
          hregister:=reg32toreg8(hregister);
-         exprasmlist^.concat(new(pai386,op_reg(flag_2_set[pfrom^.location.resflags],S_B,hregister)));
+         emit_flag2reg(pfrom^.location.resflags,hregister);
          case pto^.resulttype^.size of
           1 : pto^.location.register:=hregister;
           2 : begin
@@ -1330,19 +1335,19 @@ implementation
                   pto^.location.register:=getregister32;
                end;
          end;
-         emitl(A_JZ,l1);
+         emitjmp(C_Z,l1);
          if pfrom^.location.loc in [LOC_MEM,LOC_REFERENCE] then
            exprasmlist^.concat(new(pai386,op_ref_reg(A_MOV,S_L,newreference(
              pfrom^.location.reference),
              pto^.location.register)));
-         emitl(A_JMP,l2);
-         emitl(A_LABEL,l1);
+         emitjmp(C_None,l2);
+         emitlab(l1);
          new(hr);
          reset_reference(hr^);
          hr^.symbol:=stringdup('FPC_EMPTYCHAR');
          exprasmlist^.concat(new(pai386,op_ref_reg(A_LEA,S_L,hr,
            pto^.location.register)));
-         emitl(A_LABEL,l2);
+         emitlab(l2);
       end;
 
 
@@ -1618,7 +1623,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.56  1999-02-15 11:30:39  pierre
+  Revision 1.57  1999-02-22 02:15:06  peter
+    * updates for ag386bin
+
+  Revision 1.56  1999/02/15 11:30:39  pierre
    * memory leaks removed
 
   Revision 1.55  1999/02/12 10:43:57  florian

+ 10 - 2
compiler/cg386con.pas

@@ -44,7 +44,12 @@ implementation
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      i386,cgai386,tgeni386;
+{$ifdef ag386bin}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
+      cgai386,tgeni386;
 
 {*****************************************************************************
                              SecondRealConst
@@ -379,7 +384,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.27  1999-01-19 14:21:59  peter
+  Revision 1.28  1999-02-22 02:15:08  peter
+    * updates for ag386bin
+
+  Revision 1.27  1999/01/19 14:21:59  peter
     * shortstring truncated after 255 chars
 
   Revision 1.26  1998/12/11 00:02:49  peter

+ 67 - 55
compiler/cg386flw.pas

@@ -47,7 +47,12 @@ implementation
       cobjects,verbose,globals,systems,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      i386,cgai386,tgeni386;
+{$ifdef ag386bin}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
+      cgai386,tgeni386;
 
 {*****************************************************************************
                          Second_While_RepeatN
@@ -70,16 +75,16 @@ implementation
          { handling code at the end as it is much more efficient, and makes
            while equal to repeat loop, only the end true/false is swapped (PFV) }
          if p^.treetype=whilen then
-          emitl(A_JMP,lcont);
+          emitjmp(C_None,lcont);
 
-         emitl(A_LABEL,lloop);
+         emitlab(lloop);
 
          aktcontinuelabel:=lcont;
          aktbreaklabel:=lbreak;
          cleartempgen;
          if assigned(p^.right) then
            secondpass(p^.right);
-         emitl(A_LABEL,lcont);
+         emitlab(lcont);
          otlabel:=truelabel;
          oflabel:=falselabel;
          if p^.treetype=whilen then
@@ -96,7 +101,7 @@ implementation
          cleartempgen;
          secondpass(p^.left);
          maketojumpbool(p^.left);
-         emitl(A_LABEL,lbreak);
+         emitlab(lbreak);
          freelabel(lloop);
          freelabel(lcont);
          freelabel(lbreak);
@@ -127,7 +132,7 @@ implementation
          maketojumpbool(p^.left);
          if assigned(p^.right) then
            begin
-              emitl(A_LABEL,truelabel);
+              emitlab(truelabel);
               cleartempgen;
               secondpass(p^.right);
            end;
@@ -138,21 +143,21 @@ implementation
                    getlabel(hl);
                    { do go back to if line !! }
                    aktfilepos:=exprasmlist^.getlasttaifilepos^;
-                   emitl(A_JMP,hl);
+                   emitjmp(C_None,hl);
                 end;
-              emitl(A_LABEL,falselabel);
+              emitlab(falselabel);
               cleartempgen;
               secondpass(p^.t1);
               if assigned(p^.right) then
-                emitl(A_LABEL,hl);
+                emitlab(hl);
            end
          else
            begin
-              emitl(A_LABEL,falselabel);
+              emitlab(falselabel);
            end;
          if not(assigned(p^.right)) then
            begin
-              emitl(A_LABEL,truelabel);
+              emitlab(truelabel);
            end;
          freelabel(truelabel);
          freelabel(falselabel);
@@ -172,6 +177,7 @@ implementation
          hs : byte;
          temp1 : treference;
          hop : tasmop;
+         hcond : tasmcond;
          cmpreg,cmp32 : tregister;
          opsize : topsize;
          count_var_is_signed : boolean;
@@ -214,7 +220,7 @@ implementation
          if not(simple_loadn) then
           CGMessage(cg_e_illegal_count_var);
          already done in firstfor !! *)
-         
+
          { first set the to value
            because the count var can be in the expression !! }
          cleartempgen;
@@ -309,24 +315,26 @@ implementation
            end;
          if p^.backward then
            if count_var_is_signed then
-             hop:=A_JL
-           else hop:=A_JB
+             hcond:=C_L
+           else
+             hcond:=C_B
          else
            if count_var_is_signed then
-             hop:=A_JG
-            else hop:=A_JA;
+             hcond:=C_G
+           else
+             hcond:=C_A;
 
-             if not(omitfirstcomp) or temptovalue then
-           emitl(hop,aktbreaklabel);
+         if not(omitfirstcomp) or temptovalue then
+           emitjmp(hcond,aktbreaklabel);
 
-         emitl(A_LABEL,l3);
+         emitlab(l3);
 
          { help register must not be in instruction block }
          cleartempgen;
          if assigned(p^.t1) then
            secondpass(p^.t1);
 
-         emitl(A_LABEL,aktcontinuelabel);
+         emitlab(aktcontinuelabel);
 
          { makes no problems there }
          cleartempgen;
@@ -373,29 +381,30 @@ implementation
            end;
          if p^.backward then
            if count_var_is_signed then
-             hop:=A_JLE
+             hcond:=C_LE
            else
-             hop :=A_JBE
+             hcond:=C_BE
           else
             if count_var_is_signed then
-              hop:=A_JGE
+              hcond:=C_GE
             else
-                hop:=A_JAE;
-         emitl(hop,aktbreaklabel);
+              hcond:=C_AE;
+         emitjmp(hcond,aktbreaklabel);
          { according to count direction DEC or INC... }
          { must be after the test because of 0to 255 for bytes !! }
          if p^.backward then
            hop:=A_DEC
-         else hop:=A_INC;
+         else
+           hop:=A_INC;
 
          if p^.t2^.location.loc=LOC_CREGISTER then
            exprasmlist^.concat(new(pai386,op_reg(hop,opsize,p^.t2^.location.register)))
          else
              exprasmlist^.concat(new(pai386,op_ref(hop,opsize,newreference(p^.t2^.location.reference))));
-         emitl(A_JMP,l3);
+         emitjmp(C_None,l3);
 
            { this is the break label: }
-         emitl(A_LABEL,aktbreaklabel);
+         emitlab(aktbreaklabel);
          ungetregister32(cmp32);
 
          if temptovalue then
@@ -436,13 +445,13 @@ implementation
            LOC_CREGISTER,
             LOC_REGISTER : is_mem:=false;
                LOC_FLAGS : begin
-                             exprasmlist^.concat(new(pai386,op_reg(flag_2_set[p^.right^.location.resflags],S_B,R_AL)));
+                             emit_flag2reg(p^.right^.location.resflags,R_AL);
                              goto do_jmp;
                            end;
                 LOC_JUMP : begin
-                             emitl(A_LABEL,truelabel);
+                             emitlab(truelabel);
                              exprasmlist^.concat(new(pai386,op_const_reg(A_MOV,S_B,1,R_AL)));
-                             emitl(A_JMP,aktexit2label);
+                             emitjmp(C_None,aktexit2label);
                              exprasmlist^.concat(new(pai386,op_reg_reg(A_XOR,S_B,R_AL,R_AL)));
                              goto do_jmp;
                            end;
@@ -498,11 +507,11 @@ do_jmp:
               freelabel(falselabel);
               truelabel:=otlabel;
               falselabel:=oflabel;
-              emitl(A_JMP,aktexit2label);
+              emitjmp(C_None,aktexit2label);
            end
          else
            begin
-              emitl(A_JMP,aktexitlabel);
+              emitjmp(C_None,aktexitlabel);
            end;
        end;
 
@@ -514,7 +523,7 @@ do_jmp:
     procedure secondbreakn(var p : ptree);
       begin
          if aktbreaklabel<>nil then
-           emitl(A_JMP,aktbreaklabel)
+           emitjmp(C_None,aktbreaklabel)
          else
            CGMessage(cg_e_break_not_allowed);
       end;
@@ -527,7 +536,7 @@ do_jmp:
     procedure secondcontinuen(var p : ptree);
       begin
          if aktcontinuelabel<>nil then
-           emitl(A_JMP,aktcontinuelabel)
+           emitjmp(C_None,aktcontinuelabel)
          else
            CGMessage(cg_e_continue_not_allowed);
       end;
@@ -540,7 +549,7 @@ do_jmp:
     procedure secondgoto(var p : ptree);
 
        begin
-         emitl(A_JMP,p^.labelnr);
+         emitjmp(C_None,p^.labelnr);
        end;
 
 
@@ -550,7 +559,7 @@ do_jmp:
 
     procedure secondlabel(var p : ptree);
       begin
-         emitl(A_LABEL,p^.labelnr);
+         emitlab(p^.labelnr);
          cleartempgen;
          secondpass(p^.left);
       end;
@@ -578,7 +587,7 @@ do_jmp:
               else
                 begin
                    getlabel(a);
-                   emitl(A_LABEL,a);
+                   emitlab(a);
                    exprasmlist^.concat(new(pai386,
                      op_csymbol(A_PUSH,S_L,newcsymbol(lab2str(a),0))));
                 end;
@@ -635,27 +644,27 @@ do_jmp:
            op_reg(A_PUSH,S_L,R_EAX)));
          exprasmlist^.concat(new(pai386,
            op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
-         emitl(A_JNE,exceptlabel);
+         emitjmp(C_NE,exceptlabel);
 
          { try code }
          secondpass(p^.left);
          if codegenerror then
            exit;
 
-         emitl(A_LABEL,exceptlabel);
+         emitlab(exceptlabel);
          exprasmlist^.concat(new(pai386,
            op_reg(A_POP,S_L,R_EAX)));
          exprasmlist^.concat(new(pai386,
            op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
-         emitl(A_JNE,doexceptlabel);
+         emitjmp(C_NE,doexceptlabel);
          emitcall('FPC_POPADDRSTACK',true);
-         emitl(A_JMP,endexceptlabel);
-         emitl(A_LABEL,doexceptlabel);
+         emitjmp(C_None,endexceptlabel);
+         emitlab(doexceptlabel);
 
          if assigned(p^.right) then
            secondpass(p^.right);
 
-         emitl(A_LABEL,lastonlabel);
+         emitlab(lastonlabel);
          { default handling }
          if assigned(p^.t1) then
            begin
@@ -668,7 +677,7 @@ do_jmp:
            end
          else
            emitcall('FPC_RERAISE',true);
-         emitl(A_LABEL,endexceptlabel);
+         emitlab(endexceptlabel);
          freelabel(exceptlabel);
          freelabel(doexceptlabel);
          freelabel(endexceptlabel);
@@ -694,7 +703,7 @@ do_jmp:
          emitcall('FPC_CATCHES',true);
          exprasmlist^.concat(new(pai386,
            op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
-         emitl(A_JE,nextonlabel);
+         emitjmp(C_E,nextonlabel);
          ref.symbol:=nil;
          gettempofsizereference(4,ref);
 
@@ -709,8 +718,8 @@ do_jmp:
            secondpass(p^.right);
          { clear some stuff }
          ungetiftemp(ref);
-         emitl(A_JMP,endexceptlabel);
-         emitl(A_LABEL,nextonlabel);
+         emitjmp(C_None,endexceptlabel);
+         emitlab(nextonlabel);
          { next on node }
          if assigned(p^.left) then
            secondpass(p^.left);
@@ -741,14 +750,14 @@ do_jmp:
            op_reg(A_PUSH,S_L,R_EAX)));
          exprasmlist^.concat(new(pai386,
            op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
-         emitl(A_JNE,finallylabel);
+         emitjmp(C_NE,finallylabel);
 
          { try code }
          secondpass(p^.left);
          if codegenerror then
            exit;
 
-         emitl(A_LABEL,finallylabel);
+         emitlab(finallylabel);
 
          { finally code }
          secondpass(p^.right);
@@ -758,11 +767,11 @@ do_jmp:
            op_reg(A_POP,S_L,R_EAX)));
          exprasmlist^.concat(new(pai386,
            op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
-         emitl(A_JE,noreraiselabel);
+         emitjmp(C_E,noreraiselabel);
          emitcall('FPC_RERAISE',true);
-         emitl(A_LABEL,noreraiselabel);
+         emitlab(noreraiselabel);
          emitcall('FPC_POPADDRSTACK',true);
-         emitl(A_LABEL,endfinallylabel);
+         emitlab(endfinallylabel);
       end;
 
 
@@ -781,14 +790,17 @@ do_jmp:
          hp^.offset:=procinfo.ESI_offset;
          hp^.base:=procinfo.framepointer;
          exprasmlist^.concat(new(pai386,op_reg_ref(A_MOV,S_L,R_ESI,hp)));
-         exprasmlist^.concat(new(pai_labeled,init(A_JMP,quickexitlabel)));
+         exprasmlist^.concat(new(pai386_labeled,op_lab(A_JMP,quickexitlabel)));
       end;
 
 
 end.
 {
   $Log$
-  Revision 1.27  1999-01-26 11:26:21  pierre
+  Revision 1.28  1999-02-22 02:15:09  peter
+    * updates for ag386bin
+
+  Revision 1.27  1999/01/26 11:26:21  pierre
    * bug0152 for i:=1 to i-5 do (i-5) evaluated first
 
   Revision 1.26  1998/12/19 00:23:44  florian

+ 14 - 7
compiler/cg386inl.pas

@@ -36,7 +36,12 @@ implementation
       cobjects,verbose,globals,files,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      i386,cgai386,tgeni386,cg386ld,cg386cal;
+{$ifdef ag386bin}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
+      cgai386,tgeni386,cg386ld,cg386cal;
 
 
 {*****************************************************************************
@@ -121,7 +126,7 @@ implementation
               ((aktprocsym^.definition^.options and poiocheck)=0) then
              begin
                 getlabel(iolabel);
-                emitl(A_LABEL,iolabel);
+                emitlab(iolabel);
              end
            else
              iolabel:=nil;
@@ -572,7 +577,7 @@ implementation
                  if cs_do_assertion in aktlocalswitches then
                    begin
                       maketojumpbool(p^.left^.left);
-                      emitl(A_LABEL,falselabel);
+                      emitlab(falselabel);
                       { erroraddr }
                       exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,R_EBP)));
                       { lineno }
@@ -589,7 +594,7 @@ implementation
                       emitpushreferenceaddr(exprasmlist,p^.left^.right^.left^.location.reference);
                       { call }
                       emitcall('FPC_ASSERT',true);
-                      emitl(A_LABEL,truelabel);
+                      emitlab(truelabel);
                    end;
                  freelabel(truelabel);
                  freelabel(falselabel);
@@ -771,8 +776,7 @@ implementation
                           p^.location.register)
                       else
                       if p^.left^.location.loc=LOC_FLAGS then
-                        exprasmlist^.concat(new(pai386,op_reg(flag_2_set[p^.left^.location.resflags],S_B,
-                                  p^.location.register)))
+                        emit_flag2reg(p^.left^.location.resflags,p^.location.register)
                       else
                         begin
                            del_reference(p^.left^.location.reference);
@@ -1023,7 +1027,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.27  1999-02-17 14:21:40  pierre
+  Revision 1.28  1999-02-22 02:15:11  peter
+    * updates for ag386bin
+
+  Revision 1.27  1999/02/17 14:21:40  pierre
    * unused local removed
 
   Revision 1.26  1999/02/15 11:40:21  pierre

+ 26 - 9
compiler/cg386ld.pas

@@ -24,7 +24,7 @@ unit cg386ld;
 interface
 
     uses
-      tree,i386;
+      tree;
 
     procedure secondload(var p : ptree);
     procedure secondassignment(var p : ptree);
@@ -39,6 +39,11 @@ implementation
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
+{$ifdef ag386bin}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
       cgai386,tgeni386,cg386cnv;
 
 {*****************************************************************************
@@ -336,7 +341,9 @@ implementation
          loc : tloc;
          r : preference;
          oldrl : plinkedlist;
-
+{$ifdef Ag386Bin}
+         ai : pai386;
+{$endif}
       begin
          oldrl:=temptoremove;
          temptoremove:=new(plinkedlist,init);
@@ -583,7 +590,7 @@ implementation
                            end;
             LOC_JUMP     : begin
                               getlabel(hlabel);
-                              emitl(A_LABEL,truelabel);
+                              emitlab(truelabel);
                               if loc=LOC_CREGISTER then
                                 exprasmlist^.concat(new(pai386,op_const_reg(A_MOV,S_B,
                                   1,p^.left^.location.register)))
@@ -592,8 +599,8 @@ implementation
                                   1,newreference(p^.left^.location.reference))));
                               {exprasmlist^.concat(new(pai386,op_const_loc(A_MOV,S_B,
                                   1,p^.left^.location)));}
-                              emitl(A_JMP,hlabel);
-                              emitl(A_LABEL,falselabel);
+                              emitjmp(C_None,hlabel);
+                              emitlab(falselabel);
                               if loc=LOC_CREGISTER then
                                 exprasmlist^.concat(new(pai386,op_reg_reg(A_XOR,S_B,
                                   p^.left^.location.register,
@@ -601,15 +608,22 @@ implementation
                               else
                                 exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_B,
                                   0,newreference(p^.left^.location.reference))));
-                              emitl(A_LABEL,hlabel);
+                              emitlab(hlabel);
                            end;
             LOC_FLAGS    : begin
                               if loc=LOC_CREGISTER then
-                                exprasmlist^.concat(new(pai386,op_reg(flag_2_set[p^.right^.location.resflags],S_B,
-                                  p^.left^.location.register)))
+                                emit_flag2reg(p^.right^.location.resflags,p^.left^.location.register)
                               else
+{$ifdef Ag386Bin}
+                                begin
+                                  ai:=new(pai386,op_ref(A_Setcc,S_B,newreference(p^.left^.location.reference)));
+                                  ai^.SetCondition(flag_2_cond[p^.right^.location.resflags]);
+                                  exprasmlist^.concat(ai);
+                                end;
+{$else}
                                 exprasmlist^.concat(new(pai386,op_ref(flag_2_set[p^.right^.location.resflags],S_B,
                                   newreference(p^.left^.location.reference))));
+{$endif}
                            end;
          end;
          removetemps(exprasmlist,temptoremove);
@@ -791,7 +805,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.43  1999-01-27 00:13:54  florian
+  Revision 1.44  1999-02-22 02:15:12  peter
+    * updates for ag386bin
+
+  Revision 1.43  1999/01/27 00:13:54  florian
     * "procedure of object"-stuff fixed
 
   Revision 1.42  1999/01/21 22:10:40  peter

+ 15 - 7
compiler/cg386mat.pas

@@ -39,7 +39,12 @@ implementation
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      i386,cgai386,tgeni386;
+{$ifdef ag386bin}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
+      cgai386,tgeni386;
 
 {*****************************************************************************
                              SecondModDiv
@@ -85,12 +90,12 @@ implementation
              begin
                  exprasmlist^.concat(new(pai386,op_reg_reg(A_OR,S_L,hreg1,hreg1)));
                  getlabel(hl);
-                 emitl(A_JNS,hl);
+                 emitjmp(C_NS,hl);
                  if power=1 then
-                    exprasmlist^.concat(new(pai386,op_reg(A_INC,S_L,hreg1)))
-                 else exprasmlist^.concat(new(pai386,op_const_reg(A_ADD,S_L,p^.right^.value-1,hreg1)));
-
-                 emitl(A_LABEL,hl);
+                   exprasmlist^.concat(new(pai386,op_reg(A_INC,S_L,hreg1)))
+                 else
+                   exprasmlist^.concat(new(pai386,op_const_reg(A_ADD,S_L,p^.right^.value-1,hreg1)));
+                 emitlab(hl);
                  exprasmlist^.concat(new(pai386,op_const_reg(A_SAR,S_L,power,hreg1)));
              end
            else
@@ -763,7 +768,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.19  1999-02-04 10:49:40  florian
+  Revision 1.20  1999-02-22 02:15:13  peter
+    * updates for ag386bin
+
+  Revision 1.19  1999/02/04 10:49:40  florian
     + range checking for ansi- and widestrings
     * made it compilable with TP
 

+ 11 - 3
compiler/cg386mem.pas

@@ -47,7 +47,12 @@ implementation
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      i386,cgai386,tgeni386;
+{$ifdef ag386bin}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
+      cgai386,tgeni386;
 
 {*****************************************************************************
                              SecondLoadVMT
@@ -637,7 +642,7 @@ implementation
                  LOC_FLAGS:
                    begin
                       ind:=getregister32;
-                      exprasmlist^.concat(new(pai386,op_reg(flag_2_set[p^.right^.location.resflags],S_B,reg32toreg8(ind))));
+                      emit_flag2reg(p^.right^.location.resflags,reg32toreg8(ind));
                       emit_reg_reg(A_MOVZX,S_BL,reg32toreg8(ind),ind);
                    end
                  else
@@ -855,7 +860,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.29  1999-02-07 22:53:07  florian
+  Revision 1.30  1999-02-22 02:15:14  peter
+    * updates for ag386bin
+
+  Revision 1.29  1999/02/07 22:53:07  florian
     * potential bug in secondvecn fixed
 
   Revision 1.28  1999/02/04 17:16:51  peter

+ 41 - 36
compiler/cg386set.pas

@@ -38,7 +38,12 @@ implementation
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      i386,cgai386,tgeni386;
+{$ifdef ag386bin}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
+      cgai386,tgeni386;
 
      const
        bytes2Sxx:array[1..4] of Topsize=(S_B,S_W,S_NO,S_L);
@@ -245,7 +250,7 @@ implementation
                    if ranges then
                      exprasmlist^.concat(new(pai386,op_none(A_STC,S_NO)));
                    { If found, jump to end }
-                   emitl(A_JE,l);
+                   emitjmp(C_E,l);
                    case p^.left^.location.loc of
                   LOC_REGISTER,
                  LOC_CREGISTER : exprasmlist^.concat(new(pai386,op_const_reg(A_CMP,opsize,
@@ -258,7 +263,7 @@ implementation
                    if ranges then
                      exprasmlist^.concat(new(pai386,op_none(A_STC,S_NO)));
                    { If found, jump to end }
-                   emitl(A_JE,l);
+                   emitjmp(C_E,l);
                  end
                 else
                  begin
@@ -275,7 +280,7 @@ implementation
                           setparts[i].start,newreference(p^.left^.location.reference))));
                       end;
                       { If lower, jump to next check }
-                      emitl(A_JB,l2);
+                      emitjmp(C_B,l2);
                     end;
                    { We only check for the high bound if it is < 255, because
                      set elements higher than 255 do nt exist, the its always true,
@@ -291,12 +296,12 @@ implementation
                           setparts[i].stop+1,newreference(p^.left^.location.reference))));
                       end;
                       { If higher, element is in set }
-                      emitl(A_JB,l);
+                      emitjmp(C_B,l);
                     end
                    else
                     begin
                       exprasmlist^.concat(new(pai386,op_none(A_STC,S_NO)));
-                      emitl(A_JMP,l);
+                      emitjmp(C_None,l);
                     end;
                  end;
                 { Emit the jump over label }
@@ -317,7 +322,7 @@ implementation
                 if ranges then
                  exprasmlist^.concat(new(pai386,op_none(A_STC,S_NO)));
                 { If found, jump to end }
-                emitl(A_JE,l);
+                emitjmp(C_E,l);
               end;
              if ranges then
               exprasmlist^.concat(new(pai386,op_none(A_CLC,S_NO)));
@@ -444,7 +449,7 @@ implementation
       var
          with_sign : boolean;
          opsize : topsize;
-         jmp_gt,jmp_le,jmp_lee : tasmop;
+         jmp_gt,jmp_le,jmp_lee : tasmcond;
          hp : ptree;
          { register with case expression }
          hregister : tregister;
@@ -461,7 +466,7 @@ implementation
            lesslabel,greaterlabel : plabel;
 
        begin
-         emitl(A_LABEL,p^._at);
+         emitlab(p^._at);
          { calculate labels for left and right }
          if (p^.less=nil) then
            lesslabel:=elselabel
@@ -477,23 +482,21 @@ implementation
            begin
               exprasmlist^.concat(new(pai386,op_const_reg(A_CMP,opsize,p^._low,hregister)));
               if greaterlabel=lesslabel then
-                begin
-                   emitl(A_JNE,lesslabel);
-                end
+                emitjmp(C_NE,lesslabel)
               else
                 begin
-                   emitl(jmp_le,lesslabel);
-                   emitl(jmp_gt,greaterlabel);
+                   emitjmp(jmp_le,lesslabel);
+                   emitjmp(jmp_gt,greaterlabel);
                 end;
-              emitl(A_JMP,p^.statement);
+              emitjmp(C_None,p^.statement);
            end
          else
            begin
               exprasmlist^.concat(new(pai386,op_const_reg(A_CMP,opsize,p^._low,hregister)));
-              emitl(jmp_le,lesslabel);
+              emitjmp(jmp_le,lesslabel);
                 exprasmlist^.concat(new(pai386,op_const_reg(A_CMP,opsize,p^._high,hregister)));
-              emitl(jmp_gt,greaterlabel);
-              emitl(A_JMP,p^.statement);
+              emitjmp(jmp_gt,greaterlabel);
+              emitjmp(C_None,p^.statement);
            end;
           if assigned(p^.less) then
            gentreejmp(p^.less);
@@ -517,7 +520,7 @@ implementation
              if first and (t^._low>get_min_value(p^.left^.resulttype)) then
                begin
                   exprasmlist^.concat(new(pai386,op_const_reg(A_CMP,opsize,t^._low,hregister)));
-                  emitl(jmp_le,elselabel);
+                  emitjmp(jmp_le,elselabel);
                end;
              if t^._low=t^._high then
                begin
@@ -528,8 +531,7 @@ implementation
                   else
                     exprasmlist^.concat(new(pai386,op_const_reg(A_SUB,opsize,t^._low-last,hregister)));
                   last:=t^._low;
-
-                  emitl(A_JZ,t^.statement);
+                  emitjmp(C_Z,t^.statement);
                end
              else
                begin
@@ -565,12 +567,12 @@ implementation
                   if (t^._low-last>1) then
                     begin
                        exprasmlist^.concat(new(pai386,op_const_reg(A_SUB,opsize,t^._low-last,hregister)));
-                       emitl(jmp_le,elselabel);
+                       emitjmp(jmp_le,elselabel);
                     end
                   else
                     exprasmlist^.concat(new(pai386,op_reg(A_DEC,opsize,hregister)));
                   exprasmlist^.concat(new(pai386,op_const_reg(A_SUB,opsize,t^._high-t^._low,hregister)));
-                  emitl(jmp_lee,t^.statement);
+                  emitjmp(jmp_lee,t^.statement);
 
                   last:=t^._high;
                end;
@@ -583,7 +585,7 @@ implementation
            last:=0;
            first:=true;
            genitem(hp);
-           emitl(A_JMP,elselabel);
+           emitjmp(C_None,elselabel);
         end;
 
       procedure genjumptable(hp : pcaserecord;min_,max_ : longint);
@@ -618,9 +620,9 @@ implementation
              begin
                 exprasmlist^.concat(new(pai386,op_const_reg(A_CMP,opsize,min_,hregister)));
                 { case expr less than min_ => goto elselabel }
-                emitl(jmp_le,elselabel);
+                emitjmp(jmp_le,elselabel);
                 exprasmlist^.concat(new(pai386,op_const_reg(A_CMP,opsize,max_,hregister)));
-                emitl(jmp_gt,elselabel);
+                emitjmp(jmp_gt,elselabel);
              end;
            getlabel(table);
            { extend with sign }
@@ -670,15 +672,15 @@ implementation
          with_sign:=is_signed(p^.left^.resulttype);
          if with_sign then
            begin
-              jmp_gt:=A_JG;
-              jmp_le:=A_JL;
-              jmp_lee:=A_JLE;
+              jmp_gt:=C_G;
+              jmp_le:=C_L;
+              jmp_lee:=C_LE;
            end
          else
             begin
-              jmp_gt:=A_JA;
-              jmp_le:=A_JB;
-              jmp_lee:=A_JBE;
+              jmp_gt:=C_A;
+              jmp_le:=C_B;
+              jmp_lee:=C_BE;
            end;
          cleartempgen;
          secondpass(p^.left);
@@ -779,24 +781,27 @@ implementation
               secondpass(hp^.right);
               { don't come back to case line }
               aktfilepos:=exprasmlist^.getlasttaifilepos^;
-              emitl(A_JMP,endlabel);
+              emitjmp(C_None,endlabel);
               hp:=hp^.left;
            end;
-         emitl(A_LABEL,elselabel);
+         emitlab(elselabel);
          { ...and the else block }
          if assigned(p^.elseblock) then
              begin
               cleartempgen;
               secondpass(p^.elseblock);
            end;
-         emitl(A_LABEL,endlabel);
+         emitlab(endlabel);
       end;
 
 
 end.
 {
   $Log$
-  Revision 1.21  1999-02-17 10:12:59  peter
+  Revision 1.22  1999-02-22 02:15:16  peter
+    * updates for ag386bin
+
+  Revision 1.21  1999/02/17 10:12:59  peter
     * removed memory leak when jumps are generated
 
   Revision 1.20  1998/12/11 00:02:56  peter

+ 13 - 10
compiler/daopt386.pas

@@ -1791,7 +1791,7 @@ Begin
                         If (GetLastInstruction(p, hp) And
                            Not(((hp^.typ = ait_labeled_instruction) or
                                 (hp^.typ = ait_instruction)) And
-                                (Pai_Labeled(hp)^._operator = A_JMP))
+                                (pai386_labeled(hp)^._operator = A_JMP))
                           Then
   {previous instruction not a JMP -> the contents of the registers after the
    previous intruction has been executed have to be taken into account as well}
@@ -1808,7 +1808,7 @@ Begin
   already been processed}
                       If GetLastInstruction(p, hp) And
                          Not(hp^.typ = ait_labeled_instruction) And
-                            (Pai_Labeled(hp)^._operator = A_JMP))
+                            (pai386_labeled(hp)^._operator = A_JMP))
                         Then
   {previous instruction not a jmp, so keep all the registers' contents from the
    previous instruction}
@@ -1825,7 +1825,7 @@ Begin
       been processed}
                             While GetNextInstruction(hp, hp) And
                                   Not((hp^.typ = ait_labeled_instruction) And
-                                      (Pai_Labeled(hp)^.lab^.nb = Pai_Label(p)^.l^.nb)) And
+                                      (pai386_labeled(hp)^.lab^.nb = Pai_Label(p)^.l^.nb)) And
                                   Not((hp^.typ = ait_label) And
                                       (LTable^[Pai_Label(hp)^.l^.nb-LoLab].RefsFound
                                        = Pai_Label(hp)^.l^.RefCount) And
@@ -1863,8 +1863,8 @@ Begin
 {$IfNDef JumpAnal}
   ;
 {$Else JumpAnal}
-          With LTable^[Pai_Labeled(p)^.lab^.nb-LoLab] Do
-            If (RefsFound = Pai_Labeled(p)^.lab^.RefCount) Then
+          With LTable^[pai386_labeled(p)^.lab^.nb-LoLab] Do
+            If (RefsFound = pai386_labeled(p)^.lab^.RefCount) Then
               Begin
                 If (InstrCnt < InstrNr)
                   Then
@@ -1890,7 +1890,7 @@ Begin
 {                    If (JmpsProcessed > 0) Or
                        Not(GetLastInstruction(PaiObj, hp) And
                            (hp^.typ = ait_labeled_instruction) And
-                           (Pai_Labeled(hp)^._operator = A_JMP))
+                           (pai386_labeled(hp)^._operator = A_JMP))
                       Then}
 {instruction prior to label is not a jmp, or at least one jump to the label
  has yet been processed}
@@ -2154,9 +2154,9 @@ Begin
       Case P^.Typ Of
         ait_labeled_instruction:
           begin
-            If (Pai_Labeled(P)^.lab^.nb >= LoLab) And
-               (Pai_Labeled(P)^.lab^.nb <= HiLab) Then
-            Inc(LTable^[Pai_Labeled(P)^.lab^.nb-LoLab].RefsFound);
+            If (pai386_labeled(P)^.lab^.nb >= LoLab) And
+               (pai386_labeled(P)^.lab^.nb <= HiLab) Then
+            Inc(LTable^[pai386_labeled(P)^.lab^.nb-LoLab].RefsFound);
           end;
         ait_label:
           Begin
@@ -2227,7 +2227,10 @@ End.
 
 {
  $Log$
- Revision 1.36  1999-01-20 17:41:26  jonas
+ Revision 1.37  1999-02-22 02:15:20  peter
+   * updates for ag386bin
+
+ Revision 1.36  1999/01/20 17:41:26  jonas
    * small bugfix (memory corruption could occur when certain fpu instructions
      were encountered)
 

+ 8 - 1
compiler/hcodegen.pas

@@ -27,8 +27,12 @@ unit hcodegen;
     uses
       verbose,aasm,tree,symtable,cobjects
 {$ifdef i386}
+{$ifdef ag386bin}
+      ,i386base
+{$else}
       ,i386
 {$endif}
+{$endif}
 {$ifdef m68k}
       ,m68k
 {$endif}
@@ -360,7 +364,10 @@ end.
 
 {
   $Log$
-  Revision 1.25  1999-01-21 22:10:45  peter
+  Revision 1.26  1999-02-22 02:15:21  peter
+    * updates for ag386bin
+
+  Revision 1.25  1999/01/21 22:10:45  peter
     * fixed array of const
     * generic platform independent high() support
 

+ 22 - 10
compiler/i386.pas

@@ -194,7 +194,6 @@ unit i386;
       firstop = low(tasmop);
       lastop  = high(tasmop);
 
-
     type
        { enumeration for registers, don't change the order }
        { it's used by the register size conversions        }
@@ -297,13 +296,23 @@ unit i386;
           offset : longint;
        end;
 
+    type
+       { Only here for easier adaption of the internal assembler }
+       TAsmCond=(C_None,
+         C_A,C_AE,C_B,C_BE,C_C,C_E,C_G,C_GE,C_L,C_LE,C_NA,C_NAE,
+         C_NB,C_NBE,C_NC,C_NE,C_NG,C_NGE,C_NL,C_NLE,C_NO,C_NP,
+         C_NS,C_NZ,C_O,C_P,C_PE,C_PO,C_S,C_Z
+       );
     const
+       flag_2_cond : array[TResFlags] of TAsmCond =
+        (C_E,C_NE,C_G,C_L,C_GE,C_LE,C_C,C_NC,C_A,C_AE,C_B,C_BE);
+
        { arrays for boolean location conversions }
-       flag_2_jmp : array[F_E..F_BE] of tasmop =
+       {flag_2_jmp : array[F_E..F_BE] of tasmop =
           (A_JE,A_JNE,A_JG,A_JL,A_JGE,A_JLE,A_JC,A_JNC,
-           A_JA,A_JAE,A_JB,A_JBE);
+           A_JA,A_JAE,A_JB,A_JBE);}
 
-       flag_2_set : array[F_E..F_BE] of tasmop =
+       flag_2_set : array[TResFlags] of tasmop =
           (A_SETE,A_SETNE,A_SETG,A_SETL,A_SETGE,A_SETLE,A_SETB,A_SETAE,
            A_SETA,A_SETAE,A_SETB,A_SETBE);
 
@@ -369,12 +378,12 @@ unit i386;
        sizepostfix_pointer = S_L;
 
     type
-       pai_labeled = ^tai_labeled;
+       pai386_labeled = ^tai386_labeled;
 
-       tai_labeled = object(tai)
+       tai386_labeled = object(tai)
           _operator : tasmop;
           lab : plabel;
-          constructor init(op : tasmop; l : plabel);
+          constructor op_lab(op : tasmop; l : plabel);
           destructor done;virtual;
        end;
 
@@ -1929,7 +1938,7 @@ unit i386;
                              TAI_LABELED
  ****************************************************************************}
 
-    constructor tai_labeled.init(op : tasmop; l : plabel);
+    constructor tai386_labeled.op_lab(op : tasmop; l : plabel);
 
       begin
          inherited init;
@@ -1940,7 +1949,7 @@ unit i386;
          inc(lab^.refcount);
       end;
 
-    destructor tai_labeled.done;
+    destructor tai386_labeled.done;
 
       begin
          dec(lab^.refcount);
@@ -1983,7 +1992,10 @@ Begin
 end.
 {
   $Log$
-  Revision 1.34  1999-01-26 11:32:14  pierre
+  Revision 1.35  1999-02-22 02:15:23  peter
+    * updates for ag386bin
+
+  Revision 1.34  1999/01/26 11:32:14  pierre
    * ppheap init code can be called before any getmem
 
   Revision 1.33  1999/01/25 09:29:38  florian

+ 10 - 2
compiler/pass_2.pas

@@ -49,7 +49,12 @@ implementation
      ,gdb
 {$endif}
 {$ifdef i386}
-     ,i386,tgeni386,cgai386
+{$ifdef Ag386Bin}
+     ,i386base,i386asm
+{$else}
+     ,i386
+{$endif}
+     ,tgeni386,cgai386
      ,cg386con,cg386mat,cg386cnv,cg386set,cg386add
      ,cg386mem,cg386cal,cg386ld,cg386flw,cg386inl
 {$endif}
@@ -495,7 +500,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.14  1999-01-23 23:29:37  florian
+  Revision 1.15  1999-02-22 02:15:25  peter
+    * updates for ag386bin
+
+  Revision 1.14  1999/01/23 23:29:37  florian
     * first running version of the new code generator
     * when compiling exceptions under Linux fixed
 

+ 9 - 2
compiler/pexpr.pas

@@ -53,8 +53,12 @@ unit pexpr;
        ,pbase,pdecl
        { processor specific stuff }
 {$ifdef i386}
+{$ifdef ag386bin}
+       ,i386base
+{$else}
        ,i386
 {$endif}
+{$endif}
 {$ifdef m68k}
        ,m68k
 {$endif}
@@ -1132,7 +1136,7 @@ unit pexpr;
       procedure postfixoperators;
         var
            store_static : boolean;
-           
+
         { p1 and p2 must contain valid value_str }
         begin
           check_tokenpos;
@@ -1940,7 +1944,10 @@ unit pexpr;
 end.
 {
   $Log$
-  Revision 1.83  1999-02-11 09:46:25  pierre
+  Revision 1.84  1999-02-22 02:15:26  peter
+    * updates for ag386bin
+
+  Revision 1.83  1999/02/11 09:46:25  pierre
     * fix for normal method calls inside static methods :
       WARNING there were both parser and codegen errors !!
       added static_call boolean to calln tree

+ 8 - 1
compiler/pmodules.pas

@@ -41,8 +41,12 @@ unit pmodules;
        symtable,aasm,hcodegen,
        link,assemble,import,export,gendef,ppu,comprsrc
 {$ifdef i386}
+{$ifdef Ag386Bin}
+       ,i386base,i386asm
+{$else}
        ,i386
 {$endif}
+{$endif}
 {$ifdef m68k}
        ,m68k
 {$endif}
@@ -1241,7 +1245,10 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.97  1999-02-16 00:45:31  peter
+  Revision 1.98  1999-02-22 02:15:29  peter
+    * updates for ag386bin
+
+  Revision 1.97  1999/02/16 00:45:31  peter
     * fixed crashes by forgotten strpnew() for init_symbol
 
   Revision 1.96  1999/02/05 08:54:27  pierre

+ 41 - 38
compiler/popt386.pas

@@ -53,7 +53,7 @@ Var
 
   UsedRegs, TmpUsedRegs: TRegSet;
 
-  Procedure GetFinalDestination(hp: pai_labeled);
+  Procedure GetFinalDestination(hp: pai386_labeled);
   {traces sucessive jumps to their final destination and sets it, e.g.
    je l1                je l3
    <code>               <code>
@@ -85,15 +85,15 @@ Var
         p1 := LTable^[hp^.lab^.nb-LoLab].PaiObj; {the jump's destination}
         p1 := SkipLabels(p1);
         If (pai(p1)^.typ = ait_labeled_instruction) and
-           ((pai_labeled(p1)^._operator = A_JMP) or
-            (pai_labeled(p1)^._operator = hp^._operator))
+           ((pai386_labeled(p1)^._operator = A_JMP) or
+            (pai386_labeled(p1)^._operator = hp^._operator))
           Then
             Begin
-              GetFinalDestination(pai_labeled(p1));
+              GetFinalDestination(pai386_labeled(p1));
               Dec(hp^.lab^.refcount);
               If (hp^.lab^.refcount = 0) Then
                 hp^.lab^.is_used := False;
-              hp^.lab := pai_labeled(p1)^.lab;
+              hp^.lab := pai386_labeled(p1)^.lab;
               Inc(hp^.lab^.refcount);
             End
       End
@@ -110,7 +110,7 @@ Begin
           Begin
   {the following if-block removes all code between a jmp and the next label,
    because it can never be executed}
-            If (pai_labeled(p)^._operator = A_JMP) Then
+            If (pai386_labeled(p)^._operator = A_JMP) Then
               Begin
                 hp1 := pai(p^.next);
                 While GetNextInstruction(p, hp1) and
@@ -126,33 +126,33 @@ Begin
             If GetNextInstruction(p, hp1) then
               Begin
                 If (pai(hp1)^.typ=ait_labeled_instruction) and
-                   (pai_labeled(hp1)^._operator=A_JMP) and
+                   (pai386_labeled(hp1)^._operator=A_JMP) and
                    GetNextInstruction(hp1, hp2) And
-                   FindLabel(pai_labeled(p)^.lab, hp2)
+                   FindLabel(pai386_labeled(p)^.lab, hp2)
                   Then
                     Begin
-                      Case pai_labeled(p)^._operator Of
-                        A_JE : pai_labeled(p)^._operator:=A_JNE;
-                        A_JNE : pai_labeled(p)^._operator:=A_JE;
-                        A_JL : pai_labeled(p)^._operator:=A_JGE;
-                        A_JG : pai_labeled(p)^._operator:=A_JLE;
-                        A_JLE : pai_labeled(p)^._operator:=A_JG;
-                        A_JGE : pai_labeled(p)^._operator:=A_JL;
-                        A_JNZ : pai_labeled(p)^._operator:=A_JZ;
-                        A_JNO : pai_labeled(p)^._operator:=A_JO;
-                        A_JZ : pai_labeled(p)^._operator:=A_JNZ;
-                        A_JS : pai_labeled(p)^._operator:=A_JNS;
-                        A_JNS : pai_labeled(p)^._operator:=A_JS;
-                        A_JO : pai_labeled(p)^._operator:=A_JNO;
-                        A_JC : pai_labeled(p)^._operator:=A_JNC;
-                        A_JNC : pai_labeled(p)^._operator:=A_JC;
-                        A_JA : pai_labeled(p)^._operator:=A_JBE;
-                        A_JAE : pai_labeled(p)^._operator:=A_JB;
-                        A_JB : pai_labeled(p)^._operator:=A_JAE;
-                        A_JBE : pai_labeled(p)^._operator:=A_JA;
+                      Case pai386_labeled(p)^._operator Of
+                        A_JE : pai386_labeled(p)^._operator:=A_JNE;
+                        A_JNE : pai386_labeled(p)^._operator:=A_JE;
+                        A_JL : pai386_labeled(p)^._operator:=A_JGE;
+                        A_JG : pai386_labeled(p)^._operator:=A_JLE;
+                        A_JLE : pai386_labeled(p)^._operator:=A_JG;
+                        A_JGE : pai386_labeled(p)^._operator:=A_JL;
+                        A_JNZ : pai386_labeled(p)^._operator:=A_JZ;
+                        A_JNO : pai386_labeled(p)^._operator:=A_JO;
+                        A_JZ : pai386_labeled(p)^._operator:=A_JNZ;
+                        A_JS : pai386_labeled(p)^._operator:=A_JNS;
+                        A_JNS : pai386_labeled(p)^._operator:=A_JS;
+                        A_JO : pai386_labeled(p)^._operator:=A_JNO;
+                        A_JC : pai386_labeled(p)^._operator:=A_JNC;
+                        A_JNC : pai386_labeled(p)^._operator:=A_JC;
+                        A_JA : pai386_labeled(p)^._operator:=A_JBE;
+                        A_JAE : pai386_labeled(p)^._operator:=A_JB;
+                        A_JB : pai386_labeled(p)^._operator:=A_JAE;
+                        A_JBE : pai386_labeled(p)^._operator:=A_JA;
                         Else
                           begin
-                            If (LabDif <> 0) Then GetFinalDestination(pai_labeled(p));
+                            If (LabDif <> 0) Then GetFinalDestination(pai386_labeled(p));
                             p:=pai(p^.next);
                             continue;
                           end;
@@ -160,14 +160,14 @@ Begin
                       Dec(pai_label(hp2)^.l^.refcount);
                       If (pai_label(hp2)^.l^.refcount = 0) Then
                         pai_label(hp2)^.l^.is_used := False;
-                      pai_labeled(p)^.lab:=pai_labeled(hp1)^.lab;
-                      Inc(pai_labeled(p)^.lab^.refcount);
+                      pai386_labeled(p)^.lab:=pai386_labeled(hp1)^.lab;
+                      Inc(pai386_labeled(p)^.lab^.refcount);
                       asml^.remove(hp1);
                       dispose(hp1,done);
-                      If (LabDif <> 0) Then GetFinalDestination(pai_labeled(p));
+                      If (LabDif <> 0) Then GetFinalDestination(pai386_labeled(p));
                     end
                   else
-                    if FindLabel(pai_labeled(p)^.lab, hp1) then
+                    if FindLabel(pai386_labeled(p)^.lab, hp1) then
                       Begin
                         hp2:=pai(hp1^.next);
                         asml^.remove(p);
@@ -175,7 +175,7 @@ Begin
                         p:=hp2;
                         continue;
                       end
-                    Else If (LabDif <> 0) Then GetFinalDestination(pai_labeled(p));
+                    Else If (LabDif <> 0) Then GetFinalDestination(pai386_labeled(p));
               end
           end;
         ait_instruction:
@@ -389,8 +389,8 @@ Begin
                      (Not(GetNextInstruction(p, hp1)) Or
                        {GetNextInstruction(p, hp1) And}
                        Not((Pai(hp1)^.typ = ait_labeled_instruction) And
-                           ((pai_labeled(hp1)^._operator = A_JO) or
-                            (pai_labeled(hp1)^._operator = A_JNO))))
+                           ((pai386_labeled(hp1)^._operator = A_JO) or
+                            (pai386_labeled(hp1)^._operator = A_JNO))))
                     Then
                       Begin
                         New(TmpRef);
@@ -1521,9 +1521,9 @@ Begin
                 If (AktOptProcessor < ClassP6) And
                    GetNextInstruction(p, hp1) And
                    (hp1^.typ = ait_labeled_instruction) And
-                   (Pai_Labeled(hp1)^._operator = A_JMP) Then
+                   (pai386_labeled(hp1)^._operator = A_JMP) Then
                   Begin
-                    hp2 := New(Pai386,op_csymbol(A_PUSH,S_L,NewCSymbol(Lab2Str(Pai_Labeled(hp1)^.lab),0)));
+                    hp2 := New(Pai386,op_csymbol(A_PUSH,S_L,NewCSymbol(Lab2Str(pai386_labeled(hp1)^.lab),0)));
                     hp2^.fileinfo := p^.fileinfo;
                     InsertLLItem(AsmL, p^.previous, p, hp2);
                     Pai386(p)^._operator := A_JMP;
@@ -1619,7 +1619,10 @@ End.
 
 {
  $Log$
- Revision 1.36  1999-01-04 22:04:15  jonas
+ Revision 1.37  1999-02-22 02:15:30  peter
+   * updates for ag386bin
+
+ Revision 1.36  1999/01/04 22:04:15  jonas
    + mov reg, mem1    to    mov reg, mem1
       mov mem2, reg           cmp reg, mem2
       cmp mem1, reg

+ 10 - 2
compiler/pstatmnt.pas

@@ -44,7 +44,12 @@ unit pstatmnt;
        symtable,aasm,pass_1,types,scanner,hcodegen,ppu
        ,pbase,pexpr,pdecl
 {$ifdef i386}
-       ,i386,tgeni386
+{$ifdef Ag386Bin}
+       ,i386base,i386asm
+{$else}
+       ,i386
+{$endif}
+       ,tgeni386
   {$ifndef NoRa386Int}
        ,ra386int
   {$endif NoRa386Int}
@@ -1277,7 +1282,10 @@ unit pstatmnt;
 end.
 {
   $Log$
-  Revision 1.65  1999-02-15 13:13:15  pierre
+  Revision 1.66  1999-02-22 02:15:31  peter
+    * updates for ag386bin
+
+  Revision 1.65  1999/02/15 13:13:15  pierre
    * fix for bug0216
 
   Revision 1.64  1999/02/11 09:46:26  pierre

+ 9 - 6
compiler/ra386att.pas

@@ -1074,7 +1074,7 @@ var
          end;
        op.size:=size;
     End;
-    
+
   Procedure ConcatOpCode(var instr: TInstruction);
   {*********************************************************************}
   { First Pass:                                                         }
@@ -2186,7 +2186,7 @@ var
              else if instr.operands[1].operandtype <> OPR_LABINSTR then
                     Message(assem_e_invalid_labeled_opcode)
              else if assigned(instr.operands[1].hl) then
-                    ConcatLabel(p,instruct, instr.operands[1].hl)
+                    p^.concat(new(pai386_labeled,op_lab(instruct, instr.operands[1].hl)))
              else
                Begin
                  Message(assem_f_internal_error_in_concatlabeledinstr);
@@ -3424,7 +3424,7 @@ Begin
            Begin
              getlabel(hl);
              labellist.insert(actasmpattern,hl,TRUE);
-             ConcatLabel(p,A_LABEL,hl);
+             ConcatLabel(p,hl);
            end
           else
            Begin
@@ -3438,7 +3438,7 @@ Begin
              else
                Begin
                  if assigned(labelptr^.lab) then
-                   ConcatLabel(p,A_LABEL,labelptr^.lab);
+                   ConcatLabel(p,labelptr^.lab);
                  labelptr^.emitted := TRUE;
                end;
            end;
@@ -3449,7 +3449,7 @@ Begin
           { when looking for Pascal labels, these must }
           { be in uppercase.                           }
           if SearchLabel(upper(actasmpattern),hl) then
-           ConcatLabel(p,A_LABEL, hl)
+           ConcatLabel(p,hl)
           else
            Begin
              if (cs_compilesystem in aktmoduleswitches) then
@@ -3707,7 +3707,10 @@ end.
 
 {
   $Log$
-  Revision 1.31  1999-01-29 11:24:02  pierre
+  Revision 1.32  1999-02-22 02:15:34  peter
+    * updates for ag386bin
+
+  Revision 1.31  1999/01/29 11:24:02  pierre
    * incompatible size warning or error suppressed for sizes > 4
 
   Revision 1.30  1999/01/28 14:12:59  pierre

+ 11 - 3
compiler/ra386dir.pas

@@ -32,8 +32,13 @@ unit Ra386dir;
   implementation
 
      uses
-        comphook,files,i386,hcodegen,globals,scanner,aasm,
-        cobjects,symtable,types,verbose,rautils;
+        comphook,files,hcodegen,globals,scanner,aasm
+{$ifdef Ag386Bin}
+        ,i386base,i386asm
+{$else}
+        ,i386
+{$endif}
+        ,cobjects,symtable,types,verbose,rautils;
 
     function assemble : ptree;
 
@@ -289,7 +294,10 @@ unit Ra386dir;
 end.
 {
   $Log$
-  Revision 1.13  1999-01-27 13:04:12  pierre
+  Revision 1.14  1999-02-22 02:15:36  peter
+    * updates for ag386bin
+
+  Revision 1.13  1999/01/27 13:04:12  pierre
    * bug with static vars in assembler readers
 
   Revision 1.12  1999/01/10 15:37:57  peter

+ 8 - 5
compiler/ra386int.pas

@@ -771,7 +771,7 @@ var
            else if (instr.operands[1].operandtype = OPR_LABINSTR) and
                    (instr.numops = 1) then
                   if assigned(instr.operands[1].hl) then
-                    ConcatLabel(p,instr.getinstruction, instr.operands[1].hl)
+                    p^.concat(new(pai386_labeled,op_lab(instruc, instr.operands[1].hl)))
                   else
                     Message(assem_f_internal_error_in_findtype);
           end;
@@ -3354,7 +3354,7 @@ Begin
            Begin
              getlabel(hl);
              labellist.insert(actasmpattern,hl,TRUE);
-             ConcatLabel(p,A_LABEL,hl);
+             ConcatLabel(p,hl);
            end
           else
            { the label has already been inserted into the  }
@@ -3368,7 +3368,7 @@ Begin
               else
                Begin
                  if assigned(labelptr^.lab) then
-                   ConcatLabel(p,A_LABEL,labelptr^.lab);
+                   ConcatLabel(p,labelptr^.lab);
                  labelptr^.emitted := TRUE;
                end;
            end;
@@ -3378,7 +3378,7 @@ Begin
       AS_LABEL :
         Begin
           if SearchLabel(actasmpattern,hl) then
-            ConcatLabel(p,A_LABEL, hl)
+            ConcatLabel(p,hl)
           else
             Message1(assem_e_unknown_label_identifer,actasmpattern);
           Consume(AS_LABEL);
@@ -3473,7 +3473,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.20  1999-01-10 15:37:58  peter
+  Revision 1.21  1999-02-22 02:15:37  peter
+    * updates for ag386bin
+
+  Revision 1.20  1999/01/10 15:37:58  peter
     * moved some tables from ra386*.pas -> i386.pas
     + start of coff writer
     * renamed asmutils unit to rautils

+ 11 - 7
compiler/rautils.pas

@@ -58,8 +58,12 @@ Uses
   symtable,aasm,hcodegen,verbose,globals,files,strings,
   cobjects,
 {$ifdef i386}
+{$ifdef Ag386Bin}
+  i386base;
+{$else}
   i386;
 {$endif}
+{$endif}
 {$ifdef m68k}
    m68k;
 {$endif}
@@ -303,7 +307,7 @@ Type
   { swaps in the case of a 2/3 operand opcode the destination and the    }
   { source as to put it in AT&T style instruction format.                }
   Procedure SwapOperands(Var instr: TInstruction);
-  Procedure ConcatLabel(p : paasmoutput;op : tasmop;var l : plabel);
+  Procedure ConcatLabel(p: paasmoutput;var l : plabel);
   Procedure ConcatConstant(p : paasmoutput;value: longint; maxvalue: longint);
   Procedure ConcatRealConstant(p : paasmoutput;value: bestreal; real_typ : tfloattype);
   Procedure ConcatString(p : paasmoutput;s:string);
@@ -1723,17 +1727,14 @@ end;
        end;
     end;
 
-   Procedure ConcatLabel(p: paasmoutput;op : tasmop;var l : plabel);
+   Procedure ConcatLabel(p: paasmoutput;var l : plabel);
   {*********************************************************************}
   { PROCEDURE ConcatLabel                                               }
   {  Description: This routine either emits a label or a labeled        }
   {  instruction to the linked list of instructions.                    }
   {*********************************************************************}
    begin
-         if op=A_LABEL then
-           p^.concat(new(pai_label,init(l)))
-         else
-           p^.concat(new(pai_labeled,init(op,l)))
+     p^.concat(new(pai_label,init(l)))
    end;
 
    procedure ConcatPublic(p:paasmoutput;const s : string);
@@ -1809,7 +1810,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.3  1999-02-16 00:47:28  peter
+  Revision 1.4  1999-02-22 02:15:39  peter
+    * updates for ag386bin
+
+  Revision 1.3  1999/02/16 00:47:28  peter
     * fixed local copies of value para's
 
   Revision 1.2  1999/01/27 13:04:11  pierre

+ 15 - 9
compiler/systems.pas

@@ -68,11 +68,11 @@ unit systems;
             ,as_i386_o,as_i386_o_aout,as_i386_asw,
             as_i386_nasmcoff,as_i386_nasmelf,as_i386_nasmobj,
             as_i386_tasm,as_i386_masm,
-            as_i386_coff
+            as_i386_dbg,as_i386_coff,as_i386_pecoff
             ,as_m68k_o,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw
        );
      const
-       {$ifdef i386} i386asmcnt=9; {$else} i386asmcnt=0; {$endif}
+       {$ifdef i386} i386asmcnt=11; {$else} i386asmcnt=0; {$endif}
        {$ifdef m68k} m68kasmcnt=5; {$else} m68kasmcnt=0; {$endif}
        asmcnt=i386asmcnt+m68kasmcnt+1;
 
@@ -523,14 +523,17 @@ implementation
             labelprefix : '.L';
             comment : '; '
           )
+          ,(
+            id     : as_i386_dbg;
+            idtxt  : 'DBG'
+          )
           ,(
             id     : as_i386_coff;
-            idtxt  : 'COFF';
-            asmbin : 'as';
-            asmcmd : '-o $OBJ $ASM';
-            externals : false;
-            labelprefix : '.L';
-            comment : '# '
+            idtxt  : 'COFF'
+          )
+          ,(
+            id     : as_i386_pecoff;
+            idtxt  : 'PECOFF'
           )
 {$endif i386}
 {$ifdef m68k}
@@ -1324,7 +1327,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.56  1999-01-10 15:38:01  peter
+  Revision 1.57  1999-02-22 02:15:42  peter
+    * updates for ag386bin
+
+  Revision 1.56  1999/01/10 15:38:01  peter
     * moved some tables from ra386*.pas -> i386.pas
     + start of coff writer
     * renamed asmutils unit to rautils

+ 8 - 1
compiler/tcadd.pas

@@ -37,8 +37,12 @@ implementation
       symtable,aasm,types,
       hcodegen,htypechk,pass_1
 {$ifdef i386}
+{$ifdef ag386bin}
+      ,i386base
+{$else}
       ,i386
 {$endif}
+{$endif}
 {$ifdef m68k}
       ,m68k
 {$endif}
@@ -1013,7 +1017,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.21  1999-01-20 21:05:09  peter
+  Revision 1.22  1999-02-22 02:15:43  peter
+    * updates for ag386bin
+
+  Revision 1.21  1999/01/20 21:05:09  peter
     * fixed set operations which still had array constructor as type
 
   Revision 1.20  1999/01/20 17:39:26  jonas

+ 10 - 2
compiler/tccal.pas

@@ -44,7 +44,12 @@ implementation
       aasm,types,
       hcodegen,htypechk,pass_1
 {$ifdef i386}
-      ,i386,tgeni386
+{$ifdef ag386bin}
+      ,i386base
+{$else}
+      ,i386
+{$endif}
+      ,tgeni386
 {$endif}
 {$ifdef m68k}
       ,m68k,tgen68k
@@ -1071,7 +1076,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.23  1999-02-09 17:15:52  florian
+  Revision 1.24  1999-02-22 02:15:45  peter
+    * updates for ag386bin
+
+  Revision 1.23  1999/02/09 17:15:52  florian
     * some false warnings "function result doesn't seems to be set" are
       avoided
 

+ 8 - 1
compiler/tccnv.pas

@@ -44,8 +44,12 @@ implementation
       symtable,aasm,types,
       hcodegen,htypechk,pass_1
 {$ifdef i386}
+{$ifdef ag386bin}
+      ,i386base
+{$else}
       ,i386
 {$endif}
+{$endif}
 {$ifdef m68k}
       ,m68k
 {$endif}
@@ -975,7 +979,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18  1999-01-27 14:56:57  pierre
+  Revision 1.19  1999-02-22 02:15:46  peter
+    * updates for ag386bin
+
+  Revision 1.18  1999/01/27 14:56:57  pierre
   * typo error corrected solves bug0190 and bug0204
 
   Revision 1.17  1999/01/27 14:15:25  pierre

+ 8 - 1
compiler/tccon.pas

@@ -41,8 +41,12 @@ implementation
       symtable,aasm,types,
       hcodegen,pass_1
 {$ifdef i386}
+{$ifdef ag386bin}
+      ,i386base
+{$else}
       ,i386
 {$endif}
+{$endif}
 {$ifdef m68k}
       ,m68k
 {$endif}
@@ -126,7 +130,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.3  1998-11-17 00:36:48  peter
+  Revision 1.4  1999-02-22 02:15:47  peter
+    * updates for ag386bin
+
+  Revision 1.3  1998/11/17 00:36:48  peter
     * more ansistring fixes
 
   Revision 1.2  1998/11/05 12:03:04  peter

+ 10 - 2
compiler/tcflw.pas

@@ -47,7 +47,12 @@ implementation
       symtable,aasm,types,
       hcodegen,htypechk,temp_gen,pass_1
 {$ifdef i386}
-      ,i386,tgeni386
+{$ifdef ag386bin}
+      ,i386base
+{$else}
+      ,i386
+{$endif}
+      ,tgeni386
 {$endif}
 {$ifdef m68k}
       ,m68k,tgen68k
@@ -483,7 +488,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.5  1999-01-13 12:01:43  peter
+  Revision 1.6  1999-02-22 02:15:48  peter
+    * updates for ag386bin
+
+  Revision 1.5  1999/01/13 12:01:43  peter
     * fixed crash with counter var
 
   Revision 1.4  1998/12/11 00:03:55  peter

+ 10 - 2
compiler/tcinl.pas

@@ -37,7 +37,12 @@ implementation
       hcodegen,htypechk,pass_1,
       tccal,tcld
 {$ifdef i386}
-      ,i386,tgeni386
+{$ifdef ag386bin}
+      ,i386base
+{$else}
+      ,i386
+{$endif}
+      ,tgeni386
 {$endif}
 {$ifdef m68k}
       ,m68k,tgen68k
@@ -967,7 +972,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.17  1999-02-01 00:00:50  florian
+  Revision 1.18  1999-02-22 02:15:49  peter
+    * updates for ag386bin
+
+  Revision 1.17  1999/02/01 00:00:50  florian
     * compiler crash fixed when constant arguments passed to round/trunc
       exceeds the longint range
 

+ 12 - 4
compiler/tcld.pas

@@ -42,7 +42,12 @@ implementation
       hcodegen,htypechk,pass_1,
       tccnv
 {$ifdef i386}
-      ,i386,tgeni386
+{$ifdef ag386bin}
+      ,i386base
+{$else}
+      ,i386
+{$endif}
+      ,tgeni386
 {$endif}
 {$ifdef m68k}
       ,m68k,tgen68k
@@ -56,7 +61,7 @@ implementation
     procedure firstload(var p : ptree);
       var
          p1 : ptree;
-         
+
       begin
 {$ifndef NODIRECTWITH}
          if (p^.symtable^.symtabletype=withsymtable) and
@@ -70,7 +75,7 @@ implementation
               exit;
            end;
 {$endif ndef NODIRECTWITH}
-           
+
          p^.location.loc:=LOC_REFERENCE;
          p^.registers32:=0;
          p^.registersfpu:=0;
@@ -447,7 +452,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.15  1999-02-15 13:13:19  pierre
+  Revision 1.16  1999-02-22 02:15:52  peter
+    * updates for ag386bin
+
+  Revision 1.15  1999/02/15 13:13:19  pierre
    * fix for bug0216
 
   Revision 1.14  1999/01/27 00:13:58  florian

+ 8 - 1
compiler/tcmat.pas

@@ -40,8 +40,12 @@ implementation
       symtable,aasm,types,
       hcodegen,htypechk,pass_1
 {$ifdef i386}
+{$ifdef ag386bin}
+      ,i386base
+{$else}
       ,i386
 {$endif}
+{$endif}
 {$ifdef m68k}
       ,m68k
 {$endif}
@@ -373,7 +377,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.11  1999-02-03 10:11:11  pierre
+  Revision 1.12  1999-02-22 02:15:53  peter
+    * updates for ag386bin
+
+  Revision 1.11  1999/02/03 10:11:11  pierre
    * fix for bug0211 for i386
 
   Revision 1.10  1998/12/11 16:50:24  florian

+ 8 - 1
compiler/tcmem.pas

@@ -48,8 +48,12 @@ implementation
       symtable,aasm,types,
       hcodegen,htypechk,pass_1
 {$ifdef i386}
+{$ifdef ag386bin}
+      ,i386base
+{$else}
       ,i386
 {$endif}
+{$endif}
 {$ifdef m68k}
       ,m68k
 {$endif}
@@ -553,7 +557,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.10  1999-02-04 11:44:47  florian
+  Revision 1.11  1999-02-22 02:15:54  peter
+    * updates for ag386bin
+
+  Revision 1.10  1999/02/04 11:44:47  florian
     * fixed indexed access of ansistrings to temp. ansistring, i.e.
       c:=(s1+s2)[i], the temp is now correctly remove and the generated
       code is also fixed

+ 10 - 2
compiler/tcset.pas

@@ -40,7 +40,12 @@ implementation
       symtable,aasm,types,
       hcodegen,htypechk,pass_1
 {$ifdef i386}
-      ,i386,tgeni386
+{$ifdef ag386bin}
+      ,i386base
+{$else}
+      ,i386
+{$endif}
+      ,tgeni386
 {$endif}
 {$ifdef m68k}
       ,m68k,tgen68k
@@ -244,7 +249,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.5  1998-12-18 17:15:40  peter
+  Revision 1.6  1999-02-22 02:15:55  peter
+    * updates for ag386bin
+
+  Revision 1.5  1998/12/18 17:15:40  peter
     * added 'in []' support
 
   Revision 1.4  1998/12/11 00:03:58  peter

+ 10 - 3
compiler/temp_gen.pas

@@ -26,7 +26,11 @@ unit temp_gen;
 
     uses
 {$ifdef i386}
+{$ifdef ag386bin}
+      i386base,
+{$else}
       i386,
+{$endif}
 {$endif i386}
 {$ifdef m68k}
       m68k,
@@ -228,14 +232,14 @@ unit temp_gen;
          if (maxtemp mod 4)<>0 then
            dec(maxtemp,4+(maxtemp mod 4));
 {$endif}
-{$ifdef m68k}   
+{$ifdef m68k}
 
          { we only push words and we want to stay on }
          { even stack addresses                      }
          { maxtemp is negative                       }
          if (maxtemp mod 2)<>0 then
            dec(maxtemp);
-{$endif}        
+{$endif}
 
          gettempsize:=-maxtemp;
       end;
@@ -504,7 +508,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.8  1999-02-11 09:35:19  pierre
+  Revision 1.9  1999-02-22 02:15:56  peter
+    * updates for ag386bin
+
+  Revision 1.8  1999/02/11 09:35:19  pierre
    * ExtDebug conditionnal infinite loop on temp problem removed
 
   Revision 1.7  1999/02/02 23:52:33  florian

+ 8 - 1
compiler/tgeni386.pas

@@ -27,7 +27,11 @@ unit tgeni386;
     uses
        cobjects,globals,tree,hcodegen,verbose,files,aasm
 {$ifdef i386}
+{$ifdef ag386bin}
+       ,i386base,i386asm
+{$else}
        ,i386
+{$endif}
 {$endif}
        ;
 
@@ -370,7 +374,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.18  1999-01-18 16:02:20  pierre
+  Revision 1.19  1999-02-22 02:15:58  peter
+    * updates for ag386bin
+
+  Revision 1.18  1999/01/18 16:02:20  pierre
    * better error info with -Co
 
   Revision 1.17  1998/12/11 23:36:09  florian

+ 7 - 2
compiler/tree.pas

@@ -30,7 +30,9 @@ unit tree;
 
     uses
        globtype,cobjects,symtable,aasm
-{$ifdef i386}
+{$ifdef ag386bin}
+       ,i386base
+{$else}
        ,i386
 {$endif}
 {$ifdef m68k}
@@ -1686,7 +1688,10 @@ unit tree;
 end.
 {
   $Log$
-  Revision 1.65  1999-02-11 09:46:31  pierre
+  Revision 1.66  1999-02-22 02:15:59  peter
+    * updates for ag386bin
+
+  Revision 1.65  1999/02/11 09:46:31  pierre
     * fix for normal method calls inside static methods :
       WARNING there were both parser and codegen errors !!
       added static_call boolean to calln tree