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

* m68k compiler is again compilable (only gas writer, no assembler reader)

florian 26 жил өмнө
parent
commit
fbbf8a505c

+ 7 - 2
compiler/aasm.pas

@@ -64,7 +64,9 @@ unit aasm;
           { the follow is for the DEC Alpha }
           ait_frame,
           ait_ent,
-
+{$ifdef m68k}
+          ait_labeled_instruction,
+{$endif m68k}
           { never used, makes insertation of new ait_ easier to type }
           { lazy guy !!!! ;-) (FK) }
           ait_dummy);
@@ -985,7 +987,10 @@ uses
 end.
 {
   $Log$
-  Revision 1.62  1999-09-15 20:35:37  florian
+  Revision 1.63  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.62  1999/09/15 20:35:37  florian
     * small fix to operator overloading when in MMX mode
     + the compiler uses now fldz and fld1 if possible
     + some fixes to floating point registers

+ 47 - 39
compiler/ag68kgas.pas

@@ -45,7 +45,7 @@ unit ag68kgas;
 
     uses
       globtype,systems,
-      dos,globals,m68k,
+      dos,globals,cpubase,
       strings,files,verbose
 {$ifdef GDB}
       ,gdb
@@ -328,7 +328,6 @@ unit ag68kgas;
 {$endif GDB}
 
          case hp^.typ of
-      ait_external : ; { external is ignored }
        ait_comment : Begin
                        AsmWrite(target_asm.comment);
                        AsmWritePChar(pai_asm_comment(hp)^.str);
@@ -344,8 +343,10 @@ unit ag68kgas;
                         begin
                           AsmLn;
                           AsmWrite(ait_section2str(pai_section(hp)^.sec));
+                          {!!!!
                           if pai_section(hp)^.idataidx>0 then
                            AsmWrite('$'+tostr(pai_section(hp)^.idataidx));
+                          }
                           AsmLn;
 {$ifdef GDB}
                           case pai_section(hp)^.sec of
@@ -373,7 +374,7 @@ unit ag68kgas;
                         AsmWrite(#9'.comm'#9)
                        else
                         AsmWrite(#9'.lcomm'#9);
-                       AsmWriteLn(StrPas(pai_datablock(hp)^.name)+','+tostr(pai_datablock(hp)^.size));
+                       AsmWriteLn(pai_datablock(hp)^.sym^.name+','+tostr(pai_datablock(hp)^.size));
                      end;
    ait_const_32bit, { alignment is required for 16/32 bit data! }
    ait_const_16bit:  begin
@@ -411,6 +412,7 @@ unit ag68kgas;
   ait_const_symbol : Begin
                        AsmWriteLn(#9'.long'#9+StrPas(pchar(pai_const(hp)^.value)));
                      end;
+  {
   ait_const_symbol_offset :
                      Begin
                        AsmWrite(#9'.long'#9);
@@ -421,14 +423,15 @@ unit ag68kgas;
                          AsmWrite(tostr(pai_const_symbol_offset(hp)^.offset));
                        AsmLn;
                      end;
+  }
     ait_real_64bit : Begin
-                      AsmWriteLn(#9'.double'#9+double2str(pai_double(hp)^.value));
+                      AsmWriteLn(#9'.double'#9+double2str(pai_real_64bit(hp)^.value));
                      end;
     ait_real_32bit : Begin
-                      AsmWriteLn(#9'.single'#9+double2str(pai_single(hp)^.value));
+                      AsmWriteLn(#9'.single'#9+double2str(pai_real_32bit(hp)^.value));
                      end;
- ait_real_extended : Begin
-                      AsmWriteLn(#9'.extend'#9+double2str(pai_extended(hp)^.value));
+ ait_real_80bit : Begin
+                      AsmWriteLn(#9'.extend'#9+double2str(pai_real_80bit(hp)^.value));
                      { comp type is difficult to write so use double }
                      end;
 { TO SUPPORT SOONER OR LATER!!!
@@ -478,7 +481,7 @@ unit ag68kgas;
          ait_label : begin
                        if assigned(hp^.next) and (pai(hp^.next)^.typ in
                           [ait_const_32bit,ait_const_16bit,ait_const_8bit,
-                           ait_const_symbol,ait_const_symbol_offset,
+                           ait_const_symbol,{ ait_const_symbol_offset, }
                            ait_real_64bit,ait_real_32bit,ait_string]) then
                         begin
                           if not(cs_littlesize in aktglobalswitches) then
@@ -487,21 +490,21 @@ unit ag68kgas;
                            AsmWriteLn(#9#9'.align 2');
                         end;
                        if (pai_label(hp)^.l^.is_used) then
-                        AsmWriteLn(lab2str(pai_label(hp)^.l)+':');
+                        AsmWriteLn(pai_label(hp)^.l^.name+':');
                      end;
 ait_labeled_instruction : begin
                      { labeled operand }
                        if pai_labeled(hp)^._op1 = R_NO then
-                        AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^._operator]+#9+lab2str(pai_labeled(hp)^.lab))
+                        AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^._operator]+#9+pai_labeled(hp)^.lab^.name)
                        else
                      { labeled operand with register }
                         begin
                            if target_info.target=target_m68k_PalmOS then
                              AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^._operator]+#9+
-                               gasPalmOS_reg2str[pai_labeled(hp)^._op1]+','+lab2str(pai_labeled(hp)^.lab))
+                               gasPalmOS_reg2str[pai_labeled(hp)^._op1]+','+pai_labeled(hp)^.lab^.name)
                            else
                              AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^._operator]+#9+
-                               gas_reg2str[pai_labeled(hp)^._op1]+','+lab2str(pai_labeled(hp)^.lab))
+                               gas_reg2str[pai_labeled(hp)^._op1]+','+pai_labeled(hp)^.lab^.name)
                         end;
                      end;
         ait_symbol : begin
@@ -511,7 +514,7 @@ ait_labeled_instruction : begin
                        { ------------------------------------------------------- }
                        if assigned(hp^.next) and (pai(hp^.next)^.typ in
                           [ait_const_32bit,ait_const_16bit,ait_const_8bit,
-                           ait_const_symbol,ait_const_symbol_offset,
+                           ait_const_symbol,{!!! ait_const_symbol_offset, }
                            ait_real_64bit,ait_real_32bit,ait_string]) then
                         begin
                           if not(cs_littlesize in aktglobalswitches) then
@@ -520,51 +523,51 @@ ait_labeled_instruction : begin
                            AsmWriteLn(#9#9'.align 2');
                         end;
                        if pai_symbol(hp)^.is_global then
-                        AsmWriteLn('.globl '+StrPas(pai_symbol(hp)^.name));
-                       AsmWriteLn(StrPas(pai_symbol(hp)^.name)+':');
+                        AsmWriteLn('.globl '+pai_symbol(hp)^.sym^.name);
+                       AsmWriteLn(pai_symbol(hp)^.sym^.name+':');
                      end;
    ait_instruction : begin
                        { old versions of GAS don't like PEA.L and LEA.L }
-                       if (pai68k(hp)^._operator in [
+                       if (paicpu(hp)^._operator in [
                             A_LEA,A_PEA,A_ABCD,A_BCHG,A_BCLR,A_BSET,A_BTST,
                             A_EXG,A_NBCD,A_SBCD,A_SWAP,A_TAS,A_SCC,A_SCS,
                             A_SEQ,A_SGE,A_SGT,A_SHI,A_SLE,A_SLS,A_SLT,A_SMI,
                             A_SNE,A_SPL,A_ST,A_SVC,A_SVS,A_SF]) then
-                        s:=#9+mot_op2str[pai68k(hp)^._operator]
+                        s:=#9+mot_op2str[paicpu(hp)^._operator]
                        else
                         if target_info.target=target_m68k_PalmOS then
-                          s:=#9+mot_op2str[pai68k(hp)^._operator]+gas_opsize2str[pai68k(hp)^.size]
+                          s:=#9+mot_op2str[paicpu(hp)^._operator]+gas_opsize2str[paicpu(hp)^.size]
                         else
-                          s:=#9+mot_op2str[pai68k(hp)^._operator]+mit_opsize2str[pai68k(hp)^.size];
-                       if pai68k(hp)^.op1t<>top_none then
+                          s:=#9+mot_op2str[paicpu(hp)^._operator]+mit_opsize2str[paicpu(hp)^.size];
+                       if paicpu(hp)^.op1t<>top_none then
                         begin
                         { call and jmp need an extra handling                          }
                         { this code is only callded if jmp isn't a labeled instruction }
-                          if pai68k(hp)^._operator in [A_JSR,A_JMP] then
-                           s:=s+#9+getopstr_jmp(pai68k(hp)^.op1t,pai68k(hp)^.op1)
+                          if paicpu(hp)^._operator in [A_JSR,A_JMP] then
+                           s:=s+#9+getopstr_jmp(paicpu(hp)^.op1t,paicpu(hp)^.op1)
                           else
-                           if pai68k(hp)^.op1t = top_reglist then
-                            s:=s+#9+getopstr(pai68k(hp)^.op1t,@(pai68k(hp)^.reglist))
+                           if paicpu(hp)^.op1t = top_reglist then
+                            s:=s+#9+getopstr(paicpu(hp)^.op1t,@(paicpu(hp)^.reglist))
                            else
-                            s:=s+#9+getopstr(pai68k(hp)^.op1t,pai68k(hp)^.op1);
-                           if pai68k(hp)^.op2t<>top_none then
+                            s:=s+#9+getopstr(paicpu(hp)^.op1t,paicpu(hp)^.op1);
+                           if paicpu(hp)^.op2t<>top_none then
                             begin
-                              if pai68k(hp)^.op2t = top_reglist then
-                               s:=s+','+getopstr(pai68k(hp)^.op2t,@pai68k(hp)^.reglist)
+                              if paicpu(hp)^.op2t = top_reglist then
+                               s:=s+','+getopstr(paicpu(hp)^.op2t,@paicpu(hp)^.reglist)
                               else
-                               s:=s+','+getopstr(pai68k(hp)^.op2t,pai68k(hp)^.op2);
+                               s:=s+','+getopstr(paicpu(hp)^.op2t,paicpu(hp)^.op2);
                             { three operands }
-                              if pai68k(hp)^.op3t<>top_none then
+                              if paicpu(hp)^.op3t<>top_none then
                                begin
-                                   if (pai68k(hp)^._operator = A_DIVSL) or
-                                      (pai68k(hp)^._operator = A_DIVUL) or
-                                      (pai68k(hp)^._operator = A_MULU) or
-                                      (pai68k(hp)^._operator = A_MULS) or
-                                      (pai68k(hp)^._operator = A_DIVS) or
-                                      (pai68k(hp)^._operator = A_DIVU) then
-                                    s:=s+':'+getopstr(pai68k(hp)^.op3t,pai68k(hp)^.op3)
+                                   if (paicpu(hp)^._operator = A_DIVSL) or
+                                      (paicpu(hp)^._operator = A_DIVUL) or
+                                      (paicpu(hp)^._operator = A_MULU) or
+                                      (paicpu(hp)^._operator = A_MULS) or
+                                      (paicpu(hp)^._operator = A_DIVS) or
+                                      (paicpu(hp)^._operator = A_DIVU) then
+                                    s:=s+':'+getopstr(paicpu(hp)^.op3t,paicpu(hp)^.op3)
                                    else
-                                    s:=s+','+getopstr(pai68k(hp)^.op3t,pai68k(hp)^.op3);
+                                    s:=s+','+getopstr(paicpu(hp)^.op3t,paicpu(hp)^.op3);
                                end;
                             end;
                         end;
@@ -602,7 +605,9 @@ ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
                           if pai(hp^.next)^.typ=ait_section then
                            begin
                              lastsec:=pai_section(hp^.next)^.sec;
+                             {!!!!!
                              lastsecidx:=pai_section(hp^.next)^.idataidx;
+                             }
 {$ifdef GDB}
                              { this is needed for line info in data }
                              case pai_section(hp^.next)^.sec of
@@ -701,7 +706,10 @@ ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
 end.
 {
   $Log$
-  Revision 1.22  1998-12-23 22:53:44  peter
+  Revision 1.23  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.22  1998/12/23 22:53:44  peter
     * don't count ait_marker for lineinfo
 
   Revision 1.21  1998/12/11 00:02:39  peter

+ 5 - 2
compiler/ag68kmit.pas

@@ -44,7 +44,7 @@ unit ag68kmit;
 
     uses
       globtype,systems,
-      dos,globals,cobjects,m68k,
+      dos,globals,cobjects,cpubase,
       strings,files,verbose
 {$ifdef GDB}
       ,gdb
@@ -668,7 +668,10 @@ ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
 end.
 {
   $Log$
-  Revision 1.21  1999-03-10 13:25:45  pierre
+  Revision 1.22  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.21  1999/03/10 13:25:45  pierre
     section order changed to get closer output from coff writer
 
   Revision 1.20  1999/03/04 13:55:40  pierre

+ 5 - 2
compiler/ag68kmot.pas

@@ -39,7 +39,7 @@ unit ag68kmot;
 
     uses
       globtype,systems,
-      dos,globals,cobjects,m68k,
+      dos,globals,cobjects,cpubase,
       strings,files,verbose
 {$ifdef GDB}
       ,gdb
@@ -542,7 +542,10 @@ ait_labeled_instruction :
 end.
 {
   $Log$
-  Revision 1.17  1999-03-04 13:55:41  pierre
+  Revision 1.18  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.17  1999/03/04 13:55:41  pierre
     * some m68k fixes (still not compilable !)
     * new(tobj) does not give warning if tobj has no VMT !
 

+ 5 - 2
compiler/ag68kmpw.pas

@@ -37,7 +37,7 @@ unit ag68kmpw;
 
     uses
       globtype,systems,
-      dos,globals,cobjects,m68k,
+      dos,globals,cobjects,cpubase,
       strings,files,verbose
 {$ifdef GDB}
       ,gdb
@@ -581,7 +581,10 @@ ait_labeled_instruction :
 end.
 {
   $Log$
-  Revision 1.8  1998-12-11 00:02:42  peter
+  Revision 1.9  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.8  1998/12/11 00:02:42  peter
     + globtype,tokens,version unit splitted from globals
 
   Revision 1.7  1998/11/12 11:19:39  pierre

+ 62 - 59
compiler/cg68kadd.pas

@@ -31,11 +31,11 @@ interface
 implementation
 
     uses
-      globtype,systems,
+      globtype,systems,symconst,
       cobjects,verbose,globals,
       symtable,aasm,types,
-      temp_gen,hcodegen,pass_2,
-      m68k,cga68k,tgen68k;
+      temp_gen,hcodegen,pass_2,cpubase,
+      cga68k,tgen68k;
 
 {*****************************************************************************
                                 Helpers
@@ -49,7 +49,7 @@ implementation
        ZERO_FLAG     = $04;
        NEG_FLAG      = $08;
  var
-   label1,label2: plabel;
+   label1,label2: pasmlabel;
  (*************************************************************************)
  (*  Description: This routine handles the conversion of Floating point   *)
  (*  condition codes to normal cpu condition codes.                       *)
@@ -61,12 +61,12 @@ implementation
         equaln,unequaln: begin
                            { not equal clear zero flag }
                            emitl(A_FBEQ,label1);
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_AND, S_B, NOT ZERO_FLAG, R_CCR)));
                            emitl(A_BRA,label2);
                            emitl(A_LABEL,label1);
                            { equal - set zero flag }
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_OR,S_B, ZERO_FLAG, R_CCR)));
                            emitl(A_LABEL,label2);
                         end;
@@ -74,14 +74,14 @@ implementation
                            emitl(A_FBLT,label1);
                            { not less than       }
                            { clear N and V flags }
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_AND, S_B, NOT (NEG_FLAG OR OVFL_FLAG), R_CCR)));
                            emitl(A_BRA,label2);
                            emitl(A_LABEL,label1);
                            { less than }
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_OR,S_B, NEG_FLAG, R_CCR)));
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_AND,S_B, NOT OVFL_FLAG, R_CCR)));
                            emitl(A_LABEL,label2);
                         end;
@@ -89,13 +89,13 @@ implementation
                            emitl(A_FBGT,label1);
                            { not greater than }
                            { set Z flag       }
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_OR, S_B, ZERO_FLAG, R_CCR)));
                            emitl(A_BRA,label2);
                            emitl(A_LABEL,label1);
                            { greater than      }
                            { set N and V flags }
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_OR,S_B, NEG_FLAG OR OVFL_FLAG , R_CCR)));
                            emitl(A_LABEL,label2);
                         end;
@@ -103,15 +103,15 @@ implementation
                            emitl(A_FBGE,label1);
                            { not greater or equal }
                            { set N and clear V    }
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_AND, S_B, NOT OVFL_FLAG, R_CCR)));
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_OR,S_B, NEG_FLAG, R_CCR)));
                            emitl(A_BRA,label2);
                            emitl(A_LABEL,label1);
                            { greater or equal    }
                            { clear V and N flags }
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_AND, S_B, NOT (OVFL_FLAG OR NEG_FLAG), R_CCR)));
                            emitl(A_LABEL,label2);
                         end;
@@ -119,16 +119,16 @@ implementation
                            emitl(A_FBLE,label1);
                            { not less or equal }
                            { clear Z, N and V  }
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_AND, S_B, NOT (ZERO_FLAG OR NEG_FLAG OR OVFL_FLAG), R_CCR)));
                            emitl(A_BRA,label2);
                            emitl(A_LABEL,label1);
                            { less or equal     }
                            { set Z and N       }
                            { and clear V       }
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_OR,S_B, ZERO_FLAG OR NEG_FLAG, R_CCR)));
-                           exprasmlist^.concat(new(pai68k, op_const_reg(
+                           exprasmlist^.concat(new(paicpu, op_const_reg(
                              A_AND,S_B, NOT OVFL_FLAG, R_CCR)));
                            emitl(A_LABEL,label2);
                         end;
@@ -311,10 +311,10 @@ implementation
                                   { else pass 1 would have evaluted   }
                                   { this node                         }
                                   if p^.left^.treetype=stringconstn then
-                                    exprasmlist^.concat(new(pai68k,op_ref(
+                                    exprasmlist^.concat(new(paicpu,op_ref(
                                       A_TST,S_B,newreference(p^.right^.location.reference))))
                                   else
-                                    exprasmlist^.concat(new(pai68k,op_ref(
+                                    exprasmlist^.concat(new(paicpu,op_ref(
                                       A_TST,S_B,newreference(p^.left^.location.reference))));
                                end
                              else
@@ -329,9 +329,9 @@ implementation
                                  {   (best case)                                      }
                                  {   assembler routine: param setup (worst case) = 48 }
 
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(
                                       A_LEA,S_L,newreference(p^.left^.location.reference),R_A0)));
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(
                                       A_LEA,S_L,newreference(p^.right^.location.reference),R_A1)));
                                  {
                                  emitpushreferenceaddr(p^.left^.location.reference);
@@ -484,10 +484,10 @@ implementation
          pushed,mboverflow,cmpop : boolean;
          op : tasmop;
          flags : tresflags;
-         otl,ofl : plabel;
+         otl,ofl : pasmlabel;
          power : longint;
          opsize : topsize;
-         hl4: plabel;
+         hl4: pasmlabel;
          tmpref : treference;
 
 
@@ -626,9 +626,9 @@ implementation
                  (p^.right^.resulttype^.deftype=pointerdef) or
 
                  ((p^.right^.resulttype^.deftype=objectdef) and
-                  pobjectdef(p^.right^.resulttype)^.isclass and
+                  pobjectdef(p^.right^.resulttype)^.is_class and
                  (p^.left^.resulttype^.deftype=objectdef) and
-                  pobjectdef(p^.left^.resulttype)^.isclass
+                  pobjectdef(p^.left^.resulttype)^.is_class
                  ) or
 
                  (p^.left^.resulttype^.deftype=classrefdef) or
@@ -775,14 +775,14 @@ implementation
                              if is_in_dest then
                                begin
                                   hregister:=p^.location.register;
-                                  exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,
+                                  exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,
                                     newreference(p^.left^.location.reference),hregister)));
                                end
                              else
                                begin
                                   hregister:=getregister32;
                                   { first give free, then demand new register }
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,
                                    newreference(p^.left^.location.reference),hregister)));
                                end;
                           end;
@@ -809,7 +809,7 @@ implementation
                              if p^.right^.location.loc=LOC_CREGISTER then
                                begin
                                   if extra_not then
-                                    exprasmlist^.concat(new(pai68k,op_reg(A_NOT,opsize,p^.location.register)));
+                                    exprasmlist^.concat(new(paicpu,op_reg(A_NOT,opsize,p^.location.register)));
 
                                   emit_reg_reg(A_MOVE,opsize,p^.right^.location.register,R_D6);
                                   emit_reg_reg(op,opsize,p^.location.register,R_D6);
@@ -818,12 +818,12 @@ implementation
                              else
                                begin
                                   if extra_not then
-                                    exprasmlist^.concat(new(pai68k,op_reg(A_NOT,opsize,p^.location.register)));
+                                    exprasmlist^.concat(new(paicpu,op_reg(A_NOT,opsize,p^.location.register)));
 
-                                  exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,
+                                  exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,
                                     newreference(p^.right^.location.reference),R_D6)));
-                                  exprasmlist^.concat(new(pai68k,op_reg_reg(op,opsize,p^.location.register,R_D6)));
-                                  exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,opsize,R_D6,p^.location.register)));
+                                  exprasmlist^.concat(new(paicpu,op_reg_reg(op,opsize,p^.location.register,R_D6)));
+                                  exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,opsize,R_D6,p^.location.register)));
                                   del_reference(p^.right^.location.reference);
                                end;
                           end
@@ -831,19 +831,19 @@ implementation
                           begin
                              if (p^.right^.treetype=ordconstn) and (op=A_CMP) and
                                 (p^.right^.value=0) then
-                                  exprasmlist^.concat(new(pai68k,op_reg(A_TST,opsize,p^.location.register)))
+                                  exprasmlist^.concat(new(paicpu,op_reg(A_TST,opsize,p^.location.register)))
                              else
                                 if (p^.right^.treetype=ordconstn) and (op=A_MULS) and
                                    (ispowerof2(p^.right^.value,power)) then
                                   begin
                                     if (power <= 8) then
-                                        exprasmlist^.concat(new(pai68k,op_const_reg(A_ASL,opsize,power,
+                                        exprasmlist^.concat(new(paicpu,op_const_reg(A_ASL,opsize,power,
                                          p^.location.register)))
                                     else
                                       begin
-                                        exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,power,
+                                        exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,power,
                                          R_D6)));
-                                        exprasmlist^.concat(new(pai68k,op_reg_reg(A_ASL,opsize,R_D6,
+                                        exprasmlist^.concat(new(paicpu,op_reg_reg(A_ASL,opsize,R_D6,
                                           p^.location.register)))
                                       end;
                                   end
@@ -854,7 +854,7 @@ implementation
                                        if extra_not then
                                          begin
                                             emit_reg_reg(A_MOVE,S_L,p^.right^.location.register,R_D6);
-                                            exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,R_D6)));
+                                            exprasmlist^.concat(new(paicpu,op_reg(A_NOT,S_L,R_D6)));
                                             emit_reg_reg(A_AND,S_L,R_D6,
                                               p^.location.register);
                                          end
@@ -881,9 +881,9 @@ implementation
                                     begin
                                        if extra_not then
                                          begin
-                                            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(
+                                            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(
                                               p^.right^.location.reference),R_D6)));
-                                            exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,R_D6)));
+                                            exprasmlist^.concat(new(paicpu,op_reg(A_NOT,S_L,R_D6)));
                                             emit_reg_reg(A_AND,S_L,R_D6,
                                               p^.location.register);
                                          end
@@ -892,7 +892,7 @@ implementation
                                             if (op=A_MULS) and (opsize = S_L) and (aktoptprocessor=MC68000) then
                                             { Emulation for MC68000 }
                                             begin
-                                              exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE, opsize,
+                                              exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE, opsize,
                                                  newreference(p^.right^.location.reference),R_D1)));
                                               emit_reg_reg(A_MOVE,opsize,p^.location.register,R_D0);
                                               emitcall('FPC_LONGMUL',true);
@@ -908,13 +908,13 @@ implementation
                                             { on the m68k                                               }
                                             if (op=A_EOR) then
                                               begin
-                                                exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,newreference(
+                                                exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,newreference(
                                                     p^.right^.location.reference),R_D0)));
-                                                exprasmlist^.concat(new(pai68k,op_reg_reg(op,opsize,R_D0,
+                                                exprasmlist^.concat(new(paicpu,op_reg_reg(op,opsize,R_D0,
                                                     p^.location.register)));
                                               end
                                             else
-                                              exprasmlist^.concat(new(pai68k,op_ref_reg(op,opsize,newreference(
+                                              exprasmlist^.concat(new(paicpu,op_ref_reg(op,opsize,newreference(
                                                 p^.right^.location.reference),p^.location.register)));
                                          end;
                                        del_reference(p^.right^.location.reference);
@@ -928,9 +928,9 @@ implementation
                         if (p^.treetype=subn) and p^.swaped then
                           begin
                              if extra_not then
-                               exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,p^.location.register)));
+                               exprasmlist^.concat(new(paicpu,op_reg(A_NOT,S_L,p^.location.register)));
 
-                             exprasmlist^.concat(new(pai68k,op_reg_reg(op,opsize,
+                             exprasmlist^.concat(new(paicpu,op_reg_reg(op,opsize,
                                p^.location.register,p^.right^.location.register)));
                                swap_location(p^.location,p^.right^.location);
 
@@ -941,7 +941,7 @@ implementation
                         else
                           begin
                              if extra_not then
-                                   exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,p^.right^.location.register)));
+                                   exprasmlist^.concat(new(paicpu,op_reg(A_NOT,S_L,p^.right^.location.register)));
 
                              if (op=A_MULS) and (opsize = S_L) and (aktoptprocessor=MC68000) then
                              { Emulation for MC68000 }
@@ -957,7 +957,7 @@ implementation
                               CGMessage(cg_f_32bit_not_supported_in_68000)
                              else
 
-                               exprasmlist^.concat(new(pai68k,op_reg_reg(op,opsize,
+                               exprasmlist^.concat(new(paicpu,op_reg_reg(op,opsize,
                                p^.right^.location.register,
                                p^.location.register)));
                           end;
@@ -1012,7 +1012,7 @@ implementation
 
                              { first give free then demand new register }
                              hregister:=getregister32;
-                             exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,newreference(p^.location.reference),
+                             exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,newreference(p^.location.reference),
                                hregister)));
                           end;
                         clear_location(p^.location);
@@ -1039,7 +1039,7 @@ implementation
                           end
                         else
                           begin
-                             exprasmlist^.concat(new(pai68k,op_ref_reg(A_CMP,S_B,newreference(
+                             exprasmlist^.concat(new(paicpu,op_ref_reg(A_CMP,S_B,newreference(
                                 p^.right^.location.reference),p^.location.register)));
                              del_reference(p^.right^.location.reference);
                           end;
@@ -1109,12 +1109,12 @@ implementation
                               begin
                                { fpu_reg = right / D1 }
                                { fpu_reg = right - D1 }
-                                  exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D0)));
+                                  exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D0)));
 
 
                                   { load value into D1 }
                                   if p^.right^.location.loc <> LOC_FPU then
-                                     exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                                     exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                                        newreference(p^.right^.location.reference),R_D1)))
                                   else
                                      emit_reg_reg(A_MOVE,S_L,p^.right^.location.fpureg,R_D1);
@@ -1128,7 +1128,7 @@ implementation
                                    A_FCMP: emitcall('FPC_SINGLE_CMP',true);
                                   end;
                                   if not cmpop then { only flags are affected with cmpop }
-                                     exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D0,
+                                     exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_D0,
                                        p^.left^.location.fpureg)));
 
                                   { if this was a reference, then delete as it }
@@ -1140,7 +1140,7 @@ implementation
                               begin
 
                                   if p^.right^.location.loc <> LOC_FPU then
-                                    exprasmlist^.concat(new(pai68k,op_ref_reg(A_FMOVE,
+                                    exprasmlist^.concat(new(paicpu,op_ref_reg(A_FMOVE,
                                        getfloatsize(pfloatdef(p^.left^.resulttype)^.typ),
                                       newreference(p^.right^.location.reference),
                                       R_FP1)))
@@ -1149,13 +1149,13 @@ implementation
                                     emit_reg_reg(A_FMOVE,S_FX,p^.right^.location.fpureg,R_FP1);
 
                                   { arithmetic expression performed in extended mode }
-                                  exprasmlist^.concat(new(pai68k,op_reg_reg(op,S_FX,
+                                  exprasmlist^.concat(new(paicpu,op_reg_reg(op,S_FX,
                                       p^.left^.location.fpureg,R_FP1)));
 
                                   { cmpop does not change any floating point register!! }
                                   if not cmpop then
                                        emit_reg_reg(A_FMOVE,S_FX,R_FP1,p^.left^.location.fpureg)
-{                                       exprasmlist^.concat(new(pai68k,op_reg_reg(A_FMOVE,
+{                                       exprasmlist^.concat(new(paicpu,op_reg_reg(A_FMOVE,
                                        getfloatsize(pfloatdef(p^.left^.resulttype)^.typ),
                                        R_FP1,p^.left^.location.fpureg)))}
                                   else
@@ -1178,7 +1178,7 @@ implementation
 
                              { load value into D7 }
                              if p^.right^.location.loc <> LOC_FPU then
-                               exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                               exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                                  newreference(p^.right^.location.reference),R_D0)))
                              else
                                emit_reg_reg(A_MOVE,S_L,p^.right^.location.fpureg,R_D0);
@@ -1193,7 +1193,7 @@ implementation
                                A_FCMP: emitcall('FPC_SINGLE_CMP',true);
                              end;
                              if not cmpop then { only flags are affected with cmpop }
-                               exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D0,
+                               exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_D0,
                                  p^.left^.location.fpureg)));
                              { if this was a reference, then delete as it }
                              { it no longer required.                     }
@@ -1203,7 +1203,7 @@ implementation
                            else
                            begin
                              if p^.right^.location.loc <> LOC_FPU then
-                               exprasmlist^.concat(new(pai68k,op_ref_reg(A_FMOVE,
+                               exprasmlist^.concat(new(paicpu,op_ref_reg(A_FMOVE,
                                  getfloatsize(pfloatdef(p^.left^.resulttype)^.typ),
                                  newreference(p^.right^.location.reference),R_FP1)))
                              else
@@ -1281,7 +1281,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.16  1999-09-16 11:34:52  pierre
+  Revision 1.17  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.16  1999/09/16 11:34:52  pierre
    * typo correction
 
   Revision 1.15  1998/12/11 00:02:57  peter

+ 189 - 180
compiler/cg68kcal.pas

@@ -39,11 +39,11 @@ interface
 implementation
 
     uses
-      globtype,systems,
+      globtype,systems,symconst,
       cobjects,verbose,globals,
       aasm,types,
       hcodegen,temp_gen,pass_2,
-      m68k,cga68k,tgen68k,cg68kld;
+      cpubase,cga68k,tgen68k,cg68kld;
 
 {*****************************************************************************
                              SecondCallParaN
@@ -70,7 +70,7 @@ implementation
                    reset_reference(r^);
                    r^.base:=highframepointer;
                    r^.offset:=highoffset+4;
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,R_SPPUSH)));
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,R_SPPUSH)));
                  end
                 else
                  push_int(parraydef(p^.left^.resulttype)^.highrange-parraydef(p^.left^.resulttype)^.lowrange);
@@ -80,7 +80,7 @@ implementation
       var
          size : longint;
          stackref : treference;
-         otlabel,hlabel,oflabel : plabel;
+         otlabel,hlabel,oflabel : pasmlabel;
          { temporary variables: }
          reg : tregister;
          tempdeftype : tdeftype;
@@ -106,7 +106,7 @@ implementation
               if p^.left^.treetype=addrn then
                 begin
                    { allways a register }
-                   exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,p^.left^.location.register,R_SPPUSH)));
+                   exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,p^.left^.location.register,R_SPPUSH)));
                    ungetregister32(p^.left^.location.register);
                 end
               else
@@ -137,8 +137,9 @@ implementation
               tempdeftype:=p^.resulttype^.deftype;
               if tempdeftype=filedef then
                CGMessage(cg_e_file_must_call_by_reference);
-              if (defcoll^.paratyp=vs_const) and
-                 dont_copy_const_param(p^.resulttype) then
+              if (assigned(defcoll^.data) and
+                  is_open_array(defcoll^.data)) or
+                 push_addr_param(p^.resulttype) then
                 begin
                    maybe_push_open_array_high;
                    inc(pushedparasize,4);
@@ -155,7 +156,7 @@ implementation
                                    { indicates the parameter size to push, but    }
                                    { that is CERTAINLY NOT TRUE!                  }
                                    { CAN WE USE LIKE LOC_MEM OR LOC_REFERENCE??   }
-                                     case integer(p^.left^.resulttype^.savesize) of
+                                     case integer(p^.left^.resulttype^.size) of
                                      1 : Begin
                                      { A byte sized value normally increments       }
                                      { the SP by 2, BUT because how memory has      }
@@ -165,9 +166,9 @@ implementation
                                      {  PUSH A WORD SHIFTED LEFT 8                  }
                                            reg := getregister32;
                                            emit_reg_reg(A_MOVE, S_B, p^.left^.location.register, reg);
-                                           exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_W,
+                                           exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_W,
                                              8, reg)));
-                                           exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_W,
+                                           exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_W,
                                             reg,R_SPPUSH)));
                                            { offset will be TWO greater              }
                                            inc(pushedparasize,2);
@@ -176,20 +177,20 @@ implementation
                                          end;
                                      2 :
                                               Begin
-                                                 exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_W,
+                                                 exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_W,
                                                    p^.left^.location.register,R_SPPUSH)));
                                                  inc(pushedparasize,2);
                                                  ungetregister32(p^.left^.location.register);
                                               end;
                                       4 : Begin
-                                             exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
+                                             exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,
                                                  p^.left^.location.register,R_SPPUSH)));
                                              inc(pushedparasize,4);
                                              ungetregister32(p^.left^.location.register);
                                           end;
                                       else
                                        Begin
-                                         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
+                                         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,
                                            p^.left^.location.register,R_SPPUSH)));
                                          inc(pushedparasize,4);
                                          ungetregister32(p^.left^.location.register);
@@ -201,9 +202,9 @@ implementation
                                         inc(pushedparasize,size);
                                         { how now how long a FPU is !! }
                                         if (size > 0) and (size < 9) then
-                                          exprasmlist^.concat(new(pai68k,op_const_reg(A_SUBQ,S_L,size,R_SP)))
+                                          exprasmlist^.concat(new(paicpu,op_const_reg(A_SUBQ,S_L,size,R_SP)))
                                         else
-                                          exprasmlist^.concat(new(pai68k,op_const_reg(A_SUBA,
+                                          exprasmlist^.concat(new(paicpu,op_const_reg(A_SUBA,
                                             S_L,size,R_SP)));
                                         new(r);
                                         reset_reference(r^);
@@ -213,12 +214,12 @@ implementation
                                         begin
                                           { when in emulation mode... }
                                           { only single supported!!!  }
-                                          exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_L,
+                                          exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_L,
                                              p^.left^.location.fpureg,r)));
                                         end
                                         else
                                           { convert back from extended to normal type }
-                                          exprasmlist^.concat(new(pai68k,op_reg_ref(A_FMOVE,s,
+                                          exprasmlist^.concat(new(paicpu,op_reg_ref(A_FMOVE,s,
                                              p^.left^.location.fpureg,r)));
                                      end;
                    LOC_REFERENCE,LOC_MEM :
@@ -241,7 +242,7 @@ implementation
                                                           { SWAP OPERANDS:                                 }
                                                           if tempreference.isintvalue then
                                                           Begin
-                                                            exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_W,
+                                                            exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_W,
                                                              tempreference.offset shl 8,R_SPPUSH)));
                                                           end
                                                           else
@@ -253,20 +254,20 @@ implementation
                                                            { by hand instead.                             }
                                                            {  PUSH A WORD SHIFTED LEFT 8                  }
                                                             reg:=getregister32;
-                                                            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,
+                                                            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,
                                                              newreference(tempreference),reg)));
-                                                            exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_W,
+                                                            exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_W,
                                                              8, reg)));
-                                                            exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_W,
+                                                            exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_W,
                                                              reg,R_SPPUSH)));
                                                             ungetregister32(reg);
-{                                                           exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,
+{                                                           exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,
                                                              newreference(tempreference),R_SPPUSH))); }
                                                           end;
                                                           inc(pushedparasize,2);
                                                         end;
                                                     2 : begin
-                                                          exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,
+                                                          exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,
                                                             newreference(tempreference),R_SPPUSH)));
                                                           inc(pushedparasize,2);
                                                         end;
@@ -300,7 +301,7 @@ implementation
                                                                    dec(tempreference.offset,4);
                                                                    emit_push_mem(tempreference);
                                                                    dec(tempreference.offset,2);
-                                                                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,
+                                                                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,
                                                                      newreference(tempreference),R_SPPUSH)));
                                                                    inc(pushedparasize,extended_size);}
                                                                 end;
@@ -334,9 +335,9 @@ implementation
                                                         }
                                                         { create stack space }
                                                         if (size > 0) and (size < 9) then
-                                                            exprasmlist^.concat(new(pai68k,op_const_reg(A_SUBQ,S_L,size,R_SP)))
+                                                            exprasmlist^.concat(new(paicpu,op_const_reg(A_SUBQ,S_L,size,R_SP)))
                                                         else
-                                                            exprasmlist^.concat(new(pai68k,op_const_reg(A_SUBA,
+                                                            exprasmlist^.concat(new(paicpu,op_const_reg(A_SUBA,
                                                               S_L,size,R_SP)));
                                                         inc(pushedparasize,size);
                                                         { create stack reference }
@@ -363,23 +364,23 @@ implementation
                                    getlabel(hlabel);
                                    inc(pushedparasize,2);
                                    emitl(A_LABEL,truelabel);
-                                   exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_W,1 shl 8,R_SPPUSH)));
+                                   exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_W,1 shl 8,R_SPPUSH)));
                                    emitl(A_JMP,hlabel);
                                    emitl(A_LABEL,falselabel);
-                                   exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_W,0,R_SPPUSH)));
+                                   exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_W,0,R_SPPUSH)));
                                    emitl(A_LABEL,hlabel);
                                 end;
                  LOC_FLAGS    : begin
-                                   exprasmlist^.concat(new(pai68k,op_reg(flag_2_set[p^.left^.location.resflags],S_B,
+                                   exprasmlist^.concat(new(paicpu,op_reg(flag_2_set[p^.left^.location.resflags],S_B,
                                      R_D0)));
-                                   exprasmlist^.concat(new(pai68k,op_reg(A_NEG, S_B, R_D0)));
-                                   exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_W,$ff, R_D0)));
+                                   exprasmlist^.concat(new(paicpu,op_reg(A_NEG, S_B, R_D0)));
+                                   exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_W,$ff, R_D0)));
                                    inc(pushedparasize,2);
                                    { ----------------- HACK ----------------------- }
                                    { HERE IS THE BYTE SIZED PUSH HACK ONCE AGAIN    }
                                    { SHIFT LEFT THE BYTE TO MAKE IT WORK!           }
-                                   exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_W,8, R_D0)));
-                                   exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_W,R_D0,R_SPPUSH)));
+                                   exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_W,8, R_D0)));
+                                   exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_W,R_D0,R_SPPUSH)));
                                 end;
                 end;
            end;
@@ -414,7 +415,7 @@ implementation
          { true if a constructor is called again }
          extended_new : boolean;
          { adress returned from an I/O-error }
-         iolabel : plabel;
+         iolabel : pasmlabel;
          { lexlevel count }
          i : longint;
          { help reference pointer }
@@ -438,15 +439,15 @@ implementation
            exit;
          { only if no proc var }
          if not(assigned(p^.right)) then
-           is_con_or_destructor:=((p^.procdefinition^.options and poconstructor)<>0)
-             or ((p^.procdefinition^.options and podestructor)<>0);
+           is_con_or_destructor:=(potype_constructor=p^.procdefinition^.proctypeoption)
+             or (potype_destructor=p^.procdefinition^.proctypeoption);
          { proc variables destroy all registers }
          if (p^.right=nil) and
          { virtual methods too }
-           ((p^.procdefinition^.options and povirtualmethod)=0) then
+           (po_virtualmethod in p^.procdefinition^.procoptions) then
            begin
-              if ((p^.procdefinition^.options and poiocheck)<>0) and
-                 ((aktprocsym^.definition^.options and poiocheck)=0) and
+              if (po_iocheck in p^.procdefinition^.procoptions) and
+                 not(po_iocheck in aktprocsym^.definition^.procoptions) and
                  (cs_check_io in aktlocalswitches) then
                 begin
                        getlabel(iolabel);
@@ -455,10 +456,10 @@ implementation
               else iolabel:=nil;
 
               { save all used registers }
-              pushusedregisters(pushed,p^.procdefinition^.usedregisters);
+              pushusedregisters(pushed,pprocdef(p^.procdefinition)^.usedregisters);
 
               { give used registers through }
-              usedinproc:=usedinproc or p^.procdefinition^.usedregisters;
+              usedinproc:=usedinproc or pprocdef(p^.procdefinition)^.usedregisters;
            end
          else
            begin
@@ -495,10 +496,10 @@ implementation
               { be found elsewhere }
               if assigned(p^.right) then
                 secondcallparan(p^.left,pprocvardef(p^.right^.resulttype)^.para1,
-                  (p^.procdefinition^.options and poleftright)<>0)
+                  (pocall_leftright in p^.procdefinition^.proccalloptions))
               else
                 secondcallparan(p^.left,p^.procdefinition^.para1,
-                  (p^.procdefinition^.options and poleftright)<>0);
+                  (pocall_leftright in p^.procdefinition^.proccalloptions));
            end;
          params:=p^.left;
          p^.left:=nil;
@@ -525,7 +526,7 @@ implementation
                    reset_reference(r^);
                    r^.offset:=p^.symtable^.datasize;
                    r^.base:=procinfo.framepointer;
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,R_A5)));
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,R_A5)));
                 end;
 
               { push self }
@@ -536,91 +537,87 @@ implementation
                    if assigned(p^.methodpointer) then
                      begin
                         case p^.methodpointer^.treetype of
-                           typen : begin
-                                      { direct call to inherited method }
-                                      if (p^.procdefinition^.options and poabstractmethod)<>0 then
-                                        begin
-                                           CGMessage(cg_e_cant_call_abstract_method);
-                                           goto dont_call;
-                                        end;
-                                      { generate no virtual call }
-                                      no_virtual_call:=true;
-                             if (p^.symtableprocentry^.properties and sp_static)<>0 then
+                           typen :
+                             begin
+                                { direct call to inherited method }
+                                if po_abstractmethod in p^.procdefinition^.procoptions then
+                                  begin
+                                     CGMessage(cg_e_cant_call_abstract_method);
+                                     goto dont_call;
+                                  end;
+                                { generate no virtual call }
+                                no_virtual_call:=true;
+                                if (sp_static in p^.symtableprocentry^.symoptions) then
                                  begin
                                     { well lets put the VMT address directly into a5 }
                                     { it is kind of dirty but that is the simplest    }
                                     { way to accept virtual static functions (PM)     }
                                     loada5:=true;
-                                    exprasmlist^.concat(new(pai68k,op_csymbol_reg(A_MOVE,S_L,
+                                    exprasmlist^.concat(new(paicpu,op_csymbol_reg(A_MOVE,S_L,
                                       newcsymbol(pobjectdef(p^.methodpointer^.resulttype)^.vmt_mangledname,0),R_A5)));
-                                    concat_external(pobjectdef(p^.methodpointer^.resulttype)^.vmt_mangledname,EXT_NEAR);
-                                    exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
+                                    exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
                                  end
                                else
 
                                   { this is a member call, so A5 isn't modfied }
                                   loada5:=false;
 
-                               if not(is_con_or_destructor and
-                                  pobjectdef(p^.methodpointer^.resulttype)^.isclass and
-                                  assigned(aktprocsym) and
-                                  ((aktprocsym^.definition^.options and
-                                  (poconstructor or podestructor))<>0)) then
-                                        exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
-                                 { if an inherited con- or destructor should be  }
-                                 { called in a con- or destructor then a warning }
-                                 { will be made                                  }
-                                 { con- and destructors need a pointer to the vmt }
-                                 if is_con_or_destructor and
-                                   ((pobjectdef(p^.methodpointer^.resulttype)^.options and oo_is_class)=0) and
-                                   assigned(aktprocsym) then
-                                   begin
-                                    if not ((aktprocsym^.definition^.options
-                                      and (poconstructor or podestructor))<>0) then
-                                        CGMessage(cg_w_member_cd_call_from_method);
-                                   end;
-                                      { con- and destructors need a pointer to the vmt }
-                                      if is_con_or_destructor then
-                                        begin
-                                           { classes need the mem ! }
-                                           if ((pobjectdef(p^.methodpointer^.resulttype)^.options and
-
-                                            oo_is_class)=0) then
-                                             push_int(0)
-                                           else
-                                               begin
-                                                  exprasmlist^.concat(new(pai68k,op_csymbol(A_PEA,
-                                                   S_L,newcsymbol(pobjectdef(p^.methodpointer^.
-                                                   resulttype)^.vmt_mangledname,0))));
-                                                   concat_external(pobjectdef(p^.methodpointer^.resulttype)^.
-                                                  vmt_mangledname,EXT_NEAR);
-                                               end;
-                                        end;
+                                    { a class destructor needs a flag }
+                                    if pobjectdef(p^.methodpointer^.resulttype)^.is_class and
+                                       assigned(aktprocsym) and
+                                       (aktprocsym^.definition^.proctypeoption=potype_destructor) then
+                                      begin
+                                        push_int(0);
+                                        exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
+                                      end;
+
+                                    if not(is_con_or_destructor and
+                                           pobjectdef(p^.methodpointer^.resulttype)^.is_class and
+                                           assigned(aktprocsym) and
+                                           (aktprocsym^.definition^.proctypeoption in [potype_constructor,potype_destructor])
+                                          ) then
+                                      exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
+                                    { if an inherited con- or destructor should be  }
+                                    { called in a con- or destructor then a warning }
+                                    { will be made                                }
+                                    { con- and destructors need a pointer to the vmt }
+                                    if is_con_or_destructor and
+                                    not(pobjectdef(p^.methodpointer^.resulttype)^.is_class) and
+                                    assigned(aktprocsym) then
+                                      begin
+                                         if not(aktprocsym^.definition^.proctypeoption in
+                                                [potype_constructor,potype_destructor]) then
+                                          CGMessage(cg_w_member_cd_call_from_method);
+                                      end;
+                                    { class destructors get there flag below }
+                                    if is_con_or_destructor and
+                                        not(pobjectdef(p^.methodpointer^.resulttype)^.is_class and
+                                        assigned(aktprocsym) and
+                                        (aktprocsym^.definition^.proctypeoption=potype_destructor)) then
+                                       push_int(0);
                                    end;
                            hnewn : begin
                                      { extended syntax of new }
                                      { A5 must be zero }
-                                     exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,0,R_A5)));
+                                     exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,0,R_A5)));
                                      emit_reg_reg(A_MOVE,S_L,R_A5, R_SPPUSH);
                                      { insert the vmt }
-                                     exprasmlist^.concat(new(pai68k,op_csymbol(A_PEA,S_L,
+                                     exprasmlist^.concat(new(paicpu,op_csymbol(A_PEA,S_L,
                                        newcsymbol(pobjectdef(p^.methodpointer^.resulttype)^.vmt_mangledname,0))));
-                                     concat_external(pobjectdef(p^.methodpointer^.resulttype)^.vmt_mangledname,EXT_NEAR);
-                                              extended_new:=true;
+                                     extended_new:=true;
                                   end;
                            hdisposen : begin
                                           secondpass(p^.methodpointer);
 
                                           { destructor with extended syntax called from dispose }
                                           { hdisposen always deliver LOC_REFRENZ }
-                                          exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,
+                                          exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,
                                             newreference(p^.methodpointer^.location.reference),R_A5)));
                                           del_reference(p^.methodpointer^.location.reference);
-                                          exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
-                                          exprasmlist^.concat(new(pai68k,op_csymbol(A_PEA,S_L,
+                                          exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
+                                          exprasmlist^.concat(new(paicpu,op_csymbol(A_PEA,S_L,
                                             newcsymbol(pobjectdef
                                                (p^.methodpointer^.resulttype)^.vmt_mangledname,0))));
-                                          concat_external(pobjectdef(p^.methodpointer^.resulttype)^.vmt_mangledname,EXT_NEAR);
                                        end;
                            else
                              begin
@@ -639,12 +636,12 @@ implementation
                                         else
                                            begin
                                                  if (p^.methodpointer^.resulttype^.deftype=objectdef) and
-                                                   pobjectdef(p^.methodpointer^.resulttype)^.isclass then
-                                                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                                                   pobjectdef(p^.methodpointer^.resulttype)^.is_class then
+                                                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                                                      newreference(p^.methodpointer^.location.reference),R_A5)))
                                                  else
                                                   Begin
-                                                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,
+                                                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,
                                                      newreference(p^.methodpointer^.location.reference),R_A5)));
                                                   end;
 
@@ -652,68 +649,78 @@ implementation
                                              end;
                                      end;
                                   end;
-                                    { when calling a class method, we have
-                                      to load ESI with the VMT !
-                                      But that's wrong, if we call a class method via self
-                                    }
-                                    if ((p^.procdefinition^.options and poclassmethod)<>0)
-                                       and not(p^.methodpointer^.treetype=selfn) then
-                                      begin
-                                         { class method needs current VMT }
-                                         new(r);
-                                         reset_reference(r^);
-                                         r^.base:=R_A5;
-                                         r^.offset:= p^.procdefinition^._class^.vmt_offset;
-                                         exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,R_A5)));
-                                      end;
-
-                                   exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
+                                { when calling a class method, we have to load ESI with the VMT !
+                                  But, not for a class method via self }
+                                if not(po_containsself in p^.procdefinition^.procoptions) then
+                                  begin
+                                    if (po_classmethod in p^.procdefinition^.procoptions) and
+                                       not(p^.methodpointer^.resulttype^.deftype=classrefdef) then
+                                  begin
+                                     { class method needs current VMT }
+                                     new(r);
+                                     reset_reference(r^);
+                                     r^.base:=R_A5;
+                                     r^.offset:= pprocdef(p^.procdefinition)^._class^.vmt_offset;
+                                     exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,R_A5)));
+                                  end;
+                                    { direct call to destructor: don't remove data! }
+                                    if (p^.procdefinition^.proctypeoption=potype_destructor) and
+                                       (p^.methodpointer^.resulttype^.deftype=objectdef) and
+                                       (pobjectdef(p^.methodpointer^.resulttype)^.is_class) then
+                                      push_int(1);
+
+                                    { direct call to class constructor, don't allocate memory }
+                                    if (p^.procdefinition^.proctypeoption=potype_constructor) and
+                                       (p^.methodpointer^.resulttype^.deftype=objectdef) and
+                                       (pobjectdef(p^.methodpointer^.resulttype)^.is_class) then
+                                      push_int(0)
+                                    else
+                                      exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
                                    if is_con_or_destructor then
                                    begin
                                          { classes don't get a VMT pointer pushed }
                                          if (p^.methodpointer^.resulttype^.deftype=objectdef) and
-                                           not(pobjectdef(p^.methodpointer^.resulttype)^.isclass) then
+                                           not(pobjectdef(p^.methodpointer^.resulttype)^.is_class) then
                                            begin
 
-                                            if ((p^.procdefinition^.options and poconstructor)<>0) then
+                                            if (p^.procdefinition^.proctypeoption=potype_constructor) then
                                               begin
                                                { it's no bad idea, to insert the VMT }
-                                                      exprasmlist^.concat(new(pai68k,op_csymbol(A_PEA,S_L,
+                                                      exprasmlist^.concat(new(paicpu,op_csymbol(A_PEA,S_L,
                                                newcsymbol(pobjectdef(
                                                  p^.methodpointer^.resulttype)^.vmt_mangledname,0))));
-                                               concat_external(pobjectdef(
-                                                 p^.methodpointer^.resulttype)^.vmt_mangledname,EXT_NEAR);
                                               end
                                             { destructors haven't to dispose the instance, if this is }
                                             { a direct call                                           }
                                             else
                                               push_int(0);
                                            end;
+                                   end;
                                   end;
                              end;
                         end;
                      end
                    else
                      begin
-                         if ((p^.procdefinition^.options and poclassmethod)<>0) and
+                        if (po_classmethod in p^.procdefinition^.procoptions) and
                           not(
                             assigned(aktprocsym) and
-                            ((aktprocsym^.definition^.options and poclassmethod)<>0)
+                            (po_classmethod in aktprocsym^.definition^.procoptions)
                           ) then
                           begin
                              { class method needs current VMT }
                              new(r);
                              reset_reference(r^);
                              r^.base:=R_A5;
-                             r^.offset:= p^.procdefinition^._class^.vmt_offset;
-                             exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,R_A5)));
+                             r^.offset:= pprocdef(p^.procdefinition)^._class^.vmt_offset;
+                             exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,R_A5)));
                           end
                         else
                           begin
                              { member call, A5 isn't modified }
                              loada5:=false;
                           end;
-                        exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
+                        exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A5,R_SPPUSH)));
             { but a con- or destructor here would probably almost }
                         { always be placed wrong }
                         if is_con_or_destructor then
@@ -727,7 +734,7 @@ implementation
 
               { push base pointer ?}
               if (lexlevel>=normal_function_level) and assigned(pprocdef(p^.procdefinition)^.parast) and
-            ((p^.procdefinition^.parast^.symtablelevel)>normal_function_level) then
+            ((pprocdef(p^.procdefinition)^.parast^.symtablelevel)>normal_function_level) then
                     begin
                    { if we call a nested function in a method, we must      }
                    { push also SELF!                                        }
@@ -736,32 +743,32 @@ implementation
                    {
                      begin
                         loadesi:=false;
-                        exprasmlist^.concat(new(pai68k,op_reg(A_PUSH,S_L,R_ESI)));
+                        exprasmlist^.concat(new(paicpu,op_reg(A_PUSH,S_L,R_ESI)));
                      end;
                    }
-                   if lexlevel=(p^.procdefinition^.parast^.symtablelevel) then
+                   if lexlevel=(pprocdef(p^.procdefinition)^.parast^.symtablelevel) then
                      begin
                         new(r);
                         reset_reference(r^);
                         r^.offset:=procinfo.framepointer_offset;
                         r^.base:=procinfo.framepointer;
-                        exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,R_SPPUSH)))
+                        exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,R_SPPUSH)))
                      end
                      { this is only true if the difference is one !!
                        but it cannot be more !! }
-                   else if lexlevel=(p^.procdefinition^.parast^.symtablelevel)-1 then
+                   else if lexlevel=(pprocdef(p^.procdefinition)^.parast^.symtablelevel)-1 then
                      begin
-                        exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,procinfo.framepointer,R_SPPUSH)))
+                        exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,procinfo.framepointer,R_SPPUSH)))
                      end
-                   else if lexlevel>(p^.procdefinition^.parast^.symtablelevel) then
+                   else if lexlevel>(pprocdef(p^.procdefinition)^.parast^.symtablelevel) then
                      begin
                         hregister:=getaddressreg;
                         new(r);
                         reset_reference(r^);
                         r^.offset:=procinfo.framepointer_offset;
                         r^.base:=procinfo.framepointer;
-                        exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,hregister)));
-                        for i:=(p^.procdefinition^.parast^.symtablelevel) to lexlevel-1 do
+                        exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,hregister)));
+                        for i:=(pprocdef(p^.procdefinition)^.parast^.symtablelevel) to lexlevel-1 do
                           begin
                              new(r);
                              reset_reference(r^);
@@ -769,31 +776,30 @@ implementation
                              how can we do this !!! }
                              r^.offset:=procinfo.framepointer_offset;
                              r^.base:=hregister;
-                             exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,hregister)));
+                             exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,hregister)));
                           end;
-                        exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,hregister,R_SPPUSH)));
+                        exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,hregister,R_SPPUSH)));
                         ungetregister32(hregister);
                      end
                    else
                      internalerror(25000);
                 end;
 
-              { exported methods should be never called direct }
-              if (p^.procdefinition^.options and poexports)<>0 then
-               CGMessage(cg_e_dont_call_exported_direct);
-
-              if ((p^.procdefinition^.options and povirtualmethod)<>0) and
+              if (po_virtualmethod in p^.procdefinition^.procoptions) and
                  not(no_virtual_call) then
                 begin
                    { static functions contain the vmt_address in ESI }
                    { also class methods                              }
                    if assigned(aktprocsym) then
                      begin
-                       if ((aktprocsym^.properties and sp_static)<>0) or
-                        ((aktprocsym^.definition^.options and poclassmethod)<>0) or
-                        ((p^.procdefinition^.options and postaticmethod)<>0) or
-                        { A5 is already loaded  }
-                        ((p^.procdefinition^.options and poclassmethod)<>0)then
+                       if (((sp_static in aktprocsym^.symoptions) or
+                        (po_classmethod in aktprocsym^.definition^.procoptions)) and
+                        ((p^.methodpointer=nil) or (p^.methodpointer^.treetype=typen)))
+                        or
+                        (po_staticmethod in p^.procdefinition^.procoptions) or
+                        (p^.procdefinition^.proctypeoption=potype_constructor) or
+                        { A5 is loaded earlier }
+                        (po_classmethod in p^.procdefinition^.procoptions) then
                          begin
                             new(r);
                             reset_reference(r^);
@@ -804,8 +810,8 @@ implementation
                             new(r);
                             reset_reference(r^);
                             r^.base:=R_a5;
-                            r^.offset:= p^.procdefinition^._class^.vmt_offset;
-                            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,R_a0)));
+                            r^.offset:= pprocdef(p^.procdefinition)^._class^.vmt_offset;
+                            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,R_a0)));
                             new(r);
                             reset_reference(r^);
                             r^.base:=R_a0;
@@ -816,14 +822,14 @@ implementation
                        new(r);
                        reset_reference(r^);
                          r^.base:=R_a5;
-                       exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,R_a0)));
+                       exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,R_a0)));
                        new(r);
                        reset_reference(r^);
                        r^.base:=R_a0;
                      end;
-                  if p^.procdefinition^.extnumber=-1 then
-                        internalerror($Da);
-                  r^.offset:=p^.procdefinition^.extnumber*4+12;
+                  if pprocdef(p^.procdefinition)^.extnumber=-1 then
+                    internalerror(1609991);
+                  r^.offset:=pprocdef(p^.procdefinition)^.extnumber*4+12;
                   if (cs_check_range in aktlocalswitches) then
                     begin
                      { If the base is already A0, the no instruction will }
@@ -835,32 +841,32 @@ implementation
                    { register a0 and/or a5                                 }
                    { Because doing an indirect call with offset is NOT     }
                    { allowed on the m68k!                                  }
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(r^),R_A0)));
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(r^),R_A0)));
                    { clear the reference }
                    reset_reference(r^);
                    r^.base := R_A0;
-                  exprasmlist^.concat(new(pai68k,op_ref(A_JSR,S_NO,r)));
+                  exprasmlist^.concat(new(paicpu,op_ref(A_JSR,S_NO,r)));
                 end
-              else if (p^.procdefinition^.options and popalmossyscall)<>0 then
+              else if pocall_palmossyscall in p^.procdefinition^.proccalloptions then
                 begin
-                   exprasmlist^.concat(new(pai68k,op_const(A_TRAP,S_NO,15)));
-                   exprasmlist^.concat(new(pai_const,init_16bit(p^.procdefinition^.extnumber)));
+                   exprasmlist^.concat(new(paicpu,op_const(A_TRAP,S_NO,15)));
+                   exprasmlist^.concat(new(pai_const,init_16bit(pprocdef(p^.procdefinition)^.extnumber)));
                 end
               else
-                emitcall(p^.procdefinition^.mangledname,
+                emitcall(pprocdef(p^.procdefinition)^.mangledname,
                   (p^.symtableproc^.symtabletype=unitsymtable) or
                   ((p^.symtableproc^.symtabletype=objectsymtable) and
                   (pobjectdef(p^.symtableproc^.defowner)^.owner^.symtabletype=unitsymtable))or
                   ((p^.symtableproc^.symtabletype=withsymtable) and
                   (pobjectdef(p^.symtableproc^.defowner)^.owner^.symtabletype=unitsymtable)));
-              if ((p^.procdefinition^.options and poclearstack)<>0) then
+              if (pocall_clearstack in p^.procdefinition^.proccalloptions) then
                 begin
                    if (pushedparasize > 0) and (pushedparasize < 9) then
                      { restore the stack, to its initial value }
-                     exprasmlist^.concat(new(pai68k,op_const_reg(A_ADDQ,S_L,pushedparasize,R_SP)))
+                     exprasmlist^.concat(new(paicpu,op_const_reg(A_ADDQ,S_L,pushedparasize,R_SP)))
                    else
                      { restore the stack, to its initial value }
-                     exprasmlist^.concat(new(pai68k,op_const_reg(A_ADDA,S_L,pushedparasize,R_SP)));
+                     exprasmlist^.concat(new(paicpu,op_const_reg(A_ADDA,S_L,pushedparasize,R_SP)));
                 end;
            end
          else
@@ -876,7 +882,7 @@ implementation
                                        new(ref);
                                        reset_reference(ref^);
                                        ref^.base := reg;
-                                       exprasmlist^.concat(new(pai68k,op_ref(A_JSR,S_NO,ref)));
+                                       exprasmlist^.concat(new(paicpu,op_ref(A_JSR,S_NO,ref)));
                                        ungetregister(reg);
                                     end
                                    else
@@ -884,7 +890,7 @@ implementation
                                         new(ref);
                                         reset_reference(ref^);
                                         ref^.base := p^.right^.location.register;
-                                        exprasmlist^.concat(new(pai68k,op_ref(A_JSR,S_NO,ref)));
+                                        exprasmlist^.concat(new(paicpu,op_ref(A_JSR,S_NO,ref)));
                                     end;
                                    ungetregister32(p^.right^.location.register);
                                 end
@@ -895,21 +901,21 @@ implementation
                       { problem by loading the address first, and then emitting }
                       { the call.                                              }
                        begin
-                         exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                         exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                            newreference(p^.right^.location.reference),R_A1)));
                          new(ref);
                          reset_reference(ref^);
                          ref^.base := R_A1;
-                         exprasmlist^.concat(new(pai68k,op_ref(A_JSR,S_NO,ref)));
+                         exprasmlist^.concat(new(paicpu,op_ref(A_JSR,S_NO,ref)));
                        end
                        else
                        begin
-                         exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                         exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                            newreference(p^.right^.location.reference),R_A1)));
                          new(ref);
                          reset_reference(ref^);
                          ref^.base := R_A1;
-                         exprasmlist^.concat(new(pai68k,op_ref(A_JSR,S_NO,ref)));
+                         exprasmlist^.concat(new(paicpu,op_ref(A_JSR,S_NO,ref)));
                        end;
                        del_reference(p^.right^.location.reference);
                     end;
@@ -925,7 +931,7 @@ implementation
 
               { a contructor could be a function with boolean result }
               if (p^.right=nil) and
-                 ((p^.procdefinition^.options and poconstructor)<>0) and
+                 (p^.procdefinition^.proctypeoption=potype_constructor) and
                  { quick'n'dirty check if it is a class or an object }
                  (p^.resulttype^.deftype=orddef) then
                 begin
@@ -952,23 +958,23 @@ implementation
                 end
               else
                 begin
-                   if (p^.resulttype^.deftype=orddef) then
+                   if (p^.resulttype^.deftype in [orddef,enumdef]) then
                      begin
                         p^.location.loc:=LOC_REGISTER;
-                  case porddef(p^.resulttype)^.typ of
-                     s32bit,u32bit :
+                  case p^.resulttype^.size of
+                     4 :
                         begin
                              hregister:=getregister32;
                              emit_reg_reg(A_MOVE,S_L,R_D0,hregister);
                              p^.location.register:=hregister;
                         end;
-                     uchar,u8bit,bool8bit,s8bit :
+                     1 :
                         begin
                             hregister:=getregister32;
                             emit_reg_reg(A_MOVE,S_B,R_D0,hregister);
                             p^.location.register:=hregister;
                         end;
-                     s16bit,u16bit :
+                     2:
                        begin
                            hregister:=getregister32;
                            emit_reg_reg(A_MOVE,S_L,R_D0,hregister);
@@ -992,7 +998,7 @@ implementation
                                    emit_reg_reg(A_MOVE,S_L,R_D0,hregister);
                                    p^.location.fpureg:=hregister;
                                 end;
-                     s64bit,s64real,s80real: begin
+                     s64comp,s64real,s80real: begin
                                               if cs_fp_emulation in aktmoduleswitches then
                                               begin
                                                 p^.location.loc:=LOC_FPU;
@@ -1026,7 +1032,7 @@ implementation
          { perhaps i/o check ? }
          if iolabel<>nil then
            begin
-              exprasmlist^.concat(new(pai68k,op_csymbol(A_PEA,S_L,newcsymbol(lab2str(iolabel),0))));
+              exprasmlist^.concat(new(paicpu,op_csymbol(A_PEA,S_L,newcsymbol(iolabel^.name,0))));
               emitcall('FPC_IOCHECK',true);
            end;
 
@@ -1063,7 +1069,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18  1999-09-16 11:34:52  pierre
+  Revision 1.19  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.18  1999/09/16 11:34:52  pierre
    * typo correction
 
   Revision 1.17  1998/12/11 00:02:58  peter

+ 143 - 142
compiler/cg68kcnv.pas

@@ -37,11 +37,11 @@ interface
 implementation
 
    uses
-     globtype,systems,
+     globtype,systems,symconst,
      cobjects,verbose,globals,
      symtable,aasm,types,
      hcodegen,temp_gen,pass_2,
-     m68k,cga68k,tgen68k;
+     cpubase,cga68k,tgen68k;
 
 {*****************************************************************************
                              SecondTypeConv
@@ -52,7 +52,7 @@ implementation
       var
          hp : preference;
        hregister : tregister;
-       neglabel,poslabel : plabel;
+       neglabel,poslabel : pasmlabel;
 
       begin
          { convert from p2 to p1 }
@@ -76,13 +76,13 @@ implementation
                    if (p^.location.loc=LOC_REGISTER) or
                       (p^.location.loc=LOC_CREGISTER) then
                      begin
-                         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_B,p^.location.register,R_D6)));
-                         exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,$FF,R_D6)));
+                         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_B,p^.location.register,R_D6)));
+                         exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,$FF,R_D6)));
                      end
                    else
                      begin
-                         exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,newreference(p^.location.reference),R_D6)));
-                         exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,$FF,R_D6)));
+                         exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,newreference(p^.location.reference),R_D6)));
+                         exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,$FF,R_D6)));
                      end;
                    hregister:=R_D6;
                 end
@@ -91,26 +91,26 @@ implementation
                    if (p^.location.loc=LOC_REGISTER) or
                       (p^.location.loc=LOC_CREGISTER) then
                      begin
-                         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_B,p^.location.register,R_D6)));
+                         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_B,p^.location.register,R_D6)));
                          { byte to long }
                          if aktoptprocessor = MC68020 then
-                             exprasmlist^.concat(new(pai68k,op_reg(A_EXTB,S_L,R_D6)))
+                             exprasmlist^.concat(new(paicpu,op_reg(A_EXTB,S_L,R_D6)))
                          else
                            begin
-                             exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_W,R_D6)));
-                             exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_L,R_D6)));
+                             exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_W,R_D6)));
+                             exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_L,R_D6)));
                            end;
                      end
                    else
                      begin
-                         exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,newreference(p^.location.reference),R_D6)));
+                         exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,newreference(p^.location.reference),R_D6)));
                          { byte to long }
                          if aktoptprocessor = MC68020 then
-                             exprasmlist^.concat(new(pai68k,op_reg(A_EXTB,S_L,R_D6)))
+                             exprasmlist^.concat(new(paicpu,op_reg(A_EXTB,S_L,R_D6)))
                          else
                            begin
-                             exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_W,R_D6)));
-                             exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_L,R_D6)));
+                             exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_W,R_D6)));
+                             exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_L,R_D6)));
                            end;
                      end; { end outermost else }
                    hregister:=R_D6;
@@ -124,7 +124,7 @@ implementation
                      hregister:=p^.location.register
                    else
                      begin
-                        exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.location.reference),R_D6)));
+                        exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.location.reference),R_D6)));
                         hregister:=R_D6;
                      end;
                 end
@@ -133,22 +133,22 @@ implementation
                 begin
                    if (p^.location.loc=LOC_REGISTER) or
                       (p^.location.loc=LOC_CREGISTER) then
-                     exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_W,p^.location.register,R_D6)))
+                     exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_W,p^.location.register,R_D6)))
                    else
-                     exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,newreference(p^.location.reference),R_D6)));
+                     exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,newreference(p^.location.reference),R_D6)));
                    { unisgned extend }
-                   exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,$FFFF,R_D6)));
+                   exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,$FFFF,R_D6)));
                    hregister:=R_D6;
                 end
               else if porddef(p2)^.typ=s16bit then
                 begin
                    if (p^.location.loc=LOC_REGISTER) or
                       (p^.location.loc=LOC_CREGISTER) then
-                     exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_W,p^.location.register,R_D6)))
+                     exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_W,p^.location.register,R_D6)))
                    else
-                     exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,newreference(p^.location.reference),R_D6)));
+                     exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,newreference(p^.location.reference),R_D6)));
                    { sign extend }
-                   exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_L,R_D6)));
+                   exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_L,R_D6)));
                    hregister:=R_D6;
                 end
               else internalerror(6);
@@ -159,7 +159,7 @@ implementation
                 begin
                    getlabel(neglabel);
                    getlabel(poslabel);
-                   exprasmlist^.concat(new(pai68k,op_reg(A_TST,S_L,hregister)));
+                   exprasmlist^.concat(new(paicpu,op_reg(A_TST,S_L,hregister)));
                    emitl(A_BLT,neglabel);
                 end;
               emit_bounds_check(hp^,hregister);
@@ -216,7 +216,7 @@ implementation
                    else
                      begin
                         hregister:=getregister32;
-                        exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.location.reference),hregister)));
+                        exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.location.reference),hregister)));
                      end;
                 end
               { rangechecking for u32bit ?? !!!!!!}
@@ -226,23 +226,23 @@ implementation
                    if (p^.location.loc=LOC_REGISTER) or
                       (p^.location.loc=LOC_CREGISTER) then
                    begin
-                     exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_W,p^.location.register,hregister)));
+                     exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_W,p^.location.register,hregister)));
                    end
                    else
-                     exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,newreference(p^.location.reference),hregister)));
+                     exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,newreference(p^.location.reference),hregister)));
                    { clear unused bits  i.e unsigned extend}
-                   exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L, $FFFF, hregister)));
+                   exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L, $FFFF, hregister)));
                 end
               else if porddef(hp^.resulttype)^.typ=s16bit then
                 begin
                    hregister:=getregister32;
                    if (p^.location.loc=LOC_REGISTER) or
                       (p^.location.loc=LOC_CREGISTER) then
-                     exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_W,p^.location.register,hregister)))
+                     exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_W,p^.location.register,hregister)))
                    else
-                     exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,newreference(p^.location.reference),hregister)));
+                     exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,newreference(p^.location.reference),hregister)));
                    { sign extend }
-                   exprasmlist^.concat(new(pai68k,op_reg(A_EXT, S_L, hregister)));
+                   exprasmlist^.concat(new(paicpu,op_reg(A_EXT, S_L, hregister)));
                 end
               else internalerror(6);
 
@@ -275,7 +275,7 @@ implementation
               else
                  begin
                      hregister:=getregister32;
-                     exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(hp^.location.reference),hregister)));
+                     exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(hp^.location.reference),hregister)));
                  end;
               clear_location(p^.location);
               p^.location.loc:=LOC_REGISTER;
@@ -300,6 +300,7 @@ implementation
          is_register : boolean;
 
       begin
+{$ifdef dummy}
          is_register:=p^.left^.location.loc=LOC_REGISTER;
            if not(is_register) and (p^.left^.location.loc<>LOC_CREGISTER) then
              begin
@@ -314,14 +315,8 @@ implementation
          {Constanst cannot be loaded into registers using MOVZX!}
          if (p^.left^.location.loc<>LOC_MEM) or (not p^.left^.location.reference.isintvalue) then
              case convtyp of
-                     tc_u8bit_2_s32bit,
-                tc_u8bit_2_u32bit,
-                tc_s8bit_2_u32bit,
-                tc_s8bit_2_s16bit,
-                tc_s8bit_2_s32bit,
-                tc_u8bit_2_u16bit,
-                tc_s8bit_2_u16bit,
-                tc_u8bit_2_s16bit: begin
+                     tc_int_2_int:
+                                 begin
                                     if is_register then
                                       hregister := p^.left^.location.register
                                     else
@@ -333,39 +328,38 @@ implementation
                                       if p^.left^.location.loc = LOC_CREGISTER then
                                         emit_reg_reg(A_MOVE,S_B,p^.left^.location.register,hregister)
                                       else
-                                        exprasmlist^.concat(new(pai68k, op_ref_reg(A_MOVE,S_B,
+                                        exprasmlist^.concat(new(paicpu, op_ref_reg(A_MOVE,S_B,
                                          newreference(P^.left^.location.reference), hregister)));
                                     end;
-
                                     case convtyp of
                                       tc_u8bit_2_s32bit,
                                       tc_u8bit_2_u32bit:
-                                                   exprasmlist^.concat(new(pai68k, op_const_reg(
+                                                   exprasmlist^.concat(new(paicpu, op_const_reg(
                                                    A_AND,S_L,$FF,hregister)));
                                       tc_s8bit_2_u32bit,
                                       tc_s8bit_2_s32bit:
                                                   begin
                                                     if aktoptprocessor = MC68020 then
-                                                      exprasmlist^.concat(new(pai68k,op_reg
+                                                      exprasmlist^.concat(new(paicpu,op_reg
                                                         (A_EXTB,S_L,hregister)))
                                                     else { else if aktoptprocessor }
                                                     begin
                                                     { byte to word }
-                                                      exprasmlist^.concat(new(pai68k,op_reg
+                                                      exprasmlist^.concat(new(paicpu,op_reg
                                                         (A_EXT,S_W,hregister)));
                                                     { word to long }
-                                                      exprasmlist^.concat(new(pai68k,op_reg
+                                                      exprasmlist^.concat(new(paicpu,op_reg
                                                         (A_EXT,S_L,hregister)));
                                                     end;
                                                   end;
                                       tc_s8bit_2_u16bit,
                                       tc_u8bit_2_s16bit,
                                       tc_u8bit_2_u16bit:
-                                                  exprasmlist^.concat(new(pai68k, op_const_reg(
+                                                  exprasmlist^.concat(new(paicpu, op_const_reg(
                                                                 A_AND,S_W,$FF,hregister)));
 
                                       tc_s8bit_2_s16bit:
-                                                  exprasmlist^.concat(new(pai68k, op_reg(
+                                                  exprasmlist^.concat(new(paicpu, op_reg(
                                                                 A_EXT, S_W, hregister)));
 
                                     end; { inner case }
@@ -385,16 +379,16 @@ implementation
                                        if p^.left^.location.loc = LOC_CREGISTER then
                                          emit_reg_reg(A_MOVE,S_W,p^.left^.location.register,hregister)
                                        else
-                                         exprasmlist^.concat(new(pai68k, op_ref_reg(A_MOVE,S_W,
+                                         exprasmlist^.concat(new(paicpu, op_ref_reg(A_MOVE,S_W,
                                            newreference(P^.left^.location.reference), hregister)));
                                      end;
                                      if (convtyp = tc_u16bit_2_s32bit) or
                                         (convtyp = tc_u16bit_2_u32bit) then
-                                         exprasmlist^.concat(new(pai68k, op_const_reg(
+                                         exprasmlist^.concat(new(paicpu, op_const_reg(
                                            A_AND, S_L, $ffff, hregister)))
                                      else { tc_s16bit_2_s32bit }
                                           { tc_s16bit_2_u32bit }
-                                         exprasmlist^.concat(new(pai68k, op_reg(A_EXT,S_L,
+                                         exprasmlist^.concat(new(paicpu, op_reg(A_EXT,S_L,
                                            hregister)));
                                     end;
              end { end case }
@@ -433,7 +427,7 @@ implementation
               begin
                  if p^.left^.location.loc=LOC_CREGISTER then
                      emit_reg_reg(op,opsize,p^.left^.location.register,hregister)
-                 else exprasmlist^.concat(new(pai68k,op_ref_reg(op,opsize,
+                 else exprasmlist^.concat(new(paicpu,op_ref_reg(op,opsize,
                      newreference(p^.left^.location.reference),hregister)));
               end;
          end; { end elseif }
@@ -442,6 +436,7 @@ implementation
          p^.location.loc:=LOC_REGISTER;
          p^.location.register:=hregister;
          maybe_rangechecking(p,p^.left^.resulttype,p^.resulttype);
+{$endif dummy}
       end;
 
 
@@ -512,7 +507,7 @@ implementation
                       case p^.right^.location.loc of
                          LOC_REGISTER,LOC_CREGISTER:
                            begin
-                              { !!!!! exprasmlist^.concat(new(pai68k,op_reg(A_PUSH,S_L,p^.right^.location.register))); }
+                              { !!!!! exprasmlist^.concat(new(paicpu,op_reg(A_PUSH,S_L,p^.right^.location.register))); }
                               ungetregister32(p^.left^.location.register);
                            end;
                          LOC_REFERENCE,LOC_MEM:
@@ -570,7 +565,7 @@ implementation
          p^.location.loc:=LOC_REGISTER;
          p^.location.register:=getregister32;
          inc(p^.left^.location.reference.offset);
-         exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,newreference(p^.left^.location.reference),
+         exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,newreference(p^.left^.location.reference),
            R_A0)));
          emit_reg_reg(A_MOVE, S_L, R_A0, p^.location.register);
       end;
@@ -588,7 +583,7 @@ implementation
          clear_location(p^.location);
          p^.location.loc:=LOC_REGISTER;
          p^.location.register:=getregister32;
-         exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,newreference(p^.left^.location.reference),
+         exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,newreference(p^.left^.location.reference),
            R_A0)));
          emit_reg_reg(A_MOVE,S_L,R_A0, P^.location.register);
       end;
@@ -624,7 +619,7 @@ implementation
                 begin
                    del_reference(p^.left^.location.reference);
                    p^.location.reference.base:=getaddressreg;
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),
                      p^.location.reference.base)));
                 end;
            end;
@@ -655,7 +650,7 @@ implementation
            CGMessage(type_e_mismatch);
 
          { write the length }
-           exprasmlist^.concat(new(pai68k,op_const_ref(A_MOVE,S_B,l,
+           exprasmlist^.concat(new(paicpu,op_const_ref(A_MOVE,S_B,l,
              newreference(p^.location.reference))));
 
          { copy to first char of string }
@@ -711,20 +706,20 @@ implementation
           if (cs_fp_emulation in aktmoduleswitches) then
           begin
             p^.location.fpureg := getregister32;
-            exprasmlist^.concat(new(pai68k, op_ref_reg(A_MOVE, S_L, r, R_D0)));
+            exprasmlist^.concat(new(paicpu, op_ref_reg(A_MOVE, S_L, r, R_D0)));
             emitcall('FPC_LONG2SINGLE',true);
             emit_reg_reg(A_MOVE,S_L,R_D0,p^.location.fpureg);
           end
           else
           begin
             p^.location.fpureg := getfloatreg;
-            exprasmlist^.concat(new(pai68k, op_ref_reg(A_FMOVE, S_L, r, p^.location.fpureg)))
+            exprasmlist^.concat(new(paicpu, op_ref_reg(A_FMOVE, S_L, r, p^.location.fpureg)))
           end;
         if porddef(p^.left^.resulttype)^.typ=u32bit then
-           exprasmlist^.concat(new(pai68k,op_const_reg(A_ADD,S_L,8,R_SP)))
+           exprasmlist^.concat(new(paicpu,op_const_reg(A_ADD,S_L,8,R_SP)))
         else
         { restore the stack to the previous address }
-           exprasmlist^.concat(new(pai68k, op_const_reg(A_ADDQ, S_L, 4, R_SP)));
+           exprasmlist^.concat(new(paicpu, op_const_reg(A_ADDQ, S_L, 4, R_SP)));
       end;
 
     procedure second_real_fix(p,hp : ptree;convtyp : tconverttype);
@@ -739,31 +734,31 @@ implementation
          begin
            if (cs_fp_emulation in aktmoduleswitches) then
            begin
-             exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),R_D0)));
-             exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,65536,R_D1)));
+             exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),R_D0)));
+             exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,65536,R_D1)));
              emitcall('FPC_LONGMUL',true);
              emit_reg_reg(A_MOVE,S_L,R_D0,rreg);
            end
            else
            begin
-             exprasmlist^.concat(new(pai68k,op_ref_reg(A_FMOVE,S_L,newreference(p^.left^.location.reference),R_FP0)));
-             exprasmlist^.concat(new(pai68k,op_const_reg(A_FMUL,S_L,65536,R_FP0)));
-             exprasmlist^.concat(new(pai68k,op_reg_reg(A_FMOVE,S_L,R_FP0,rreg)));
+             exprasmlist^.concat(new(paicpu,op_ref_reg(A_FMOVE,S_L,newreference(p^.left^.location.reference),R_FP0)));
+             exprasmlist^.concat(new(paicpu,op_const_reg(A_FMUL,S_L,65536,R_FP0)));
+             exprasmlist^.concat(new(paicpu,op_reg_reg(A_FMOVE,S_L,R_FP0,rreg)));
            end;
          end
          else
          begin
            if (cs_fp_emulation in aktmoduleswitches) then
            begin
-             exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D0)));
-             exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,65536,R_D1)));
+             exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D0)));
+             exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,65536,R_D1)));
              emitcall('FPC_LONGMUL',true);
              emit_reg_reg(A_MOVE,S_L,R_D0,rreg);
            end
            else
            begin
-             exprasmlist^.concat(new(pai68k,op_const_reg(A_FMUL,S_L,65536,p^.left^.location.fpureg)));
-             exprasmlist^.concat(new(pai68k,op_reg_reg(A_FMOVE,S_L,p^.left^.location.fpureg,rreg)));
+             exprasmlist^.concat(new(paicpu,op_const_reg(A_FMUL,S_L,65536,p^.left^.location.fpureg)));
+             exprasmlist^.concat(new(paicpu,op_reg_reg(A_FMOVE,S_L,p^.left^.location.fpureg,rreg)));
            end;
          end;
          clear_location(p^.location);
@@ -793,10 +788,10 @@ implementation
     procedure second_fix_real(p,hp : ptree;convtyp : tconverttype);
     var
         startreg : tregister;
-        hl : plabel;
+        hl : pasmlabel;
         r : treference;
         reg1: tregister;
-        hl1,hl2,hl3,hl4,hl5,hl6,hl7,hl8,hl9: plabel;
+        hl1,hl2,hl3,hl4,hl5,hl6,hl7,hl8,hl9: pasmlabel;
       begin
          if (p^.left^.location.loc=LOC_REGISTER) or
             (p^.left^.location.loc=LOC_CREGISTER) then
@@ -808,7 +803,7 @@ implementation
            end
          else
            begin
-              exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(
+              exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(
                 p^.left^.location.reference),R_D0)));
               del_reference(p^.left^.location.reference);
               startreg:=R_NO;
@@ -818,92 +813,92 @@ implementation
 
          { Motorola 68000 equivalent of CDQ     }
          { we choose d1:d0 pair for quad word   }
-         exprasmlist^.concat(new(pai68k,op_reg(A_TST,S_L,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_reg(A_TST,S_L,R_D0)));
          getlabel(hl1);
          emitl(A_BPL,hl1);
          { we copy all bits (-ve number) }
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,$ffffffff,R_D1)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,$ffffffff,R_D1)));
          getlabel(hl2);
          emitl(A_BRA,hl2);
          emitl(A_LABEL,hl1);
-         exprasmlist^.concat(new(pai68k,op_reg(A_CLR,S_L,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_reg(A_CLR,S_L,R_D0)));
          emitl(A_LABEL,hl2);
          { end CDQ }
 
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_EOR,S_L,R_D1,R_D0)));
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D0,reg1)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_EOR,S_L,R_D1,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_D0,reg1)));
          getlabel(hl3);
          emitl(A_BEQ,hl3);
 
          { Motorola 68000 equivalent of RCL    }
          getlabel(hl4);
          emitl(A_BCC,hl4);
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,1,reg1)));
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_OR,S_L,1,reg1)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,1,reg1)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_OR,S_L,1,reg1)));
          getlabel(hl5);
          emitl(A_BRA,hl5);
          emitl(A_LABEL,hl4);
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,1,reg1)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,1,reg1)));
          emitl(A_LABEL,hl5);
          { end RCL }
 
          { Motorola 68000 equivalent of BSR }
          { save register }
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D0,R_D6)));
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_B,31,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_D0,R_D6)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_B,31,R_D0)));
          getlabel(hl6);
          emitl(A_LABEL,hl6);
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_BTST,S_L,R_D0,R_D1)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_BTST,S_L,R_D0,R_D1)));
          getlabel(hl7);
          emitl(A_BNE,hl7);
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_SUBQ,S_B,1,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_SUBQ,S_B,1,R_D0)));
          emitl(A_BPL,hl6);
          { restore register }
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D6,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_D6,R_D0)));
          emitl(A_LABEL,hl7);
          { end BSR }
 
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_B,32,R_D6)));
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_SUB,S_B,R_D1,R_D6)));
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_LSL,S_L,R_D6,R_D0)));
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_ADD,S_W,1007,R_D1)));
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,5,R_D1)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_B,32,R_D6)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_SUB,S_B,R_D1,R_D6)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_LSL,S_L,R_D6,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_ADD,S_W,1007,R_D1)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,5,R_D1)));
 
          { Motorola 68000 equivalent of SHLD }
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_W,11,R_D6)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_W,11,R_D6)));
          { save register }
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D1,R_A0)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_D1,R_A0)));
          getlabel(hl8);
          emitl(A_LABEL,hl8);
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_ROXL,S_W,1,R_D1)));
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_ROXL,S_W,1,reg1)));
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_SUBQ,S_B,1,R_D6)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_ROXL,S_W,1,R_D1)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_ROXL,S_W,1,reg1)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_SUBQ,S_B,1,R_D6)));
          emitl(A_BNE,hl8);
          { restore register }
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A0,R_D1)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A0,R_D1)));
          { end Motorola equivalent of SHLD }
 
          { Motorola 68000 equivalent of SHLD }
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_W,20,R_D6)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_W,20,R_D6)));
          { save register }
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D0,R_A0)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_D0,R_A0)));
          getlabel(hl9);
          emitl(A_LABEL,hl9);
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_ROXL,S_W,1,R_D0)));
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_ROXL,S_W,1,reg1)));
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_SUBQ,S_B,1,R_D6)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_ROXL,S_W,1,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_ROXL,S_W,1,reg1)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_SUBQ,S_B,1,R_D6)));
          emitl(A_BNE,hl9);
          { restore register }
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A0,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A0,R_D0)));
          { end Motorola equivalent of SHLD }
 
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_B,20,R_D6)));
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_SUB,S_L,R_D6,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_B,20,R_D6)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_SUB,S_L,R_D6,R_D0)));
          emitl(A_LABEL, hl3);
 
          { create temp values and put on stack }
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,reg1,R_SPPUSH)));
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D0,R_SPPUSH)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,reg1,R_SPPUSH)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_D0,R_SPPUSH)));
 
 
          reset_reference(r);
@@ -914,7 +909,7 @@ implementation
            clear_location(p^.location);
            p^.location.loc:=LOC_FPU;
            p^.location.fpureg := getregister32;
-           exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(r),
+           exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(r),
              p^.left^.location.fpureg)))
          end
          else
@@ -922,11 +917,11 @@ implementation
            clear_location(p^.location);
            p^.location.loc:=LOC_FPU;
            p^.location.fpureg := getfloatreg;
-           exprasmlist^.concat(new(pai68k,op_ref_reg(A_FMOVE,S_L,newreference(r),
+           exprasmlist^.concat(new(paicpu,op_ref_reg(A_FMOVE,S_L,newreference(r),
                p^.left^.location.fpureg)))
          end;
          { clear temporary space }
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_ADDQ,S_L,8,R_SP)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_ADDQ,S_L,8,R_SP)));
          ungetregister32(reg1);
 { Alreadu handled above...          }
 {         p^.location.loc:=LOC_FPU; }
@@ -949,38 +944,38 @@ implementation
               hregister:=getregister32;
               case porddef(p^.left^.resulttype)^.typ of
                 s8bit : begin
-                           exprasmlist^.concat(new(pai68k, op_ref_reg(A_MOVE,S_B,
+                           exprasmlist^.concat(new(paicpu, op_ref_reg(A_MOVE,S_B,
                               newreference(p^.left^.location.reference),hregister)));
                            if aktoptprocessor = MC68020 then
-                              exprasmlist^.concat(new(pai68k, op_reg(A_EXTB,S_L,hregister)))
+                              exprasmlist^.concat(new(paicpu, op_reg(A_EXTB,S_L,hregister)))
                            else
                             begin
-                              exprasmlist^.concat(new(pai68k, op_reg(A_EXT,S_W,hregister)));
-                              exprasmlist^.concat(new(pai68k, op_reg(A_EXT,S_L,hregister)));
+                              exprasmlist^.concat(new(paicpu, op_reg(A_EXT,S_W,hregister)));
+                              exprasmlist^.concat(new(paicpu, op_reg(A_EXT,S_L,hregister)));
                             end;
                         end;
                 u8bit : begin
-                          exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,newreference(p^.left^.location.reference),
+                          exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,newreference(p^.left^.location.reference),
                             hregister)));
-                          exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,$ff,hregister)));
+                          exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,$ff,hregister)));
                         end;
                 s16bit :begin
-                         exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,newreference(p^.left^.location.reference),
+                         exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,newreference(p^.left^.location.reference),
                            hregister)));
-                          exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_L,hregister)));
+                          exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_L,hregister)));
                         end;
                 u16bit : begin
-                            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,newreference(p^.left^.location.reference),
+                            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,newreference(p^.left^.location.reference),
                                hregister)));
-                            exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,$ffff,hregister)));
+                            exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,$ffff,hregister)));
                          end;
-                s32bit,u32bit : exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),
+                s32bit,u32bit : exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),
                   hregister)));
                 {!!!! u32bit }
               end;
            end;
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVEQ,S_L,16,R_D1)));
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_LSL,S_L,R_D1,hregister)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVEQ,S_L,16,R_D1)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_LSL,S_L,R_D1,hregister)));
 
          clear_location(p^.location);
          p^.location.loc:=LOC_REGISTER;
@@ -996,7 +991,7 @@ implementation
         p^.location.loc:=LOC_REGISTER;
         del_reference(hp^.location.reference);
         p^.location.register:=getregister32;
-        exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,
+        exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,
          newreference(hp^.location.reference),R_A0)));
 
         emit_reg_reg(A_MOVE, S_L, R_A0, P^.location.register);
@@ -1005,7 +1000,7 @@ implementation
       procedure second_bool_to_int(p,hp : ptree;convtyp : tconverttype);
 
       var
-         oldtruelabel,oldfalselabel,hlabel : plabel;
+         oldtruelabel,oldfalselabel,hlabel : pasmlabel;
          hregister : tregister;
          newsize,
          opsize : topsize;
@@ -1079,14 +1074,14 @@ implementation
 
          case hp^.location.loc of
             LOC_MEM,
-      LOC_REFERENCE : exprasmlist^.concat(new(pai68k,op_ref_reg(op,opsize,
+      LOC_REFERENCE : exprasmlist^.concat(new(paicpu,op_ref_reg(op,opsize,
                         newreference(hp^.location.reference),p^.location.register)));
        LOC_REGISTER,
-      LOC_CREGISTER : exprasmlist^.concat(new(pai68k,op_reg_reg(op,opsize,
+      LOC_CREGISTER : exprasmlist^.concat(new(paicpu,op_reg_reg(op,opsize,
                         hp^.location.register,p^.location.register)));
           LOC_FLAGS : begin
 {                       hregister:=reg32toreg8(hregister); }
-                        exprasmlist^.concat(new(pai68k,op_reg(flag_2_set[hp^.location.resflags],S_B,hregister)));
+                        exprasmlist^.concat(new(paicpu,op_reg(flag_2_set[hp^.location.resflags],S_B,hregister)));
 { !!!!!!!!
                         case porddef(p^.resulttype)^.typ of
                   bool16bit,
@@ -1098,10 +1093,10 @@ implementation
            LOC_JUMP : begin
                         getlabel(hlabel);
                         emitl(A_LABEL,truelabel);
-                        exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,newsize,1,hregister)));
+                        exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,newsize,1,hregister)));
                         emitl(A_JMP,hlabel);
                         emitl(A_LABEL,falselabel);
-                        exprasmlist^.concat(new(pai68k,op_reg(A_CLR,newsize,hregister)));
+                        exprasmlist^.concat(new(paicpu,op_reg(A_CLR,newsize,hregister)));
                         emitl(A_LABEL,hlabel);
                       end;
          else
@@ -1125,7 +1120,7 @@ implementation
             LOC_MEM,LOC_REFERENCE :
               begin
                 hregister:=getregister32;
-                exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                   newreference(hp^.location.reference),hregister)));
               end;
             LOC_REGISTER,LOC_CREGISTER :
@@ -1135,9 +1130,9 @@ implementation
           else
             internalerror(10062);
           end;
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_OR,S_L,hregister,hregister)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_OR,S_L,hregister,hregister)));
 {        hregister:=reg32toreg8(hregister); }
-         exprasmlist^.concat(new(pai68k,op_reg(flag_2_set[hp^.location.resflags],S_B,hregister)));
+         exprasmlist^.concat(new(paicpu,op_reg(flag_2_set[hp^.location.resflags],S_B,hregister)));
          case porddef(p^.resulttype)^.typ of
            bool8bit : p^.location.register:=hregister;
 { !!!!!!!!!!!
@@ -1177,7 +1172,7 @@ implementation
     procedure second_ansistring_to_pchar(p,hp : ptree;convtyp : tconverttype);
 
       var
-         l1,l2 : plabel;
+         l1,l2 : pasmlabel;
          hr : preference;
 
       begin
@@ -1242,7 +1237,10 @@ implementation
            second_bigger,second_bigger,
            second_smaller,second_smaller,
            second_smaller,second_smaller,
-           second_bigger,second_smaller,
+           second_bigger);
+
+{$ifdef dummy}
+           ,second_smaller,
            second_only_rangecheck,second_bigger,
            second_bigger,second_bigger,
            second_bigger,second_only_rangecheck,
@@ -1259,6 +1257,7 @@ implementation
            second_ansistring_to_pchar,
            second_pchar_to_string,
            second_nothing);
+{$endif dummy}
 
       begin
          { this isn't good coding, I think tc_bool_2_int, shouldn't be }
@@ -1301,13 +1300,13 @@ implementation
          case p^.left^.location.loc of
             LOC_REGISTER,LOC_CREGISTER:
               begin
-                 exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,
+                 exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,
                    S_L,p^.left^.location.register,R_SPPUSH)));
                  ungetregister32(p^.left^.location.register);
               end;
             LOC_MEM,LOC_REFERENCE:
               begin
-                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,
+                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,
                    S_L,newreference(p^.left^.location.reference),R_SPPUSH)));
                  del_reference(p^.left^.location.reference);
               end;
@@ -1319,20 +1318,20 @@ implementation
          case p^.right^.location.loc of
             LOC_REGISTER,LOC_CREGISTER:
               begin
-                 exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,
+                 exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,
                    S_L,p^.right^.location.register,R_SPPUSH)));
                  ungetregister32(p^.right^.location.register);
               end;
             LOC_MEM,LOC_REFERENCE:
               begin
-                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,
+                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,
                    S_L,newreference(p^.right^.location.reference),R_SPPUSH)));
                  del_reference(p^.right^.location.reference);
               end;
             else internalerror(100);
          end;
          emitcall('FPC_DO_IS',true);
-         exprasmlist^.concat(new(pai68k,op_reg(A_TST,S_B,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_reg(A_TST,S_B,R_D0)));
          popusedregisters(pushed);
       end;
 
@@ -1351,9 +1350,8 @@ implementation
          { save all used registers }
          pushusedregisters(pushed,$ffff);
          { push the vmt of the class }
-         exprasmlist^.concat(new(pai68k,op_csymbol_reg(A_MOVE,
+         exprasmlist^.concat(new(paicpu,op_csymbol_reg(A_MOVE,
            S_L,newcsymbol(pobjectdef(p^.right^.resulttype)^.vmt_mangledname,0),R_SPPUSH)));
-         concat_external(pobjectdef(p^.right^.resulttype)^.vmt_mangledname,EXT_NEAR);
          emitpushreferenceaddr(exprasmlist,p^.location.reference);
           emitcall('FPC_DO_AS',true);
          popusedregisters(pushed);
@@ -1363,7 +1361,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.13  1999-08-25 11:59:48  jonas
+  Revision 1.14  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.13  1999/08/25 11:59:48  jonas
     * changed pai386, paippc and paiapha (same for tai*) to paicpu (taicpu)
 
   Revision 1.12  1998/12/11 00:02:59  peter

+ 29 - 18
compiler/cg68kcon.pas

@@ -44,18 +44,23 @@ implementation
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      m68k,cga68k,tgen68k;
+      cpubase,cga68k,tgen68k,symconst;
 
 {*****************************************************************************
                              SecondRealConst
 *****************************************************************************}
 
     procedure secondrealconst(var p : ptree);
+      const
+        floattype2ait:array[tfloattype] of tait=
+          (ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_none,ait_none);
       var
          hp1 : pai;
-         lastlabel : plabel;
+         lastlabel : pasmlabel;
+         realait : tait;
       begin
          lastlabel:=nil;
+         realait:=floattype2ait[pfloatdef(p^.resulttype)^.typ];
          { const already used ? }
          if not assigned(p^.lab_real) then
            begin
@@ -67,12 +72,15 @@ implementation
                      lastlabel:=pai_label(hp1)^.l
                    else
                      begin
-                        if (hp1^.typ=p^.realtyp) and (lastlabel<>nil) then
+                        if (hp1^.typ=realait) and (lastlabel<>nil) then
                           begin
-                             if ((p^.realtyp=ait_real_64bit) and (pai_double(hp1)^.value=p^.value_real)) or
-                               ((p^.realtyp=ait_real_extended) and (pai_extended(hp1)^.value=p^.value_real)) or
-                               ((p^.realtyp=ait_real_32bit) and (pai_single(hp1)^.value=p^.value_real)) then
-                               begin
+                             if(
+                                ((realait=ait_real_32bit) and (pai_real_32bit(hp1)^.value=p^.value_real)) or
+                                ((realait=ait_real_64bit) and (pai_real_64bit(hp1)^.value=p^.value_real)) or
+                                ((realait=ait_real_80bit) and (pai_real_80bit(hp1)^.value=p^.value_real)) or
+                                ((realait=ait_comp_64bit) and (pai_comp_64bit(hp1)^.value=p^.value_real))
+                               ) then
+                              begin
                                   { found! }
                                   p^.lab_real:=lastlabel;
                                   break;
@@ -90,17 +98,17 @@ implementation
                    if (cs_smartlink in aktmoduleswitches) then
                     consts^.concat(new(pai_cut,init));
                    consts^.concat(new(pai_label,init(lastlabel)));
-                   case p^.realtyp of
-                     ait_real_64bit : consts^.concat(new(pai_double,init(p^.value_real)));
-                     ait_real_32bit : consts^.concat(new(pai_single,init(p^.value_real)));
-                  ait_real_extended : consts^.concat(new(pai_extended,init(p^.value_real)));
+                   case realait of
+                     ait_real_64bit : consts^.concat(new(pai_real_32bit,init(p^.value_real)));
+                     ait_real_32bit : consts^.concat(new(pai_real_32bit,init(p^.value_real)));
+                     ait_real_80bit : consts^.concat(new(pai_real_32bit,init(p^.value_real)));
                    else
                      internalerror(10120);
                    end;
                 end;
            end;
          clear_reference(p^.location.reference);
-         p^.location.reference.symbol:=stringdup(lab2str(p^.lab_real));
+         p^.location.reference.symbol:=stringdup(p^.lab_real^.name);
          p^.location.loc:=LOC_MEM;
       end;
 
@@ -139,7 +147,7 @@ implementation
       var
          hp1 : pai;
          l1,l2,
-         lastlabel   : plabel;
+         lastlabel   : pasmlabel;
          pc          : pchar;
          same_string : boolean;
          i,mylength  : longint;
@@ -207,7 +215,7 @@ implementation
                                 getdatalabel(l1);
                                 getdatalabel(l2);
                                 consts^.concat(new(pai_label,init(l2)));
-                                consts^.concat(new(pai_const,init_symbol(strpnew(lab2str(l1)))));
+                                consts^.concat(new(pai_const_symbol,init(l1)));
                                 consts^.concat(new(pai_const,init_32bit(p^.length)));
                                 consts^.concat(new(pai_const,init_32bit(p^.length)));
                                 consts^.concat(new(pai_const,init_32bit(-1)));
@@ -243,7 +251,7 @@ implementation
                 end;
            end;
          clear_reference(p^.location.reference);
-         p^.location.reference.symbol:=stringdup(lab2str(p^.lab_str));
+         p^.location.reference.symbol:=stringdup(p^.lab_str^.name);
          p^.location.loc:=LOC_MEM;
       end;
 
@@ -255,7 +263,7 @@ implementation
     procedure secondsetconst(var p : ptree);
       var
          hp1         : pai;
-         lastlabel   : plabel;
+         lastlabel   : pasmlabel;
          i           : longint;
          neededtyp   : tait;
       begin
@@ -345,7 +353,7 @@ implementation
                end;
           end;
         clear_reference(p^.location.reference);
-        p^.location.reference.symbol:=stringdup(lab2str(p^.lab_set));
+        p^.location.reference.symbol:=stringdup(p^.lab_set^.name);
         p^.location.loc:=LOC_MEM;
       end;
 
@@ -364,7 +372,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.5  1998-12-11 00:03:01  peter
+  Revision 1.6  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.5  1998/12/11 00:03:01  peter
     + globtype,tokens,version unit splitted from globals
 
   Revision 1.4  1998/11/06 09:47:29  pierre

+ 47 - 44
compiler/cg68kflw.pas

@@ -44,11 +44,11 @@ interface
 implementation
 
     uses
-      globtype,systems,
+      globtype,systems,symconst,
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      m68k,cga68k,tgen68k;
+      cpubase,cga68k,tgen68k;
 
 {*****************************************************************************
                          Second_While_RepeatN
@@ -57,8 +57,8 @@ implementation
     procedure second_while_repeatn(var p : ptree);
 
       var
-         l1,l2,l3,oldclabel,oldblabel : plabel;
-         otlabel,oflabel : plabel;
+         l1,l2,l3,oldclabel,oldblabel : pasmlabel;
+         otlabel,oflabel : pasmlabel;
       begin
          getlabel(l1);
          getlabel(l2);
@@ -127,7 +127,7 @@ implementation
     procedure secondifn(var p : ptree);
 
       var
-         hl,otlabel,oflabel : plabel;
+         hl,otlabel,oflabel : pasmlabel;
 
       begin
          otlabel:=truelabel;
@@ -173,7 +173,7 @@ implementation
     procedure secondfor(var p : ptree);
 
       var
-         l1,l3,oldclabel,oldblabel : plabel;
+         l1,l3,oldclabel,oldblabel : pasmlabel;
          omitfirstcomp,temptovalue : boolean;
          hs : byte;
          temp1 : treference;
@@ -232,7 +232,7 @@ implementation
               if (p^.right^.location.loc=LOC_REGISTER) or
                  (p^.right^.location.loc=LOC_CREGISTER) then
                 begin
-                   exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,opsize,p^.right^.location.register,
+                   exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,opsize,p^.right^.location.register,
                       newreference(temp1))));
                  end
               else
@@ -244,14 +244,14 @@ implementation
            begin
               if p^.t2^.location.loc=LOC_CREGISTER then
                begin
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_CMP,opsize,newreference(temp1),
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_CMP,opsize,newreference(temp1),
                      p^.t2^.location.register)));
                 end
               else
                 begin
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,newreference(p^.t2^.location.reference),
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,newreference(p^.t2^.location.reference),
                      cmpreg)));
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_CMP,opsize,newreference(temp1),
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_CMP,opsize,newreference(temp1),
                      cmpreg)));
                 end;
            end
@@ -260,10 +260,10 @@ implementation
               if not(omitfirstcomp) then
                 begin
                    if p^.t2^.location.loc=LOC_CREGISTER then
-                     exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,opsize,p^.right^.value,
+                     exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,opsize,p^.right^.value,
                        p^.t2^.location.register)))
                    else
-                     exprasmlist^.concat(new(pai68k,op_const_ref(A_CMP,opsize,p^.right^.value,
+                     exprasmlist^.concat(new(paicpu,op_const_ref(A_CMP,opsize,p^.right^.value,
                newreference(p^.t2^.location.reference))));
                 end;
            end;
@@ -312,24 +312,24 @@ implementation
            begin
               if p^.t2^.location.loc=LOC_CREGISTER then
                 begin
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_CMP,opsize,newreference(temp1),
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_CMP,opsize,newreference(temp1),
                      p^.t2^.location.register)));
                 end
               else
                 begin
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,newreference(p^.t2^.location.reference),
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,newreference(p^.t2^.location.reference),
                      cmpreg)));
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_CMP,opsize,newreference(temp1),
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_CMP,opsize,newreference(temp1),
                      cmpreg)));
                 end;
            end
          else
            begin
               if p^.t2^.location.loc=LOC_CREGISTER then
-                exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,opsize,p^.right^.value,
+                exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,opsize,p^.right^.value,
                   p^.t2^.location.register)))
               else
-                exprasmlist^.concat(new(pai68k,op_const_ref(A_CMP,opsize,p^.right^.value,
+                exprasmlist^.concat(new(paicpu,op_const_ref(A_CMP,opsize,p^.right^.value,
                   newreference(p^.t2^.location.reference))));
            end;
          if p^.backward then
@@ -350,9 +350,9 @@ implementation
          else hop:=A_ADD;
 
          if p^.t2^.location.loc=LOC_CREGISTER then
-           exprasmlist^.concat(new(pai68k,op_const_reg(hop,opsize,1,p^.t2^.location.register)))
+           exprasmlist^.concat(new(paicpu,op_const_reg(hop,opsize,1,p^.t2^.location.register)))
          else
-            exprasmlist^.concat(new(pai68k,op_const_ref(hop,opsize,1,newreference(p^.t2^.location.reference))));
+            exprasmlist^.concat(new(paicpu,op_const_ref(hop,opsize,1,newreference(p^.t2^.location.reference))));
          emitl(A_JMP,l3);
 
      { this is the break label: }
@@ -380,7 +380,7 @@ implementation
          is_mem : boolean;
          {op : tasmop;
          s : topsize;}
-         otlabel,oflabel : plabel;
+         otlabel,oflabel : pasmlabel;
 
       label
          do_jmp;
@@ -399,15 +399,15 @@ implementation
                  LOC_CREGISTER,
                  LOC_REGISTER : is_mem:=false;
                  LOC_FLAGS : begin
-                                exprasmlist^.concat(new(pai68k,op_reg(flag_2_set[p^.right^.location.resflags],S_B,R_D0)));
-                                exprasmlist^.concat(new(pai68k,op_reg(A_NEG, S_B, R_D0)));
+                                exprasmlist^.concat(new(paicpu,op_reg(flag_2_set[p^.right^.location.resflags],S_B,R_D0)));
+                                exprasmlist^.concat(new(paicpu,op_reg(A_NEG, S_B, R_D0)));
                                 goto do_jmp;
                              end;
                  LOC_JUMP : begin
                                emitl(A_LABEL,truelabel);
-                               exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_B,1,R_D0)));
+                               exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_B,1,R_D0)));
                                emitl(A_JMP,aktexit2label);
-                               exprasmlist^.concat(new(pai68k,op_reg(A_CLR,S_B,R_D0)));
+                               exprasmlist^.concat(new(paicpu,op_reg(A_CLR,S_B,R_D0)));
                                goto do_jmp;
                             end;
                  else internalerror(2001);
@@ -417,17 +417,17 @@ implementation
               enumdef : begin
                           case procinfo.retdef^.size of
                            4 : if is_mem then
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                                    newreference(p^.left^.location.reference),R_D0)))
                                else
                                  emit_reg_reg(A_MOVE,S_L,p^.left^.location.register,R_D0);
                            2 : if is_mem then
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,
                                    newreference(p^.left^.location.reference),R_D0)))
                                else
                                  emit_reg_reg(A_MOVE,S_W,p^.left^.location.register,R_D0);
                            1 : if is_mem then
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,
                                    newreference(p^.left^.location.reference),R_D0)))
                                else
                                  emit_reg_reg(A_MOVE,S_B,p^.left^.location.register,R_D0);
@@ -436,10 +436,10 @@ implementation
            pointerdef,
            procvardef : begin
                           if is_mem then
-                            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                               newreference(p^.left^.location.reference),R_D0)))
                           else
-                            exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,p^.left^.location.register,R_D0)));
+                            exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,p^.left^.location.register,R_D0)));
                         end;
              floatdef : begin
                           { floating point return values .... }
@@ -448,7 +448,7 @@ implementation
                              (pfloatdef(procinfo.retdef)^.typ=s32real) then
                            begin
                              if is_mem then
-                               exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                               exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                                  newreference(p^.left^.location.reference),R_D0)))
                              else
                                begin
@@ -460,7 +460,7 @@ implementation
                                       if cs_fp_emulation in aktmoduleswitches then
                                          emit_reg_reg(A_MOVE,S_L,p^.left^.location.fpureg,R_D0)
                                       else
-                                         exprasmlist^.concat(new(pai68k,op_reg_reg(A_FMOVE,S_FS,
+                                         exprasmlist^.concat(new(paicpu,op_reg_reg(A_FMOVE,S_FS,
                                             p^.left^.location.fpureg,R_D0)));
                                    end;
                                end;
@@ -471,7 +471,7 @@ implementation
                              { LOC_MEM,LOC_REFERENCE }
                              if is_mem then
                               begin
-                                exprasmlist^.concat(new(pai68k,op_ref_reg(A_FMOVE,
+                                exprasmlist^.concat(new(paicpu,op_ref_reg(A_FMOVE,
                                   getfloatsize(pfloatdef(procinfo.retdef)^.typ),
                                     newreference(p^.left^.location.reference),R_FP0)));
                               end
@@ -480,7 +480,7 @@ implementation
                               begin
                                 { convert from extended to correct type }
                                 { when storing                          }
-                                exprasmlist^.concat(new(pai68k,op_reg_reg(A_FMOVE,
+                                exprasmlist^.concat(new(paicpu,op_reg_reg(A_FMOVE,
                                   getfloatsize(pfloatdef(procinfo.retdef)^.typ),p^.left^.location.fpureg,R_FP0)));
                               end;
                            end;
@@ -557,7 +557,7 @@ do_jmp:
     procedure secondraise(var p : ptree);
 
       var
-         a : plabel;
+         a : pasmlabel;
 
       begin
          if assigned(p^.left) then
@@ -573,8 +573,8 @@ do_jmp:
                 begin
                    getlabel(a);
                    emitl(A_LABEL,a);
-                   exprasmlist^.concat(new(pai68k,
-                     op_csymbol_reg(A_MOVE,S_L,newcsymbol(lab2str(a),0),R_SPPUSH)));
+                   exprasmlist^.concat(new(paicpu,
+                     op_csymbol_reg(A_MOVE,S_L,newcsymbol(a^.name,0),R_SPPUSH)));
                 end;
               secondpass(p^.left);
               if codegenerror then
@@ -582,7 +582,7 @@ do_jmp:
 
               case p^.left^.location.loc of
                  LOC_MEM,LOC_REFERENCE : emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
-                 LOC_CREGISTER,LOC_REGISTER : exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
+                 LOC_CREGISTER,LOC_REGISTER : exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,
                    p^.left^.location.register,R_SPPUSH)));
                  else CGMessage(type_e_mismatch);
               end;
@@ -598,13 +598,13 @@ do_jmp:
 *****************************************************************************}
 
     var
-       endexceptlabel : plabel;
+       endexceptlabel : pasmlabel;
 
     procedure secondtryexcept(var p : ptree);
 
       var
          exceptlabel,doexceptlabel,oldendexceptlabel,
-         lastonlabel : plabel;
+         lastonlabel : pasmlabel;
 
       begin
         InternalError(3431243);
@@ -671,7 +671,7 @@ do_jmp:
 
     procedure secondon(var p : ptree);
       var
-         nextonlabel,myendexceptlabel : plabel;
+         nextonlabel,myendexceptlabel : pasmlabel;
          ref : treference;
 
       begin
@@ -715,7 +715,7 @@ do_jmp:
     procedure secondtryfinally(var p : ptree);
 
       var
-         finallylabel,noreraiselabel,endfinallylabel : plabel;
+         finallylabel,noreraiselabel,endfinallylabel : pasmlabel;
 
       begin
 (*         { we modify EAX }
@@ -766,20 +766,23 @@ do_jmp:
       var
         hp : preference;
       begin
-         exprasmlist^.concat(new(pai68k,op_reg(A_CLR,S_L,R_A5)));
+         exprasmlist^.concat(new(paicpu,op_reg(A_CLR,S_L,R_A5)));
          { also reset to zero in the stack }
          new(hp);
          reset_reference(hp^);
          hp^.offset:=procinfo.ESI_offset;
          hp^.base:=procinfo.framepointer;
-         exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_L,R_A5,hp)));
+         exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_L,R_A5,hp)));
          exprasmlist^.concat(new(pai_labeled,init(A_JMP,quickexitlabel)));
       end;
 
 end.
 {
   $Log$
-  Revision 1.9  1999-08-25 11:59:49  jonas
+  Revision 1.10  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.9  1999/08/25 11:59:49  jonas
     * changed pai386, paippc and paiapha (same for tai*) to paicpu (taicpu)
 
   Revision 1.8  1998/12/11 00:03:02  peter

+ 40 - 38
compiler/cg68kinl.pas

@@ -32,11 +32,11 @@ interface
 implementation
 
     uses
-      globtype,systems,
+      globtype,systems,symconst,
       cobjects,verbose,globals,
       aasm,types,symtable,
       hcodegen,temp_gen,pass_2,
-      m68k,cga68k,tgen68k,cg68kld,cg68kcal;
+      cpubase,cga68k,tgen68k,cg68kld,cg68kcal;
 
 
 {*****************************************************************************
@@ -103,8 +103,7 @@ implementation
             new(r);
             reset_reference(r^);
             r^.symbol:=stringdup('U_'+upper(target_info.system_unit)+io[byte(doread)]);
-            concat_external(r^.symbol^,EXT_NEAR);
-            exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,r,R_A0)))
+            exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,r,R_A0)))
           end;
 
         var
@@ -113,13 +112,13 @@ implementation
            pararesult : pdef;
            has_length : boolean;
            dummycoll  : tdefcoll;
-           iolabel    : plabel;
+           iolabel    : pasmlabel;
            npara      : longint;
 
         begin
            { I/O check }
            if (cs_check_io in aktlocalswitches) and
-              ((aktprocsym^.definition^.options and poiocheck)=0) then
+              not(po_iocheck in aktprocsym^.definition^.procoptions) then
              begin
                 getlabel(iolabel);
                 emitl(A_LABEL,iolabel);
@@ -140,7 +139,7 @@ implementation
                 { the following instructions are for "writeln;" }
                 loadstream;
                 { save @aktfile in temporary variable }
-                exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_L,R_A0,newreference(aktfile))));
+                exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_L,R_A0,newreference(aktfile))));
              end
            else
              begin
@@ -167,7 +166,7 @@ implementation
                           exit;
                        end;
 
-                     exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,newreference(node^.left^.location.reference),R_A0)));
+                     exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,newreference(node^.left^.location.reference),R_A0)));
 
                      { skip to the next parameter }
                      node:=node^.right;
@@ -179,7 +178,7 @@ implementation
                   end;
 
                 { save @aktfile in temporary variable }
-                exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_L,R_A0,newreference(aktfile))));
+                exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_L,R_A0,newreference(aktfile))));
                 if doread then
                 { parameter by READ gives call by reference }
                   dummycoll.paratyp:=vs_var
@@ -394,7 +393,7 @@ implementation
            if assigned(iolabel) then
              begin
                 { registers are saved in the procedure }
-                exprasmlist^.concat(new(pai68k,op_csymbol(A_PEA,S_L,newcsymbol(lab2str(iolabel),0))));
+                exprasmlist^.concat(new(paicpu,op_csymbol(A_PEA,S_L,newcsymbol(iolabel^.name,0))));
                 emitcall('FPC_IOCHECK',true);
              end;
          { Freeup all used temps }
@@ -513,7 +512,7 @@ implementation
          l : longint;
          ispushed : boolean;
          hregister : tregister;
-         otlabel,oflabel,filenamestring : plabel;
+         otlabel,oflabel,filenamestring : pasmlabel;
          oldpushedparasize : longint;
       begin
       { save & reset pushedparasize }
@@ -541,14 +540,14 @@ implementation
                               begin
                                  del_reference(p^.left^.location.reference);
                                  p^.location.register:=getregister32;
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,
                                   newreference(p^.left^.location.reference),
                                   p^.location.register)));
                               end;
                          end
                        else p^.location.register:=p^.left^.location.register;
                        if p^.inlinenumber=in_hi_word then
-                         exprasmlist^.concat(new(pai68k,op_const_reg(A_LSR,S_W,8,p^.location.register)));
+                         exprasmlist^.concat(new(paicpu,op_const_reg(A_LSR,S_W,8,p^.location.register)));
                        p^.location.register:=p^.location.register;
               end;
             in_high_x :
@@ -562,7 +561,7 @@ implementation
                       reset_reference(r^);
                       r^.base:=highframepointer;
                       r^.offset:=highoffset+4;
-                      exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                      exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                         r,p^.location.register)));
                    end
               end;
@@ -581,12 +580,12 @@ implementation
                     reset_reference(r^);
                     r^.base:=highframepointer;
                     r^.offset:=highoffset+4;
-                    exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                    exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                       r,p^.location.register)));
-                    exprasmlist^.concat(new(pai68k,op_const_reg(A_ADD,S_L,
+                    exprasmlist^.concat(new(paicpu,op_const_reg(A_ADD,S_L,
                       1,p^.location.register)));
                     if parraydef(p^.left^.resulttype)^.elesize<>1 then
-                      exprasmlist^.concat(new(pai68k,op_const_reg(A_MULS,S_L,
+                      exprasmlist^.concat(new(paicpu,op_const_reg(A_MULS,S_L,
                         parraydef(p^.left^.resulttype)^.elesize,p^.location.register)));
                   end
                  else
@@ -594,7 +593,7 @@ implementation
                     { for both cases load vmt }
                     if p^.left^.treetype=typen then
                       begin
-                        exprasmlist^.concat(new(pai68k,op_csymbol_reg(A_LEA,
+                        exprasmlist^.concat(new(paicpu,op_csymbol_reg(A_LEA,
                           S_L,newcsymbol(pobjectdef(p^.left^.resulttype)^.vmt_mangledname,0),
                           R_A0)));
                         p^.location.register:=getregister32;
@@ -609,7 +608,7 @@ implementation
                         { load VMT pointer }
                         inc(p^.left^.location.reference.offset,
                           pobjectdef(p^.left^.resulttype)^.vmt_offset);
-                        exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                        exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                           newreference(p^.left^.location.reference),
                           p^.location.register)));
                       end;
@@ -623,7 +622,7 @@ implementation
                         { address.                                          }
                         emit_reg_reg(A_MOVE, S_L, p^.location.register, R_A0);
                         r^.base:=R_A0;
-                        exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,
+                        exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,
                           p^.location.register)));
                       end;
                   end;
@@ -644,7 +643,7 @@ implementation
                               begin
                                  del_reference(p^.left^.location.reference);
                                  p^.location.register:=getregister32;
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                                   newreference(p^.left^.location.reference),
                                   p^.location.register)));
                               end;
@@ -652,8 +651,8 @@ implementation
                        else p^.location.register:=p^.left^.location.register;
                        if p^.inlinenumber=in_hi_long then
                          begin
-                           exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVEQ, S_L, 16, R_D1)));
-                           exprasmlist^.concat(new(pai68k,op_reg_reg(A_LSR,S_L,R_D1,p^.location.register)));
+                           exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVEQ, S_L, 16, R_D1)));
+                           exprasmlist^.concat(new(paicpu,op_reg_reg(A_LSR,S_L,R_D1,p^.location.register)));
                          end;
                        p^.location.register:=p^.location.register;
                     end;
@@ -689,17 +688,17 @@ implementation
                           p^.location.register)
                       else
                       if p^.left^.location.loc=LOC_FLAGS then
-                        exprasmlist^.concat(new(pai68k,op_reg(flag_2_set[p^.left^.location.resflags],S_NO,
+                        exprasmlist^.concat(new(paicpu,op_reg(flag_2_set[p^.left^.location.resflags],S_NO,
                                   p^.location.register)))
                       else
                         begin
                            del_reference(p^.left^.location.reference);
-                           exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,newreference(p^.left^.location.reference),
+                           exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,newreference(p^.left^.location.reference),
                              p^.location.register)));
                         end;
                    end
                  else p^.location.register:=p^.left^.location.register;
-                 exprasmlist^.concat(new(pai68k,op_const_reg(asmop,opsize,1,
+                 exprasmlist^.concat(new(paicpu,op_const_reg(asmop,opsize,1,
                    p^.location.register)))
                  { here we should insert bounds check ? }
                  { and direct call to bounds will crash the program }
@@ -727,7 +726,7 @@ implementation
                            end;
               pointerdef : begin
                              opsize:=S_L;
-                             addvalue:=ppointerdef(p^.left^.left^.resulttype)^.definition^.savesize;
+                             addvalue:=ppointerdef(p^.left^.left^.resulttype)^.definition^.size;
                            end;
                 else
                  internalerror(10081);
@@ -747,7 +746,7 @@ implementation
                         LOC_MEM,
                   LOC_REFERENCE : begin
                                     hregister:=getregister32;
-                                    exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                                    exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                                       newreference(p^.left^.right^.left^.location.reference),hregister)));
                                   end;
                        else
@@ -755,7 +754,7 @@ implementation
                        end;
                     { insert multiply with addvalue if its >1 }
                       if addvalue>1 then
-                       exprasmlist^.concat(new(pai68k,op_const_reg(A_MULS,opsize,
+                       exprasmlist^.concat(new(paicpu,op_const_reg(A_MULS,opsize,
                          addvalue,hregister)));
                       addconstant:=false;
                     end;
@@ -764,15 +763,15 @@ implementation
                 if addconstant then
                  begin
                    if (addvalue > 0) and (addvalue < 9) then
-                    exprasmlist^.concat(new(pai68k,op_const_ref(addqconstsubop[p^.inlinenumber],opsize,
+                    exprasmlist^.concat(new(paicpu,op_const_ref(addqconstsubop[p^.inlinenumber],opsize,
                       addvalue,newreference(p^.left^.left^.location.reference))))
                    else
-                    exprasmlist^.concat(new(pai68k,op_const_ref(addconstsubop[p^.inlinenumber],opsize,
+                    exprasmlist^.concat(new(paicpu,op_const_ref(addconstsubop[p^.inlinenumber],opsize,
                       addvalue,newreference(p^.left^.left^.location.reference))));
                  end
                 else
                  begin
-                   exprasmlist^.concat(new(pai68k,op_reg_ref(addsubop[p^.inlinenumber],opsize,
+                   exprasmlist^.concat(new(paicpu,op_reg_ref(addsubop[p^.inlinenumber],opsize,
                       hregister,newreference(p^.left^.left^.location.reference))));
                    ungetregister32(hregister);
                  end;
@@ -785,13 +784,13 @@ implementation
                 if (p^.left^.left^.location.loc=LOC_REGISTER) or
                    (p^.left^.left^.location.loc=LOC_CREGISTER) then
                  begin
-                   exprasmlist^.concat(new(pai68k,op_reg(A_TST,S_L,
+                   exprasmlist^.concat(new(paicpu,op_reg(A_TST,S_L,
                     p^.left^.left^.location.register)));
                    ungetregister32(p^.left^.left^.location.register);
                  end
                 else
                  begin
-                   exprasmlist^.concat(new(pai68k,op_ref(A_TST,S_L,
+                   exprasmlist^.concat(new(paicpu,op_ref(A_TST,S_L,
                    newreference(p^.left^.left^.location.reference))));
                    del_reference(p^.left^.left^.location.reference);
                  end;
@@ -800,7 +799,7 @@ implementation
              in_reset_typedfile,in_rewrite_typedfile :
                begin
                   pushusedregisters(pushed,$ffff);
-                  exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,
+                  exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,
                     pfiledef(p^.left^.resulttype)^.typed_as^.size,R_SPPUSH)));
                   secondload(p^.left);
                   emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
@@ -845,13 +844,13 @@ implementation
                       if (p^.left^.left^.location.loc=LOC_REFERENCE) then
                         begin
                            inc(p^.left^.left^.location.reference.offset,(p^.left^.right^.left^.value div 32)*4);
-                           exprasmlist^.concat(new(pai68k,op_const_ref(asmop,S_L,
+                           exprasmlist^.concat(new(paicpu,op_const_ref(asmop,S_L,
                              l,newreference(p^.left^.left^.location.reference))));
                            del_reference(p^.left^.left^.location.reference);
                         end
                       else
                         { LOC_CREGISTER }
-                        exprasmlist^.concat(new(pai68k,op_const_reg(asmop,S_L,
+                        exprasmlist^.concat(new(paicpu,op_const_reg(asmop,S_L,
                           l,p^.left^.left^.location.register)));
                    end
                  else
@@ -900,7 +899,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.17  1999-08-25 11:59:50  jonas
+  Revision 1.18  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.17  1999/08/25 11:59:50  jonas
     * changed pai386, paippc and paiapha (same for tai*) to paicpu (taicpu)
 
   Revision 1.16  1999/04/07 15:31:18  pierre

+ 46 - 80
compiler/cg68kld.pas

@@ -24,7 +24,7 @@ unit cg68kld;
 interface
 
     uses
-      tree,m68k;
+      tree,cpubase;
 
     var
        { this is for open arrays and strings        }
@@ -46,7 +46,7 @@ interface
 implementation
 
     uses
-      cobjects,verbose,globals,
+      cobjects,verbose,globals,symconst,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
       cga68k,tgen68k;
@@ -73,8 +73,6 @@ implementation
                  begin
                     stringdispose(p^.location.reference.symbol);
                     p^.location.reference.symbol:=stringdup(p^.symtableentry^.mangledname);
-                    if p^.symtableentry^.owner^.symtabletype=unitsymtable then
-                      concat_external(p^.symtableentry^.mangledname,EXT_NEAR);
                  end;
               varsym :
                  begin
@@ -101,8 +99,8 @@ implementation
                               if (symtabletype=localsymtable) then
                                 p^.location.reference.offset:=-p^.location.reference.offset;
 
-                              if (symtabletype=parasymtable) then
-                                inc(p^.location.reference.offset,p^.symtable^.call_offset);
+                              if (symtabletype in [localsymtable,inlinelocalsymtable]) then
+                                p^.location.reference.offset:=-p^.location.reference.offset;
 
                               if (lexlevel>(p^.symtable^.symtablelevel)) then
                                 begin
@@ -114,7 +112,7 @@ implementation
                                    hp^.offset:=procinfo.framepointer_offset;
                                    hp^.base:=procinfo.framepointer;
 
-                                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hp,hregister)));
+                                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hp,hregister)));
 
                                    simple_loadn:=false;
                                    i:=lexlevel-1;
@@ -126,7 +124,7 @@ implementation
                                         hp^.offset:=8;
                                         hp^.base:=hregister;
 
-                                        exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hp,hregister)));
+                                        exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hp,hregister)));
                                         dec(i);
                                      end;
                                    p^.location.reference.base:=hregister;
@@ -139,16 +137,12 @@ implementation
                               staticsymtable : begin
                                                   stringdispose(p^.location.reference.symbol);
                                                   p^.location.reference.symbol:=stringdup(p^.symtableentry^.mangledname);
-                                                   if symtabletype=unitsymtable then
-                                                     concat_external(p^.symtableentry^.mangledname,EXT_NEAR);
                                                end;
                               objectsymtable : begin
-                                                  if (pvarsym(p^.symtableentry)^.properties and sp_static)<>0 then
+                                                  if sp_static in pvarsym(p^.symtableentry)^.symoptions then
                                                     begin
                                                        stringdispose(p^.location.reference.symbol);
                                                        p^.location.reference.symbol:=stringdup(p^.symtableentry^.mangledname);
-                                                        if p^.symtable^.defowner^.owner^.symtabletype=unitsymtable then
-                                                          concat_external(p^.symtableentry^.mangledname,EXT_NEAR);
                                                     end
                                                   else
                                                     begin
@@ -165,7 +159,7 @@ implementation
                                                   hp^.offset:=p^.symtable^.datasize;
                                                   hp^.base:=procinfo.framepointer;
 
-                                                  exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hp,hregister)));
+                                                  exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hp,hregister)));
 
                                                   p^.location.reference.offset:=
                                                     pvarsym(p^.symtableentry)^.address;
@@ -174,8 +168,10 @@ implementation
 
                          { in case call by reference, then calculate: }
                          if (pvarsym(p^.symtableentry)^.varspez=vs_var) or
+                            is_open_array(pvarsym(p^.symtableentry)^.definition) or
+                            is_array_of_const(pvarsym(p^.symtableentry)^.definition) or
                             ((pvarsym(p^.symtableentry)^.varspez=vs_const) and
-                             dont_copy_const_param(pvarsym(p^.symtableentry)^.definition)) then
+                             push_addr_param(pvarsym(p^.symtableentry)^.definition)) then
                            begin
                               simple_loadn:=false;
                               if hregister=R_NO then
@@ -190,10 +186,10 @@ implementation
                                 begin
                                    highframepointer:=R_A1;
                                    highoffset:=p^.location.reference.offset;
-                                   exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
+                                   exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,
                                      p^.location.reference.base,R_A1)));
                                 end;
-                              exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.location.reference),
+                              exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.location.reference),
                                 hregister)));
                               { END ADDITION }
                               clear_reference(p^.location.reference);
@@ -206,7 +202,7 @@ implementation
                               simple_loadn:=false;
                               if hregister=R_NO then
                                 hregister:=getaddressreg;
-                              exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.location.reference),
+                              exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.location.reference),
                                 hregister)));
                               clear_reference(p^.location.reference);
                               p^.location.reference.base:=hregister;
@@ -220,15 +216,11 @@ implementation
                     stringdispose(p^.location.reference.symbol);
                     p^.location.reference.symbol:=
                       stringdup(pprocsym(p^.symtableentry)^.definition^.mangledname);
-                    if p^.symtable^.symtabletype=unitsymtable then
-                    concat_external(p^.symtableentry^.mangledname,EXT_NEAR);
                  end;
               typedconstsym :
                  begin
                     stringdispose(p^.location.reference.symbol);
                     p^.location.reference.symbol:=stringdup(p^.symtableentry^.mangledname);
-                    if p^.symtable^.symtabletype=unitsymtable then
-                    concat_external(p^.symtableentry^.mangledname,EXT_NEAR);
                  end;
               else internalerror(4);
          end;
@@ -244,9 +236,10 @@ implementation
       var
          opsize : topsize;
          withresult : boolean;
-         otlabel,hlabel,oflabel : plabel;
+         otlabel,hlabel,oflabel : pasmlabel;
          hregister : tregister;
          loc : tloc;
+         pushed : boolean;
 
       begin
          otlabel:=truelabel;
@@ -256,32 +249,9 @@ implementation
          withresult:=false;
          { calculate left sides }
          secondpass(p^.left);
-         case p^.left^.location.loc of
-            LOC_REFERENCE : begin
-                              { in case left operator uses too many registers }
-                              { but to few are free then LEA                  }
-                              if (p^.left^.location.reference.base<>R_NO) and
-                                 (p^.left^.location.reference.index<>R_NO) and
-                                 (usableaddress<p^.right^.registers32) then
-                                begin
-                                   del_reference(p^.left^.location.reference);
-                                   hregister:=getaddressreg;
-                                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,newreference(
-                                     p^.left^.location.reference),
-                                     hregister)));
-                                   clear_reference(p^.left^.location.reference);
-                                   p^.left^.location.reference.base:=hregister;
-                                   p^.left^.location.reference.index:=R_NO;
-                                end;
-                              loc:=LOC_REFERENCE;
-                           end;
-            LOC_CREGISTER : loc:=LOC_CREGISTER;
-            else
-               begin
-                  CGMessage(cg_e_illegal_expression);
-                  exit;
-               end;
-         end;
+         if codegenerror then
+           exit;
+         loc:=p^.left^.location.loc;
          { lets try to optimize this (PM)             }
          { define a dest_loc that is the location      }
          { and a ptree to verify that it is the right }
@@ -295,19 +265,12 @@ implementation
            end;
 {$endif test_dest_loc}
 
-         if (p^.right^.treetype=realconstn) then
-           begin
-              if p^.left^.resulttype^.deftype=floatdef then
-                begin
-                   case pfloatdef(p^.left^.resulttype)^.typ of
-                     s32real : p^.right^.realtyp:=ait_real_32bit;
-                     s64real : p^.right^.realtyp:=ait_real_64bit;
-                     s80real : p^.right^.realtyp:=ait_real_extended;
-                     { what about f32bit and s64bit }
-                     end;
-                end;
-           end;
+         pushed:=maybe_push(p^.right^.registers32,p^.left);
          secondpass(p^.right);
+         if pushed then restore(p^.left);
+
+         if codegenerror then
+           exit;
 {$ifdef test_dest_loc}
          dest_loc_known:=false;
          if in_dest_loc then
@@ -341,14 +304,14 @@ implementation
                                  4 : opsize:=S_L;
                               end;
                               if loc=LOC_CREGISTER then
-                                exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,
+                                exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,
                                   newreference(p^.right^.location.reference),
                                   p^.left^.location.register)))
                               else
-                                exprasmlist^.concat(new(pai68k,op_const_ref(A_MOVE,opsize,
+                                exprasmlist^.concat(new(paicpu,op_const_ref(A_MOVE,opsize,
                                   p^.right^.location.reference.offset,
                                   newreference(p^.left^.location.reference))));
-                              {exprasmlist^.concat(new(pai68k,op_const_loc(A_MOV,opsize,
+                              {exprasmlist^.concat(new(paicpu,op_const_loc(A_MOV,opsize,
                                   p^.right^.location.reference.offset,
                                   p^.left^.location)));}
                            end
@@ -369,14 +332,14 @@ implementation
                               end;
                               { simplified with op_reg_loc         }
                               if loc=LOC_CREGISTER then
-                                exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,opsize,
+                                exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,opsize,
                                   p^.right^.location.register,
                                   p^.left^.location.register)))
                               else
-                                exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,opsize,
+                                exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,opsize,
                                   p^.right^.location.register,
                                   newreference(p^.left^.location.reference))));
-                              {exprasmlist^.concat(new(pai68k,op_reg_loc(A_MOV,opsize,
+                              {exprasmlist^.concat(new(paicpu,op_reg_loc(A_MOV,opsize,
                                   p^.right^.location.register,
                                   p^.left^.location)));             }
 
@@ -392,35 +355,35 @@ implementation
                               getlabel(hlabel);
                               emitl(A_LABEL,truelabel);
                               if loc=LOC_CREGISTER then
-                                exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_B,
+                                exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_B,
                                   1,p^.left^.location.register)))
                               else
-                                exprasmlist^.concat(new(pai68k,op_const_ref(A_MOVE,S_B,
+                                exprasmlist^.concat(new(paicpu,op_const_ref(A_MOVE,S_B,
                                   1,newreference(p^.left^.location.reference))));
-                              {exprasmlist^.concat(new(pai68k,op_const_loc(A_MOV,S_B,
+                              {exprasmlist^.concat(new(paicpu,op_const_loc(A_MOV,S_B,
                                   1,p^.left^.location)));}
                               emitl(A_JMP,hlabel);
                               emitl(A_LABEL,falselabel);
                               if loc=LOC_CREGISTER then
-                                exprasmlist^.concat(new(pai68k,op_reg(A_CLR,S_B,
+                                exprasmlist^.concat(new(paicpu,op_reg(A_CLR,S_B,
                                   p^.left^.location.register)))
                               else
-                                exprasmlist^.concat(new(pai68k,op_const_ref(A_MOVE,S_B,
+                                exprasmlist^.concat(new(paicpu,op_const_ref(A_MOVE,S_B,
                                   0,newreference(p^.left^.location.reference))));
                               emitl(A_LABEL,hlabel);
                            end;
             LOC_FLAGS    : begin
                               if loc=LOC_CREGISTER then
                                begin
-                                exprasmlist^.concat(new(pai68k,op_reg(flag_2_set[p^.right^.location.resflags],S_B,
+                                exprasmlist^.concat(new(paicpu,op_reg(flag_2_set[p^.right^.location.resflags],S_B,
                                   p^.left^.location.register)));
-                                exprasmlist^.concat(new(pai68k,op_reg(A_NEG,S_B,p^.left^.location.register)));
+                                exprasmlist^.concat(new(paicpu,op_reg(A_NEG,S_B,p^.left^.location.register)));
                                end
                               else
                                begin
-                                 exprasmlist^.concat(new(pai68k,op_ref(flag_2_set[p^.right^.location.resflags],S_B,
+                                 exprasmlist^.concat(new(paicpu,op_ref(flag_2_set[p^.right^.location.resflags],S_B,
                                     newreference(p^.left^.location.reference))));
-                                 exprasmlist^.concat(new(pai68k,op_ref(A_NEG,S_B,newreference(p^.left^.location.reference))));
+                                 exprasmlist^.concat(new(paicpu,op_ref(A_NEG,S_B,newreference(p^.left^.location.reference))));
                                end;
 
                            end;
@@ -453,7 +416,7 @@ implementation
               hr_valid:=true;
               hp:=new_reference(procinfo.framepointer,
                 procinfo.framepointer_offset);
-              exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hp,hr)));
+              exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hp,hr)));
 
               pp:=procinfo.parent;
               { walk up the stack frame }
@@ -461,7 +424,7 @@ implementation
                 begin
                    hp:=new_reference(hr,
                      pp^.framepointer_offset);
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hp,hr)));
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hp,hr)));
                    pp:=pp^.parent;
                 end;
               p^.location.reference.base:=hr;
@@ -474,7 +437,7 @@ implementation
               if not hr_valid then
                 { this was wrong !! PM }
                 hr:=getaddressreg;
-              exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.location.reference),hr)));
+              exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.location.reference),hr)));
               p^.location.reference.base:=hr;
               p^.location.reference.offset:=0;
            end;
@@ -510,7 +473,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.8  1999-09-16 11:34:54  pierre
+  Revision 1.9  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.8  1999/09/16 11:34:54  pierre
    * typo correction
 
   Revision 1.7  1998/10/19 08:54:55  pierre

+ 49 - 46
compiler/cg68kmat.pas

@@ -35,11 +35,11 @@ interface
 implementation
 
     uses
-      globtype,systems,
+      globtype,systems,symconst,
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      m68k,cga68k,tgen68k;
+      cpubase,cga68k,tgen68k;
 
 {*****************************************************************************
                              SecondModDiv
@@ -51,10 +51,10 @@ implementation
       var
          hreg1 : tregister;
          power : longint;
-         hl : plabel;
+         hl : pasmlabel;
          reg: tregister;
          pushed: boolean;
-         hl1: plabel;
+         hl1: pasmlabel;
       begin
          secondpass(p^.left);
          set_location(p^.location,p^.left^.location);
@@ -74,7 +74,7 @@ implementation
                 begin
                   del_reference(p^.left^.location.reference);
                   hreg1:=getregister32;
-                  exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),
+                  exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),
                     hreg1)));
                 end;
               clear_location(p^.left^.location);
@@ -86,26 +86,26 @@ implementation
          if (p^.treetype=divn) and (p^.right^.treetype=ordconstn) and
             ispowerof2(p^.right^.value,power) then
            begin
-              exprasmlist^.concat(new(pai68k, op_reg(A_TST, S_L, hreg1)));
+              exprasmlist^.concat(new(paicpu, op_reg(A_TST, S_L, hreg1)));
               getlabel(hl);
               emitl(A_BPL,hl);
               if (power = 1) then
-                 exprasmlist^.concat(new(pai68k, op_const_reg(A_ADDQ, S_L,1, hreg1)))
+                 exprasmlist^.concat(new(paicpu, op_const_reg(A_ADDQ, S_L,1, hreg1)))
               else
                Begin
                  { optimize using ADDQ if possible!   }
                  if (p^.right^.value-1) < 9 then
-                   exprasmlist^.concat(new(pai68k, op_const_reg(A_ADDQ, S_L,p^.right^.value-1, hreg1)))
+                   exprasmlist^.concat(new(paicpu, op_const_reg(A_ADDQ, S_L,p^.right^.value-1, hreg1)))
                  else
-                   exprasmlist^.concat(new(pai68k, op_const_reg(A_ADD, S_L,p^.right^.value-1, hreg1)));
+                   exprasmlist^.concat(new(paicpu, op_const_reg(A_ADD, S_L,p^.right^.value-1, hreg1)));
                end;
               emitl(A_LABEL, hl);
               if (power > 0) and (power < 9) then
-                 exprasmlist^.concat(new(pai68k, op_const_reg(A_ASR, S_L,power, hreg1)))
+                 exprasmlist^.concat(new(paicpu, op_const_reg(A_ASR, S_L,power, hreg1)))
               else
                begin
-                  exprasmlist^.concat(new(pai68k, op_const_reg(A_MOVE,S_L,power, R_D0)));
-                  exprasmlist^.concat(new(pai68k, op_reg_reg(A_ASR,S_L,R_D0, hreg1)));
+                  exprasmlist^.concat(new(paicpu, op_const_reg(A_MOVE,S_L,power, R_D0)));
+                  exprasmlist^.concat(new(paicpu, op_reg_reg(A_ASR,S_L,R_D0, hreg1)));
                end;
            end
          else
@@ -119,7 +119,7 @@ implementation
                  begin
                    del_reference(p^.right^.location.reference);
                    p^.left^.location.loc:=LOC_REGISTER;
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.right^.location.reference),R_D1)));
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.right^.location.reference),R_D1)));
                 end
              else
               begin
@@ -134,38 +134,38 @@ implementation
                  { Check if divisor is ZERO - if so call HALT_ERROR }
                  { with d0 = 200 (Division by zero!)                }
                  getlabel(hl1);
-                 exprasmlist^.concat(new(pai68k,op_reg(A_TST,S_L,R_D1)));
+                 exprasmlist^.concat(new(paicpu,op_reg(A_TST,S_L,R_D1)));
                  { if not zero then simply continue on }
                  emitl(A_BNE,hl1);
-                 exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,200,R_D0)));
+                 exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,200,R_D0)));
                  emitcall('FPC_HALT_ERROR',true);
                  emitl(A_LABEL,hl1);
                  if (p^.treetype = modn) then
                  Begin
                    reg := getregister32;
-                   exprasmlist^.concat(new(pai68k,op_reg(A_CLR,S_L,reg)));
+                   exprasmlist^.concat(new(paicpu,op_reg(A_CLR,S_L,reg)));
                    getlabel(hl);
                    { here what we do is prepare the high register with the     }
                    { correct sign. i.e we clear it, check if the low dword reg }
                    { which will participate in the division is signed, if so we}
                    { we extend the sign to the high doword register by inverting }
                    { all the bits.                                             }
-                   exprasmlist^.concat(new(pai68k,op_reg(A_TST,S_L,hreg1)));
+                   exprasmlist^.concat(new(paicpu,op_reg(A_TST,S_L,hreg1)));
                    emitl(A_BPL,hl);
-                   exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,reg)));
+                   exprasmlist^.concat(new(paicpu,op_reg(A_NOT,S_L,reg)));
                    emitl(A_LABEL,hl);
                    { reg:hreg1 / d1 }
-                   exprasmlist^.concat(new(pai68k,op_reg_reg_reg(A_DIVSL,S_L,R_D1,reg,hreg1)));
+                   exprasmlist^.concat(new(paicpu,op_reg_reg_reg(A_DIVSL,S_L,R_D1,reg,hreg1)));
                    { hreg1 already contains quotient }
                    { looking for remainder }
-                   exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,reg,hreg1)));
+                   exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,reg,hreg1)));
                    ungetregister32(reg);
                  end
                  else
                  { simple division... }
                  Begin
                    { reg:hreg1 / d1 }
-                   exprasmlist^.concat(new(pai68k,op_reg_reg(A_DIVS,S_L,R_D1,hreg1)));
+                   exprasmlist^.concat(new(paicpu,op_reg_reg(A_DIVS,S_L,R_D1,hreg1)));
                  end;
               end
               else { MC68000 operations }
@@ -222,7 +222,7 @@ implementation
                 begin
                    del_reference(p^.left^.location.reference);
                    hregister1:=getregister32;
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),
                      hregister1)));
                 end;
            end
@@ -238,13 +238,13 @@ implementation
          if (p^.right^.treetype=ordconstn) then
            begin
              if (p^.right^.location.reference.offset and 31 > 0) and (p^.right^.location.reference.offset and 31 < 9) then
-                 exprasmlist^.concat(new(pai68k,op_const_reg(op,S_L,p^.right^.location.reference.offset and 31,
+                 exprasmlist^.concat(new(paicpu,op_const_reg(op,S_L,p^.right^.location.reference.offset and 31,
                    hregister1)))
              else
                begin
-                 exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,p^.right^.location.reference.offset and 31,
+                 exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,p^.right^.location.reference.offset and 31,
                    R_D6)));
-                 exprasmlist^.concat(new(pai68k,op_reg_reg(op,S_L,R_D6,hregister1)));
+                 exprasmlist^.concat(new(paicpu,op_reg_reg(op,S_L,R_D6,hregister1)));
                end;
               p^.location.loc:=LOC_REGISTER;
               p^.location.register:=hregister1;
@@ -264,7 +264,7 @@ implementation
                      begin
                         del_reference(p^.right^.location.reference);
                         hregister2:=getregister32;
-                        exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.right^.location.reference),
+                        exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.right^.location.reference),
                           hregister2)));
                      end;
                 end
@@ -290,13 +290,13 @@ implementation
          case p^.left^.location.loc of
             LOC_REGISTER : begin
                               p^.location.register:=p^.left^.location.register;
-                              exprasmlist^.concat(new(pai68k,op_reg(A_NEG,S_L,p^.location.register)));
+                              exprasmlist^.concat(new(paicpu,op_reg(A_NEG,S_L,p^.location.register)));
                            end;
             LOC_CREGISTER : begin
                                p^.location.register:=getregister32;
                                emit_reg_reg(A_MOVE,S_L,p^.location.register,
                                  p^.location.register);
-                               exprasmlist^.concat(new(pai68k,op_reg(A_NEG,S_L,p^.location.register)));
+                               exprasmlist^.concat(new(paicpu,op_reg(A_NEG,S_L,p^.location.register)));
                             end;
             LOC_REFERENCE,LOC_MEM :
                            begin
@@ -315,28 +315,28 @@ implementation
                                      p^.left^.location.reference,p^.location);
                                    if (cs_fp_emulation) in aktmoduleswitches then
                                        { if in emulation mode change sign manually }
-                                       exprasmlist^.concat(new(pai68k,op_const_reg(A_BCHG,S_L,31,
+                                       exprasmlist^.concat(new(paicpu,op_const_reg(A_BCHG,S_L,31,
                                           p^.location.fpureg)))
                                    else
-                                       exprasmlist^.concat(new(pai68k,op_reg(A_FNEG,S_FX,
+                                       exprasmlist^.concat(new(paicpu,op_reg(A_FNEG,S_FX,
                                           p^.location.fpureg)));
                                 end
                               else
                                 begin
                                    p^.location.register:=getregister32;
-                                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                                      newreference(p^.left^.location.reference),
                                      p^.location.register)));
-                                   exprasmlist^.concat(new(pai68k,op_reg(A_NEG,S_L,p^.location.register)));
+                                   exprasmlist^.concat(new(paicpu,op_reg(A_NEG,S_L,p^.location.register)));
                                 end;
                            end;
             LOC_FPU : begin
                               p^.location.loc:=LOC_FPU;
                               p^.location.fpureg := p^.left^.location.fpureg;
                               if (cs_fp_emulation) in aktmoduleswitches then
-                                  exprasmlist^.concat(new(pai68k,op_const_reg(A_BCHG,S_L,31,p^.location.fpureg)))
+                                  exprasmlist^.concat(new(paicpu,op_const_reg(A_BCHG,S_L,31,p^.location.fpureg)))
                               else
-                                 exprasmlist^.concat(new(pai68k,op_reg(A_FNEG,S_FX,p^.location.fpureg)));
+                                 exprasmlist^.concat(new(paicpu,op_reg(A_FNEG,S_FX,p^.location.fpureg)));
                            end;
          end;
 {         emitoverflowcheck;}
@@ -355,7 +355,7 @@ implementation
              F_A,F_AE,F_B,F_BE);
 
       var
-         hl : plabel;
+         hl : pasmlabel;
 
       begin
          if (p^.resulttype^.deftype=orddef) and
@@ -379,7 +379,7 @@ implementation
                     LOC_REGISTER : begin
                                       secondpass(p^.left);
                                       p^.location.register:=p^.left^.location.register;
-                                      exprasmlist^.concat(new(pai68k,op_const_reg(A_EOR,S_B,1,p^.location.register)));
+                                      exprasmlist^.concat(new(paicpu,op_const_reg(A_EOR,S_B,1,p^.location.register)));
                                    end;
                     LOC_CREGISTER : begin
                                        secondpass(p^.left);
@@ -387,7 +387,7 @@ implementation
                                        p^.location.register:=getregister32;
                                        emit_reg_reg(A_MOVE,S_B,p^.left^.location.register,
                                          p^.location.register);
-                                       exprasmlist^.concat(new(pai68k,op_const_reg(A_EOR,S_B,1,p^.location.register)));
+                                       exprasmlist^.concat(new(paicpu,op_const_reg(A_EOR,S_B,1,p^.location.register)));
                                     end;
                     LOC_REFERENCE,LOC_MEM : begin
                                               secondpass(p^.left);
@@ -398,10 +398,10 @@ implementation
                                                 emit_reg_reg(A_MOVE,S_B,p^.left^.location.register,
                                                    p^.location.register)
                                               else
-                                                exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,
+                                                exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,
                                               newreference(p^.left^.location.reference),
                                                 p^.location.register)));
-                                              exprasmlist^.concat(new(pai68k,op_const_reg(A_EOR,S_B,1,p^.location.register)));
+                                              exprasmlist^.concat(new(paicpu,op_const_reg(A_EOR,S_B,1,p^.location.register)));
                                            end;
                  end;
               end
@@ -413,22 +413,22 @@ implementation
                 case p^.left^.location.loc of
                    LOC_REGISTER : begin
                                      p^.location.register:=p^.left^.location.register;
-                                     exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,p^.location.register)));
+                                     exprasmlist^.concat(new(paicpu,op_reg(A_NOT,S_L,p^.location.register)));
                                   end;
                    LOC_CREGISTER : begin
                                      p^.location.register:=getregister32;
                                      emit_reg_reg(A_MOVE,S_L,p^.left^.location.register,
                                        p^.location.register);
-                                     exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,p^.location.register)));
+                                     exprasmlist^.concat(new(paicpu,op_reg(A_NOT,S_L,p^.location.register)));
                                    end;
                    LOC_REFERENCE,LOC_MEM :
                                   begin
                                      del_reference(p^.left^.location.reference);
                                      p^.location.register:=getregister32;
-                                     exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                                     exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                                        newreference(p^.left^.location.reference),
                                        p^.location.register)));
-                                     exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,p^.location.register)));
+                                     exprasmlist^.concat(new(paicpu,op_reg(A_NOT,S_L,p^.location.register)));
                                   end;
                 end;
                 {if  p^.left^.location.loc=loc_register then
@@ -437,11 +437,11 @@ implementation
                   begin
                      del_locref(p^.left^.location);
                      p^.location.register:=getregister32;
-                     exprasmlist^.concat(new(pai68k,op_loc_reg(A_MOV,S_L,
+                     exprasmlist^.concat(new(paicpu,op_loc_reg(A_MOV,S_L,
                        p^.left^.location,
                        p^.location.register)));
                   end;
-                exprasmlist^.concat(new(pai68k,op_reg(A_NOT,S_L,p^.location.register)));}
+                exprasmlist^.concat(new(paicpu,op_reg(A_NOT,S_L,p^.location.register)));}
 
              end;
       end;
@@ -449,7 +449,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.4  1998-12-11 00:03:05  peter
+  Revision 1.5  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.4  1998/12/11 00:03:05  peter
     + globtype,tokens,version unit splitted from globals
 
   Revision 1.3  1998/10/13 16:50:10  pierre

+ 45 - 42
compiler/cg68kmem.pas

@@ -47,7 +47,7 @@ implementation
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      m68k,cga68k,tgen68k;
+      cpubase,cga68k,tgen68k;
 
 
 {*****************************************************************************
@@ -58,7 +58,7 @@ implementation
       begin
          p^.location.loc:=LOC_REGISTER;
          p^.location.register:=getregister32;
-         exprasmlist^.concat(new(pai68k,op_csymbol_reg(A_MOVE,
+         exprasmlist^.concat(new(paicpu,op_csymbol_reg(A_MOVE,
             S_L,newcsymbol(pobjectdef(pclassrefdef(p^.resulttype)^.definition)^.vmt_mangledname,0),
             p^.location.register)));
       end;
@@ -135,7 +135,7 @@ implementation
             LOC_REGISTER,
             LOC_CREGISTER : begin
                                p^.location.reference.base:=getaddressreg;
-                               exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
+                               exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,
                                  p^.left^.location.register,
                                  p^.location.reference.base)));
                             end;
@@ -143,7 +143,7 @@ implementation
                             begin
                                del_reference(p^.left^.location.reference);
                                p^.location.reference.base:=getaddressreg;
-                               exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),
+                               exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.left^.location.reference),
                                  p^.location.reference.base)));
                             end;
          end;
@@ -172,7 +172,7 @@ implementation
 
          { push pointer adress }
          case p^.left^.location.loc of
-            LOC_CREGISTER : exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
+            LOC_CREGISTER : exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,
               p^.left^.location.register,R_SPPUSH)));
             LOC_REFERENCE:
               emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
@@ -249,14 +249,14 @@ implementation
             (p^.left^.symtableentry^.typ=varsym) and
           (Pvarsym(p^.left^.symtableentry)^.definition^.deftype=
            procvardef) then
-            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
              newreference(p^.left^.location.reference),
              p^.location.register)))
          else
            begin
-            exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,
+            exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,
              newreference(p^.left^.location.reference),R_A0)));
-            exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
+            exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,
              R_A0,p^.location.register)));
            end;
          { for use of other segments }
@@ -277,9 +277,9 @@ implementation
          p^.location.loc:=LOC_REGISTER;
          del_reference(p^.left^.location.reference);
          p^.location.register:=getregister32;
-         exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,
+         exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,
           newreference(p^.left^.location.reference),R_A0)));
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,
           R_A0,p^.location.register)));
       end;
 
@@ -318,7 +318,7 @@ implementation
 
                  { ...and reserve one for the pointer }
                  hr:=getaddressreg;
-                 exprasmlist^.concat(new(pai68k,op_ref_reg(
+                 exprasmlist^.concat(new(paicpu,op_ref_reg(
                    A_MOVE,S_L,newreference(p^.left^.location.reference),
                    hr)));
                  p^.location.reference.base:=hr;
@@ -343,7 +343,7 @@ implementation
            exit;
          { classes must be dereferenced implicit }
          if (p^.left^.resulttype^.deftype=objectdef) and
-           pobjectdef(p^.left^.resulttype)^.isclass then
+           pobjectdef(p^.left^.resulttype)^.is_class then
            begin
              clear_reference(p^.location.reference);
              case p^.left^.location.loc of
@@ -370,7 +370,7 @@ implementation
 
                      { ... and reserve one for the pointer }
                      hr:=getaddressreg;
-                     exprasmlist^.concat(new(pai68k,op_ref_reg(
+                     exprasmlist^.concat(new(paicpu,op_ref_reg(
                        A_MOVE,S_L,newreference(p^.left^.location.reference),
                        hr)));
                      p^.location.reference.base:=hr;
@@ -408,29 +408,29 @@ implementation
            l1:=p^.resulttype^.size;
            case l1 of
               1     : p^.location.reference.scalefactor:=l1;
-              2 : exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,1,ind)));
-              4 : exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,2,ind)));
-              8 : exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,3,ind)));
+              2 : exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,1,ind)));
+              4 : exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,2,ind)));
+              8 : exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,3,ind)));
            else
              begin
                if ispowerof2(l1,l2) then
-                 exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,l2,ind)))
+                 exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,l2,ind)))
                    else
                  begin
                    { use normal MC68000 signed multiply }
                    if (l1 >= -32768) and (l1 <= 32767) then
-                     exprasmlist^.concat(new(pai68k,op_const_reg(A_MULS,S_W,l1,ind)))
+                     exprasmlist^.concat(new(paicpu,op_const_reg(A_MULS,S_W,l1,ind)))
                    else
                    { use long MC68020 long multiply }
                    if (aktoptprocessor = MC68020) then
-                     exprasmlist^.concat(new(pai68k,op_const_reg(A_MULS,S_L,l1,ind)))
+                     exprasmlist^.concat(new(paicpu,op_const_reg(A_MULS,S_L,l1,ind)))
                    else
                    { MC68000 long multiply }
                      begin
-                       exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,l1,R_D0)));
-                       exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,ind,R_D1)));
+                       exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,l1,R_D0)));
+                       exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,ind,R_D1)));
                        emitcall('FPC_LONGMUL',true);
-                       exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D0,ind)));
+                       exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_D0,ind)));
                      end;
                  end;
              end; { else case }
@@ -441,7 +441,7 @@ implementation
        extraoffset : longint;
          t : ptree;
          hp : preference;
-         tai:pai68k;
+         tai:paicpu;
        reg: tregister;
 
       begin
@@ -542,9 +542,9 @@ implementation
                 LOC_REGISTER : begin
                                  ind:=p^.right^.location.register;
                                  case p^.right^.resulttype^.size of
-                                 1: exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,
+                                 1: exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,
                                       $ff,ind)));
-                                 2: exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,
+                                 2: exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,
                                       $ffff,ind)));
                                  end;
                                end;
@@ -553,32 +553,32 @@ implementation
                                    ind:=getregister32;
                                    emit_reg_reg(A_MOVE,S_L,p^.right^.location.register,ind);
                                    case p^.right^.resulttype^.size of
-                                   1: exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,
+                                   1: exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,
                                       $ff,ind)));
-                                   2: exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,
+                                   2: exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,
                                       $ffff,ind)));
                                    end;
                                 end;
                    LOC_FLAGS:
                      begin
                         ind:=getregister32;
-                        exprasmlist^.concat(new(pai68k,op_reg(flag_2_set[p^.right^.location.resflags],S_B,ind)));
-                        exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,$ff,ind)));
+                        exprasmlist^.concat(new(paicpu,op_reg(flag_2_set[p^.right^.location.resflags],S_B,ind)));
+                        exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,$ff,ind)));
                      end
                 else { else outer case }
                    begin
                       del_reference(p^.right^.location.reference);
                            ind:=getregister32;
 
-                      exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                      exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                         newreference(p^.right^.location.reference),ind)));
 
                            {Booleans are stored in an 8 bit memory location, so
                            the use of MOVL is not correct.}
                       case p^.right^.resulttype^.size of
-                        1: exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,
+                        1: exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,
                           $ff,ind)));
-                        2: exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,
+                        2: exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,
                           $ffff,ind)));
                       end; { end case }
                 end; { end else begin }
@@ -607,7 +607,7 @@ implementation
               if p^.location.reference.base <> R_NO then
                 CGMessage(cg_f_secondvecn_base_defined_twice);
               p^.location.reference.base:=getaddressreg;
-              exprasmlist^.concat(new(pai68k,op_csymbol_reg(A_LEA,S_L,newcsymbol(p^.location.reference.symbol^,0),
+              exprasmlist^.concat(new(paicpu,op_csymbol_reg(A_LEA,S_L,newcsymbol(p^.location.reference.symbol^,0),
                 p^.location.reference.base)));
               stringdispose(p^.location.reference.symbol);
            end;
@@ -622,12 +622,12 @@ implementation
               { with correct value.                    }
               if p^.location.reference.offset > 127 then
                 begin
-                   exprasmlist^.concat(new(pai68k,op_const_reg(A_ADD,S_L,p^.location.reference.offset,ind)));
+                   exprasmlist^.concat(new(paicpu,op_const_reg(A_ADD,S_L,p^.location.reference.offset,ind)));
                    p^.location.reference.offset := 0;
                 end
               else if p^.location.reference.offset < -128 then
                 begin
-                   exprasmlist^.concat(new(pai68k,op_const_reg(A_SUB,S_L,-p^.location.reference.offset,ind)));
+                   exprasmlist^.concat(new(paicpu,op_const_reg(A_SUB,S_L,-p^.location.reference.offset,ind)));
                    p^.location.reference.offset := 0;
                 end;
            end
@@ -635,9 +635,9 @@ implementation
          else if p^.location.reference.base=R_NO then
            begin
               case p^.location.reference.scalefactor of
-                  2 : exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,1,p^.location.reference.index)));
-                  4 : exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,2,p^.location.reference.index)));
-                  8 : exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,3,p^.location.reference.index)));
+                  2 : exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,1,p^.location.reference.index)));
+                  4 : exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,2,p^.location.reference.index)));
+                  8 : exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,3,p^.location.reference.index)));
                 end;
               calc_emit_mul;
 
@@ -655,7 +655,7 @@ implementation
          else
            begin
               reg := getaddressreg;
-              exprasmlist^.concat(new(pai68k,op_ref_reg(
+              exprasmlist^.concat(new(paicpu,op_ref_reg(
                 A_LEA,S_L,newreference(p^.location.reference),
                 reg)));
 
@@ -701,9 +701,9 @@ implementation
                secondpass(p^.left);
                ref.symbol:=nil;
                gettempofsizereference(4,ref);
-               exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,
+               exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,
                  newreference(p^.left^.location.reference),R_A0)));
-               exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_L,
+               exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_L,
                  R_A0,newreference(ref))));
                del_reference(p^.left^.location.reference);
                { the offset relative to (%ebp) is only needed here! }
@@ -725,7 +725,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.12  1999-08-25 11:59:52  jonas
+  Revision 1.13  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.12  1999/08/25 11:59:52  jonas
     * changed pai386, paippc and paiapha (same for tai*) to paicpu (taicpu)
 
   Revision 1.11  1998/12/11 10:48:11  pierre

+ 72 - 71
compiler/cg68kset.pas

@@ -34,11 +34,11 @@ interface
 implementation
 
     uses
-      globtype,systems,
+      globtype,systems,symconst,
       cobjects,verbose,globals,
       symtable,aasm,types,
       hcodegen,temp_gen,pass_2,
-      m68k,cga68k,tgen68k;
+      cpubase,cga68k,tgen68k;
 
     const
       bytes2Sxx:array[1..4] of Topsize=(S_B,S_W,S_NO,S_L);
@@ -88,9 +88,9 @@ implementation
          setparts:array[1..8] of Tsetpart;
          i,numparts:byte;
          {href,href2:Treference;}
-         l,l2 : plabel;
-         hl,hl1 : plabel;
-         hl2, hl3: plabel;
+         l,l2 : pasmlabel;
+         hl,hl1 : pasmlabel;
+         hl2, hl3: pasmlabel;
          opsize : topsize;
 
 
@@ -191,14 +191,14 @@ implementation
                      LOC_REGISTER,LOC_CREGISTER :
                        begin
                          emit_reg_reg(A_MOVE,S_L,p^.right^.location.register,R_D1);
-                         exprasmlist^.concat(new(pai68k,
+                         exprasmlist^.concat(new(paicpu,
                            op_const_reg(A_AND,S_L, 1 shl (p^.left^.value and 31),R_D1)));
                        end;
                    else
                        begin
-                         exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(
+                         exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(
                            p^.right^.location.reference),R_D1)));
-                         exprasmlist^.concat(new(pai68k,op_const_reg(
+                         exprasmlist^.concat(new(paicpu,op_const_reg(
                            A_AND,S_L,1 shl (p^.left^.value and 31) ,R_D1)));
                        end;
                    end;
@@ -227,7 +227,7 @@ implementation
                          begin
                             { Small sets are always 32 bit values, there is no  }
                             { way they can be anything else, so no problems here}
-                            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                               newreference(p^.left^.location.reference),R_D1)));
                             hr:=R_D1;
                             del_reference(p^.left^.location.reference);
@@ -235,12 +235,12 @@ implementation
                    end;
                    case p^.right^.location.loc of
                       LOC_REGISTER,
-                      LOC_CREGISTER : exprasmlist^.concat(new(pai68k, op_reg_reg(A_BTST,S_L,hr,p^.right^.location.register)));
+                      LOC_CREGISTER : exprasmlist^.concat(new(paicpu, op_reg_reg(A_BTST,S_L,hr,p^.right^.location.register)));
                       else
                          begin
-                            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(p^.right^.location.reference),
+                            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(p^.right^.location.reference),
                               R_D0)));
-                            exprasmlist^.concat(new(pai68k,op_reg_reg(A_BTST,S_L,hr,R_D0)));
+                            exprasmlist^.concat(new(paicpu,op_reg_reg(A_BTST,S_L,hr,R_D0)));
                             del_reference(p^.right^.location.reference);
                          end;
                    end;
@@ -250,12 +250,12 @@ implementation
                    getlabel(hl);
                    emitl(A_BNE,hl);
                    { leave all bits unchanged except Carry  = 0 }
-                   exprasmlist^.concat(new(pai68k, op_const_reg(A_AND, S_B, $FE, R_CCR)));
+                   exprasmlist^.concat(new(paicpu, op_const_reg(A_AND, S_B, $FE, R_CCR)));
                    getlabel(hl1);
                    emitl(A_BRA,hl1);
                    emitl(A_LABEL, hl);
                    { set carry to 1 }
-                   exprasmlist^.concat(new(pai68k, op_const_reg(A_OR, S_B, $01, R_CCR)));
+                   exprasmlist^.concat(new(paicpu, op_const_reg(A_OR, S_B, $01, R_CCR)));
                    emitl(A_LABEL, hl1);
                    { end support carry routines }
                    p^.location.loc:=LOC_FLAGS;
@@ -273,9 +273,9 @@ implementation
                      exit;
                    p^.location.resflags:=F_NE;
                    inc(p^.right^.location.reference.offset,(p^.left^.value div 32)*4);
-                   exprasmlist^.concat(new(pai68k, op_ref_reg(A_MOVE, S_L,
+                   exprasmlist^.concat(new(paicpu, op_ref_reg(A_MOVE, S_L,
                        newreference(p^.right^.location.reference), R_D1)));
-                   exprasmlist^.concat(new(pai68k, op_const_reg(A_AND, S_L,
+                   exprasmlist^.concat(new(paicpu, op_const_reg(A_AND, S_L,
                        1 shl (p^.left^.value mod 32),R_D1)));
                    del_reference(p^.right^.location.reference);
                 end
@@ -293,7 +293,7 @@ implementation
                       case p^.left^.location.loc of
                         LOC_REGISTER,
                         LOC_CREGISTER :
-                           exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,
+                           exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,
                              255,p^.left^.location.register)));
                         else
                          Begin
@@ -301,16 +301,16 @@ implementation
                            { value into a register first, all depending on the source      }
                            { size!                                                         }
                            opsize:=S_NO;
-                           case integer(p^.left^.resulttype^.savesize) of
+                           case integer(p^.left^.resulttype^.size) of
                              1 : opsize:=S_B;
                              2 : opsize:=S_W;
                              4 : opsize:=S_L;
                            else
                              internalerror(19);
                            end;
-                           exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,
+                           exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,
                              newreference(p^.left^.location.reference),R_D0)));
-                           exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,
+                           exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,
                              255,R_D0)));
                          end;
                       end;
@@ -339,37 +339,37 @@ implementation
                                     case p^.left^.location.loc of
                                       LOC_REGISTER,
                                       LOC_CREGISTER :
-                                         exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_W,
+                                         exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,S_W,
                                            setparts[i].start,p^.left^.location.register)));
                                     else
-                                         exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_W,
+                                         exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,S_W,
                                            setparts[i].start,R_D0)));
-{                                         exprasmlist^.concat(new(pai68k,op_const_ref(A_CMP,S_B,
+{                                         exprasmlist^.concat(new(paicpu,op_const_ref(A_CMP,S_B,
                                            setparts[i].start,newreference(p^.left^.location.reference))));}
                                     end;
                                   {Result should be in carry flag when ranges are used.}
                                   { Here the m68k does not affect any flag except the  }
                                   { flag which is OR'ed                                }
                                   if ranges then
-                                     exprasmlist^.concat(new(pai68k,op_const_reg(A_OR,S_B,$01,R_CCR)));
+                                     exprasmlist^.concat(new(paicpu,op_const_reg(A_OR,S_B,$01,R_CCR)));
                                   {If found, jump to end.}
                                   emitl(A_BEQ,l);
                                   case p^.left^.location.loc of
                                     LOC_REGISTER,
                                     LOC_CREGISTER :
-                                      exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_W,
+                                      exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,S_W,
                                         setparts[i].stop,p^.left^.location.register)));
                                     else
-                                      exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_W,
+                                      exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,S_W,
                                         setparts[i].stop,R_D0)));
-{                                      exprasmlist^.concat(new(pai68k,op_const_ref(A_CMP,S_B,
+{                                      exprasmlist^.concat(new(paicpu,op_const_ref(A_CMP,S_B,
                                       setparts[i].stop,newreference(p^.left^.location.reference))));}
                                   end;
                                   {Result should be in carry flag when ranges are used.}
                                   { Here the m68k does not affect any flag except the  }
                                   { flag which is OR'ed                                }
                                   if ranges then
-                                     exprasmlist^.concat(new(pai68k,op_const_reg(A_OR,S_B,$01,R_CCR)));
+                                     exprasmlist^.concat(new(paicpu,op_const_reg(A_OR,S_B,$01,R_CCR)));
                                   {If found, jump to end.}
                                   emitl(A_BEQ,l);
                              end
@@ -382,12 +382,12 @@ implementation
                                     case p^.left^.location.loc of
                                       LOC_REGISTER,
                                       LOC_CREGISTER :
-                                        exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_W,
+                                        exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,S_W,
                                         setparts[i].start,p^.left^.location.register)));
                                     else
-                                        exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_W,
+                                        exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,S_W,
                                         setparts[i].start,R_D0)));
-{                                        exprasmlist^.concat(new(pai68k,op_const_ref(A_CMP,S_B,
+{                                        exprasmlist^.concat(new(paicpu,op_const_ref(A_CMP,S_B,
                                         setparts[i].start,newreference(p^.left^.location.reference)))); }
                                     end;
                                     {If lower, jump to next check.}
@@ -400,12 +400,12 @@ implementation
                                           case p^.left^.location.loc of
                                             LOC_REGISTER,
                                             LOC_CREGISTER :
-                                              exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_W,
+                                              exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,S_W,
                                                 setparts[i].stop+1,p^.left^.location.register)));
                                           else
-                                              exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_W,
+                                              exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,S_W,
                                                 setparts[i].stop+1,R_D0)));
-{                                              exprasmlist^.concat(new(pai68k,op_const_ref(A_CMP,S_B,
+{                                              exprasmlist^.concat(new(paicpu,op_const_ref(A_CMP,S_B,
                                                 setparts[i].stop+1,newreference(p^.left^.location.reference))));}
                                           end; { end case }
                                           {If higher, element is in set.}
@@ -413,7 +413,7 @@ implementation
                                        end
                                      else
                                        begin
-                                         exprasmlist^.concat(new(pai68k,op_const_reg(A_OR,S_B,$01,R_CCR)));
+                                         exprasmlist^.concat(new(paicpu,op_const_reg(A_OR,S_B,$01,R_CCR)));
                                          emitl(A_JMP,l);
                                        end;
                                   end;
@@ -426,23 +426,23 @@ implementation
                                  case p^.left^.location.loc of
                                    LOC_REGISTER,
                                    LOC_CREGISTER :
-                                     exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_W,
+                                     exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,S_W,
                                       setparts[i].stop,p^.left^.location.register)));
                                    else
-{                                     exprasmlist^.concat(new(pai68k,op_const_ref(A_CMP,S_B,
+{                                     exprasmlist^.concat(new(paicpu,op_const_ref(A_CMP,S_B,
                                      setparts[i].stop,newreference(p^.left^.location.reference))));}
-                                     exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,S_W,
+                                     exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,S_W,
                                       setparts[i].stop,R_D0)));
                                    end;
                                  {Result should be in carry flag when ranges are used.}
                                  if ranges then
-                                   exprasmlist^.concat(new(pai68k, op_const_reg(A_OR,S_B,$01,R_CCR)));
+                                   exprasmlist^.concat(new(paicpu, op_const_reg(A_OR,S_B,$01,R_CCR)));
                                    {If found, jump to end.}
                                  emitl(A_BEQ,l);
                                end;
                             if ranges then
                             { clear carry flag }
-                                exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_B,$FE,R_CCR)));
+                                exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_B,$FE,R_CCR)));
                             {To compensate for not doing a second pass.}
                             stringdispose(p^.right^.location.reference.symbol);
                             {Now place the end label.}
@@ -472,7 +472,7 @@ implementation
                             { d0.b = value to compare with                          }
                             { CARRY SET IF FOUND ON EXIT                            }
                             loadsetelement(p^.left);
-                            exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,
+                            exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,
                               newreference(p^.right^.location.reference),R_A0)));;
 {                            emitpushreferenceaddr(p^.right^.location.reference);}
                             del_reference(p^.right^.location.reference);
@@ -499,7 +499,7 @@ implementation
          hp : ptree;
          { register with case expression }
          hregister : tregister;
-         endlabel,elselabel : plabel;
+         endlabel,elselabel : pasmlabel;
 
          { true, if we can omit the range check of the jump table }
          jumptable_no_range : boolean;
@@ -507,7 +507,7 @@ implementation
       procedure gentreejmp(p : pcaserecord);
 
         var
-           lesslabel,greaterlabel : plabel;
+           lesslabel,greaterlabel : pasmlabel;
 
       begin
          emitl(A_LABEL,p^._at);
@@ -524,7 +524,7 @@ implementation
          { no range label: }
          if p^._low=p^._high then
            begin
-              exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,opsize,p^._low,hregister)));
+              exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,opsize,p^._low,hregister)));
               if greaterlabel=lesslabel then
                 begin
                    emitl(A_BNE,lesslabel);
@@ -538,9 +538,9 @@ implementation
            end
          else
            begin
-              exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,opsize,p^._low,hregister)));
+              exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,opsize,p^._low,hregister)));
               emitl(jmp_le,lesslabel);
-              exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,opsize,p^._high,hregister)));
+              exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,opsize,p^._high,hregister)));
               emitl(jmp_gt,greaterlabel);
               emitl(A_JMP,p^.statement);
            end;
@@ -564,12 +564,12 @@ implementation
              if t^._low=t^._high then
                begin
                   if (t^._low-last > 0) and (t^._low-last < 9) then
-                     exprasmlist^.concat(new(pai68k,op_const_reg(A_SUBQ,opsize,t^._low-last,hregister)))
+                     exprasmlist^.concat(new(paicpu,op_const_reg(A_SUBQ,opsize,t^._low-last,hregister)))
                   else
                   if (t^._low-last = 0) then
-                     exprasmlist^.concat(new(pai68k,op_reg(A_TST,opsize,hregister)))
+                     exprasmlist^.concat(new(paicpu,op_reg(A_TST,opsize,hregister)))
                   else
-                     exprasmlist^.concat(new(pai68k,op_const_reg(A_SUB,opsize,t^._low-last,hregister)));
+                     exprasmlist^.concat(new(paicpu,op_const_reg(A_SUB,opsize,t^._low-last,hregister)));
                   last:=t^._low;
 
                   emitl(A_BEQ,t^.statement);
@@ -582,12 +582,12 @@ implementation
                   if first then
                     begin
                        if (t^._low-1 > 0) and (t^._low < 9) then
-                          exprasmlist^.concat(new(pai68k,op_const_reg(A_SUBQ,opsize,t^._low-1,hregister)))
+                          exprasmlist^.concat(new(paicpu,op_const_reg(A_SUBQ,opsize,t^._low-1,hregister)))
                        else
                        if t^._low-1=0 then
-                         exprasmlist^.concat(new(pai68k,op_reg(A_TST,opsize,hregister)))
+                         exprasmlist^.concat(new(paicpu,op_reg(A_TST,opsize,hregister)))
                        else
-                         exprasmlist^.concat(new(pai68k,op_const_reg(A_SUB,opsize,t^._low-1,hregister)));
+                         exprasmlist^.concat(new(paicpu,op_const_reg(A_SUB,opsize,t^._low-1,hregister)));
                        if t^._low = 0 then
                           emitl(A_BLE,elselabel)
                        else
@@ -600,12 +600,12 @@ implementation
 
                     begin
                        if ((t^._low-last-1) > 0) and ((t^._low-last-1) < 9) then
-                         exprasmlist^.concat(new(pai68k,op_const_reg(A_SUBQ,opsize,t^._low-last-1,hregister)))
+                         exprasmlist^.concat(new(paicpu,op_const_reg(A_SUBQ,opsize,t^._low-last-1,hregister)))
                        else
-                         exprasmlist^.concat(new(pai68k,op_const_reg(A_SUB,opsize,t^._low-last-1,hregister)));
+                         exprasmlist^.concat(new(paicpu,op_const_reg(A_SUB,opsize,t^._low-last-1,hregister)));
                        emitl(jmp_lee,elselabel);
                     end;
-                  exprasmlist^.concat(new(pai68k,op_const_reg(A_SUB,opsize,t^._high-t^._low+1,hregister)));
+                  exprasmlist^.concat(new(paicpu,op_const_reg(A_SUB,opsize,t^._high-t^._low+1,hregister)));
                   emitl(jmp_lee,t^.statement);
 
                   last:=t^._high;
@@ -633,7 +633,7 @@ implementation
       procedure genjumptable(hp : pcaserecord;min_,max_ : longint);
 
         var
-           table : plabel;
+           table : pasmlabel;
            last : longint;
            hr : preference;
 
@@ -647,11 +647,9 @@ implementation
                genitem(t^.less);
              { fill possible hole }
              for i:=last+1 to t^._low-1 do
-               datasegment^.concat(new(pai_const,init_symbol(strpnew(lab2str
-                 (elselabel)))));
+               datasegment^.concat(new(pai_const_symbol,init(elselabel)));
              for i:=t^._low to t^._high do
-               datasegment^.concat(new(pai_const,init_symbol(strpnew(lab2str
-                (t^.statement)))));
+               datasegment^.concat(new(pai_const_symbol,init(t^.statement)));
               last:=t^._high;
              if assigned(t^.greater) then
                genitem(t^.greater);
@@ -660,10 +658,10 @@ implementation
         begin
            if not(jumptable_no_range) then
              begin
-                exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,opsize,min_,hregister)));
+                exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,opsize,min_,hregister)));
                 { case expr less than min_ => goto elselabel }
                 emitl(jmp_le,elselabel);
-                exprasmlist^.concat(new(pai68k,op_const_reg(A_CMP,opsize,max_,hregister)));
+                exprasmlist^.concat(new(paicpu,op_const_reg(A_CMP,opsize,max_,hregister)));
                 emitl(jmp_gt,elselabel);
              end;
            getlabel(table);
@@ -671,33 +669,33 @@ implementation
            if opsize=S_W then
              begin
                 { word to long - unsigned }
-                exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,$ffff,hregister)));
+                exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,$ffff,hregister)));
              end
            else if opsize=S_B then
              begin
                 { byte to long - unsigned }
-                exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,$ff,hregister)));
+                exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,$ff,hregister)));
              end;
            new(hr);
            reset_reference(hr^);
-           hr^.symbol:=stringdup(lab2str(table));
+           hr^.symbol:=stringdup(table^.name);
            hr^.offset:=(-min_)*4;
 
            { add scalefactor *4 to index }
-           exprasmlist^.concat(new(pai68k,op_const_reg(A_LSL,S_L,2,hregister)));
+           exprasmlist^.concat(new(paicpu,op_const_reg(A_LSL,S_L,2,hregister)));
 {           hr^.scalefactor:=4; }
            hr^.base:=getaddressreg;
            emit_reg_reg(A_MOVE,S_L,hregister,hr^.base);
-           exprasmlist^.concat(new(pai68k,op_ref(A_JMP,S_NO,hr)));
+           exprasmlist^.concat(new(paicpu,op_ref(A_JMP,S_NO,hr)));
 {          if not(cs_littlesize in aktglobalswitches^ ) then
-             datasegment^.concat(new(pai68k,op_const(A_ALIGN,S_NO,4))); }
+             datasegment^.concat(new(paicpu,op_const(A_ALIGN,S_NO,4))); }
            datasegment^.concat(new(pai_label,init(table)));
              last:=min_;
            genitem(hp);
            if hr^.base <> R_NO then ungetregister(hr^.base);
            { !!!!!!!
            if not(cs_littlesize in aktglobalswitches^ ) then
-             exprasmlist^.concat(new(pai68k,op_const(A_ALIGN,S_NO,4)));
+             exprasmlist^.concat(new(paicpu,op_const(A_ALIGN,S_NO,4)));
            }
         end;
 
@@ -734,7 +732,7 @@ implementation
             LOC_MEM,LOC_REFERENCE : begin
                                        del_reference(p^.left^.location.reference);
                                            hregister:=getregister32;
-                                       exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,newreference(
+                                       exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,newreference(
                                          p^.left^.location.reference),hregister)));
                                     end;
             else internalerror(2002);
@@ -815,7 +813,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.8  1998-12-11 00:03:08  peter
+  Revision 1.9  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.8  1998/12/11 00:03:08  peter
     + globtype,tokens,version unit splitted from globals
 
   Revision 1.7  1998/10/15 12:41:19  pierre

+ 162 - 164
compiler/cga68k.pas

@@ -25,9 +25,9 @@ unit cga68k;
   interface
 
     uses
-       globtype,cobjects,tree,m68k,aasm,symtable;
+       globtype,cobjects,tree,cpubase,aasm,symtable,symconst;
 
-    procedure emitl(op : tasmop;var l : plabel);
+    procedure emitl(op : tasmop;var l : pasmlabel);
     procedure emit_reg_reg(i : tasmop;s : topsize;reg1,reg2 : tregister);
     procedure emitcall(const routine:string;add_to_externals : boolean);
     procedure emitloadord2reg(location:Tlocation;orddef:Porddef;
@@ -124,9 +124,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 {         push_int(len);                     }
          { This speeds up from 116 cycles to 24 cycles on the 68000 }
          { when passing register parameters!                        }
-         exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,newreference(dref),R_A1)));
-         exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,newreference(sref),R_A0)));
-         exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,len,R_D0)));
+         exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,newreference(dref),R_A1)));
+         exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,newreference(sref),R_A0)));
+         exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,len,R_D0)));
          emitcall('FPC_STRCOPY',true);
          maybe_loada5;
          popusedregisters(pushed);
@@ -149,7 +149,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                        { load 0 length string            }
                        if (p^.right^.treetype=stringconstn) and
                           (str_length(p^.right)=0) then
-                        exprasmlist^.concat(new(pai68k,op_const_ref(
+                        exprasmlist^.concat(new(paicpu,op_const_ref(
                            A_MOVE,S_B,0,newreference(p^.left^.location.reference))))
                        else
                         copystring(p^.left^.location.reference,p^.right^.location.reference,
@@ -160,7 +160,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                         begin
                             { offset 0: length of string }
                             { offset 1: character        }
-                            exprasmlist^.concat(new(pai68k,op_const_ref(A_MOVE,S_W,1*256+p^.right^.value,
+                            exprasmlist^.concat(new(paicpu,op_const_ref(A_MOVE,S_W,1*256+p^.right^.value,
                               newreference(p^.left^.location.reference))))
                         end
                        else
@@ -168,25 +168,25 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                             { not so elegant (goes better with extra register }
                             if (p^.right^.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
                               begin
-                                 exprasmlist^.concat(new(pai68k,op_reg_reg(
+                                 exprasmlist^.concat(new(paicpu,op_reg_reg(
                                     A_MOVE,S_B,p^.right^.location.register,R_D0)));
                                  ungetregister32(p^.right^.location.register);
                               end
                             else
                               begin
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(
                                     A_MOVE,S_B,newreference(p^.right^.location.reference),R_D0)));
                                  del_reference(p^.right^.location.reference);
                               end;
                             { alignment can cause problems }
                             { add length of string to ref }
-                            exprasmlist^.concat(new(pai68k,op_const_ref(A_MOVE,S_B,1,
+                            exprasmlist^.concat(new(paicpu,op_const_ref(A_MOVE,S_B,1,
                                newreference(p^.left^.location.reference))));
 (*                            if abs(p^.left^.location.reference.offset) >= 1 then
                               Begin *)
                               { temporarily decrease offset }
                                 Inc(p^.left^.location.reference.offset);
-                                 exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_B,R_D0,
+                                 exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_B,R_D0,
                                   newreference(p^.left^.location.reference))));
                                 Dec(p^.left^.location.reference.offset);
                                 { restore offset }
@@ -218,7 +218,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
          else
             hregister:=getaddressreg;
 
-         exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_SPPULL,hregister)));
+         exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_SPPULL,hregister)));
          if (p^.location.loc=LOC_REGISTER) or (p^.location.loc=LOC_CREGISTER) then
            begin
               p^.location.register:=hregister;
@@ -242,7 +242,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                  (p^.location.loc=LOC_CREGISTER) then
                 begin
                    pushed:=true;
-                   exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,p^.location.register,R_SPPUSH)));
+                   exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,p^.location.register,R_SPPUSH)));
                    ungetregister32(p^.location.register);
                 end
                else
@@ -251,9 +251,9 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                     (p^.location.reference.index<>R_NO)) then
                   begin
                      del_reference(p^.location.reference);
-                     exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,newreference(p^.location.reference),
+                     exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,newreference(p^.location.reference),
                         R_A0)));
-                     exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A0,R_SPPUSH)));
+                     exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A0,R_SPPUSH)));
                      pushed:=true;
                   end
               else pushed:=false;
@@ -268,21 +268,21 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
     { index = index of array to check }
     { memory of range check information for array }
      var
-      hl : plabel;
+      hl : pasmlabel;
      begin
         if (aktoptprocessor = MC68020) then
           begin
-             exprasmlist^.concat(new(pai68k, op_ref_reg(A_CMP2,S_L,newreference(hp),index)));
+             exprasmlist^.concat(new(paicpu, op_ref_reg(A_CMP2,S_L,newreference(hp),index)));
              getlabel(hl);
              emitl(A_BCC, hl);
-             exprasmlist^.concat(new(pai68k, op_const_reg(A_MOVE,S_L,201,R_D0)));
+             exprasmlist^.concat(new(paicpu, op_const_reg(A_MOVE,S_L,201,R_D0)));
              emitcall('FPC_HALT_ERROR',true);
              emitl(A_LABEL, hl);
           end
         else
           begin
-            exprasmlist^.concat(new(pai68k, op_ref_reg(A_LEA,S_L,newreference(hp), R_A1)));
-            exprasmlist^.concat(new(pai68k, op_reg_reg(A_MOVE, S_L, index, R_D0)));
+            exprasmlist^.concat(new(paicpu, op_ref_reg(A_LEA,S_L,newreference(hp), R_A1)));
+            exprasmlist^.concat(new(paicpu, op_reg_reg(A_MOVE, S_L, index, R_D0)));
             emitcall('FPC_RE_BOUNDS_CHECK',true);
           end;
      end;
@@ -322,7 +322,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
      end;
     end;
 
-    procedure emitl(op : tasmop;var l : plabel);
+    procedure emitl(op : tasmop;var l : pasmlabel);
 
       begin
          if op=A_LABEL then
@@ -335,17 +335,19 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 
       begin
          if (reg1 <> reg2) or (i <> A_MOVE) then
-           exprasmlist^.concat(new(pai68k,op_reg_reg(i,s,reg1,reg2)));
+           exprasmlist^.concat(new(paicpu,op_reg_reg(i,s,reg1,reg2)));
       end;
 
 
     procedure emitcall(const routine:string;add_to_externals : boolean);
 
      begin
-        exprasmlist^.concat(new(pai68k,op_csymbol(A_JSR,S_NO,newcsymbol(routine,0))));
+        exprasmlist^.concat(new(paicpu,op_csymbol(A_JSR,S_NO,newcsymbol(routine,0))));
+        {!!!!!
         if add_to_externals and
            not (cs_compilesystem in aktmoduleswitches) then
           concat_external(routine,EXT_NEAR);
+        }
      end;
 
 
@@ -367,13 +369,13 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                 begin
                    case p^.location.loc of
                       LOC_CREGISTER,LOC_REGISTER : begin
-                                        exprasmlist^.concat(new(pai68k,op_reg(A_TST,S_B,p^.location.register)));
+                                        exprasmlist^.concat(new(paicpu,op_reg(A_TST,S_B,p^.location.register)));
                                         ungetregister32(p^.location.register);
                                         emitl(A_BNE,truelabel);
                                         emitl(A_JMP,falselabel);
                                      end;
                       LOC_MEM,LOC_REFERENCE : begin
-                                        exprasmlist^.concat(new(pai68k,op_ref(
+                                        exprasmlist^.concat(new(paicpu,op_ref(
                                           A_TST,S_B,newreference(p^.location.reference))));
                                         del_reference(p^.location.reference);
                                         emitl(A_BNE,truelabel);
@@ -393,7 +395,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
     procedure emitoverflowcheck(p: ptree);
 
       var
-         hl : plabel;
+         hl : pasmlabel;
 
       begin
          if cs_check_overflow in aktlocalswitches  then
@@ -416,18 +418,18 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
       begin
          if (l = 0) and (aktoptprocessor = MC68020) then
            begin
-          exprasmlist^.concat(new(pai68k,op_reg(A_CLR,S_L,R_D6)));
-              exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
+          exprasmlist^.concat(new(paicpu,op_reg(A_CLR,S_L,R_D6)));
+              exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,
               R_D6, R_SPPUSH)));
            end
          else
          if not(cs_littlesize in aktglobalswitches) and (l >= -128) and (l <= 127) then
            begin
-           exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVEQ,S_L,l,R_D6)));
-           exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_D6,R_SPPUSH)));
+           exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVEQ,S_L,l,R_D6)));
+           exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_D6,R_SPPUSH)));
            end
          else
-           exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,l,R_SPPUSH)));
+           exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,l,R_SPPUSH)));
       end;
 
     procedure emit_push_mem(const ref : treference);
@@ -436,7 +438,7 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
          if ref.isintvalue then
            push_int(ref.offset)
          else
-           exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(ref),R_SPPUSH)));
+           exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(ref),R_SPPUSH)));
       end;
 
 
@@ -449,19 +451,19 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
          else
            begin
               if (ref.base=R_NO) and (ref.index=R_NO) then
-                list^.concat(new(pai68k,op_ref(A_PEA,S_L,
+                list^.concat(new(paicpu,op_ref(A_PEA,S_L,
                     newreference(ref))))
               else if (ref.base=R_NO) and (ref.index<>R_NO) and
                  (ref.offset=0) and (ref.scalefactor=0) and (ref.symbol=nil) then
-                list^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,
+                list^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,
                     ref.index,R_SPPUSH)))
               else if (ref.base<>R_NO) and (ref.index=R_NO) and
                  (ref.offset=0) and (ref.symbol=nil) then
-                list^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,ref.base,R_SPPUSH)))
+                list^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,ref.base,R_SPPUSH)))
               else
                 begin
-                   list^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,newreference(ref),R_A1)));
-                   list^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A1,R_SPPUSH)));
+                   list^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,newreference(ref),R_A1)));
+                   list^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A1,R_SPPUSH)));
                 end;
            end;
         end;
@@ -492,21 +494,21 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                  { This is quite complicated, because of the endian on }
                  { the m68k!                                           }
                  opsize:=S_NO;
-                 case integer(p^.resulttype^.savesize) of
+                 case integer(p^.resulttype^.size) of
                    1 : opsize:=S_B;
                    2 : opsize:=S_W;
                    4 : opsize:=S_L;
                  else
                    internalerror(19);
                  end;
-                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,opsize,
+                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,opsize,
                     newreference(p^.location.reference),R_D0)));
-                 exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,
+                 exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,
                     255,R_D0)));
 {
-                  exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,
+                  exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,
                     newreference(p^.location.reference),R_D0)));        }
-{                  exprasmlist^.concat(new(pai68k,op_const_reg(A_AND,S_L,
+{                  exprasmlist^.concat(new(paicpu,op_const_reg(A_AND,S_L,
                     $ff,R_D0))); }
                   del_reference(p^.location.reference);
                end;
@@ -541,13 +543,13 @@ var hs:string;
     stab_function_name:Pai_stab_function_name;
 {$endif GDB}
 begin
-    if (aktprocsym^.definition^.options and poproginit<>0) then
+    if potype_proginit=aktprocsym^.definition^.proctypeoption then
         begin
             {Init the stack checking.}
             if (cs_check_stack in aktlocalswitches) and
              (target_info.target=target_m68k_linux) then
                 begin
-                    procinfo.aktentrycode^.insert(new(pai68k,
+                    procinfo.aktentrycode^.insert(new(paicpu,
                      op_csymbol(A_JSR,S_NO,newcsymbol('FPC_INIT_STACK_CHECK',0))));
                 end
             else
@@ -555,11 +557,10 @@ begin
             { with a value of ZERO, and the comparison will directly check!           }
             if (cs_check_stack in aktlocalswitches) then
                 begin
-                  procinfo.aktentrycode^.insert(new(pai68k,op_csymbol(A_JSR,S_NO,
+                  procinfo.aktentrycode^.insert(new(paicpu,op_csymbol(A_JSR,S_NO,
                       newcsymbol('FPC_STACKCHECK',0))));
-                  procinfo.aktentrycode^.insert(new(pai68k,op_const_reg(A_MOVE,S_L,
+                  procinfo.aktentrycode^.insert(new(paicpu,op_const_reg(A_MOVE,S_L,
                       0,R_D0)));
-                  concat_external('FPC_STACKCHECK',EXT_NEAR);
                 end;
 
 
@@ -572,8 +573,7 @@ begin
                     { call the unit init code and make it external }
                     if (hp^.u^.flags and uf_init)<>0 then
                         begin
-                           unitinits.concat(new(pai68k,op_csymbol(A_JSR,S_NO,newcsymbol('INIT$$'+hp^.u^.modulename^,0))));
-                           concat_external('INIT$$'+hp^.u^.modulename^,EXT_NEAR);
+                           unitinits.concat(new(paicpu,op_csymbol(A_JSR,S_NO,newcsymbol('INIT$$'+hp^.u^.modulename^,0))));
                         end;
                    hp:=pused_unit(hp^.next);
                 end;
@@ -582,22 +582,20 @@ begin
         end;
 
         { a constructor needs a help procedure }
-        if (aktprocsym^.definition^.options and poconstructor)<>0 then
+        if potype_constructor=aktprocsym^.definition^.proctypeoption then
         begin
-           if procinfo._class^.isclass then
+           if procinfo._class^.is_class then
              begin
               procinfo.aktentrycode^.insert(new(pai_labeled,init(A_BEQ,quickexitlabel)));
-              procinfo.aktentrycode^.insert(new(pai68k,op_csymbol(A_JSR,S_NO,
+              procinfo.aktentrycode^.insert(new(paicpu,op_csymbol(A_JSR,S_NO,
               newcsymbol('FPC_NEW_CLASS',0))));
-              concat_external('FPC_NEW_CLASS',EXT_NEAR);
              end
            else
              begin
               procinfo.aktentrycode^.insert(new(pai_labeled,init(A_BEQ,quickexitlabel)));
-              procinfo.aktentrycode^.insert(new(pai68k,op_csymbol(A_JSR,S_NO,
+              procinfo.aktentrycode^.insert(new(paicpu,op_csymbol(A_JSR,S_NO,
               newcsymbol('FPC_HELP_CONSTRUCTOR',0))));
-              concat_external('FPC_HELP_CONSTRUCTOR',EXT_NEAR);
-              procinfo.aktentrycode^.insert(new(pai68k,op_const_reg(A_MOVE,S_L,procinfo._class^.vmt_offset,R_D0)));
+              procinfo.aktentrycode^.insert(new(paicpu,op_const_reg(A_MOVE,S_L,procinfo._class^.vmt_offset,R_D0)));
              end;
         end;
     { don't load ESI, does the caller }
@@ -612,14 +610,18 @@ begin
         begin
             CGMessage(cg_d_stackframe_omited);
             nostackframe:=true;
-            if (aktprocsym^.definition^.options and (pounitinit or poproginit or pounitfinalize)<>0) then
+            if (aktprocsym^.definition^.proctypeoption=potype_unitinit) or
+               (aktprocsym^.definition^.proctypeoption=potype_proginit) or
+               (aktprocsym^.definition^.proctypeoption=potype_unitfinalize) then
                 parasize:=0
             else
                 parasize:=aktprocsym^.definition^.parast^.datasize+procinfo.call_offset;
         end
     else
         begin
-             if (aktprocsym^.definition^.options and (pounitinit or poproginit or pounitfinalize)<>0) then
+            if (aktprocsym^.definition^.proctypeoption=potype_unitinit) or
+               (aktprocsym^.definition^.proctypeoption=potype_proginit) or
+               (aktprocsym^.definition^.proctypeoption=potype_unitfinalize) then
                 parasize:=0
              else
                 parasize:=aktprocsym^.definition^.parast^.datasize+procinfo.call_offset-8;
@@ -632,19 +634,18 @@ begin
                                (target_info.target<>target_m68k_linux) then
                                 begin
                                   { If only not in main program, do we setup stack checking }
-                                  if (aktprocsym^.definition^.options and poproginit=0) then
+                                  if (aktprocsym^.definition^.proctypeoption<>potype_proginit) then
                                    Begin
-                                       procinfo.aktentrycode^.insert(new(pai68k,
+                                       procinfo.aktentrycode^.insert(new(paicpu,
                                          op_csymbol(A_JSR,S_NO,newcsymbol('FPC_STACKCHECK',0))));
-                                       procinfo.aktentrycode^.insert(new(pai68k,op_const_reg(A_MOVE,S_L,stackframe,R_D0)));
-                                       concat_external('FPC_STACKCHECK',EXT_NEAR);
+                                       procinfo.aktentrycode^.insert(new(paicpu,op_const_reg(A_MOVE,S_L,stackframe,R_D0)));
                                    end;
                                 end;
                             { to allocate stack space }
                             { here we allocate space using link signed 16-bit version }
                             { -ve offset to allocate stack space! }
                             if (stackframe > -32767) and (stackframe < 32769) then
-                              procinfo.aktentrycode^.insert(new(pai68k,op_reg_const(A_LINK,S_W,R_A6,-stackframe)))
+                              procinfo.aktentrycode^.insert(new(paicpu,op_reg_const(A_LINK,S_W,R_A6,-stackframe)))
                             else
                               CGMessage(cg_e_stacklimit_in_local_routine);
                         end
@@ -655,19 +656,18 @@ begin
                           { exceed 32K in size.                                            }
                           if (stackframe > -32767) and (stackframe < 32769) then
                             begin
-                              procinfo.aktentrycode^.insert(new(pai68k,op_const_reg(A_SUB,S_L,stackframe,R_SP)));
+                              procinfo.aktentrycode^.insert(new(paicpu,op_const_reg(A_SUB,S_L,stackframe,R_SP)));
                               { IF only NOT in main program do we check the stack normally }
-                              if (cs_check_stack in aktlocalswitches)
-                              and (aktprocsym^.definition^.options and poproginit=0) then
+                              if (cs_check_stack in aktlocalswitches) and
+                               (aktprocsym^.definition^.proctypeoption<>potype_proginit) then
                                 begin
-                                  procinfo.aktentrycode^.insert(new(pai68k,
+                                  procinfo.aktentrycode^.insert(new(paicpu,
                                    op_csymbol(A_JSR,S_NO,newcsymbol('FPC_STACKCHECK',0))));
-                                  procinfo.aktentrycode^.insert(new(pai68k,op_const_reg(A_MOVE,S_L,
+                                  procinfo.aktentrycode^.insert(new(paicpu,op_const_reg(A_MOVE,S_L,
                                     stackframe,R_D0)));
-                                  concat_external('FPC_STACKCHECK',EXT_NEAR);
                                 end;
-                               procinfo.aktentrycode^.insert(new(pai68k,op_reg_reg(A_MOVE,S_L,R_SP,R_A6)));
-                               procinfo.aktentrycode^.insert(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A6,R_SPPUSH)));
+                               procinfo.aktentrycode^.insert(new(paicpu,op_reg_reg(A_MOVE,S_L,R_SP,R_A6)));
+                               procinfo.aktentrycode^.insert(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A6,R_SPPUSH)));
                             end
                           else
                             CGMessage(cg_e_stacklimit_in_local_routine);
@@ -675,13 +675,13 @@ begin
                 end {endif stackframe<>0 }
             else
                begin
-                 procinfo.aktentrycode^.insert(new(pai68k,op_reg_reg(A_MOVE,S_L,R_SP,R_A6)));
-                 procinfo.aktentrycode^.insert(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A6,R_SPPUSH)));
+                 procinfo.aktentrycode^.insert(new(paicpu,op_reg_reg(A_MOVE,S_L,R_SP,R_A6)));
+                 procinfo.aktentrycode^.insert(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A6,R_SPPUSH)));
                end;
         end;
 
 
-    if (aktprocsym^.definition^.options and pointerrupt)<>0 then
+    if po_interrupt in aktprocsym^.definition^.procoptions then
         generate_interrupt_stackframe_entry;
 
     {proc_names.insert(aktprocsym^.definition^.mangledname);}
@@ -701,9 +701,9 @@ begin
     while hs<>'' do
         begin
               if make_global then
-                procinfo.aktentrycode^.insert(new(pai_symbol,init_global(hs)))
+                procinfo.aktentrycode^.insert(new(pai_symbol,initname_global(hs,0)))
               else
-                procinfo.aktentrycode^.insert(new(pai_symbol,init(hs)));
+                procinfo.aktentrycode^.insert(new(pai_symbol,initname(hs,0)));
 {$ifdef GDB}
             if (cs_debuginfo in aktmoduleswitches) then
              begin
@@ -745,35 +745,32 @@ begin
     procinfo.aktexitcode^.insert(new(pai_label,init(aktexitlabel)));
 
     { call the destructor help procedure }
-    if (aktprocsym^.definition^.options and podestructor)<>0 then
+    if potype_destructor=aktprocsym^.definition^.proctypeoption then
      begin
-       if procinfo._class^.isclass then
+       if procinfo._class^.is_class then
          begin
-           procinfo.aktexitcode^.insert(new(pai68k,op_csymbol(A_JSR,S_NO,
+           procinfo.aktexitcode^.insert(new(paicpu,op_csymbol(A_JSR,S_NO,
              newcsymbol('FPC_DISPOSE_CLASS',0))));
-           concat_external('FPC_DISPOSE_CLASS',EXT_NEAR);
          end
        else
          begin
-           procinfo.aktexitcode^.insert(new(pai68k,op_csymbol(A_JSR,S_NO,
+           procinfo.aktexitcode^.insert(new(paicpu,op_csymbol(A_JSR,S_NO,
              newcsymbol('FPC_HELP_DESTRUCTOR',0))));
-           procinfo.aktexitcode^.insert(new(pai68k,op_const_reg(A_MOVE,S_L,procinfo._class^.vmt_offset,R_D0)));
-           concat_external('FPC_HELP_DESTRUCTOR',EXT_NEAR);
+           procinfo.aktexitcode^.insert(new(paicpu,op_const_reg(A_MOVE,S_L,procinfo._class^.vmt_offset,R_D0)));
          end;
      end;
 
     { call __EXIT for main program }
     { ????????? }
-    if ((aktprocsym^.definition^.options and poproginit)<>0) and
+    if (potype_proginit=aktprocsym^.definition^.proctypeoption) and
       (target_info.target<>target_m68k_PalmOS) then
      begin
-       procinfo.aktexitcode^.concat(new(pai68k,op_csymbol(A_JSR,S_NO,newcsymbol('FPC_DO_EXIT',0))));
-       externals^.concat(new(pai_external,init('FPC_DO_EXIT',EXT_NEAR)));
+       procinfo.aktexitcode^.concat(new(paicpu,op_csymbol(A_JSR,S_NO,newcsymbol('FPC_DO_EXIT',0))));
      end;
 
     { handle return value }
-    if (aktprocsym^.definition^.options and poassembler)=0 then
-        if (aktprocsym^.definition^.options and poconstructor)=0 then
+    if po_assembler in aktprocsym^.definition^.procoptions then
+      if (aktprocsym^.definition^.proctypeoption<>potype_constructor) then
             begin
                 if procinfo.retdef<>pdef(voiddef) then
                     begin
@@ -786,23 +783,23 @@ begin
                         if (procinfo.retdef^.deftype in [orddef,enumdef]) then
                             begin
                                 case procinfo.retdef^.size of
-                                 4 : procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hr,R_D0)));
-                                 2 : procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,hr,R_D0)));
-                                 1 : procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,hr,R_D0)));
+                                 4 : procinfo.aktexitcode^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hr,R_D0)));
+                                 2 : procinfo.aktexitcode^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,hr,R_D0)));
+                                 1 : procinfo.aktexitcode^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,hr,R_D0)));
                                 end;
                             end
                         else
                             if (procinfo.retdef^.deftype in [pointerdef,enumdef,procvardef]) or
                              ((procinfo.retdef^.deftype=setdef) and
                              (psetdef(procinfo.retdef)^.settype=smallset)) then
-                                procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hr,R_D0)))
+                                procinfo.aktexitcode^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hr,R_D0)))
                             else
                                 if (procinfo.retdef^.deftype=floatdef) then
                                     begin
                                         if pfloatdef(procinfo.retdef)^.typ=f32bit then
                                             begin
                                                 { Isnt this missing ? }
-                                                procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hr,R_D0)));
+                                                procinfo.aktexitcode^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hr,R_D0)));
                                             end
                                         else
                                             begin
@@ -811,16 +808,16 @@ begin
                                              { TRUE FPU register (does not apply in emulation mode)     }
                                              if (pfloatdef(procinfo.retdef)^.typ = s32real) then
                                               begin
-                                                procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,
+                                                procinfo.aktexitcode^.concat(new(paicpu,op_ref_reg(A_MOVE,
                                                   S_L,hr,R_D0)))
                                               end
                                              else
                                               begin
                                                if cs_fp_emulation in aktmoduleswitches then
-                                                 procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_MOVE,
+                                                 procinfo.aktexitcode^.concat(new(paicpu,op_ref_reg(A_MOVE,
                                                     S_L,hr,R_D0)))
                                                else
-                                                 procinfo.aktexitcode^.concat(new(pai68k,op_ref_reg(A_FMOVE,
+                                                 procinfo.aktexitcode^.concat(new(paicpu,op_ref_reg(A_FMOVE,
                                                  getfloatsize(pfloatdef(procinfo.retdef)^.typ),hr,R_FP0)));
                                              end;
                                            end;
@@ -835,29 +832,28 @@ begin
                 { and returns self in accumulator              }
                 procinfo.aktexitcode^.concat(new(pai_label,init(quickexitlabel)));
                 { eax must be set to zero if the allocation failed !!! }
-                procinfo.aktexitcode^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_A5,R_D0)));
+                procinfo.aktexitcode^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_A5,R_D0)));
                 { faster then OR on mc68000/mc68020 }
-                procinfo.aktexitcode^.concat(new(pai68k,op_reg(A_TST,S_L,R_D0)));
+                procinfo.aktexitcode^.concat(new(paicpu,op_reg(A_TST,S_L,R_D0)));
             end;
     procinfo.aktexitcode^.concat(new(pai_label,init(aktexit2label)));
     if not(nostackframe) then
-        procinfo.aktexitcode^.concat(new(pai68k,op_reg(A_UNLK,S_NO,R_A6)));
+        procinfo.aktexitcode^.concat(new(paicpu,op_reg(A_UNLK,S_NO,R_A6)));
 
     { at last, the return is generated }
 
-    if (aktprocsym^.definition^.options and pointerrupt)<>0 then
+    if po_interrupt in aktprocsym^.definition^.procoptions then
         generate_interrupt_stackframe_exit
     else
-        if (parasize=0) or ((aktprocsym^.definition^.options and poclearstack)<>0)
-        then
+        if (parasize=0) or (pocall_clearstack in aktprocsym^.definition^.proccalloptions) then
             {Routines with the poclearstack flag set use only a ret.}
             { also routines with parasize=0           }
-            procinfo.aktexitcode^.concat(new(pai68k,op_none(A_RTS,S_NO)))
+            procinfo.aktexitcode^.concat(new(paicpu,op_none(A_RTS,S_NO)))
         else
             { return with immediate size possible here }
             { signed!                                  }
             if (aktoptprocessor = MC68020) and (parasize < $7FFF) then
-                procinfo.aktexitcode^.concat(new(pai68k,op_const(
+                procinfo.aktexitcode^.concat(new(paicpu,op_const(
                  A_RTD,S_NO,parasize)))
             { manually restore the stack }
             else
@@ -867,20 +863,20 @@ begin
                     { point to nowhere!                                   }
 
                     { save the PC counter (pop it from the stack)         }
-                    procinfo.aktexitcode^.concat(new(pai68k,op_reg_reg(
+                    procinfo.aktexitcode^.concat(new(paicpu,op_reg_reg(
                          A_MOVE,S_L,R_SPPULL,R_A0)));
                     { can we do a quick addition ... }
                     if (parasize > 0) and (parasize < 9) then
-                       procinfo.aktexitcode^.concat(new(pai68k,op_const_reg(
+                       procinfo.aktexitcode^.concat(new(paicpu,op_const_reg(
                          A_ADD,S_L,parasize,R_SP)))
                     else { nope ... }
-                       procinfo.aktexitcode^.concat(new(pai68k,op_const_reg(
+                       procinfo.aktexitcode^.concat(new(paicpu,op_const_reg(
                          A_ADD,S_L,parasize,R_SP)));
                     { endif }
                     { restore the PC counter (push it on the stack)       }
-                    procinfo.aktexitcode^.concat(new(pai68k,op_reg_reg(
+                    procinfo.aktexitcode^.concat(new(paicpu,op_reg_reg(
                          A_MOVE,S_L,R_A0,R_SPPUSH)));
-                    procinfo.aktexitcode^.concat(new(pai68k,op_none(
+                    procinfo.aktexitcode^.concat(new(paicpu,op_none(
                       A_RTS,S_NO)))
                end;
 {$ifdef GDB}
@@ -922,8 +918,9 @@ end;
          jregister : tregister;
          hp1 : treference;
          hp2 : treference;
-         hl : plabel;
-         hl2: plabel;
+         hl : pasmlabel;
+         hl2: pasmlabel;
+
       begin
          { this should never occur }
          if size > 65535 then
@@ -939,8 +936,8 @@ end;
               { move a dword x times }
               for i:=1 to helpsize do
                 begin
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(source),hregister)));
-                   exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_L,hregister,newreference(dest))));
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(source),hregister)));
+                   exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_L,hregister,newreference(dest))));
                    inc(source.offset,4);
                    inc(dest.offset,4);
                    dec(size,4);
@@ -948,8 +945,8 @@ end;
               { move a word }
               if size>1 then
                 begin
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,newreference(source),hregister)));
-                   exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_W,hregister,newreference(dest))));
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,newreference(source),hregister)));
+                   exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_W,hregister,newreference(dest))));
                    inc(source.offset,2);
                    inc(dest.offset,2);
                    dec(size,2);
@@ -957,8 +954,8 @@ end;
               { move a single byte }
               if size>0 then
                 begin
-                  exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,newreference(source),hregister)));
-                  exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_B,hregister,newreference(dest))));
+                  exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,newreference(source),hregister)));
+                  exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_B,hregister,newreference(dest))));
                 end
 
            end
@@ -991,8 +988,8 @@ end;
               { jregister = destination }
 
 
-              exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,newreference(source),iregister)));
-              exprasmlist^.concat(new(pai68k,op_ref_reg(A_LEA,S_L,newreference(dest),jregister)));
+              exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,newreference(source),iregister)));
+              exprasmlist^.concat(new(paicpu,op_ref_reg(A_LEA,S_L,newreference(dest),jregister)));
 
               { double word move only on 68020+ machines }
               { because of possible alignment problems   }
@@ -1001,32 +998,32 @@ end;
                 begin
                    helpsize := size - size mod 4;
                    size := size mod 4;
-                   exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,helpsize div 4,hregister)));
+                   exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,helpsize div 4,hregister)));
                    getlabel(hl2);
                    emitl(A_BRA,hl2);
                    getlabel(hl);
                    emitl(A_LABEL,hl);
-                   exprasmlist^.concat(new(pai68k,op_ref_ref(A_MOVE,S_L,newreference(hp1),newreference(hp2))));
+                   exprasmlist^.concat(new(paicpu,op_ref_ref(A_MOVE,S_L,newreference(hp1),newreference(hp2))));
                    emitl(A_LABEL,hl2);
                    exprasmlist^.concat(new(pai_labeled, init_reg(A_DBRA,hl,hregister)));
                    if size > 1 then
                      begin
                         dec(size,2);
-                        exprasmlist^.concat(new(pai68k,op_ref_ref(A_MOVE,S_W,newreference(hp1), newreference(hp2))));
+                        exprasmlist^.concat(new(paicpu,op_ref_ref(A_MOVE,S_W,newreference(hp1), newreference(hp2))));
                      end;
                    if size = 1 then
-                    exprasmlist^.concat(new(pai68k,op_ref_ref(A_MOVE,S_B,newreference(hp1), newreference(hp2))));
+                    exprasmlist^.concat(new(paicpu,op_ref_ref(A_MOVE,S_B,newreference(hp1), newreference(hp2))));
                 end
               else
                 begin
                    { Fast 68010 loop mode with no possible alignment problems }
                    helpsize := size;
-                   exprasmlist^.concat(new(pai68k,op_const_reg(A_MOVE,S_L,helpsize,hregister)));
+                   exprasmlist^.concat(new(paicpu,op_const_reg(A_MOVE,S_L,helpsize,hregister)));
                    getlabel(hl2);
                    emitl(A_BRA,hl2);
                    getlabel(hl);
                    emitl(A_LABEL,hl);
-                   exprasmlist^.concat(new(pai68k,op_ref_ref(A_MOVE,S_B,newreference(hp1),newreference(hp2))));
+                   exprasmlist^.concat(new(paicpu,op_ref_ref(A_MOVE,S_B,newreference(hp1),newreference(hp2))));
                    emitl(A_LABEL,hl2);
                    exprasmlist^.concat(new(pai_labeled, init_reg(A_DBRA,hl,hregister)));
                 end;
@@ -1055,7 +1052,7 @@ end;
 
     {A lot smaller and less bug sensitive than the original unfolded loads.}
 
-    var tai:pai68k;
+    var tai:paicpu;
         r:Preference;
 
     begin
@@ -1064,34 +1061,34 @@ end;
                 begin
                     case orddef^.typ of
                         u8bit: begin
-                                 exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_B,location.register,destreg)));
-                                 exprasmlist^.concat(new(pai68k,op_const_reg(A_ANDI,S_L,$FF,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_B,location.register,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_const_reg(A_ANDI,S_L,$FF,destreg)));
                                end;
                         s8bit: begin
-                                 exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_B,location.register,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_B,location.register,destreg)));
                                  if (aktoptprocessor <> MC68020) then
                                   begin
                                  { byte to word }
-                                     exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_W,destreg)));
+                                     exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_W,destreg)));
                                  { word to long }
-                                     exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_L,destreg)));
+                                     exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_L,destreg)));
                                   end
                                  else { 68020+ and later only }
-                                     exprasmlist^.concat(new(pai68k,op_reg(A_EXTB,S_L,destreg)));
+                                     exprasmlist^.concat(new(paicpu,op_reg(A_EXTB,S_L,destreg)));
                                 end;
                         u16bit: begin
-                                 exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_W,location.register,destreg)));
-                                 exprasmlist^.concat(new(pai68k,op_const_reg(A_ANDI,S_L,$FFFF,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_W,location.register,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_const_reg(A_ANDI,S_L,$FFFF,destreg)));
                                 end;
                         s16bit: begin
-                                 exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_W,location.register,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_W,location.register,destreg)));
                                  { word to long }
-                                 exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_L,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_L,destreg)));
                                 end;
                         u32bit:
-                            exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,location.register,destreg)));
+                            exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,location.register,destreg)));
                         s32bit:
-                            exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,location.register,destreg)));
+                            exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,location.register,destreg)));
                     end;
                     if delloc then
                         ungetregister(location.register);
@@ -1101,34 +1098,34 @@ end;
                     r:=newreference(location.reference);
                     case orddef^.typ of
                         u8bit: begin
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,r,destreg)));
-                                 exprasmlist^.concat(new(pai68k,op_const_reg(A_ANDI,S_L,$FF,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,r,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_const_reg(A_ANDI,S_L,$FF,destreg)));
                                end;
                         s8bit:  begin
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_B,r,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_B,r,destreg)));
                                  if (aktoptprocessor <> MC68020) then
                                   begin
                                  { byte to word }
-                                     exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_W,destreg)));
+                                     exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_W,destreg)));
                                  { word to long }
-                                     exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_L,destreg)));
+                                     exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_L,destreg)));
                                   end
                                  else { 68020+ and later only }
-                                     exprasmlist^.concat(new(pai68k,op_reg(A_EXTB,S_L,destreg)));
+                                     exprasmlist^.concat(new(paicpu,op_reg(A_EXTB,S_L,destreg)));
                                 end;
                         u16bit: begin
-                                 exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,r,destreg)));
-                                 exprasmlist^.concat(new(pai68k,op_const_reg(A_ANDI,S_L,$ffff,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,r,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_const_reg(A_ANDI,S_L,$ffff,destreg)));
                                 end;
                         s16bit: begin
-                                       exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_W,r,destreg)));
+                                       exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_W,r,destreg)));
                                  { word to long }
-                                 exprasmlist^.concat(new(pai68k,op_reg(A_EXT,S_L,destreg)));
+                                 exprasmlist^.concat(new(paicpu,op_reg(A_EXT,S_L,destreg)));
                                 end;
                         u32bit:
-                            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,destreg)));
+                            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,destreg)));
                         s32bit:
-                            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,r,destreg)));
+                            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,r,destreg)));
                     end;
                     if delloc then
                         del_reference(location.reference);
@@ -1156,7 +1153,7 @@ end;
                    reset_reference(hp^);
                    hp^.offset:=procinfo.framepointer_offset;
                    hp^.base:=procinfo.framepointer;
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hp,R_A5)));
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hp,R_A5)));
                    p:=procinfo.parent;
                    for i:=3 to lexlevel-1 do
                      begin
@@ -1164,14 +1161,14 @@ end;
                         reset_reference(hp^);
                         hp^.offset:=p^.framepointer_offset;
                         hp^.base:=R_A5;
-                        exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hp,R_A5)));
+                        exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hp,R_A5)));
                         p:=p^.parent;
                      end;
                    new(hp);
                    reset_reference(hp^);
                    hp^.offset:=p^.ESI_offset;
                    hp^.base:=R_A5;
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hp,R_A5)));
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hp,R_A5)));
                 end
               else
                 begin
@@ -1179,7 +1176,7 @@ end;
                    reset_reference(hp^);
                    hp^.offset:=procinfo.ESI_offset;
                    hp^.base:=procinfo.framepointer;
-                   exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,hp,R_A5)));
+                   exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,hp,R_A5)));
                 end;
            end;
       end;
@@ -1214,7 +1211,7 @@ end;
         if not ((cs_fp_emulation) in aktmoduleswitches) then
         begin
             location.fpureg := getfloatreg;
-            exprasmlist^.concat(new(pai68k,op_ref_reg(A_FMOVE,s,newreference(ref),location.fpureg)))
+            exprasmlist^.concat(new(paicpu,op_ref_reg(A_FMOVE,s,newreference(ref),location.fpureg)))
         end
         else
         { handle emulation }
@@ -1222,7 +1219,7 @@ end;
           if t = s32real then
           begin
             location.fpureg := getregister32;
-            exprasmlist^.concat(new(pai68k,op_ref_reg(A_MOVE,S_L,newreference(ref),location.fpureg)))
+            exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOVE,S_L,newreference(ref),location.fpureg)))
           end
           else
              { other floating types are not supported in emulation mode }
@@ -1284,12 +1281,12 @@ end;
             if not (location.fpureg in [R_FP0..R_FP7]) then
              Begin
                if s = S_FS then
-                 exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_L,location.fpureg,newreference(ref))))
+                 exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_L,location.fpureg,newreference(ref))))
                else
                  internalerror(255);
              end
             else
-               exprasmlist^.concat(new(pai68k,op_reg_ref(A_FMOVE,s,location.fpureg,newreference(ref))));
+               exprasmlist^.concat(new(paicpu,op_reg_ref(A_FMOVE,s,location.fpureg,newreference(ref))));
             ungetregister(location.fpureg);
         end
         else
@@ -1297,7 +1294,7 @@ end;
         begin
           if t = s32real then
           begin
-            exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,S_L,location.fpureg,newreference(ref))));
+            exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,S_L,location.fpureg,newreference(ref))));
             ungetregister32(location.fpureg);
           end
           else
@@ -1348,7 +1345,7 @@ end;
              else
              if (dest_loc.loc=LOC_REFERENCE) or (dest_loc.loc=LOC_MEM) then
                begin
-                 exprasmlist^.concat(new(pai68k,op_reg_ref(A_MOVE,s,reg,newreference(dest_loc.reference))));
+                 exprasmlist^.concat(new(paicpu,op_reg_ref(A_MOVE,s,reg,newreference(dest_loc.reference))));
                  set_location(p^.location,dest_loc);
                  in_dest_loc:=true;
                end
@@ -1370,10 +1367,8 @@ end;
               if is_ansistring(hp^.typ) then
                 begin
                    emitpushreferenceaddr(list,hp^.address);
-                   list^.concat(new(pai68k,
+                   list^.concat(new(paicpu,
                      op_csymbol(A_JSR,S_NO,newcsymbol('FPC_ANSISTR_DECR_REF',0))));
-                   if not (cs_compilesystem in aktmoduleswitches) then
-                     concat_external('FPC_ANSISTR_DECR_REF',EXT_NEAR);
                 end;
               hp:=ptemptodestroy(hp^.next);
            end;
@@ -1396,7 +1391,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.33  1999-09-16 11:34:54  pierre
+  Revision 1.34  1999-09-16 23:05:51  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.33  1999/09/16 11:34:54  pierre
    * typo correction
 
   Revision 1.32  1999/08/25 11:59:54  jonas

+ 5 - 5
compiler/compiler.pas

@@ -128,11 +128,8 @@ function Compile(const cmd:string):longint;
 implementation
 
 uses
-{$ifdef m68k}
-  m68k;
-{$else}
   cpubase;
-{$endif}
+
 var
   CompilerInitedAfterArgs,
   CompilerInited : boolean;
@@ -299,7 +296,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.33  1999-09-07 15:10:04  pierre
+  Revision 1.34  1999-09-16 23:05:52  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.33  1999/09/07 15:10:04  pierre
    * use do_halt instead of halt
 
   Revision 1.32  1999/09/02 18:47:44  daniel

+ 9 - 2
compiler/link.pas

@@ -761,10 +761,14 @@ begin
     target_i386_Go32v2 :
       linker:=new(plinkergo32v2,Init);
 {$endif i386}
+{$ifdef m68k}
+    target_m68k_palmos:
+      linker:=new(plinker,Init);
+{$endif m68k}
 {$ifdef alpha}
     target_alpha_linux:
       linker:=new(plinker,Init);
-{$endif i386}
+{$endif alpha}
 {$ifdef powerpc}
     target_powerpc_linux:
       linker:=new(plinker,Init);
@@ -785,7 +789,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.71  1999-09-16 11:34:56  pierre
+  Revision 1.72  1999-09-16 23:05:52  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.71  1999/09/16 11:34:56  pierre
    * typo correction
 
   Revision 1.70  1999/09/15 22:09:16  florian

+ 3 - 0
compiler/m68k/TODO

@@ -0,0 +1,3 @@
+- rewrite type casting
+- reference.symbol should be change to tasmsymbol or something like this
+- adapt m68k.inc, especially class/object helpers

+ 33 - 0
compiler/m68k/cpuasm.pas

@@ -0,0 +1,33 @@
+{
+    $Id$
+    Copyright (c) 1999 by Florian Klaempfl
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+unit cpuasm;
+
+  interface
+
+  implementation
+
+end.
+{
+  $Log$
+  Revision 1.1  1999-09-16 23:05:57  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+}

+ 40 - 41
compiler/m68k.pas → compiler/m68k/cpubase.pas

@@ -21,7 +21,7 @@
 
  ****************************************************************************
 }
-unit m68k;
+unit cpubase;
 
   interface
 
@@ -266,9 +266,9 @@ unit m68k;
           destructor done;virtual;
        end;
 
-       pai68k = ^tai68k;
+       paicpu = ^taicpu;
 
-       tai68k = object(tai)
+       taicpu = object(tai)
       { this isn't a proper style, but not very memory expensive }
       op1,op2,op3 : pointer;
       _operator : tasmop;
@@ -324,8 +324,12 @@ unit m68k;
 
     const
        maxvarregs = 5;
+       maxfpuvarregs = 8;
        varregs : array[1..maxvarregs] of tregister =
         (R_D2,R_D3,R_D4,R_D5,R_D7);
+       fpuvarregs : array[1..maxfpuvarregs] of tregister =
+        (R_FP0,R_FP1,R_FP2,R_FP3,R_FP4,R_FP5,R_FP6,
+         R_FP7);
 
 
     { resets all values of ref to defaults }
@@ -943,10 +947,10 @@ unit m68k;
       end;
 
 {****************************************************************************
-                 TAI68k
+                 Taicpu
  ****************************************************************************}
 
-    constructor tai68k.op_none(op : tasmop;_size : topsize);
+    constructor taicpu.op_none(op : tasmop;_size : topsize);
 
       begin
      inherited init;
@@ -963,7 +967,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_reg(op : tasmop;_size : topsize;_op1 : tregister);
+    constructor taicpu.op_reg(op : tasmop;_size : topsize;_op1 : tregister);
 
       begin
      inherited init;
@@ -979,7 +983,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_const(op : tasmop;_size : topsize;_op1 : longint);
+    constructor taicpu.op_const(op : tasmop;_size : topsize;_op1 : longint);
 
  begin
      inherited init;
@@ -997,7 +1001,7 @@ unit m68k;
 
 
 
-    constructor tai68k.op_ref(op : tasmop;_size : topsize;_op1 : preference);
+    constructor taicpu.op_ref(op : tasmop;_size : topsize;_op1 : preference);
 
       begin
      inherited init;
@@ -1022,7 +1026,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_loc(op : tasmop;_size : topsize;_op1 : tlocation);
+    constructor taicpu.op_loc(op : tasmop;_size : topsize;_op1 : tlocation);
 
       begin
      inherited init;
@@ -1052,7 +1056,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_reg_reg(op : tasmop;_size : topsize;_op1,_op2 : tregister);
+    constructor taicpu.op_reg_reg(op : tasmop;_size : topsize;_op1,_op2 : tregister);
 
       begin
      inherited init;
@@ -1068,7 +1072,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_reg_ref(op : tasmop;_size : topsize;_op1 : tregister;_op2 : preference);
+    constructor taicpu.op_reg_ref(op : tasmop;_size : topsize;_op1 : tregister;_op2 : preference);
 
       begin
      inherited init;
@@ -1094,7 +1098,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_reg_loc(op : tasmop;_size : topsize;_op1 : tregister;_op2 : tlocation);
+    constructor taicpu.op_reg_loc(op : tasmop;_size : topsize;_op1 : tregister;_op2 : tlocation);
 
       begin
      inherited init;
@@ -1125,7 +1129,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_loc_reg(op : tasmop;_size : topsize;_op1 : tlocation;_op2 : tregister);
+    constructor taicpu.op_loc_reg(op : tasmop;_size : topsize;_op1 : tlocation;_op2 : tregister);
 
       begin
      inherited init;
@@ -1156,7 +1160,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_const_reg_reg(op : tasmop;_size : topsize;_op1 : longint;_op2 : tregister;_op3 : tregister);
+    constructor taicpu.op_const_reg_reg(op : tasmop;_size : topsize;_op1 : longint;_op2 : tregister;_op3 : tregister);
 
       begin
      inherited init;
@@ -1171,7 +1175,7 @@ unit m68k;
      op3:=pointer(_op3);
       end;
 
-  constructor tai68k.op_reg_const(op: tasmop; _size: topsize; _op1: tregister; _op2: longint);
+  constructor taicpu.op_reg_const(op: tasmop; _size: topsize; _op1: tregister; _op2: longint);
    begin
     inherited init;
     typ := ait_instruction;
@@ -1185,7 +1189,7 @@ unit m68k;
    end;
 
 
-    constructor tai68k.op_reg_reg_reg(op : tasmop;_size : topsize;_op1 : tregister;_op2 : tregister;_op3 : tregister);
+    constructor taicpu.op_reg_reg_reg(op : tasmop;_size : topsize;_op1 : tregister;_op2 : tregister;_op3 : tregister);
 
       begin
      inherited init;
@@ -1200,7 +1204,7 @@ unit m68k;
      op3:=pointer(_op3);
       end;
 
-    constructor tai68k.op_const_reg(op : tasmop;_size : topsize;_op1 : longint;_op2 : tregister);
+    constructor taicpu.op_const_reg(op : tasmop;_size : topsize;_op1 : longint;_op2 : tregister);
 
       begin
      inherited init;
@@ -1216,7 +1220,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_const_const(op : tasmop;_size : topsize;_op1,_op2 : longint);
+    constructor taicpu.op_const_const(op : tasmop;_size : topsize;_op1,_op2 : longint);
 
       begin
      inherited init;
@@ -1232,7 +1236,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_const_ref(op : tasmop;_size : topsize;_op1 : longint;_op2 : preference);
+    constructor taicpu.op_const_ref(op : tasmop;_size : topsize;_op1 : longint;_op2 : preference);
 
       begin
      inherited init;
@@ -1258,7 +1262,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_const_loc(op : tasmop;_size : topsize;_op1 : longint;_op2 : tlocation);
+    constructor taicpu.op_const_loc(op : tasmop;_size : topsize;_op1 : longint;_op2 : tlocation);
 
       begin
      inherited init;
@@ -1289,7 +1293,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_ref_reg(op : tasmop;_size : topsize;_op1 : preference;_op2 : tregister);
+    constructor taicpu.op_ref_reg(op : tasmop;_size : topsize;_op1 : preference;_op2 : tregister);
 
       begin
      inherited init;
@@ -1315,7 +1319,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_ref_ref(op : tasmop;_size : topsize;_op1,_op2 : preference);
+    constructor taicpu.op_ref_ref(op : tasmop;_size : topsize;_op1,_op2 : preference);
 
       begin
      inherited init;
@@ -1351,7 +1355,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_csymbol(op : tasmop;_size : topsize;_op1 : pcsymbol);
+    constructor taicpu.op_csymbol(op : tasmop;_size : topsize;_op1 : pcsymbol);
 
       begin
      inherited init;
@@ -1370,7 +1374,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_csymbol_reg(op : tasmop;_size : topsize;_op1 : pcsymbol;_op2 : tregister);
+    constructor taicpu.op_csymbol_reg(op : tasmop;_size : topsize;_op1 : pcsymbol;_op2 : tregister);
 
       begin
      inherited init;
@@ -1386,7 +1390,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_csymbol_ref(op : tasmop;_size : topsize;_op1 : pcsymbol;_op2 : preference);
+    constructor taicpu.op_csymbol_ref(op : tasmop;_size : topsize;_op1 : pcsymbol;_op2 : preference);
 
       begin
      inherited init;
@@ -1412,7 +1416,7 @@ unit m68k;
      op3:=nil;
       end;
 
-    constructor tai68k.op_csymbol_loc(op : tasmop;_size : topsize;_op1 : pcsymbol;_op2 : tlocation);
+    constructor taicpu.op_csymbol_loc(op : tasmop;_size : topsize;_op1 : pcsymbol;_op2 : tlocation);
 
       begin
      inherited init;
@@ -1443,7 +1447,7 @@ unit m68k;
      op3:=nil;
       end;
 
-   destructor tai68k.done;
+   destructor taicpu.done;
 
      begin
     if op1t=top_symbol then
@@ -1471,7 +1475,7 @@ unit m68k;
      end;
 
 
-   constructor tai68k.op_ref_reglist(op: tasmop; _size : topsize; _op1: preference;_op2: tregisterlist);
+   constructor taicpu.op_ref_reglist(op: tasmop; _size : topsize; _op1: preference;_op2: tregisterlist);
    Begin
      Inherited Init;
       typ:=ait_instruction;
@@ -1497,7 +1501,7 @@ unit m68k;
    end;
 
 
-   constructor tai68k.op_reglist_ref(op: tasmop; _size : topsize; _op1: tregisterlist; _op2: preference);
+   constructor taicpu.op_reglist_ref(op: tasmop; _size : topsize; _op1: tregisterlist; _op2: preference);
    Begin
      Inherited Init;
       typ:=ait_instruction;
@@ -1537,8 +1541,7 @@ unit m68k;
          _operator:=op;
          _op1:=R_NO;
          lab:=l;
-         lab^.is_used:=true;
-         inc(lab^.refcount);
+         inc(lab^.refs);
       end;
 
     constructor tai_labeled.init_reg(op : tasmop; l : pasmlabel; reg: tregister);
@@ -1549,20 +1552,13 @@ unit m68k;
          _op1:=reg;
          _operator:=op;
          lab:=l;
-         lab^.is_used:=true;
-         inc(lab^.refcount);
+         inc(lab^.refs);
       end;
 
     destructor tai_labeled.done;
 
       begin
-         dec(lab^.refcount);
-         if lab^.refcount=0 then
-           Begin
-             lab^.is_used := False;
-             If Not(lab^.is_set) Then
-               Dispose(lab);
-           End;
+         dec(lab^.refs);
          inherited done;
       end;
 {*****************************************************************************
@@ -1580,7 +1576,10 @@ unit m68k;
 end.
 {
   $Log$
-  Revision 1.12  1999-08-19 13:02:08  pierre
+  Revision 1.1  1999-09-16 23:05:57  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.12  1999/08/19 13:02:08  pierre
     + label faillabel added for _FAIL support
 
   Revision 1.11  1999/06/22 16:24:42  pierre

+ 13 - 5
compiler/pass_2.pas

@@ -134,6 +134,7 @@ implementation
                 case hp2^.typ of
                   ait_instruction :
                      begin
+{$ifdef i386}
                        { fixup the references }
                        for i:=1 to paicpu(hp2)^.ops do
                         if paicpu(hp2)^.oper[i-1].typ=top_ref then
@@ -147,6 +148,7 @@ implementation
                            end;
                          end;
                        exprasmlist^.concat(hp2);
+{$endif i386}
                      end;
                    ait_marker :
                      begin
@@ -560,7 +562,7 @@ implementation
                                          hr,regvars[i]^.reg)));
 {$endif i386}
 {$ifdef m68k}
-                                       procinfo.aktentrycode^.concat(new(pai68k,op_ref_reg(A_MOVE,regsize,
+                                       procinfo.aktentrycode^.concat(new(paicpu,op_ref_reg(A_MOVE,regsize,
                                          hr,regvars[i]^.reg)));
 {$endif m68k}
                                        unused:=unused - [regvars[i]^.reg];
@@ -622,13 +624,16 @@ implementation
                           begin
                              if assigned(regvars[i]) then
                                begin
-                                  regvars[i]^.reg:=correct_fpuregister(R_ST0,i-1);
-                                  { reserve place on the FPU stack }
 {$ifdef i386}
+                                  { reserve place on the FPU stack }
+                                  regvars[i]^.reg:=correct_fpuregister(R_ST0,i-1);
                                   procinfo.aktentrycode^.concat(new(paicpu,op_none(A_FLDZ,S_NO)));
                                   { ... and clean it up }
                                   procinfo.aktexitcode^.concat(new(paicpu,op_reg(A_FSTP,S_NO,R_ST0)));
 {$endif i386}
+{$ifdef m68k}
+                                  regvars[i]^.reg:=fpuvarregs[i];
+{$endif m68k}
 {$ifdef dummy}
                                   { parameter must be load }
                                   if regvars_para[i] then
@@ -646,7 +651,7 @@ implementation
                                          hr,regvars[i]^.reg)));
 {$endif i386}
 {$ifdef m68k}
-                                       procinfo.aktentrycode^.concat(new(pai68k,op_ref_reg(A_MOVE,regsize,
+                                       procinfo.aktentrycode^.concat(new(paicpu,op_ref_reg(A_MOVE,regsize,
                                          hr,regvars[i]^.reg)));
 {$endif m68k}
                                     end;
@@ -691,7 +696,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.37  1999-09-15 20:35:41  florian
+  Revision 1.38  1999-09-16 23:05:54  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.37  1999/09/15 20:35:41  florian
     * small fix to operator overloading when in MMX mode
     + the compiler uses now fldz and fld1 if possible
     + some fixes to floating point registers

+ 6 - 3
compiler/pmodules.pas

@@ -241,7 +241,7 @@ unit pmodules;
 {$ifdef m68k}
          if target_info.target<>target_m68k_PalmOS then
            begin
-              datasegment^.concat(new(pai_symbol,init_global('HEAP_SIZE')));
+              datasegment^.concat(new(pai_symbol,initname_global('HEAP_SIZE',0)));
               datasegment^.concat(new(pai_const,init_32bit(heapsize)));
            end;
 {$else m68k}
@@ -301,7 +301,7 @@ unit pmodules;
           target_m68k_Atari :
             begin
               { stacksize can be specified }
-              datasegment^.concat(new(pai_symbol,init_global('__stklen',4)));
+              datasegment^.concat(new(pai_symbol,initname_global('__stklen',4)));
               datasegment^.concat(new(pai_const,init_32bit(stacksize)));
             end;
 {$endif m68k}
@@ -1464,7 +1464,10 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.154  1999-09-16 14:18:12  pierre
+  Revision 1.155  1999-09-16 23:05:54  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.154  1999/09/16 14:18:12  pierre
    + warning if truncate unit name found
 
   Revision 1.153  1999/09/13 22:56:17  peter

+ 5 - 2
compiler/pp.pas

@@ -213,7 +213,7 @@ uses
   {$endif}
   {$ifdef m68k}
         {$O opts68k}
-        {$O m68k}
+        {$O cpubase}
         {$O cga68k}
         {$O tgen68k}
         {$O cg68kadd}
@@ -280,7 +280,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.48  1999-09-10 18:48:08  florian
+  Revision 1.49  1999-09-16 23:05:54  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.48  1999/09/10 18:48:08  florian
     * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
     * most things for stored properties fixed
 

+ 6 - 3
compiler/pstatmnt.pas

@@ -56,7 +56,7 @@ unit pstatmnt;
   {$endif NoRa386Dir}
 {$endif i386}
 {$ifdef m68k}
-       ,m68k,tgen68k
+       ,tgen68k
   {$ifndef NoRa68kMot}
        ,ra68kmot
   {$endif NoRa68kMot}
@@ -1209,7 +1209,7 @@ unit pstatmnt;
                      usedinproc:=usedinproc or ($80 shr byte(R_EDX))
 {$endif}
 {$ifdef m68k}
-                   usedinproc:=usedinproc or ($800 shr word(R_D0))
+                   usedinproc:=usedinproc or ($800 shr word(R_D0));
 
                    if is_64bitint(procinfo.retdef) then
                      usedinproc:=usedinproc or ($800 shr byte(R_D1))
@@ -1317,7 +1317,10 @@ unit pstatmnt;
 end.
 {
   $Log$
-  Revision 1.101  1999-09-10 18:48:09  florian
+  Revision 1.102  1999-09-16 23:05:54  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.101  1999/09/10 18:48:09  florian
     * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
     * most things for stored properties fixed
 

+ 6 - 3
compiler/psystem.pas

@@ -218,8 +218,8 @@ begin
   s80floatdef:=new(pfloatdef,init(s80real));
 {$endif}
 {$ifdef m68k}
-  s32floatdef:=new(pfloatdef,init(s32real))
-  s64floatdef:=new(pfloatdef,init(s32real));
+  s32floatdef:=new(pfloatdef,init(s32real));
+  s64floatdef:=new(pfloatdef,init(s64real));
   if (cs_fp_emulation in aktmoduleswitches) then
    s80floatdef:=new(pfloatdef,init(s32real))
   else
@@ -238,7 +238,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.27  1999-08-13 14:24:17  pierre
+  Revision 1.28  1999-09-16 23:05:55  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.27  1999/08/13 14:24:17  pierre
     + stabs for classes and classref working,
       a class still needs an ^ to get that content of it,
       but the class fields inside a class don't result into an

+ 5 - 2
compiler/ra68kmot.pas

@@ -45,7 +45,7 @@ Unit Ra68kMot;
 Interface
 
 Uses
-  globtype,m68k,tree;
+  globtype,cpubase,tree;
 
    function assemble: ptree;
 
@@ -2178,7 +2178,10 @@ Begin
 end.
 {
   $Log$
-  Revision 1.8  1999-01-10 15:37:59  peter
+  Revision 1.9  1999-09-16 23:05:56  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.8  1999/01/10 15:37:59  peter
     * moved some tables from ra386*.pas -> i386.pas
     + start of coff writer
     * renamed asmutils unit to rautils

+ 7 - 1
compiler/tccal.pas

@@ -44,6 +44,9 @@ implementation
 {$ifdef i386}
       ,tgeni386
 {$endif}
+{$ifdef m68k}
+      ,tgen68k
+{$endif m68k}
       ;
 
 {*****************************************************************************
@@ -1219,7 +1222,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.64  1999-09-14 07:59:48  florian
+  Revision 1.65  1999-09-16 23:05:56  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.64  1999/09/14 07:59:48  florian
     * finally!? fixed
          with <function with result in temp> do
       My last and also Peter's fix before were wrong :(

+ 7 - 1
compiler/tcflw.pas

@@ -49,6 +49,9 @@ implementation
 {$ifdef i386}
       ,tgeni386
 {$endif}
+{$ifdef m68k}
+      ,tgen68k
+{$endif m68k}
       ;
 
 {*****************************************************************************
@@ -492,7 +495,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18  1999-09-16 10:44:30  pierre
+  Revision 1.19  1999-09-16 23:05:56  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.18  1999/09/16 10:44:30  pierre
    * firstexit must now set procinfo.funcret_is_valid
 
   Revision 1.17  1999/08/23 23:41:45  pierre

+ 7 - 8
compiler/tgen68k.pas

@@ -25,11 +25,7 @@ unit tgen68k;
   interface
 
     uses
-       cobjects,globals,tree,hcodegen,verbose,files,aasm
-{$ifdef m68k}
-       ,m68k
-{$endif}
-       ;
+       cobjects,globals,tree,hcodegen,verbose,files,aasm,cpubase;
 
     type
        tregisterset = set of tregister;
@@ -119,7 +115,7 @@ unit tgen68k;
                      begin
                         { then save it }
                         { then save it on the stack }
-                        exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,r,R_SPPUSH)));
+                        exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,r,R_SPPUSH)));
                         { here was a big problem  !!!!!}
                         { you cannot do that for a register that is
                         globally assigned to a var
@@ -143,7 +139,7 @@ unit tgen68k;
          for r:=R_A4 downto R_D2 do
            if pushed[r] then
              begin
-                exprasmlist^.concat(new(pai68k,op_reg_reg(A_MOVE,S_L,R_SPPULL,r)));
+                exprasmlist^.concat(new(paicpu,op_reg_reg(A_MOVE,S_L,R_SPPULL,r)));
                 unused:=unused-[r];
              end;
       end;
@@ -332,7 +328,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.4  1998-09-01 09:03:48  peter
+  Revision 1.5  1999-09-16 23:05:57  florian
+    * m68k compiler is again compilable (only gas writer, no assembler reader)
+
+  Revision 1.4  1998/09/01 09:03:48  peter
     + resetregistercount, resetusableregisters
 
   Revision 1.3  1998/08/31 12:26:35  peter