Pārlūkot izejas kodu

* changed some types to prevend range check errors

florian 22 gadi atpakaļ
vecāks
revīzija
4584775cbe

+ 8 - 5
compiler/arm/aasmcpu.pas

@@ -50,12 +50,12 @@ uses
 
 
          constructor op_reg_reg(op : tasmop;_op1,_op2 : tregister);
          constructor op_reg_reg(op : tasmop;_op1,_op2 : tregister);
          constructor op_reg_ref(op : tasmop;_op1 : tregister;const _op2 : treference);
          constructor op_reg_ref(op : tasmop;_op1 : tregister;const _op2 : treference);
-         constructor op_reg_const(op:tasmop; _op1: tregister; _op2: longint);
+         constructor op_reg_const(op:tasmop; _op1: tregister; _op2: aword);
 
 
          constructor op_ref_regset(op:tasmop; _op1: treference; _op2: tcpuregisterset);
          constructor op_ref_regset(op:tasmop; _op1: treference; _op2: tcpuregisterset);
 
 
          constructor op_reg_reg_reg(op : tasmop;_op1,_op2,_op3 : tregister);
          constructor op_reg_reg_reg(op : tasmop;_op1,_op2,_op3 : tregister);
-         constructor op_reg_reg_const(op : tasmop;_op1,_op2 : tregister; _op3: Longint);
+         constructor op_reg_reg_const(op : tasmop;_op1,_op2 : tregister; _op3: aword);
          constructor op_reg_reg_sym_ofs(op : tasmop;_op1,_op2 : tregister; _op3: tasmsymbol;_op3ofs: longint);
          constructor op_reg_reg_sym_ofs(op : tasmop;_op1,_op2 : tregister; _op3: tasmsymbol;_op3ofs: longint);
          constructor op_reg_reg_ref(op : tasmop;_op1,_op2 : tregister; const _op3: treference);
          constructor op_reg_reg_ref(op : tasmop;_op1,_op2 : tregister; const _op3: treference);
          constructor op_reg_reg_shifterop(op : tasmop;_op1,_op2 : tregister;_op3 : tshifterop);
          constructor op_reg_reg_shifterop(op : tasmop;_op1,_op2 : tregister;_op3 : tshifterop);
@@ -161,7 +161,7 @@ implementation
       end;
       end;
 
 
 
 
-    constructor taicpu.op_reg_const(op:tasmop; _op1: tregister; _op2: longint);
+    constructor taicpu.op_reg_const(op:tasmop; _op1: tregister; _op2: aword);
       begin
       begin
          inherited create(op);
          inherited create(op);
          ops:=2;
          ops:=2;
@@ -198,7 +198,7 @@ implementation
       end;
       end;
 
 
 
 
-     constructor taicpu.op_reg_reg_const(op : tasmop;_op1,_op2 : tregister; _op3: Longint);
+     constructor taicpu.op_reg_reg_const(op : tasmop;_op1,_op2 : tregister; _op3: aword);
        begin
        begin
          inherited create(op);
          inherited create(op);
          ops:=3;
          ops:=3;
@@ -365,7 +365,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.13  2003-11-02 14:30:03  florian
+  Revision 1.14  2003-11-24 15:17:37  florian
+    * changed some types to prevend range check errors
+
+  Revision 1.13  2003/11/02 14:30:03  florian
     * fixed ARM for new reg. allocation scheme
     * fixed ARM for new reg. allocation scheme
 
 
   Revision 1.12  2003/09/11 11:54:59  florian
   Revision 1.12  2003/09/11 11:54:59  florian

+ 11 - 8
compiler/arm/cgcpu.pas

@@ -477,21 +477,21 @@ unit cgcpu;
                  begin
                  begin
                    if dst<>src1 then
                    if dst<>src1 then
                      begin
                      begin
-                       rgint.add_edge(dst,src1);
+                       rgint.add_edge(getsupreg(dst),getsupreg(src1));
                        list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src1,src2));
                        list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src1,src2));
                      end
                      end
                    else
                    else
                      begin
                      begin
                        tmpreg:=getintregister(list,size);
                        tmpreg:=getintregister(list,size);
                        a_load_reg_reg(list,size,size,src2,dst);
                        a_load_reg_reg(list,size,size,src2,dst);
-                       rgint.add_edge(dst,tmpreg);
+                       rgint.add_edge(getsupreg(dst),getsupreg(tmpreg));
                        ungetregister(list,tmpreg);
                        ungetregister(list,tmpreg);
                        list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,tmpreg,src1));
                        list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,tmpreg,src1));
                      end;
                      end;
                  end
                  end
                else
                else
                  begin
                  begin
-                   rgint.add_edge(dst,src2);
+                   rgint.add_edge(getsupreg(dst),getsupreg(src2));
                    list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src2,src1));
                    list.concat(taicpu.op_reg_reg_reg(A_MUL,dst,src2,src1));
                  end;
                  end;
              end;
              end;
@@ -532,15 +532,15 @@ unit cgcpu;
        begin
        begin
           if not(size in [OS_8,OS_S8,OS_16,OS_S16,OS_32,OS_S32]) then
           if not(size in [OS_8,OS_S8,OS_16,OS_S16,OS_32,OS_S32]) then
             internalerror(2002090902);
             internalerror(2002090902);
-          if is_shifter_const(a,imm_shift) then
+          if is_shifter_const(dword(a),imm_shift) then
             list.concat(taicpu.op_reg_const(A_MOV,reg,a))
             list.concat(taicpu.op_reg_const(A_MOV,reg,a))
-          else if is_shifter_const(not(a),imm_shift) then
+          else if is_shifter_const(dword(not(a)),imm_shift) then
             list.concat(taicpu.op_reg_const(A_MVN,reg,not(a)))
             list.concat(taicpu.op_reg_const(A_MVN,reg,not(a)))
           else
           else
             begin
             begin
                objectlibrary.getdatalabel(l);
                objectlibrary.getdatalabel(l);
                current_procinfo.aktlocaldata.concat(tai_symbol.Create(l,0));
                current_procinfo.aktlocaldata.concat(tai_symbol.Create(l,0));
-               current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(a));
+               current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(longint(a)));
                reference_reset(hr);
                reference_reset(hr);
                hr.symbol:=l;
                hr.symbol:=l;
                list.concat(taicpu.op_reg_ref(A_LDR,reg,hr));
                list.concat(taicpu.op_reg_ref(A_LDR,reg,hr));
@@ -937,7 +937,7 @@ unit cgcpu;
           end;
           end;
 
 
         if assigned(tmpref.symbol) or
         if assigned(tmpref.symbol) or
-           not(is_shifter_const(tmpref.offset,b)) or
+           not(is_shifter_const(dword(tmpref.offset),b)) or
            ((tmpref.base<>NR_NO) and (tmpref.index<>NR_NO)) then
            ((tmpref.base<>NR_NO) and (tmpref.index<>NR_NO)) then
           fixref(list,tmpref);
           fixref(list,tmpref);
 
 
@@ -1282,7 +1282,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.23  2003-11-21 16:29:26  florian
+  Revision 1.24  2003-11-24 15:17:37  florian
+    * changed some types to prevend range check errors
+
+  Revision 1.23  2003/11/21 16:29:26  florian
     * fixed reading of reg. sets in the arm assembler reader
     * fixed reading of reg. sets in the arm assembler reader
 
 
   Revision 1.22  2003/11/07 15:58:32  florian
   Revision 1.22  2003/11/07 15:58:32  florian

+ 12 - 3
compiler/arm/cpupi.pas

@@ -39,6 +39,7 @@ unit cpupi;
           constructor create(aparent:tprocinfo);override;
           constructor create(aparent:tprocinfo);override;
           // procedure handle_body_start;override;
           // procedure handle_body_start;override;
           // procedure after_pass1;override;
           // procedure after_pass1;override;
+          procedure set_first_temp_offset;override;
           procedure allocate_push_parasize(size: longint);override;
           procedure allocate_push_parasize(size: longint);override;
           function calc_stackframe_size:longint;override;
           function calc_stackframe_size:longint;override;
        end;
        end;
@@ -104,6 +105,11 @@ unit cpupi;
 *)
 *)
 
 
 
 
+    procedure tarmprocinfo.set_first_temp_offset;
+      begin
+        tg.setfirsttemp(0);
+      end;
+
     procedure tarmprocinfo.allocate_push_parasize(size:longint);
     procedure tarmprocinfo.allocate_push_parasize(size:longint);
       begin
       begin
         if size>maxpushedparasize then
         if size>maxpushedparasize then
@@ -115,9 +121,9 @@ unit cpupi;
       begin
       begin
         { more or less copied from cgcpu.pas/g_stackframe_entry }
         { more or less copied from cgcpu.pas/g_stackframe_entry }
         if not (po_assembler in procdef.procoptions) then
         if not (po_assembler in procdef.procoptions) then
-          result := align(align((31-13+1)*4+(31-14+1)*8,16)+tg.lasttemp,16)
+          result := align(align((31-13+1)*4+(31-14+1)*8,16)+tg.lasttemp*tg.direction,16)
         else
         else
-          result := align(tg.lasttemp,16);
+          result := align(tg.lasttemp*tg.direction,16);
       end;
       end;
 
 
 
 
@@ -126,7 +132,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2003-11-02 14:30:03  florian
+  Revision 1.3  2003-11-24 15:17:37  florian
+    * changed some types to prevend range check errors
+
+  Revision 1.2  2003/11/02 14:30:03  florian
     * fixed ARM for new reg. allocation scheme
     * fixed ARM for new reg. allocation scheme
 
 
   Revision 1.1  2003/08/20 15:50:13  florian
   Revision 1.1  2003/08/20 15:50:13  florian

+ 6 - 3
compiler/arm/raarmgas.pas

@@ -553,13 +553,13 @@ Unit raarmgas;
                 begin
                 begin
                   if actasmtoken=AS_REGISTER then
                   if actasmtoken=AS_REGISTER then
                     begin
                     begin
-                      include(registerset,actasmregister);
+                      include(registerset,getsupreg(actasmregister));
                       tempreg:=actasmregister;
                       tempreg:=actasmregister;
                       consume(AS_REGISTER);
                       consume(AS_REGISTER);
                       if actasmtoken=AS_MINUS then
                       if actasmtoken=AS_MINUS then
                         begin
                         begin
                           consume(AS_MINUS);
                           consume(AS_MINUS);
-                          for ireg:=tempreg to actasmregister do
+                          for ireg:=getsupreg(tempreg) to getsupreg(actasmregister) do
                             include(registerset,ireg);
                             include(registerset,ireg);
                           consume(AS_REGISTER);
                           consume(AS_REGISTER);
                         end;
                         end;
@@ -783,7 +783,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2003-11-21 16:29:26  florian
+  Revision 1.3  2003-11-24 15:17:37  florian
+    * changed some types to prevend range check errors
+
+  Revision 1.2  2003/11/21 16:29:26  florian
     * fixed reading of reg. sets in the arm assembler reader
     * fixed reading of reg. sets in the arm assembler reader
 
 
   Revision 1.1  2003/11/17 23:23:47  florian
   Revision 1.1  2003/11/17 23:23:47  florian

+ 5 - 2
compiler/rgobj.pas

@@ -62,7 +62,7 @@ if two registers interfere there is a connection between them in the graph.
 In addition to the imaginary registers in the code generator, the psysical
 In addition to the imaginary registers in the code generator, the psysical
 CPU registers are also present in this graph. This allows us to make
 CPU registers are also present in this graph. This allows us to make
 interferences between imaginary registers and cpu registers. This is very
 interferences between imaginary registers and cpu registers. This is very
-usefull for describing archtectural constraints, like for example that
+usefull for describing architectural constraints, like for example that
 the div instruction modifies edx, so variables that are in use at that time
 the div instruction modifies edx, so variables that are in use at that time
 cannot be stored into edx. This can be modelled by making edx interfere
 cannot be stored into edx. This can be modelled by making edx interfere
 with those variables.
 with those variables.
@@ -1819,7 +1819,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.95  2003-11-10 19:05:50  peter
+  Revision 1.96  2003-11-24 15:17:37  florian
+    * changed some types to prevend range check errors
+
+  Revision 1.95  2003/11/10 19:05:50  peter
     * fixed alias/colouring > 255
     * fixed alias/colouring > 255
 
 
   Revision 1.94  2003/11/07 15:58:32  florian
   Revision 1.94  2003/11/07 15:58:32  florian