Răsfoiți Sursa

* fixed compilation of arm compiler

florian 21 ani în urmă
părinte
comite
60f0434585

+ 35 - 52
compiler/arm/cgcpu.pas

@@ -32,6 +32,7 @@ unit cgcpu;
        globtype,symtype,
        cgbase,cgobj,
        aasmbase,aasmcpu,aasmtai,
+       parabase,
        cpubase,cpuinfo,node,cg64f32,rgcpu;
 
 
@@ -42,9 +43,9 @@ unit cgcpu;
         procedure init_register_allocators;override;
         procedure done_register_allocators;override;
 
-        procedure a_param_const(list : taasmoutput;size : tcgsize;a : aint;const locpara : tparalocation);override;
-        procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const locpara : tparalocation);override;
-        procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);override;
+        procedure a_param_const(list : taasmoutput;size : tcgsize;a : aint;const paraloc : TCGPara);override;
+        procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const paraloc : TCGPara);override;
+        procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const paraloc : TCGPara);override;
 
         procedure a_call_name(list : taasmoutput;const s : string);override;
         procedure a_call_reg(list : taasmoutput;reg: tregister); override;
@@ -79,20 +80,20 @@ unit cgcpu;
 
         procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: TResFlags; reg: TRegister); override;
 
-        procedure g_copyvaluepara_openarray(list : taasmoutput;const ref:treference;const lenloc:tlocation;elesize:aint);override;
+        procedure g_copyvaluepara_openarray(list : taasmoutput;const ref:treference;const lenloc:tlocation;elesize:aint;loadref:boolean);override;
         procedure g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);override;
         procedure g_proc_exit(list : taasmoutput;parasize : longint;nostackframe:boolean); override;
 
         procedure a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);override;
 
-        procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint; delsource,loadref : boolean);override;
+        procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint;loadref : boolean);override;
 
         procedure g_overflowcheck(list: taasmoutput; const l: tlocation; def: tdef); override;
 
         procedure g_save_standard_registers(list : taasmoutput);override;
         procedure g_restore_standard_registers(list : taasmoutput);override;
         procedure g_save_all_registers(list : taasmoutput);override;
-        procedure g_restore_all_registers(list : taasmoutput;const funcretparaloc:tparalocation);override;
+        procedure g_restore_all_registers(list : taasmoutput;const funcretparaloc:TCGPara);override;
 
         procedure a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel);
         procedure fixref(list : taasmoutput;var ref : treference);
@@ -169,78 +170,79 @@ unit cgcpu;
       end;
 
 
-    procedure tcgarm.a_param_const(list : taasmoutput;size : tcgsize;a : aint;const locpara : tparalocation);
+    procedure tcgarm.a_param_const(list : taasmoutput;size : tcgsize;a : aint;const paraloc : TCGPara);
       var
         ref: treference;
       begin
-        case locpara.loc of
+        paraloc.check_simple_location;
+        case paraloc.location^.loc of
           LOC_REGISTER,LOC_CREGISTER:
-            a_load_const_reg(list,size,a,locpara.register);
+            a_load_const_reg(list,size,a,paraloc.location^.register);
           LOC_REFERENCE:
             begin
                reference_reset(ref);
-               ref.base:=locpara.reference.index;
-               ref.offset:=locpara.reference.offset;
+               ref.base:=paraloc.location^.reference.index;
+               ref.offset:=paraloc.location^.reference.offset;
                a_load_const_ref(list,size,a,ref);
             end;
           else
             internalerror(2002081101);
         end;
-        if locpara.alignment<>0 then
+        if paraloc.alignment<>0 then
           internalerror(2002081102);
       end;
 
 
-    procedure tcgarm.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const locpara : tparalocation);
+    procedure tcgarm.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const paraloc : TCGPara);
       var
         ref: treference;
         tmpreg: tregister;
       begin
-        case locpara.loc of
+        paraloc.check_simple_location;
+        case paraloc.location^.loc of
           LOC_REGISTER,LOC_CREGISTER:
-            a_load_ref_reg(list,size,size,r,locpara.register);
+            a_load_ref_reg(list,size,size,r,paraloc.location^.register);
           LOC_REFERENCE:
             begin
                reference_reset(ref);
-               ref.base:=locpara.reference.index;
-               ref.offset:=locpara.reference.offset;
+               ref.base:=paraloc.location^.reference.index;
+               ref.offset:=paraloc.location^.reference.offset;
                tmpreg := getintregister(list,size);
                a_load_ref_reg(list,size,size,r,tmpreg);
                a_load_reg_ref(list,size,size,tmpreg,ref);
-               ungetregister(list,tmpreg);
             end;
           LOC_FPUREGISTER,LOC_CFPUREGISTER:
             case size of
                OS_F32, OS_F64:
-                 a_loadfpu_ref_reg(list,size,r,locpara.register);
+                 a_loadfpu_ref_reg(list,size,r,paraloc.location^.register);
                else
                  internalerror(2002072801);
             end;
           else
             internalerror(2002081103);
         end;
-        if locpara.alignment<>0 then
+        if paraloc.alignment<>0 then
           internalerror(2002081104);
       end;
 
 
-    procedure tcgarm.a_paramaddr_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);
+    procedure tcgarm.a_paramaddr_ref(list : taasmoutput;const r : treference;const paraloc : TCGPara);
       var
         ref: treference;
         tmpreg: tregister;
       begin
-         case locpara.loc of
+        paraloc.check_simple_location;
+         case paraloc.location^.loc of
             LOC_REGISTER,LOC_CREGISTER:
-              a_loadaddr_ref_reg(list,r,locpara.register);
+              a_loadaddr_ref_reg(list,r,paraloc.location^.register);
             LOC_REFERENCE:
               begin
                 reference_reset(ref);
-                ref.base := locpara.reference.index;
-                ref.offset := locpara.reference.offset;
+                ref.base := paraloc.location^.reference.index;
+                ref.offset := paraloc.location^.reference.offset;
                 tmpreg := getintregister(list,OS_ADDR);
                 a_loadaddr_ref_reg(list,r,tmpreg);
                 a_load_reg_ref(list,OS_ADDR,OS_ADDR,tmpreg,ref);
-                ungetregister(list,tmpreg);
               end;
             else
               internalerror(2002080701);
@@ -382,7 +384,6 @@ unit cgcpu;
                   tmpreg:=getintregister(list,size);
                   a_load_const_reg(list,size,a,tmpreg);
                   a_op_reg_reg_reg(list,op,size,tmpreg,src,dst);
-                  ungetregister(list,tmpreg);
                 end;
             end;
        end;
@@ -431,7 +432,6 @@ unit cgcpu;
                      begin
                        tmpreg:=getintregister(list,size);
                        a_load_reg_reg(list,size,size,src2,dst);
-                       ungetregister(list,tmpreg);
                        list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,tmpreg,src1));
                      end;
                  end
@@ -627,8 +627,6 @@ unit cgcpu;
               end;
           end;
         list.concat(setoppostfix(taicpu.op_reg_ref(op,reg,ref),oppostfix));
-        if (tmpreg<>NR_NO) then
-          ungetregister(list,tmpreg);
       end;
 
 
@@ -793,7 +791,6 @@ unit cgcpu;
             tmpreg:=getintregister(list,size);
             a_load_const_reg(list,size,a,tmpreg);
             list.concat(taicpu.op_reg_reg(A_CMP,reg,tmpreg));
-            ungetregister(list,tmpreg);
           end;
         a_jmp_cond(list,cmp_op,l);
       end;
@@ -837,7 +834,7 @@ unit cgcpu;
       end;
 
 
-    procedure tcgarm.g_copyvaluepara_openarray(list : taasmoutput;const ref:treference;const lenloc:tlocation;elesize:aint);
+    procedure tcgarm.g_copyvaluepara_openarray(list : taasmoutput;const ref:treference;const lenloc:tlocation;elesize:aint;loadref:boolean);
       begin
       end;
 
@@ -988,7 +985,6 @@ unit cgcpu;
                 add_move_instruction(instr);
               end;
           end;
-        reference_release(list,tmpref);
       end;
 
 
@@ -1048,7 +1044,7 @@ unit cgcpu;
       end;
 
 
-    procedure tcgarm.g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint; delsource,loadref : boolean);
+    procedure tcgarm.g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint;loadref : boolean);
       var
         srcref,dstref:treference;
         srcreg,destreg,countreg,r:tregister;
@@ -1072,7 +1068,6 @@ unit cgcpu;
           r:=getintregister(list,size2opsize[size]);
           a_load_ref_reg(list,size2opsize[size],size2opsize[size],srcref,r);
           a_load_reg_ref(list,size2opsize[size],size2opsize[size],r,dstref);
-          ungetregister(list,r);
           list.concat(setoppostfix(taicpu.op_reg_reg_const(A_SUB,countreg,countreg,1),PF_S));
           list.concat(setcondition(taicpu.op_sym(A_B,l),C_NE));
           { keep the registers alive }
@@ -1108,12 +1103,9 @@ unit cgcpu;
                 dec(len,copysize);
                 r:=getintregister(list,cgsize);
                 a_load_ref_reg(list,cgsize,cgsize,srcref,r);
-                if (len=0) and delsource then
-                  reference_release(list,source);
                 a_load_reg_ref(list,cgsize,cgsize,r,dstref);
                 inc(srcref.offset,copysize);
                 inc(dstref.offset,copysize);
-                ungetregister(list,r);
               end;
           end
         else
@@ -1129,9 +1121,6 @@ unit cgcpu;
               a_loadaddr_ref_reg(list,source,srcreg);
             reference_reset_base(srcref,srcreg,0);
 
-            if delsource then
-              reference_release(list,source);
-
             countreg:=getintregister(list,OS_32);
 
 //            if cs_littlesize in aktglobalswitches  then
@@ -1157,12 +1146,7 @@ unit cgcpu;
                   list.concat(Taicpu.op_none(A_MOVSB,S_NO));
                 end;
 }
-            ungetregister(list,countreg);
-            ungetregister(list,srcreg);
-            ungetregister(list,destreg);
           end;
-        if delsource then
-          tg.ungetiftemp(list,source);
       end;
 
 
@@ -1189,7 +1173,7 @@ unit cgcpu;
       end;
 
 
-    procedure tcgarm.g_restore_all_registers(list : taasmoutput;const funcretparaloc:tparalocation);
+    procedure tcgarm.g_restore_all_registers(list : taasmoutput;const funcretparaloc:TCGPara);
       begin
         { we support only ARM standard calling conventions so this procedure has no use on the ARM }
       end;
@@ -1253,7 +1237,6 @@ unit cgcpu;
                   tmpreg:=cg.getintregister(list,OS_32);
                   cg.a_load_const_reg(list,OS_32,lo(value),tmpreg);
                   list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ADD,regdst.reglo,regsrc.reglo,tmpreg),PF_S));
-                  cg.ungetregister(list,tmpreg);
                 end;
 
               if is_shifter_const(hi(value),b) then
@@ -1263,7 +1246,6 @@ unit cgcpu;
                   tmpreg:=cg.getintregister(list,OS_32);
                   cg.a_load_const_reg(list,OS_32,hi(value),tmpreg);
                   list.concat(taicpu.op_reg_reg_reg(A_ADC,regdst.reghi,regsrc.reghi,tmpreg));
-                  cg.ungetregister(list,tmpreg);
                 end;
             end;
           OP_SUB:
@@ -1275,7 +1257,6 @@ unit cgcpu;
                   tmpreg:=cg.getintregister(list,OS_32);
                   cg.a_load_const_reg(list,OS_32,lo(value),tmpreg);
                   list.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,regdst.reglo,regsrc.reglo,tmpreg),PF_S));
-                  cg.ungetregister(list,tmpreg);
                 end;
 
               if is_shifter_const(hi(value),b) then
@@ -1285,7 +1266,6 @@ unit cgcpu;
                   tmpreg:=cg.getintregister(list,OS_32);
                   cg.a_load_const_reg(list,OS_32,hi(value),tmpreg);
                   list.concat(taicpu.op_reg_reg_reg(A_SBC,regdst.reghi,regsrc.reghi,tmpreg));
-                  cg.ungetregister(list,tmpreg);
                 end;
             end;
           else
@@ -1324,7 +1304,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.55  2004-10-11 15:46:45  peter
+  Revision 1.56  2004-10-24 07:54:25  florian
+    * fixed compilation of arm compiler
+
+  Revision 1.55  2004/10/11 15:46:45  peter
     * length parameter for copyvaluearray changed to tlocation
 
   Revision 1.54  2004/07/03 19:29:14  florian

+ 124 - 100
compiler/arm/cpupara.pas

@@ -200,7 +200,8 @@ unit cpupara;
         stack_offset : aword;
         hp : tparaitem;
         loc : tcgloc;
-        is_64bit: boolean;
+        paracgsize   : tcgsize;
+        paralen : longint;
 
       procedure assignintreg;
         begin
@@ -243,10 +244,18 @@ unit cpupara;
                 break;
               end;
 
+            if push_addr_param(hp.paratyp,hp.paratype.def,p.proccalloption) then
+              paracgsize:=OS_ADDR
+            else
+              begin
+                paracgsize:=def_cgSize(hp.paratype.def);
+                if paracgsize=OS_NO then
+                  paracgsize:=OS_ADDR;
+              end;
+
              hp.paraloc[side].reset;
              hp.paraloc[side].size:=paracgsize;
              hp.paraloc[side].Alignment:=std_param_align;
-             paralen:=tcgsize2size[paracgsize];
 
              if (hp.paratyp in [vs_var,vs_out]) then
                begin
@@ -259,97 +268,90 @@ unit cpupara;
                  loc:=getparaloc(p.proccalloption,paradef);
                end;
 
-             paraloc:=hp.paraloc[side].add_location;
-             case loc of
-                LOC_REGISTER:
-                  begin
-                    paraloc^.size := def_cgsize(paradef);
-                    { for things like formaldef }
-                    if paraloc^.size = OS_NO then
-                      paraloc^.size := OS_ADDR;
-                    is_64bit:=paraloc^.size in [OS_64,OS_S64,OS_F64];
-                    { this is not abi compliant }
-                    if nextintreg<=(RS_R3-ord(is_64bit)) then
+             paralen:=tcgsize2size[paracgsize];
+             while (paralen>0) do
+               begin
+                 paraloc:=hp.paraloc[side].add_location;
+                 { for things like formaldef }
+                 if paracgsize=OS_NO then
+                   paraloc^.size:=OS_ADDR
+                 else if paracgsize in [OS_64,OS_S64] then
+                   paraloc^.size:=OS_32
+                 else
+                   paraloc^.size:=def_cgsize(paradef);
+                 case loc of
+                    LOC_REGISTER:
                       begin
-                        paraloc^.loc:=LOC_REGISTER;
-                        paraloc^.registerlow:=newreg(R_INTREGISTER,nextintreg,R_SUBWHOLE);
-                        inc(nextintreg);
-                        if is_64bit then
-                         begin
-                           paraloc^.lochigh:=LOC_REGISTER;
-                           paraloc.registerhigh:=newreg(R_INTREGISTER,nextintreg,R_SUBWHOLE);
-                           inc(nextintreg);
+                        { this is not abi compliant }
+                        if nextintreg<=RS_R3 then
+                          begin
+                            paraloc^.loc:=LOC_REGISTER;
+                            paraloc^.register:=newreg(R_INTREGISTER,nextintreg,R_SUBWHOLE);
+                            inc(nextintreg);
+                          end
+                        else
+                          begin
+                            paraloc^.loc:=LOC_REFERENCE;
+                            paraloc^.reference.index:=NR_STACK_POINTER_REG;
+                            paraloc^.reference.offset:=stack_offset;
                          end;
-                      end
-                    else
-                       begin
-                         nextintreg:=RS_R4;
-                         paraloc.loc:=LOC_REFERENCE;
-                         paraloc.reference.index:=NR_STACK_POINTER_REG;
-                         paraloc.reference.offset:=stack_offset;
-                         if not is_64bit then
-                           inc(stack_offset,4)
-                         else
-                           inc(stack_offset,8);
                       end;
-                  end;
-                LOC_FPUREGISTER:
-                  begin
-                    paraloc.size:=def_cgsize(paradef);
-                    if nextfloatreg<=RS_F3 then
-                      begin
-                        paraloc.loc:=LOC_FPUREGISTER;
-                        paraloc.register:=newreg(R_FPUREGISTER,nextfloatreg,R_SUBWHOLE);
-                        inc(nextfloatreg);
-                      end
-                    else
+                    LOC_FPUREGISTER:
                       begin
-                        paraloc^.size:=def_cgsize(paradef);
-                        nextintreg:=RS_F4;
-                        paraloc^.loc:=LOC_REFERENCE;
-                        paraloc^.reference.index:=NR_STACK_POINTER_REG;
-                        paraloc^.reference.offset:=stack_offset;
-                        case paraloc.size of
-                          OS_F32:
-                            inc(stack_offset,4);
-                          OS_F64:
-                            inc(stack_offset,8);
-                          OS_F80:
-                            inc(stack_offset,10);
-                          OS_F128:
-                            inc(stack_offset,16);
-                          else
-                            internalerror(200403201);
-                        end;
+                        if nextfloatreg<=RS_F3 then
+                          begin
+                            paraloc^.loc:=LOC_FPUREGISTER;
+                            paraloc^.register:=newreg(R_FPUREGISTER,nextfloatreg,R_SUBWHOLE);
+                            inc(nextfloatreg);
+                          end
+                        else
+                          begin
+                            paraloc^.loc:=LOC_REFERENCE;
+                            paraloc^.reference.index:=NR_STACK_POINTER_REG;
+                            paraloc^.reference.offset:=stack_offset;
+                            case paraloc^.size of
+                              OS_F32:
+                                inc(stack_offset,4);
+                              OS_F64:
+                                inc(stack_offset,8);
+                              OS_F80:
+                                inc(stack_offset,10);
+                              OS_F128:
+                                inc(stack_offset,16);
+                              else
+                                internalerror(200403201);
+                            end;
+                          end;
                       end;
-                  end;
-                LOC_REFERENCE:
-                  begin
-                    paraloc^.size:=OS_ADDR;
-                    if push_addr_param(hp.paratyp,paradef,p.proccalloption) or
-                      is_open_array(paradef) or
-                      is_array_of_const(paradef) then
-                      assignintreg
-                    else
+                    LOC_REFERENCE:
                       begin
-                         paraloc.loc:=LOC_REFERENCE;
-                         paraloc.reference.index:=NR_STACK_POINTER_REG;
-                         paraloc.reference.offset:=stack_offset;
-                         inc(stack_offset,hp.paratype.def.size);
+                        paraloc^.size:=OS_ADDR;
+                        if push_addr_param(hp.paratyp,paradef,p.proccalloption) or
+                          is_open_array(paradef) or
+                          is_array_of_const(paradef) then
+                          assignintreg
+                        else
+                          begin
+                             paraloc^.loc:=LOC_REFERENCE;
+                             paraloc^.reference.index:=NR_STACK_POINTER_REG;
+                             paraloc^.reference.offset:=stack_offset;
+                             inc(stack_offset,hp.paratype.def.size);
+                          end;
                       end;
-                  end;
-                else
-                  internalerror(2002071002);
-             end;
-             if side=calleeside then
-               begin
-                 if paraloc.loc=LOC_REFERENCE then
+                    else
+                      internalerror(2002071002);
+                 end;
+                 if side=calleeside then
                    begin
-                     paraloc.reference.index:=NR_FRAME_POINTER_REG;
-                     inc(paraloc.reference.offset,4);
+                     if paraloc^.loc=LOC_REFERENCE then
+                       begin
+                         paraloc^.reference.index:=NR_FRAME_POINTER_REG;
+                         inc(paraloc^.reference.offset,4);
+                       end;
                    end;
+                 dec(paralen,tcgsize2size[paraloc^.size]);
                end;
-             hp.paraloc[side]:=paraloc;
+
              hp:=tparaitem(hp.next);
           end;
         curintreg:=nextintreg;
@@ -362,43 +364,59 @@ unit cpupara;
 
     function tarmparamanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
       var
-        paraloc : tparalocation;
+        paraloc : pcgparalocation;
         cur_stack_offset: aword;
         curintreg, curfloatreg, curmmreg: tsuperregister;
+        retcgsize  : tcgsize;
       begin
         init_values(curintreg,curfloatreg,curmmreg,cur_stack_offset);
 
         result:=create_paraloc_info_intern(p,side,tparaitem(p.para.first),curintreg,curfloatreg,curmmreg,cur_stack_offset);
 
+        { Constructors return self instead of a boolean }
+        if (p.proctypeoption=potype_constructor) then
+          retcgsize:=OS_ADDR
+        else
+          retcgsize:=def_cgsize(p.rettype.def);
+        p.funcret_paraloc[side].reset;
+        p.funcret_paraloc[side].Alignment:=std_param_align;
+        p.funcret_paraloc[side].size:=retcgsize;
+        { void has no location }
+        if is_void(p.rettype.def) then
+          exit;
         { Function return }
-        fillchar(paraloc,sizeof(tparalocation),0);
-        paraloc.lochigh:=LOC_INVALID;
-        paraloc.size:=def_cgsize(p.rettype.def);
+        paraloc:=p.funcret_paraloc[side].add_location;
+
         { Return in FPU register? }
         if p.rettype.def.deftype=floatdef then
           begin
-            paraloc.loc:=LOC_FPUREGISTER;
-            paraloc.register:=NR_FPU_RESULT_REG;
+            paraloc^.loc:=LOC_FPUREGISTER;
+            paraloc^.register:=NR_FPU_RESULT_REG;
           end
-        else
           { Return in register? }
-          if not ret_in_param(p.rettype.def,p.proccalloption) then
+        else if not ret_in_param(p.rettype.def,p.proccalloption) then
             begin
-              paraloc.loc:=LOC_REGISTER;
-              if paraloc.size in [OS_64,OS_S64] then
+              paraloc^.loc:=LOC_REGISTER;
+              if paraloc^.size in [OS_64,OS_S64] then
                 begin
-                  paraloc.lochigh:=LOC_REGISTER;
-                  paraloc.register:=NR_FUNCTION_RETURN64_LOW_REG;
-                  paraloc.registerhigh:=NR_FUNCTION_RETURN64_HIGH_REG;
+                  { low }
+                  paraloc^.loc:=LOC_REGISTER;
+                  paraloc^.size:=OS_32;
+                  paraloc^.register:=NR_FUNCTION_RESULT64_LOW_REG;
+
+                  { high }
+                  paraloc:=p.funcret_paraloc[side].add_location;
+                  paraloc^.loc:=LOC_REGISTER;
+                  paraloc^.size:=OS_32;
+                  paraloc^.register:=NR_FUNCTION_RESULT64_HIGH_REG;
                 end
               else
-                paraloc.register:=NR_FUNCTION_RETURN_REG;
+                paraloc^.register:=NR_FUNCTION_RETURN_REG;
             end
         else
           begin
-            paraloc.loc:=LOC_REFERENCE;
+            paraloc^.loc:=LOC_REFERENCE;
           end;
-        p.funcret_paraloc[side]:=paraloc;
      end;
 
 
@@ -417,6 +435,8 @@ unit cpupara;
           { just continue loading the parameters in the registers }
           result:=create_paraloc_info_intern(p,callerside,tparaitem(varargspara.first),curintreg,curfloatreg,curmmreg,cur_stack_offset)
         else
+          internalerror(200410231);
+        {
           begin
             hp:=tparaitem(varargspara.first);
             parasize:=cur_stack_offset;
@@ -435,6 +455,7 @@ unit cpupara;
               end;
             result := parasize;
           end;
+        }
       end;
 
 begin
@@ -442,7 +463,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.20  2004-10-22 16:36:57  florian
+  Revision 1.21  2004-10-24 07:54:25  florian
+    * fixed compilation of arm compiler
+
+  Revision 1.20  2004/10/22 16:36:57  florian
     * first arm fixes for new paraloc handling
 
   Revision 1.19  2004/06/20 08:55:31  florian

+ 4 - 13
compiler/arm/narmadd.pas

@@ -160,8 +160,6 @@ interface
                  location.register,left.location.register,right.location.register),
                  cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
 
-              release_reg_left_right;
-
               location.loc:=LOC_FPUREGISTER;
             end;
           fpu_soft:
@@ -196,7 +194,6 @@ interface
              left.location.register,right.location.register),
              cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
 
-        release_reg_left_right;
         location_reset(location,LOC_FLAGS,OS_NO);
         location.resflags:=getresflags(false);
       end;
@@ -234,13 +231,11 @@ interface
               tmpreg:=cg.getintregister(exprasmlist,location.size);
               exprasmlist.concat(taicpu.op_reg_reg_reg(A_AND,tmpreg,left.location.register,right.location.register));
               exprasmlist.concat(taicpu.op_reg_reg(A_CMP,tmpreg,right.location.register));
-              cg.ungetregister(exprasmlist,tmpreg);
               location.resflags:=F_EQ;
             end;
           else
             internalerror(2004012401);
         end;
-        release_reg_left_right;
       end;
 
 
@@ -270,7 +265,6 @@ interface
             tmpreg:=cg.getintregister(exprasmlist,location.size);
             exprasmlist.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,tmpreg,left.location.register64.reglo,right.location.register64.reglo),PF_S));
             exprasmlist.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SBC,tmpreg,left.location.register64.reghi,right.location.register64.reghi),PF_S));
-            cg.ungetregister(exprasmlist,tmpreg);
           end
         else
         { operation requiring proper N, Z and V flags ? }
@@ -279,7 +273,6 @@ interface
             tmpreg:=cg.getintregister(exprasmlist,location.size);
             exprasmlist.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SUB,tmpreg,right.location.register64.reglo,left.location.register64.reglo),PF_S));
             exprasmlist.concat(setoppostfix(taicpu.op_reg_reg_reg(A_SBC,tmpreg,right.location.register64.reghi,left.location.register64.reghi),PF_S));
-            cg.ungetregister(exprasmlist,tmpreg);
             if nf_swaped in flags then
               begin
                 if location.resflags=F_LT then
@@ -299,8 +292,6 @@ interface
                   internalerror(200401221);
               end;
           end;
-
-        release_reg_left_right;
       end;
 
 
@@ -326,7 +317,6 @@ interface
                  cg.a_load_const_reg(exprasmlist,OS_INT,
                    aword(right.location.value),tmpreg);
                  exprasmlist.concat(taicpu.op_reg_reg(A_CMP,left.location.register,tmpreg));
-                 cg.ungetregister(exprasmlist,tmpreg);
                end;
           end
         else
@@ -334,8 +324,6 @@ interface
 
         location_reset(location,LOC_FLAGS,OS_NO);
         location.resflags:=getresflags(unsigned);
-
-        release_reg_left_right;
       end;
 
 begin
@@ -343,7 +331,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.15  2004-06-20 08:55:31  florian
+  Revision 1.16  2004-10-24 07:54:25  florian
+    * fixed compilation of arm compiler
+
+  Revision 1.15  2004/06/20 08:55:31  florian
     * logs truncated
 
   Revision 1.14  2004/03/23 21:03:50  florian

+ 4 - 8
compiler/arm/narmcnv.pas

@@ -152,12 +152,10 @@ implementation
               begin
                 if left.location.size in [OS_64,OS_S64] then
                  begin
-                   location_release(exprasmlist,left.location);
                    hregister:=cg.getintregister(exprasmlist,OS_INT);
                    cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,left.location.reference,hregister);
                    href:=left.location.reference;
                    inc(href.offset,4);
-                   cg.ungetregister(exprasmlist,hregister);
                    tcgarm(cg).setflags:=true;
                    cg.a_op_ref_reg(exprasmlist,OP_OR,OS_32,href,hregister);
                    tcgarm(cg).setflags:=false;
@@ -165,7 +163,6 @@ implementation
                 else
                  begin
                    location_force_reg(exprasmlist,left.location,left.location.size,true);
-                   location_release(exprasmlist,left.location);
                    tcgarm(cg).setflags:=true;
                    cg.a_op_reg_reg(exprasmlist,OP_OR,left.location.size,left.location.register,left.location.register);
                    tcgarm(cg).setflags:=false;
@@ -181,15 +178,12 @@ implementation
                  begin
                    hregister:=cg.getintregister(exprasmlist,OS_32);
                    cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,left.location.registerlow,hregister);
-                   cg.ungetregister(exprasmlist,hregister);
-                   location_release(exprasmlist,left.location);
                    tcgarm(cg).setflags:=true;
                    cg.a_op_reg_reg(exprasmlist,OP_OR,OS_32,left.location.registerhigh,hregister);
                    tcgarm(cg).setflags:=false;
                  end
                 else
                  begin
-                   location_release(exprasmlist,left.location);
                    tcgarm(cg).setflags:=true;
                    cg.a_op_reg_reg(exprasmlist,OP_OR,left.location.size,left.location.register,left.location.register);
                    tcgarm(cg).setflags:=false;
@@ -205,7 +199,6 @@ implementation
                 cg.a_label(exprasmlist,falselabel);
                 cg.a_load_const_reg(exprasmlist,OS_INT,0,hregister);
                 cg.a_label(exprasmlist,hlabel);
-                cg.ungetregister(exprasmlist,hregister);
                 tcgarm(cg).setflags:=true;
                 cg.a_op_reg_reg(exprasmlist,OP_OR,OS_INT,hregister,hregister);
                 tcgarm(cg).setflags:=false;
@@ -227,7 +220,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.10  2004-06-20 08:55:31  florian
+  Revision 1.11  2004-10-24 07:54:25  florian
+    * fixed compilation of arm compiler
+
+  Revision 1.10  2004/06/20 08:55:31  florian
     * logs truncated
 
   Revision 1.9  2004/02/03 22:32:54  peter

+ 4 - 2
compiler/arm/narmmat.pas

@@ -90,7 +90,6 @@ implementation
                 begin
                   location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true);
                   exprasmlist.concat(taicpu.op_reg_const(A_CMP,left.location.register,0));
-                  location_release(exprasmlist,left.location);
                   location_reset(location,LOC_FLAGS,OS_NO);
                   location.resflags:=F_EQ;
                end;
@@ -122,7 +121,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.7  2004-06-20 08:55:31  florian
+  Revision 1.8  2004-10-24 07:54:25  florian
+    * fixed compilation of arm compiler
+
+  Revision 1.7  2004/06/20 08:55:31  florian
     * logs truncated
 
   Revision 1.6  2004/03/13 18:45:40  florian

+ 37 - 107
compiler/arm/rgcpu.pas

@@ -36,12 +36,8 @@ unit rgcpu;
 
      type
        trgcpu = class(trgobj)
-         procedure do_spill_read(list : taasmoutput;instr : taicpu;pos: tai; regidx: word;
-          const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);override;
-         procedure do_spill_written(list : taasmoutput;instr : taicpu;pos: tai; regidx: word;
-          const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);override;
-         procedure do_spill_readwritten(list : taasmoutput;instr : taicpu;pos: tai; regidx: word;
-          const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);override;
+         procedure do_spill_read(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister);override;
+         procedure do_spill_written(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister);override;
        end;
 
        trgintcpu = class(trgcpu)
@@ -56,17 +52,15 @@ unit rgcpu;
       procinfo;
 
 
-    procedure trgcpu.do_spill_read(list : taasmoutput;instr : taicpu;pos: tai; regidx: word;
-     const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);
+    procedure trgcpu.do_spill_read(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister);
       var
         helpins: tai;
-        tmpref,ref : treference;
+        tmpref : treference;
         helplist : taasmoutput;
         l : tasmlabel;
-        tmpreg : tregister;
+        hreg : tregister;
       begin
-        ref:=spilltemplist[regs[regidx].orgreg];
-        if abs(ref.offset)>4095 then
+        if abs(spilltemp.offset)>4095 then
           begin
             helplist:=taasmoutput.create;
             reference_reset(tmpref);
@@ -75,103 +69,46 @@ unit rgcpu;
             cg.a_label(current_procinfo.aktlocaldata,l);
             tmpref.symboldata:=current_procinfo.aktlocaldata.last;
 
-            current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(ref.offset));
+            current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(spilltemp.offset));
 
             { load consts entry }
-            if getregtype(regs[regidx].tempreg)=R_INTREGISTER then
-              getregisterinline(helplist,pos,defaultsub,tmpreg)
+            if getregtype(tempreg)=R_INTREGISTER then
+              hreg:=getregisterinline(helplist,R_SUBWHOLE)
             else
-              tmpreg:=cg.getintregister(helplist,OS_ADDR);
+              hreg:=cg.getintregister(helplist,OS_ADDR);
+
             tmpref.symbol:=l;
             tmpref.base:=NR_R15;
-            helplist.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
+            helplist.concat(taicpu.op_reg_ref(A_LDR,hreg,tmpref));
+
+            reference_reset_base(tmpref,hreg,0);
 
-            if ref.index<>NR_NO then
+            if spilltemp.index<>NR_NO then
               internalerror(200401263);
-            ref.index:=tmpreg;
-            ref.offset:=0;
 
-            helpins:=spilling_create_load(ref,regs[regidx].tempreg);
+            helpins:=spilling_create_load(tmpref,tempreg);
             helplist.concat(helpins);
             if pos=nil then
               list.insertlistafter(list.first,helplist)
             else
               list.insertlistafter(pos.next,helplist);
 
-            ungetregisterinline(list,helpins,regs[regidx].tempreg);
-
-            if getregtype(regs[regidx].tempreg)=R_INTREGISTER then
-              ungetregisterinline(list,helpins,tmpreg);
-
-            forward_allocation(tai(helpins.next),instr);
-
             helplist.free;
           end
         else
-          inherited do_spill_read(list,instr,pos,regidx,spilltemplist,regs);
+          inherited do_spill_read(list,pos,spilltemp,tempreg);
       end;
 
 
-    procedure trgcpu.do_spill_written(list : taasmoutput;instr : taicpu;pos: tai; regidx: word;
-      const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);
+    procedure trgcpu.do_spill_written(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister);
       var
         helpins: tai;
-        ref,tmpref : treference;
-        helplist : taasmoutput;
-        l : tasmlabel;
-        tmpreg : tregister;
-      begin
-        ref:=spilltemplist[regs[regidx].orgreg];
-        if abs(ref.offset)>4095 then
-          begin
-            helplist:=taasmoutput.create;
-            reference_reset(tmpref);
-            { create consts entry }
-            objectlibrary.getlabel(l);
-            cg.a_label(current_procinfo.aktlocaldata,l);
-            tmpref.symboldata:=current_procinfo.aktlocaldata.last;
-
-            current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(ref.offset));
-
-            { load consts entry }
-            if getregtype(regs[regidx].tempreg)=R_INTREGISTER then
-              getregisterinline(helplist,pos,defaultsub,tmpreg)
-            else
-              tmpreg:=cg.getintregister(helplist,OS_ADDR);
-            tmpref.symbol:=l;
-            tmpref.base:=NR_R15;
-            helplist.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
-
-            if ref.index<>NR_NO then
-              internalerror(200401263);
-            ref.index:=tmpreg;
-            ref.offset:=0;
-
-            helplist.concat(spilling_create_store(regs[regidx].tempreg,ref));
-            ungetregisterinline(helplist,tai(helplist.last),regs[regidx].tempreg);
-            if getregtype(regs[regidx].tempreg)=R_INTREGISTER then
-              ungetregisterinline(helplist,tai(helplist.last),tmpreg);
-
-            list.insertlistafter(instr,helplist);
-
-            helplist.free;
-          end
-        else
-          inherited do_spill_written(list,instr,pos,regidx,spilltemplist,regs);
-      end;
-
-
-    procedure trgcpu.do_spill_readwritten(list : taasmoutput;instr : taicpu;pos: tai; regidx: word;
-      const spilltemplist:Tspill_temp_list;const regs : tspillregsinfo);
-      var
-        helpins1, helpins2: tai;
-        tmpref,ref : treference;
+        tmpref : treference;
         helplist : taasmoutput;
         l : tasmlabel;
-        tmpreg : tregister;
+        hreg : tregister;
       begin
-        ref:=spilltemplist[regs[regidx].orgreg];
-        if abs(ref.offset)>4095 then
+        if abs(spilltemp.offset)>4095 then
           begin
             helplist:=taasmoutput.create;
             reference_reset(tmpref);
@@ -180,40 +117,31 @@ unit rgcpu;
             cg.a_label(current_procinfo.aktlocaldata,l);
             tmpref.symboldata:=current_procinfo.aktlocaldata.last;
 
-            current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(ref.offset));
+            current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(spilltemp.offset));
 
             { load consts entry }
-            if getregtype(regs[regidx].tempreg)=R_INTREGISTER then
-              getregisterinline(helplist,pos,defaultsub,tmpreg)
+            if getregtype(tempreg)=R_INTREGISTER then
+              hreg:=getregisterinline(helplist,R_SUBWHOLE)
             else
-              tmpreg:=cg.getintregister(helplist,OS_ADDR);
+              hreg:=cg.getintregister(helplist,OS_ADDR);
             tmpref.symbol:=l;
             tmpref.base:=NR_R15;
-            helplist.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
+            helplist.concat(taicpu.op_reg_ref(A_LDR,hreg,tmpref));
 
-            if ref.index<>NR_NO then
+            if spilltemp.index<>NR_NO then
               internalerror(200401263);
-            ref.index:=tmpreg;
-            ref.offset:=0;
 
-            helpins1:=spilling_create_load(ref,regs[regidx].tempreg);
-            helplist.concat(helpins1);
-            if pos=nil then
-              list.insertlistafter(list.first,helplist)
-            else
-              list.insertlistafter(pos.next,helplist);
+            reference_reset_base(tmpref,hreg,0);
 
-            helpins2:=spilling_create_store(regs[regidx].tempreg,ref);
-            list.insertafter(helpins2,instr);
-            ungetregisterinline(list,helpins2,regs[regidx].tempreg);
+            helplist.concat(spilling_create_store(tempreg,tmpref));
 
-            if getregtype(regs[regidx].tempreg)=R_INTREGISTER then
-              ungetregisterinline(list,helpins2,tmpreg);
+            if getregtype(tempreg)=R_INTREGISTER then
+              ungetregisterinline(helplist,hreg);
 
-            forward_allocation(tai(helpins1.next),instr);
+            list.insertlistafter(pos,helplist)
           end
         else
-          inherited do_spill_readwritten(list,instr,pos,regidx,spilltemplist,regs);
+          inherited do_spill_written(list,pos,spilltemp,tempreg);
       end;
 
 
@@ -231,7 +159,10 @@ end.
 
 {
   $Log$
-  Revision 1.13  2004-07-03 19:29:14  florian
+  Revision 1.14  2004-10-24 07:54:25  florian
+    * fixed compilation of arm compiler
+
+  Revision 1.13  2004/07/03 19:29:14  florian
     * fixed problem with cpu interferences
 
   Revision 1.12  2004/06/20 08:55:31  florian
@@ -251,5 +182,4 @@ end.
 
   Revision 1.10.2.1  2004/06/12 17:01:01  florian
     * fixed compilation of arm compiler
-
 }