Browse Source

* powerpc64: removed references to global variables 'cg' (it is implicit 'self' in methods of tcg descendants) and 'current_asmdata.currasmlist' (the asmlist to use is passed as argument).

git-svn-id: trunk@27860 -
sergei 11 years ago
parent
commit
bcddc40150
1 changed files with 29 additions and 29 deletions
  1. 29 29
      compiler/powerpc64/cgcpu.pas

+ 29 - 29
compiler/powerpc64/cgcpu.pas

@@ -414,7 +414,7 @@ begin
   if (target_info.abi<>abi_powerpc_sysv) then
   if (target_info.abi<>abi_powerpc_sysv) then
     inherited a_call_reg(list,reg)
     inherited a_call_reg(list,reg)
   else if (not (cs_opt_size in current_settings.optimizerswitches)) then begin
   else if (not (cs_opt_size in current_settings.optimizerswitches)) then begin
-    tempreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT);
+    tempreg := getintregister(list, OS_INT);
     { load actual function entry (reg contains the reference to the function descriptor)
     { load actual function entry (reg contains the reference to the function descriptor)
     into tempreg }
     into tempreg }
     reference_reset_base(tmpref, reg, 0, sizeof(pint));
     reference_reset_base(tmpref, reg, 0, sizeof(pint));
@@ -722,58 +722,58 @@ var
     if (a = 0) then begin
     if (a = 0) then begin
       internalerror(2005061701);
       internalerror(2005061701);
     end else if (a = 1) then begin
     end else if (a = 1) then begin
-      cg.a_load_reg_reg(current_asmdata.CurrAsmList, OS_INT, OS_INT, src, dst);
+      a_load_reg_reg(list, OS_INT, OS_INT, src, dst);
     end else if (a = -1) and (signed) then begin
     end else if (a = -1) and (signed) then begin
       { note: only in the signed case possible..., may overflow }
       { note: only in the signed case possible..., may overflow }
-      current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(negops[cs_check_overflow in current_settings.localswitches], dst, src));
+      list.concat(taicpu.op_reg_reg(negops[cs_check_overflow in current_settings.localswitches], dst, src));
     end else if (ispowerof2(a, power, isNegPower)) then begin
     end else if (ispowerof2(a, power, isNegPower)) then begin
       if (signed) then begin
       if (signed) then begin
         { From "The PowerPC Compiler Writer's Guide", pg. 52ff          }
         { From "The PowerPC Compiler Writer's Guide", pg. 52ff          }
-        cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SAR, OS_INT, power,
+        a_op_const_reg_reg(list, OP_SAR, OS_INT, power,
           src, dst);
           src, dst);
-        current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_ADDZE, dst, dst));
+        list.concat(taicpu.op_reg_reg(A_ADDZE, dst, dst));
         if (isNegPower) then
         if (isNegPower) then
-          current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_NEG, dst, dst));
+          list.concat(taicpu.op_reg_reg(A_NEG, dst, dst));
       end else begin
       end else begin
-        cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, power, src, dst)
+        a_op_const_reg_reg(list, OP_SHR, OS_INT, power, src, dst)
       end;
       end;
     end else begin
     end else begin
       { replace division by multiplication, both implementations }
       { replace division by multiplication, both implementations }
       { from "The PowerPC Compiler Writer's Guide" pg. 53ff      }
       { from "The PowerPC Compiler Writer's Guide" pg. 53ff      }
-      divreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT);
+      divreg := getintregister(list, OS_INT);
       if (signed) then begin
       if (signed) then begin
         getmagic_signedN(sizeof(aInt)*8, a, magic, shift);
         getmagic_signedN(sizeof(aInt)*8, a, magic, shift);
         { load magic value }
         { load magic value }
-        cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, magic, divreg);
+        a_load_const_reg(list, OS_INT, magic, divreg);
         { multiply }
         { multiply }
-        current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULHD, dst, src, divreg));
+        list.concat(taicpu.op_reg_reg_reg(A_MULHD, dst, src, divreg));
         { add/subtract numerator }
         { add/subtract numerator }
         if (a > 0) and (magic < 0) then begin
         if (a > 0) and (magic < 0) then begin
-          cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_ADD, OS_INT, src, dst, dst);
+          a_op_reg_reg_reg(list, OP_ADD, OS_INT, src, dst, dst);
         end else if (a < 0) and (magic > 0) then begin
         end else if (a < 0) and (magic > 0) then begin
-          cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, src, dst, dst);
+          a_op_reg_reg_reg(list, OP_SUB, OS_INT, src, dst, dst);
         end;
         end;
         { shift shift places to the right (arithmetic) }
         { shift shift places to the right (arithmetic) }
-        cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SAR, OS_INT, shift, dst, dst);
+        a_op_const_reg_reg(list, OP_SAR, OS_INT, shift, dst, dst);
         { extract and add sign bit }
         { extract and add sign bit }
         if (a >= 0) then begin
         if (a >= 0) then begin
-          cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, 63, src, divreg);
+          a_op_const_reg_reg(list, OP_SHR, OS_INT, 63, src, divreg);
         end else begin
         end else begin
-          cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, 63, dst, divreg);
+          a_op_const_reg_reg(list, OP_SHR, OS_INT, 63, dst, divreg);
         end;
         end;
-        cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_ADD, OS_INT, dst, divreg, dst);
+        a_op_reg_reg_reg(list, OP_ADD, OS_INT, dst, divreg, dst);
       end else begin
       end else begin
         getmagic_unsignedN(sizeof(aWord)*8, a, u_magic, u_add, u_shift);
         getmagic_unsignedN(sizeof(aWord)*8, a, u_magic, u_add, u_shift);
         { load magic in divreg }
         { load magic in divreg }
-        cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, aint(u_magic), divreg);
-        current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULHDU, dst, src, divreg));
+        a_load_const_reg(list, OS_INT, aint(u_magic), divreg);
+        list.concat(taicpu.op_reg_reg_reg(A_MULHDU, dst, src, divreg));
         if (u_add) then begin
         if (u_add) then begin
-          cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, dst, src, divreg);
-          cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT,  1, divreg, divreg);
-          cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_ADD, OS_INT, divreg, dst, divreg);
-          cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, u_shift-1, divreg, dst);
+          a_op_reg_reg_reg(list, OP_SUB, OS_INT, dst, src, divreg);
+          a_op_const_reg_reg(list, OP_SHR, OS_INT,  1, divreg, divreg);
+          a_op_reg_reg_reg(list, OP_ADD, OS_INT, divreg, dst, divreg);
+          a_op_const_reg_reg(list, OP_SHR, OS_INT, u_shift-1, divreg, dst);
         end else begin
         end else begin
-          cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, u_shift, dst, dst);
+          a_op_const_reg_reg(list, OP_SHR, OS_INT, u_shift, dst, dst);
         end;
         end;
       end;
       end;
     end;
     end;
@@ -819,7 +819,7 @@ begin
       else if ispowerof2(a, shift, isneg) then begin
       else if ispowerof2(a, shift, isneg) then begin
         list.concat(taicpu.op_reg_reg_const(A_SLDI, dst, src, shift));
         list.concat(taicpu.op_reg_reg_const(A_SLDI, dst, src, shift));
         if (isneg) then
         if (isneg) then
-          current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_NEG, dst, dst));
+          list.concat(taicpu.op_reg_reg(A_NEG, dst, dst));
       end else if (a >= low(smallint)) and (a <= high(smallint)) then
       end else if (a >= low(smallint)) and (a <= high(smallint)) then
         list.concat(taicpu.op_reg_reg_const(A_MULLI, dst, src,
         list.concat(taicpu.op_reg_reg_const(A_MULLI, dst, src,
           smallint(a)))
           smallint(a)))
@@ -934,7 +934,7 @@ begin
       end;
       end;
     OP_ROR:
     OP_ROR:
       begin
       begin
-        tmpreg := getintregister(current_asmdata.CurrAsmList, OS_INT);
+        tmpreg := getintregister(list, OS_INT);
 	list.concat(taicpu.op_reg_reg(A_NEG, tmpreg, src1));
 	list.concat(taicpu.op_reg_reg(A_NEG, tmpreg, src1));
         if (size in [OS_64, OS_S64]) then begin
         if (size in [OS_64, OS_S64]) then begin
 	  list.concat(taicpu.op_reg_reg_reg_const(A_RLDCL, dst, src2, tmpreg, 0));
 	  list.concat(taicpu.op_reg_reg_reg_const(A_RLDCL, dst, src2, tmpreg, 0));
@@ -993,7 +993,7 @@ begin
       opsize := OS_S32
       opsize := OS_S32
     else
     else
       opsize := OS_32;
       opsize := OS_32;
-    a_load_reg_reg(current_asmdata.CurrAsmList, size, opsize, reg, reg);
+    a_load_reg_reg(list, size, opsize, reg, reg);
   end;
   end;
 
 
   { can we use immediate compares? }
   { can we use immediate compares? }
@@ -1005,8 +1005,8 @@ begin
   if (useconst) then begin
   if (useconst) then begin
     list.concat(taicpu.op_reg_reg_const(op, NR_CR0, reg, a));
     list.concat(taicpu.op_reg_reg_const(op, NR_CR0, reg, a));
   end else begin
   end else begin
-    tmpreg := getintregister(current_asmdata.CurrAsmList, OS_INT);
-    a_load_const_reg(current_asmdata.CurrAsmList, opsize, a, tmpreg);
+    tmpreg := getintregister(list, OS_INT);
+    a_load_const_reg(list, opsize, a, tmpreg);
     list.concat(taicpu.op_reg_reg_reg(op, NR_CR0, reg, tmpreg));
     list.concat(taicpu.op_reg_reg_reg(op, NR_CR0, reg, tmpreg));
   end;
   end;
 
 
@@ -1929,7 +1929,7 @@ begin
   {$IFDEF EXTDEBUG}
   {$IFDEF EXTDEBUG}
   list.concat(tai_comment.create(strpnew('loading value from TOC reference for ' + symname)));
   list.concat(tai_comment.create(strpnew('loading value from TOC reference for ' + symname)));
   {$ENDIF EXTDEBUG}
   {$ENDIF EXTDEBUG}
-  cg.a_load_ref_reg(list, OS_INT, OS_INT, ref, reg);
+  a_load_ref_reg(list, OS_INT, OS_INT, ref, reg);
 end;
 end;