Selaa lähdekoodia

* fixed several problems caused by Jonas' commit :)

florian 23 vuotta sitten
vanhempi
commit
391ce796ef
2 muutettua tiedostoa jossa 18 lisäystä ja 10 poistoa
  1. 10 6
      compiler/powerpc/cgcpu.pas
  2. 8 4
      compiler/powerpc/nppcadd.pas

+ 10 - 6
compiler/powerpc/cgcpu.pas

@@ -244,7 +244,6 @@ const
 
     { calling a code fragment by name }
     procedure tcgppc.a_call_name(list : taasmoutput;const s : string);
-
       var
         href : treference;
       begin
@@ -258,19 +257,21 @@ const
          procinfo.flags:=procinfo.flags or pi_do_call;
       end;
 
+
     { calling a code fragment through a reference }
     procedure tcgppc.a_call_ref(list : taasmoutput;const ref : treference);
-
       var
         href : treference;
+        tmpreg : tregister;
       begin
         { save our RTOC register value. Only necessary when doing pointer based    }
         { calls or cross TOC calls, but currently done always                      }
         reference_reset_base(href,STACK_POINTER_REG,LA_RTOC);
         list.concat(taicpu.op_reg_ref(A_STW,R_TOC,href));
-        a_reg_alloc(list,R_0);
-        a_load_ref_reg(list,OS_ADDR,ref,R_0);
-        list.concat(taicpu.op_reg_reg(A_MTSPR,R_LR,R_0));
+        tmpreg := get_scratch_reg_int(list);
+        a_load_ref_reg(list,OS_ADDR,ref,tmpreg);
+        list.concat(taicpu.op_reg(A_MTLR,tmpreg));
+        free_scratch_reg(list,tmpreg);
         a_reg_dealloc(list,R_0);
         list.concat(taicpu.op_none(A_BCCTRL));
         list.concat(taicpu.op_reg_ref(A_LWZ,R_TOC,href));
@@ -1687,7 +1688,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.46  2002-08-31 19:25:50  jonas
+  Revision 1.47  2002-08-31 21:30:45  florian
+    * fixed several problems caused by Jonas' commit :)
+
+  Revision 1.46  2002/08/31 19:25:50  jonas
     + implemented a_call_ref()
 
   Revision 1.45  2002/08/18 22:16:14  florian

+ 8 - 4
compiler/powerpc/nppcadd.pas

@@ -831,6 +831,9 @@ interface
             internalerror(2002072705);
         end;
 
+        if not cmpop then
+          location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
+
         load_left_right(cmpop,(cs_check_overflow in aktlocalswitches) and
             (nodetype in [addn,subn]));
 
@@ -916,9 +919,7 @@ interface
         { set result location }
         { (emit_compare sets it to LOC_FLAGS for compares, so set the }
         {  real location only now) (JM)                               }
-        if not cmpop then
-          location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def))
-         else
+        if cmpop then
           location_reset(location,LOC_JUMP,OS_NO);
 
         clear_left_right(cmpop);
@@ -1303,7 +1304,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.14  2002-08-31 19:26:20  jonas
+  Revision 1.15  2002-08-31 21:30:46  florian
+    * fixed several problems caused by Jonas' commit :)
+
+  Revision 1.14  2002/08/31 19:26:20  jonas
     * fixed 64bit comparisons
 
   Revision 1.13  2002/08/17 22:09:47  florian